Cantharella-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
- 279 discussions
Author: echatellier
Date: 2013-02-04 11:53:27 +0100 (Mon, 04 Feb 2013)
New Revision: 69
Url: http://forge.codelutin.com/projects/cantharella/repository/revisions/69
Log:
Update aspectj and wicket
Modified:
trunk/cantharella.data/pom.xml
trunk/pom.xml
Modified: trunk/cantharella.data/pom.xml
===================================================================
--- trunk/cantharella.data/pom.xml 2013-02-04 10:31:18 UTC (rev 68)
+++ trunk/cantharella.data/pom.xml 2013-02-04 10:53:27 UTC (rev 69)
@@ -107,6 +107,11 @@
<artifactId>slf4j-log4j12</artifactId>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <scope>test</scope>
+ </dependency>
<dependency>
<groupId>org.apache.commons</groupId>
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2013-02-04 10:31:18 UTC (rev 68)
+++ trunk/pom.xml 2013-02-04 10:53:27 UTC (rev 69)
@@ -121,7 +121,7 @@
<version.lucene>3.6.2</version.lucene>
<version.c3p0>0.9.1</version.c3p0>
- <version.aspectj>1.6.8</version.aspectj>
+ <version.aspectj>1.7.1</version.aspectj>
<version.opencsv>2.3</version.opencsv>
<version.javassist>3.8.0.GA</version.javassist>
<version.spring>3.2.1.RELEASE</version.spring>
@@ -132,7 +132,7 @@
<version.servlet-api>2.5</version.servlet-api>
- <version.wicket>1.5.6</version.wicket>
+ <version.wicket>1.5.9</version.wicket>
<!-- FIXME echatellier Probleme de parallelisation des tests unitaire,
cause org.hibernate.HibernateException: Don't change the reference to a collection
@@ -249,6 +249,12 @@
<scope>runtime</scope>
</dependency>
<dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>1.2.17</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>${version.slf4j}</version>
1
0
04 Feb '13
Author: echatellier
Date: 2013-02-04 11:31:18 +0100 (Mon, 04 Feb 2013)
New Revision: 68
Url: http://forge.codelutin.com/projects/cantharella/repository/revisions/68
Log:
Move log over slf4j instead of java commons logging
Added:
trunk/cantharella.web/src/main/resources/commons/log4j.xml
Removed:
trunk/cantharella.utils/src/main/java/nc/ird/module/utils/LogTools.java
trunk/cantharella.utils/src/test/java/nc/ird/module/utils/LogToolsTest.java
trunk/licenses/icu4j-license.txt
Modified:
trunk/cantharella.data/pom.xml
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/config/DataContext.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/config/ValidationIntegrator.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Molecule.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Produit.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Purification.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/ResultatTestBio.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/comparators/CampagnePersonneDroitsComp.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/comparators/ExtraitsOfExtractionComp.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/comparators/FractionsOfPurificationComp.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/comparators/ResultatsOfTestBioComp.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/search/ProduitBridge.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/search/UtilisateurSearchFilter.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/utils/AbstractModel.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/CollectionUniqueFieldValidator.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/DbUniqueFieldValidator.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/QueryConstraintValidator.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/utils/ModelValidatorEventListener.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/utils/ModelValidatorImpl.java
trunk/cantharella.data/src/test/java/nc/ird/cantharella/data/dao/utils/TestAppender.java
trunk/cantharella.service/pom.xml
trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/CampagneServiceImpl.java
trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/DocumentServiceImpl.java
trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/ExtractionServiceImpl.java
trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/LotServiceImpl.java
trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/MailServiceImpl.java
trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/MoleculeServiceImpl.java
trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/PersonneServiceImpl.java
trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/ProduitServiceImpl.java
trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/PurificationServiceImpl.java
trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/SearchServiceImpl.java
trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/SpecimenServiceImpl.java
trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/StationServiceImpl.java
trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/TestBioServiceImpl.java
trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/utils/normalizers/utils/Normalizer.java
trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/utils/normalizers/utils/NormalizerAspect.java
trunk/cantharella.service/src/test/java/nc/ird/cantharella/service/utils/PopulateDB.java
trunk/cantharella.utils/pom.xml
trunk/cantharella.utils/src/main/java/nc/ird/module/utils/BeanTools.java
trunk/cantharella.utils/src/main/java/nc/ird/module/utils/CoordTools.java
trunk/cantharella.utils/src/main/java/nc/ird/module/utils/GenericsTools.java
trunk/cantharella.web/pom.xml
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/config/WebApplicationImpl.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/HomePage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/SandboxPage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/TemplatePage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/campagne/ManageCampagnePage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/campagne/ReadCampagnePage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/config/ManageErreurTestBioPage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/config/ManageMethodeExtractionPage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/config/ManageMethodePurificationPage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/config/ManageMethodeTestBioPage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/config/ManagePartiePage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/extraction/ManageExtractionPage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/extraction/ReadExtractionPage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/lot/ManageLotPage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/lot/ReadLotPage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule/ManageMoleculePage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/personne/ListPersonnesPage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/personne/ManagePersonnePage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/personne/ReadPersonnePage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/purification/ListPurificationsPage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/purification/ManagePurificationPage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/purification/ReadPurificationPage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/specimen/ManageSpecimenPage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/specimen/ReadSpecimenPage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/station/ManageStationPage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/station/ReadStationPage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/testBio/ManageTestBioPage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/testBio/ReadTestBioPage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/utilisateur/ManageUtilisateurPage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/utilisateur/ReadUtilisateurPage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/behaviors/MoleculeEditorBehavior.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/behaviors/MoleculeViewBehavior.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/converters/BigDecimalConverterImpl.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/converters/DoubleConverterImpl.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/forms/SubmittableButton.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/models/GenericLoadableDetachableModel.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/models/LoadableDetachableSortableListDataProvider.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/security/AuthSession.java
trunk/cantharella.web/src/main/webapp/js/moleditor.js
trunk/cantharella.web/src/main/webapp/js/molviewer.js
trunk/cantharella.web/src/site/rst/devel/integration-chemdoodle.rst
trunk/pom.xml
Modified: trunk/cantharella.data/pom.xml
===================================================================
--- trunk/cantharella.data/pom.xml 2013-02-04 09:18:54 UTC (rev 67)
+++ trunk/cantharella.data/pom.xml 2013-02-04 10:31:18 UTC (rev 68)
@@ -95,6 +95,20 @@
</dependency>
<dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>jcl-over-slf4j</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
@@ -106,10 +120,6 @@
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
</dependency>
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </dependency>
<dependency>
<groupId>org.aspectj</groupId>
@@ -184,12 +194,6 @@
</dependency>
<dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>test</scope>
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/config/DataContext.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/config/DataContext.java 2013-02-04 09:18:54 UTC (rev 67)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/config/DataContext.java 2013-02-04 10:31:18 UTC (rev 68)
@@ -40,9 +40,9 @@
import nc.ird.cantharella.data.exceptions.UnexpectedException;
import nc.ird.cantharella.data.validation.utils.ModelValidator;
import nc.ird.cantharella.data.validation.utils.ModelValidatorImpl;
-import nc.ird.module.utils.LogTools;
-import org.apache.commons.logging.Log;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.hibernate.SessionFactory;
import org.hibernate.cache.ehcache.SingletonEhCacheRegionFactory;
import org.hibernate.cfg.Environment;
@@ -81,7 +81,7 @@
public abstract class DataContext {
/** Logger */
- private static final Log LOG = LogTools.getLog();
+ private static final Logger LOG = LoggerFactory.getLogger(DataContext.class);
/** Country codes */
public static final List<String> COUNTRY_CODES = Collections.unmodifiableList(Arrays.asList(Locale
@@ -183,7 +183,7 @@
try {
dataSource.setDriverClass(Driver.class.getName());
} catch (PropertyVetoException e) {
- LOG.fatal(e.getMessage(), e);
+ LOG.error(e.getMessage(), e);
throw new UnexpectedException(e);
}
dataSource.setJdbcUrl(dbUrlProperty);
@@ -199,7 +199,7 @@
try {
dataSource.setConnectionTesterClassName(DefaultConnectionTester.class.getName());
} catch (PropertyVetoException e) {
- LOG.fatal(e.getMessage(), e);
+ LOG.error(e.getMessage(), e);
throw new UnexpectedException(e);
}
dataSource.setPreferredTestQuery(null);
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/config/ValidationIntegrator.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/config/ValidationIntegrator.java 2013-02-04 09:18:54 UTC (rev 67)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/config/ValidationIntegrator.java 2013-02-04 10:31:18 UTC (rev 68)
@@ -27,9 +27,9 @@
import javax.validation.ValidatorFactory;
import nc.ird.cantharella.data.validation.utils.ModelValidatorEventListener;
-import nc.ird.module.utils.LogTools;
-import org.apache.commons.logging.Log;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.hibernate.cfg.Configuration;
import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.event.service.spi.EventListenerRegistry;
@@ -46,7 +46,7 @@
public class ValidationIntegrator implements Integrator {
/** Logger */
- private static final Log LOG = LogTools.getLog();
+ private static final Logger LOG = LoggerFactory.getLogger(ValidationIntegrator.class);
@Override
public void integrate(Configuration configuration,
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Molecule.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Molecule.java 2013-02-04 09:18:54 UTC (rev 67)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Molecule.java 2013-02-04 10:31:18 UTC (rev 68)
@@ -27,8 +27,6 @@
import javax.persistence.Column;
import javax.persistence.Entity;
-import javax.persistence.EnumType;
-import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
@@ -41,7 +39,6 @@
import javax.validation.constraints.NotNull;
import nc.ird.cantharella.data.config.DataContext;
-import nc.ird.cantharella.data.model.Specimen.TypeOrganisme;
import nc.ird.cantharella.data.model.search.UtilisateurSearchFilter;
import nc.ird.cantharella.data.model.utils.AbstractModel;
@@ -329,7 +326,7 @@
}
/**
- * @param provenance the provenances to set
+ * @param provenances the provenances to set
*/
public void setProvenances(List<MoleculeProvenance> provenances) {
this.provenances = provenances;
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Produit.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Produit.java 2013-02-04 09:18:54 UTC (rev 67)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Produit.java 2013-02-04 10:31:18 UTC (rev 68)
@@ -64,8 +64,6 @@
impl = ProduitBridge.class)
public abstract class Produit extends AbstractModel implements Cloneable, Comparable<Produit> {
- /** Logger */
- // private static final Log LOG = LogTools.getLog();
/** Id du produit */
@Id
@GeneratedValue
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Purification.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Purification.java 2013-02-04 09:18:54 UTC (rev 67)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Purification.java 2013-02-04 10:31:18 UTC (rev 68)
@@ -76,8 +76,6 @@
})
public class Purification extends AbstractModel implements Comparable<Purification> {
- /** Logger */
- // private static final Log LOG = LogTools.getLog();
/** Id de la purification */
@Id
@GeneratedValue
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/ResultatTestBio.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/ResultatTestBio.java 2013-02-04 09:18:54 UTC (rev 67)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/ResultatTestBio.java 2013-02-04 10:31:18 UTC (rev 68)
@@ -69,8 +69,6 @@
public class ResultatTestBio extends AbstractModel implements Cloneable,
Comparable<ResultatTestBio> {
- /** Logger */
- // private static final Log LOG = LogTools.getLog();
/**
* Type du résultat de test biologique
*/
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/comparators/CampagnePersonneDroitsComp.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/comparators/CampagnePersonneDroitsComp.java 2013-02-04 09:18:54 UTC (rev 67)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/comparators/CampagnePersonneDroitsComp.java 2013-02-04 10:31:18 UTC (rev 68)
@@ -25,10 +25,10 @@
import java.util.Comparator;
import nc.ird.cantharella.data.model.CampagnePersonneDroits;
-import nc.ird.module.utils.LogTools;
import org.apache.commons.beanutils.BeanComparator;
-import org.apache.commons.logging.Log;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* CampagnePersonneDroits comparator. Compare on campagne.
@@ -38,7 +38,7 @@
public class CampagnePersonneDroitsComp implements Comparator<CampagnePersonneDroits> {
/** Logger */
- private static final Log LOG = LogTools.getLog();
+ private static final Logger LOG = LoggerFactory.getLogger(CampagnePersonneDroitsComp.class);
/** {@inheritDoc} */
@Override
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/comparators/ExtraitsOfExtractionComp.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/comparators/ExtraitsOfExtractionComp.java 2013-02-04 09:18:54 UTC (rev 67)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/comparators/ExtraitsOfExtractionComp.java 2013-02-04 10:31:18 UTC (rev 68)
@@ -34,8 +34,6 @@
*/
public class ExtraitsOfExtractionComp implements Comparator<Extrait> {
- /** Logger */
- // private static final Log LOG = LogTools.getLog();
/** {@inheritDoc} */
@Override
public int compare(Extrait obj1, Extrait obj2) {
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/comparators/FractionsOfPurificationComp.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/comparators/FractionsOfPurificationComp.java 2013-02-04 09:18:54 UTC (rev 67)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/comparators/FractionsOfPurificationComp.java 2013-02-04 10:31:18 UTC (rev 68)
@@ -36,8 +36,6 @@
*/
public class FractionsOfPurificationComp implements Comparator<Fraction> {
- /** Logger */
- // private static final Log LOG = LogTools.getLog();
/** {@inheritDoc} */
@Override
public int compare(Fraction obj1, Fraction obj2) {
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/comparators/ResultatsOfTestBioComp.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/comparators/ResultatsOfTestBioComp.java 2013-02-04 09:18:54 UTC (rev 67)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/comparators/ResultatsOfTestBioComp.java 2013-02-04 10:31:18 UTC (rev 68)
@@ -36,8 +36,6 @@
*/
public class ResultatsOfTestBioComp implements Comparator<ResultatTestBio> {
- /** Logger */
- // private static final Log LOG = LogTools.getLog();
/** {@inheritDoc} */
@Override
public int compare(ResultatTestBio obj1, ResultatTestBio obj2) {
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/search/ProduitBridge.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/search/ProduitBridge.java 2013-02-04 09:18:54 UTC (rev 67)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/search/ProduitBridge.java 2013-02-04 10:31:18 UTC (rev 68)
@@ -27,10 +27,10 @@
import nc.ird.cantharella.data.model.Fraction;
import nc.ird.cantharella.data.model.Produit;
import nc.ird.cantharella.data.model.ResultatTestBio;
-import nc.ird.module.utils.LogTools;
import org.apache.commons.lang3.StringUtils;
-import org.apache.commons.logging.Log;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.hibernate.search.bridge.FieldBridge;
@@ -45,7 +45,7 @@
public class ProduitBridge implements FieldBridge {
/** Logger */
- private static final Log LOG = LogTools.getLog();
+ private static final Logger LOG = LoggerFactory.getLogger(ProduitBridge.class);
@Override
public void set(String name, Object value, Document document,
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/search/UtilisateurSearchFilter.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/search/UtilisateurSearchFilter.java 2013-02-04 09:18:54 UTC (rev 67)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/search/UtilisateurSearchFilter.java 2013-02-04 10:31:18 UTC (rev 68)
@@ -26,9 +26,9 @@
import nc.ird.cantharella.data.model.Utilisateur;
import nc.ird.cantharella.data.model.Utilisateur.TypeDroit;
-import nc.ird.module.utils.LogTools;
-import org.apache.commons.logging.Log;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.Term;
import org.apache.lucene.index.TermDocs;
@@ -51,7 +51,7 @@
private static final long serialVersionUID = 5599764509232575010L;
/** Logger */
- private static final Log LOG = LogTools.getLog();
+ private static final Logger LOG = LoggerFactory.getLogger(UtilisateurSearchFilter.class);
/** Utilisateur performing the query. */
protected Utilisateur utilisateur;
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/utils/AbstractModel.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/utils/AbstractModel.java 2013-02-04 09:18:54 UTC (rev 67)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/utils/AbstractModel.java 2013-02-04 10:31:18 UTC (rev 68)
@@ -35,9 +35,9 @@
import nc.ird.module.utils.AssertTools;
import nc.ird.module.utils.BeanTools;
import nc.ird.module.utils.BeanTools.AccessType;
-import nc.ird.module.utils.LogTools;
-import org.apache.commons.logging.Log;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Abstract model
@@ -65,7 +65,7 @@
protected static final int LENGTH_TINY_TEXT = 10;
/** Logger */
- private static final Log LOG = LogTools.getLog();
+ private static final Logger LOG = LoggerFactory.getLogger(AbstractModel.class);
/**
* Retrieve the @Id or @EmbeddedId field
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/CollectionUniqueFieldValidator.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/CollectionUniqueFieldValidator.java 2013-02-04 09:18:54 UTC (rev 67)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/CollectionUniqueFieldValidator.java 2013-02-04 10:31:18 UTC (rev 68)
@@ -38,8 +38,6 @@
*/
public final class CollectionUniqueFieldValidator implements ConstraintValidator<CollectionUniqueField, Object> {
- /** Logger */
- // private static final Log LOG = LogTools.getLog();
/**
* field name of the list which must be unique
*/
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/DbUniqueFieldValidator.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/DbUniqueFieldValidator.java 2013-02-04 09:18:54 UTC (rev 67)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/DbUniqueFieldValidator.java 2013-02-04 10:31:18 UTC (rev 68)
@@ -42,8 +42,6 @@
*/
public final class DbUniqueFieldValidator implements ConstraintValidator<DbUniqueField, Object> {
- /** Logger */
- // private static final Log LOG = LogTools.getLog();
/**
* field name of the list which must be unique
*/
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/QueryConstraintValidator.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/QueryConstraintValidator.java 2013-02-04 09:18:54 UTC (rev 67)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/QueryConstraintValidator.java 2013-02-04 10:31:18 UTC (rev 68)
@@ -30,9 +30,9 @@
import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;
-import nc.ird.module.utils.LogTools;
-import org.apache.commons.logging.Log;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
@@ -50,7 +50,7 @@
public class QueryConstraintValidator implements ConstraintValidator<QueryConstraint, String> {
/** Logger */
- private static final Log LOG = LogTools.getLog();
+ private static final Logger LOG = LoggerFactory.getLogger(QueryConstraintValidator.class);
/** Hql query to request */
private String hql;
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/utils/ModelValidatorEventListener.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/utils/ModelValidatorEventListener.java 2013-02-04 09:18:54 UTC (rev 67)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/utils/ModelValidatorEventListener.java 2013-02-04 10:31:18 UTC (rev 68)
@@ -31,9 +31,9 @@
import javax.validation.ValidatorFactory;
import nc.ird.module.utils.AssertTools;
-import nc.ird.module.utils.LogTools;
-import org.apache.commons.logging.Log;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.hibernate.EntityMode;
import org.hibernate.event.spi.AbstractPreDatabaseOperationEvent;
import org.hibernate.event.spi.PreInsertEvent;
@@ -59,7 +59,7 @@
}
/** Logger */
- private static final Log LOG = LogTools.getLog();
+ private static final Logger LOG = LoggerFactory.getLogger(ModelValidatorEventListener.class);
/** Validator */
private final Validator validator;
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/utils/ModelValidatorImpl.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/utils/ModelValidatorImpl.java 2013-02-04 09:18:54 UTC (rev 67)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/utils/ModelValidatorImpl.java 2013-02-04 10:31:18 UTC (rev 68)
@@ -37,10 +37,10 @@
import nc.ird.cantharella.data.model.utils.AbstractModel;
import nc.ird.module.utils.AssertTools;
-import nc.ird.module.utils.LogTools;
import org.apache.commons.lang3.StringUtils;
-import org.apache.commons.logging.Log;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.context.NoSuchMessageException;
import org.springframework.context.support.MessageSourceAccessor;
@@ -52,7 +52,7 @@
public final class ModelValidatorImpl implements ModelValidator {
/** Logger */
- static final Log LOG = LogTools.getLog();
+ private static final Logger LOG = LoggerFactory.getLogger(ModelValidatorImpl.class);
/** Pattern error property: "property message" */
private static final String PATTERN_ERROR_MESSAGE = "%s - %s";
Modified: trunk/cantharella.data/src/test/java/nc/ird/cantharella/data/dao/utils/TestAppender.java
===================================================================
--- trunk/cantharella.data/src/test/java/nc/ird/cantharella/data/dao/utils/TestAppender.java 2013-02-04 09:18:54 UTC (rev 67)
+++ trunk/cantharella.data/src/test/java/nc/ird/cantharella/data/dao/utils/TestAppender.java 2013-02-04 10:31:18 UTC (rev 68)
@@ -25,13 +25,12 @@
import java.util.ArrayList;
import java.util.List;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.apache.log4j.AppenderSkeleton;
import org.apache.log4j.Level;
import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
import org.apache.log4j.spi.LoggingEvent;
+import org.slf4j.LoggerFactory;
/**
* Base test appender used to capture logging events for test purposes.
@@ -39,9 +38,9 @@
* @version $Id: $
*/
public class TestAppender extends AppenderSkeleton {
+ /** Logger */
+ private static org.slf4j.Logger log = LoggerFactory.getLogger(TestAppender.class);
/** */
- private static Log log = LogFactory.getLog(TestAppender.class);
- /** */
@SuppressWarnings("rawtypes")
private final Class[] monitoredClasses;
/** */
Modified: trunk/cantharella.service/pom.xml
===================================================================
--- trunk/cantharella.service/pom.xml 2013-02-04 09:18:54 UTC (rev 67)
+++ trunk/cantharella.service/pom.xml 2013-02-04 10:31:18 UTC (rev 68)
@@ -71,15 +71,25 @@
</dependency>
<dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-lang3</artifactId>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
+ <groupId>org.slf4j</groupId>
+ <artifactId>jcl-over-slf4j</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ <scope>test</scope>
+ </dependency>
<dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-lang3</artifactId>
+ </dependency>
+
+ <dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
</dependency>
@@ -138,12 +148,6 @@
</dependency>
<dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>test</scope>
Modified: trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/CampagneServiceImpl.java
===================================================================
--- trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/CampagneServiceImpl.java 2013-02-04 09:18:54 UTC (rev 67)
+++ trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/CampagneServiceImpl.java 2013-02-04 10:31:18 UTC (rev 68)
@@ -38,9 +38,9 @@
import nc.ird.cantharella.data.model.Utilisateur.TypeDroit;
import nc.ird.cantharella.service.services.CampagneService;
import nc.ird.module.utils.AssertTools;
-import nc.ird.module.utils.LogTools;
-import org.apache.commons.logging.Log;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -53,7 +53,7 @@
public final class CampagneServiceImpl implements CampagneService {
/** Logger */
- private static final Log LOG = LogTools.getLog();
+ private static final Logger LOG = LoggerFactory.getLogger(CampagneServiceImpl.class);
/** Accès aux données */
@Autowired
Modified: trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/DocumentServiceImpl.java
===================================================================
--- trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/DocumentServiceImpl.java 2013-02-04 09:18:54 UTC (rev 67)
+++ trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/DocumentServiceImpl.java 2013-02-04 10:31:18 UTC (rev 68)
@@ -31,9 +31,9 @@
import nc.ird.cantharella.data.model.TypeDocument;
import nc.ird.cantharella.service.services.DocumentService;
import nc.ird.module.utils.AssertTools;
-import nc.ird.module.utils.LogTools;
-import org.apache.commons.logging.Log;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -45,7 +45,7 @@
public final class DocumentServiceImpl implements DocumentService {
/** Logger */
- private static final Log LOG = LogTools.getLog();
+ private static final Logger LOG = LoggerFactory.getLogger(DocumentServiceImpl.class);
/** DAO */
@Autowired
Modified: trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/ExtractionServiceImpl.java
===================================================================
--- trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/ExtractionServiceImpl.java 2013-02-04 09:18:54 UTC (rev 67)
+++ trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/ExtractionServiceImpl.java 2013-02-04 10:31:18 UTC (rev 68)
@@ -42,9 +42,9 @@
import nc.ird.cantharella.service.services.ExtractionService;
import nc.ird.cantharella.service.services.LotService;
import nc.ird.module.utils.AssertTools;
-import nc.ird.module.utils.LogTools;
-import org.apache.commons.logging.Log;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -57,7 +57,7 @@
public final class ExtractionServiceImpl implements ExtractionService {
/** Logger */
- private static final Log LOG = LogTools.getLog();
+ private static final Logger LOG = LoggerFactory.getLogger(ExtractionServiceImpl.class);
/** DAO */
@Autowired
Modified: trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/LotServiceImpl.java
===================================================================
--- trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/LotServiceImpl.java 2013-02-04 09:18:54 UTC (rev 67)
+++ trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/LotServiceImpl.java 2013-02-04 10:31:18 UTC (rev 68)
@@ -38,9 +38,9 @@
import nc.ird.cantharella.data.model.Utilisateur.TypeDroit;
import nc.ird.cantharella.service.services.LotService;
import nc.ird.module.utils.AssertTools;
-import nc.ird.module.utils.LogTools;
-import org.apache.commons.logging.Log;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -53,7 +53,7 @@
public final class LotServiceImpl implements LotService {
/** Logger */
- private static final Log LOG = LogTools.getLog();
+ private static final Logger LOG = LoggerFactory.getLogger(LotServiceImpl.class);
/** DAO */
@Autowired
Modified: trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/MailServiceImpl.java
===================================================================
--- trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/MailServiceImpl.java 2013-02-04 09:18:54 UTC (rev 67)
+++ trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/MailServiceImpl.java 2013-02-04 10:31:18 UTC (rev 68)
@@ -31,10 +31,10 @@
import nc.ird.cantharella.service.exceptions.EmailException;
import nc.ird.cantharella.service.services.MailService;
import nc.ird.module.utils.AssertTools;
-import nc.ird.module.utils.LogTools;
import org.apache.commons.lang3.StringUtils;
-import org.apache.commons.logging.Log;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mail.MailSender;
import org.springframework.mail.SimpleMailMessage;
@@ -49,7 +49,7 @@
public final class MailServiceImpl implements MailService {
/** Logger */
- private static final Log LOG = LogTools.getLog();
+ private static final Logger LOG = LoggerFactory.getLogger(MailServiceImpl.class);
/** E-mail message template */
@Autowired
Modified: trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/MoleculeServiceImpl.java
===================================================================
--- trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/MoleculeServiceImpl.java 2013-02-04 09:18:54 UTC (rev 67)
+++ trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/MoleculeServiceImpl.java 2013-02-04 10:31:18 UTC (rev 68)
@@ -35,9 +35,9 @@
import nc.ird.cantharella.data.model.Utilisateur.TypeDroit;
import nc.ird.cantharella.service.services.MoleculeService;
import nc.ird.module.utils.AssertTools;
-import nc.ird.module.utils.LogTools;
-import org.apache.commons.logging.Log;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -50,7 +50,7 @@
public final class MoleculeServiceImpl implements MoleculeService {
/** Logger */
- private static final Log LOG = LogTools.getLog();
+ private static final Logger LOG = LoggerFactory.getLogger(MoleculeServiceImpl.class);
/** DAO */
@Autowired
Modified: trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/PersonneServiceImpl.java
===================================================================
--- trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/PersonneServiceImpl.java 2013-02-04 09:18:54 UTC (rev 67)
+++ trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/PersonneServiceImpl.java 2013-02-04 10:31:18 UTC (rev 68)
@@ -40,10 +40,10 @@
import nc.ird.cantharella.service.utils.normalizers.EmailNormalizer;
import nc.ird.cantharella.service.utils.normalizers.utils.Normalize;
import nc.ird.module.utils.AssertTools;
-import nc.ird.module.utils.LogTools;
import nc.ird.module.utils.PasswordTools;
-import org.apache.commons.logging.Log;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.NoSuchMessageException;
import org.springframework.context.support.MessageSourceAccessor;
@@ -63,7 +63,7 @@
public final class PersonneServiceImpl implements PersonneService {
/** Logger */
- private static final Log LOG = LogTools.getLog();
+ private static final Logger LOG = LoggerFactory.getLogger(PersonneServiceImpl.class);
/** Accès aux données */
@Autowired
Modified: trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/ProduitServiceImpl.java
===================================================================
--- trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/ProduitServiceImpl.java 2013-02-04 09:18:54 UTC (rev 67)
+++ trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/ProduitServiceImpl.java 2013-02-04 10:31:18 UTC (rev 68)
@@ -52,8 +52,6 @@
@Service
public final class ProduitServiceImpl implements ProduitService {
- /** Logger */
- // private static final Log LOG = LogTools.getLog();
/** DAO */
@Autowired
private GenericDao dao;
Modified: trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/PurificationServiceImpl.java
===================================================================
--- trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/PurificationServiceImpl.java 2013-02-04 09:18:54 UTC (rev 67)
+++ trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/PurificationServiceImpl.java 2013-02-04 10:31:18 UTC (rev 68)
@@ -46,9 +46,9 @@
import nc.ird.cantharella.service.services.ExtractionService;
import nc.ird.cantharella.service.services.PurificationService;
import nc.ird.module.utils.AssertTools;
-import nc.ird.module.utils.LogTools;
-import org.apache.commons.logging.Log;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -60,7 +60,7 @@
public final class PurificationServiceImpl implements PurificationService {
/** Logger */
- private static final Log LOG = LogTools.getLog();
+ private static final Logger LOG = LoggerFactory.getLogger(PurificationServiceImpl.class);
/** DAO */
@Autowired
Modified: trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/SearchServiceImpl.java
===================================================================
--- trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/SearchServiceImpl.java 2013-02-04 09:18:54 UTC (rev 67)
+++ trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/SearchServiceImpl.java 2013-02-04 10:31:18 UTC (rev 68)
@@ -36,9 +36,9 @@
import nc.ird.cantharella.data.model.Utilisateur;
import nc.ird.cantharella.service.model.SearchResult;
import nc.ird.cantharella.service.services.SearchService;
-import nc.ird.module.utils.LogTools;
-import org.apache.commons.logging.Log;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.apache.lucene.index.FieldInfos;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.queryParser.MultiFieldQueryParser;
@@ -67,7 +67,7 @@
public class SearchServiceImpl implements SearchService {
/** Logger */
- private static final Log LOG = LogTools.getLog();
+ private static final Logger LOG = LoggerFactory.getLogger(SearchServiceImpl.class);
@Resource
private SessionFactory sessionFactory;
Modified: trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/SpecimenServiceImpl.java
===================================================================
--- trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/SpecimenServiceImpl.java 2013-02-04 09:18:54 UTC (rev 67)
+++ trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/SpecimenServiceImpl.java 2013-02-04 10:31:18 UTC (rev 68)
@@ -40,9 +40,9 @@
import nc.ird.cantharella.data.model.Utilisateur.TypeDroit;
import nc.ird.cantharella.service.services.SpecimenService;
import nc.ird.module.utils.AssertTools;
-import nc.ird.module.utils.LogTools;
-import org.apache.commons.logging.Log;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -55,7 +55,7 @@
public final class SpecimenServiceImpl implements SpecimenService {
/** Logger */
- private static final Log LOG = LogTools.getLog();
+ private static final Logger LOG = LoggerFactory.getLogger(SpecimenServiceImpl.class);
/** Accès aux données */
@Autowired
Modified: trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/StationServiceImpl.java
===================================================================
--- trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/StationServiceImpl.java 2013-02-04 09:18:54 UTC (rev 67)
+++ trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/StationServiceImpl.java 2013-02-04 10:31:18 UTC (rev 68)
@@ -39,9 +39,9 @@
import nc.ird.cantharella.data.model.Utilisateur.TypeDroit;
import nc.ird.cantharella.service.services.StationService;
import nc.ird.module.utils.AssertTools;
-import nc.ird.module.utils.LogTools;
-import org.apache.commons.logging.Log;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -54,7 +54,7 @@
public final class StationServiceImpl implements StationService {
/** Logger */
- private static final Log LOG = LogTools.getLog();
+ private static final Logger LOG = LoggerFactory.getLogger(StationServiceImpl.class);
/** DAO */
@Autowired
Modified: trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/TestBioServiceImpl.java
===================================================================
--- trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/TestBioServiceImpl.java 2013-02-04 09:18:54 UTC (rev 67)
+++ trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/TestBioServiceImpl.java 2013-02-04 10:31:18 UTC (rev 68)
@@ -42,9 +42,9 @@
import nc.ird.cantharella.service.services.LotService;
import nc.ird.cantharella.service.services.TestBioService;
import nc.ird.module.utils.AssertTools;
-import nc.ird.module.utils.LogTools;
-import org.apache.commons.logging.Log;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -56,7 +56,7 @@
public final class TestBioServiceImpl implements TestBioService {
/** Logger */
- private static final Log LOG = LogTools.getLog();
+ private static final Logger LOG = LoggerFactory.getLogger(TestBioServiceImpl.class);
/** Service : lots */
@Autowired
Modified: trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/utils/normalizers/utils/Normalizer.java
===================================================================
--- trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/utils/normalizers/utils/Normalizer.java 2013-02-04 09:18:54 UTC (rev 67)
+++ trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/utils/normalizers/utils/Normalizer.java 2013-02-04 10:31:18 UTC (rev 68)
@@ -27,9 +27,9 @@
import java.util.Map;
import nc.ird.cantharella.data.exceptions.UnexpectedException;
-import nc.ird.module.utils.LogTools;
-import org.apache.commons.logging.Log;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Data normalizer
@@ -40,7 +40,7 @@
public abstract class Normalizer<O> {
/** Logger */
- private static final Log LOG = LogTools.getLog();
+ private static final Logger LOG = LoggerFactory.getLogger(Normalizer.class);
/** Normalizers cache: normalizerClass + normalizer */
private static final Map<Class<? extends Normalizer<?>>, Normalizer<?>> NORMALIZERS = Collections
Modified: trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/utils/normalizers/utils/NormalizerAspect.java
===================================================================
--- trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/utils/normalizers/utils/NormalizerAspect.java 2013-02-04 09:18:54 UTC (rev 67)
+++ trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/utils/normalizers/utils/NormalizerAspect.java 2013-02-04 10:31:18 UTC (rev 68)
@@ -26,9 +26,9 @@
import java.lang.reflect.Method;
import java.util.Arrays;
-import nc.ird.module.utils.LogTools;
-import org.apache.commons.logging.Log;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
@@ -45,7 +45,7 @@
public final class NormalizerAspect {
/** Logger */
- private static final Log LOG = LogTools.getLog();
+ private static final Logger LOG = LoggerFactory.getLogger(NormalizerAspect.class);
/**
* Automatically normalizes data by wrapping methods with Normalize annotation on its parameters
Modified: trunk/cantharella.service/src/test/java/nc/ird/cantharella/service/utils/PopulateDB.java
===================================================================
--- trunk/cantharella.service/src/test/java/nc/ird/cantharella/service/utils/PopulateDB.java 2013-02-04 09:18:54 UTC (rev 67)
+++ trunk/cantharella.service/src/test/java/nc/ird/cantharella/service/utils/PopulateDB.java 2013-02-04 10:31:18 UTC (rev 68)
@@ -61,11 +61,11 @@
import nc.ird.cantharella.service.services.StationService;
import nc.ird.cantharella.service.utils.ExcelColumnStructure.ExcelColumnType;
import nc.ird.module.utils.CoordTools;
-import nc.ird.module.utils.LogTools;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
-import org.apache.commons.logging.Log;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
@@ -78,7 +78,7 @@
public final class PopulateDB {
/** Logger */
- private static final Log LOG = LogTools.getLog();
+ private static final Logger LOG = LoggerFactory.getLogger(PopulateDB.class);
/** Date format */
private static final DateFormat DATE_FORMAT = new SimpleDateFormat("d/M/y");
Modified: trunk/cantharella.utils/pom.xml
===================================================================
--- trunk/cantharella.utils/pom.xml 2013-02-04 09:18:54 UTC (rev 67)
+++ trunk/cantharella.utils/pom.xml 2013-02-04 10:31:18 UTC (rev 68)
@@ -30,10 +30,6 @@
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </dependency>
<dependency>
<groupId>net.sf.opencsv</groupId>
Modified: trunk/cantharella.utils/src/main/java/nc/ird/module/utils/BeanTools.java
===================================================================
--- trunk/cantharella.utils/src/main/java/nc/ird/module/utils/BeanTools.java 2013-02-04 09:18:54 UTC (rev 67)
+++ trunk/cantharella.utils/src/main/java/nc/ird/module/utils/BeanTools.java 2013-02-04 10:31:18 UTC (rev 68)
@@ -45,8 +45,6 @@
*/
public final class BeanTools {
- /** Logger */
- // private static final Log LOG = LogTools.getLog();
/**
* Access type
*/
Modified: trunk/cantharella.utils/src/main/java/nc/ird/module/utils/CoordTools.java
===================================================================
--- trunk/cantharella.utils/src/main/java/nc/ird/module/utils/CoordTools.java 2013-02-04 09:18:54 UTC (rev 67)
+++ trunk/cantharella.utils/src/main/java/nc/ird/module/utils/CoordTools.java 2013-02-04 10:31:18 UTC (rev 68)
@@ -36,8 +36,6 @@
*/
public final class CoordTools {
- /** Logger */
- // private static final Log LOG = LogTools.getLog();
/** Degrees character */
public static final char DEGREES = '°';
Modified: trunk/cantharella.utils/src/main/java/nc/ird/module/utils/GenericsTools.java
===================================================================
--- trunk/cantharella.utils/src/main/java/nc/ird/module/utils/GenericsTools.java 2013-02-04 09:18:54 UTC (rev 67)
+++ trunk/cantharella.utils/src/main/java/nc/ird/module/utils/GenericsTools.java 2013-02-04 10:31:18 UTC (rev 68)
@@ -4,7 +4,7 @@
* $Id:$
* $HeadURL:$
* %%
- * Copyright (C) 2009 - 2012 IRD (Institut de Recherche pour le Developpement) and by respective authors (see below)
+ * Copyright (C) 2009 - 2013 IRD (Institut de Recherche pour le Developpement) and by respective authors (see below)
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -22,14 +22,11 @@
*/
package nc.ird.module.utils;
-import sun.reflect.Reflection;
-
/**
* Tools for generics classes
* @author Mickael Tricot
* @author Adrien Cheype
*/
-@SuppressWarnings("restriction")
public final class GenericsTools {
/**
@@ -50,15 +47,4 @@
private GenericsTools() {
//
}
-
- /**
- * Return the class where this method is called
- * @return this class
- */
- public static Class<?> getCallerClass(){
- // Warning, access type of this method is forbidden (you must configure your IDE tu use it)
- // work only with SUN JVM
- return Reflection.getCallerClass(1);
- }
-
}
Deleted: trunk/cantharella.utils/src/main/java/nc/ird/module/utils/LogTools.java
===================================================================
--- trunk/cantharella.utils/src/main/java/nc/ird/module/utils/LogTools.java 2013-02-04 09:18:54 UTC (rev 67)
+++ trunk/cantharella.utils/src/main/java/nc/ird/module/utils/LogTools.java 2013-02-04 10:31:18 UTC (rev 68)
@@ -1,52 +0,0 @@
-/*
- * #%L
- * Cantharella :: Utils
- * $Id:$
- * $HeadURL:$
- * %%
- * Copyright (C) 2009 - 2012 IRD (Institut de Recherche pour le Developpement) and by respective authors (see below)
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- * #L%
- */
-package nc.ird.module.utils;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * Tools for logging
- * @author Mickael Tricot
- * @author Adrien Cheype
- */
-public final class LogTools {
-
- /**
- * Create a logger by retrieving the caller class. This method is expensive, so you may use it only once in each
- * class.
- * @return Logger
- */
- public static Log getLog() {
- //old methode to get the class in a static methode
- //new LogConfigurationException().fillInStackTrace().getStackTrace()[1].getClassName()
- return LogFactory.getLog(GenericsTools.getCallerClass());
- }
-
- /**
- * Constructor (prevents from instantiation)
- */
- private LogTools() {
- //
- }
-}
Deleted: trunk/cantharella.utils/src/test/java/nc/ird/module/utils/LogToolsTest.java
===================================================================
--- trunk/cantharella.utils/src/test/java/nc/ird/module/utils/LogToolsTest.java 2013-02-04 09:18:54 UTC (rev 67)
+++ trunk/cantharella.utils/src/test/java/nc/ird/module/utils/LogToolsTest.java 2013-02-04 10:31:18 UTC (rev 68)
@@ -1,44 +0,0 @@
-/*
- * #%L
- * Cantharella :: Utils
- * $Id:$
- * $HeadURL:$
- * %%
- * Copyright (C) 2009 - 2012 IRD (Institut de Recherche pour le Developpement) and by respective authors (see below)
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- * #L%
- */
-package nc.ird.module.utils;
-
-import org.apache.commons.logging.Log;
-import org.junit.Assert;
-import org.junit.Test;
-
-/**
- * LogTools test
- * @author Mickael Tricot
- */
-public final class LogToolsTest {
-
- /**
- * getLog test
- */
- @Test
- public void getLog() {
- Log log = LogTools.getLog();
- Assert.assertNotNull(log);
- log.debug(null);
- }
-}
Modified: trunk/cantharella.web/pom.xml
===================================================================
--- trunk/cantharella.web/pom.xml 2013-02-04 09:18:54 UTC (rev 67)
+++ trunk/cantharella.web/pom.xml 2013-02-04 10:31:18 UTC (rev 68)
@@ -204,14 +204,23 @@
</dependency>
<dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>jcl-over-slf4j</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ </dependency>
+
+ <dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
<dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </dependency>
- <dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
</dependency>
@@ -291,12 +300,6 @@
</dependency>
<dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
</dependency>
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/config/WebApplicationImpl.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/config/WebApplicationImpl.java 2013-02-04 09:18:54 UTC (rev 67)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/config/WebApplicationImpl.java 2013-02-04 10:31:18 UTC (rev 68)
@@ -71,9 +71,9 @@
import nc.ird.cantharella.web.utils.security.AuthSession;
import nc.ird.cantharella.web.utils.security.AuthStrategy;
import nc.ird.module.utils.AssertTools;
-import nc.ird.module.utils.LogTools;
-import org.apache.commons.logging.Log;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.apache.wicket.ConverterLocator;
import org.apache.wicket.IConverterLocator;
import org.apache.wicket.RuntimeConfigurationType;
@@ -106,7 +106,7 @@
public final class WebApplicationImpl extends WebApplication {
/** Logger */
- private static final Log LOG = LogTools.getLog();
+ private static final Logger LOG = LoggerFactory.getLogger(WebApplicationImpl.class);
/**
* SpringBeans injector (some objects such as Pages are automatically injected, by not all of them)
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/HomePage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/HomePage.java 2013-02-04 09:18:54 UTC (rev 67)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/HomePage.java 2013-02-04 10:31:18 UTC (rev 68)
@@ -52,9 +52,9 @@
import nc.ird.cantharella.web.utils.security.AuthRole;
import nc.ird.module.utils.BeanTools.AccessType;
import nc.ird.module.utils.CollectionTools;
-import nc.ird.module.utils.LogTools;
-import org.apache.commons.logging.Log;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.apache.wicket.MarkupContainer;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.markup.html.AjaxFallbackLink;
@@ -82,7 +82,7 @@
public final class HomePage extends TemplatePage {
/** Logger */
- private static final Log LOG = LogTools.getLog();
+ private static final Logger LOG = LoggerFactory.getLogger(HomePage.class);
/** Action : login */
private static final String ACTION_LOGIN = "Login";
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/SandboxPage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/SandboxPage.java 2013-02-04 09:18:54 UTC (rev 67)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/SandboxPage.java 2013-02-04 10:31:18 UTC (rev 68)
@@ -28,9 +28,9 @@
import nc.ird.cantharella.data.dao.impl.PersonneDao;
import nc.ird.cantharella.data.model.Utilisateur;
import nc.ird.cantharella.data.model.Utilisateur.TypeDroit;
-import nc.ird.module.utils.LogTools;
-import org.apache.commons.logging.Log;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.spring.injection.annot.SpringBean;
import org.hibernate.criterion.DetachedCriteria;
@@ -43,7 +43,7 @@
public class SandboxPage extends WebPage {
/** Logger */
- private static final Log LOG = LogTools.getLog();
+ private static final Logger LOG = LoggerFactory.getLogger(SandboxPage.class);
/** DAO */
@SpringBean
@@ -58,20 +58,20 @@
@SuppressWarnings("unchecked")
public SandboxPage() {
long count = dao.count(PersonneDao.CRITERIA_LIST_ADMINS);
- LOG.debug(count);
+ LOG.debug(String.valueOf(count));
List<Utilisateur> users = (List<Utilisateur>) dao.list(DetachedCriteria.forClass(Utilisateur.class)
.add(Restrictions.eq("typeDroit", TypeDroit.ADMINISTRATEUR))
.add(Restrictions.eq("estValide", Boolean.TRUE)));
- LOG.debug(users);
+ LOG.debug(users.toString());
for (Utilisateur u : users) {
- LOG.debug(u);
+ LOG.debug(u.toString());
}
List<Utilisateur> users2 = (List<Utilisateur>) dao.list(PersonneDao.CRITERIA_LIST_ADMINS);
- LOG.debug(users2);
+ LOG.debug(users2.toString());
for (Utilisateur u : users2) {
- LOG.debug(u);
+ LOG.debug(u.toString());
}
// LOG.debug("createur proxy : " + (p1.createur instanceof HibernateProxy));
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/TemplatePage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/TemplatePage.java 2013-02-04 09:18:54 UTC (rev 67)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/TemplatePage.java 2013-02-04 10:31:18 UTC (rev 68)
@@ -44,10 +44,10 @@
import nc.ird.cantharella.web.utils.security.AuthRole;
import nc.ird.cantharella.web.utils.security.AuthSession;
import nc.ird.module.utils.AssertTools;
-import nc.ird.module.utils.LogTools;
import nc.ird.module.utils.Pair;
-import org.apache.commons.logging.Log;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.apache.wicket.Component;
import org.apache.wicket.MarkupContainer;
import org.apache.wicket.ajax.AjaxRequestTarget;
@@ -81,7 +81,7 @@
private static final String ID_AJAX_INDICATOR = "AjaxIndicator";
/** Logger */
- private static final Log LOG = LogTools.getLog();
+ private static final Logger LOG = LoggerFactory.getLogger(TemplatePage.class);
/** Pattern: enum value label (simpleClassName.valueString) */
public static final String PATTERN_ENUM_VALUE_LABEL = "%s.%s";
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/campagne/ManageCampagnePage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/campagne/ManageCampagnePage.java 2013-02-04 09:18:54 UTC (rev 67)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/campagne/ManageCampagnePage.java 2013-02-04 10:31:18 UTC (rev 68)
@@ -55,9 +55,9 @@
import nc.ird.cantharella.web.utils.security.AuthRole;
import nc.ird.cantharella.web.utils.security.AuthRoles;
import nc.ird.module.utils.CollectionTools;
-import nc.ird.module.utils.LogTools;
-import org.apache.commons.logging.Log;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.apache.wicket.AttributeModifier;
import org.apache.wicket.MarkupContainer;
import org.apache.wicket.ajax.AjaxRequestTarget;
@@ -102,7 +102,7 @@
private static final String ACTION_UPDATE = "Update";
/** Logger */
- private static final Log LOG = LogTools.getLog();
+ private static final Logger LOG = LoggerFactory.getLogger(ManageCampagnePage.class);
/** Bouton d'ajout d'un participant */
private Button addParticipant;
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/campagne/ReadCampagnePage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/campagne/ReadCampagnePage.java 2013-02-04 09:18:54 UTC (rev 67)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/campagne/ReadCampagnePage.java 2013-02-04 10:31:18 UTC (rev 68)
@@ -69,7 +69,7 @@
public final class ReadCampagnePage extends TemplatePage {
/** Logger */
- // private static final Log LOG = LogTools.getLog();
+ //private static final Logger LOG = LoggerFactory.getLogger(ReadCampagnePage.class);
/** Action : delete */
public static final String ACTION_DELETE = "Delete";
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/config/ManageErreurTestBioPage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/config/ManageErreurTestBioPage.java 2013-02-04 09:18:54 UTC (rev 67)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/config/ManageErreurTestBioPage.java 2013-02-04 10:31:18 UTC (rev 68)
@@ -34,9 +34,9 @@
import nc.ird.cantharella.web.utils.forms.SubmittableButtonEvents;
import nc.ird.cantharella.web.utils.security.AuthRole;
import nc.ird.cantharella.web.utils.security.AuthRoles;
-import nc.ird.module.utils.LogTools;
-import org.apache.commons.logging.Log;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.apache.wicket.markup.html.form.Button;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.form.TextArea;
@@ -69,7 +69,7 @@
final private String[] RETURN_PARAM = { "erreurTestBio", "opened" };
/** Logger */
- private static final Log LOG = LogTools.getLog();
+ private static final Logger LOG = LoggerFactory.getLogger(ManageErreurTestBioPage.class);
/** erreurTest Model */
private final IModel<ErreurTestBio> erreurTestModel;
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/config/ManageMethodeExtractionPage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/config/ManageMethodeExtractionPage.java 2013-02-04 09:18:54 UTC (rev 67)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/config/ManageMethodeExtractionPage.java 2013-02-04 10:31:18 UTC (rev 68)
@@ -41,9 +41,9 @@
import nc.ird.cantharella.web.utils.forms.SubmittableButtonEvents;
import nc.ird.cantharella.web.utils.security.AuthRole;
import nc.ird.cantharella.web.utils.security.AuthRoles;
-import nc.ird.module.utils.LogTools;
-import org.apache.commons.logging.Log;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.apache.wicket.AttributeModifier;
import org.apache.wicket.MarkupContainer;
import org.apache.wicket.ajax.AjaxRequestTarget;
@@ -84,7 +84,7 @@
final private String[] RETURN_PARAM = { "methodeExtraction", "opened" };
/** Logger */
- private static final Log LOG = LogTools.getLog();
+ private static final Logger LOG = LoggerFactory.getLogger(ManageMethodeExtractionPage.class);
/** erreurTest Model */
private final IModel<MethodeExtraction> methodeExtractionModel;
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/config/ManageMethodePurificationPage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/config/ManageMethodePurificationPage.java 2013-02-04 09:18:54 UTC (rev 67)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/config/ManageMethodePurificationPage.java 2013-02-04 10:31:18 UTC (rev 68)
@@ -41,9 +41,9 @@
import nc.ird.cantharella.web.utils.forms.SubmittableButtonEvents;
import nc.ird.cantharella.web.utils.security.AuthRole;
import nc.ird.cantharella.web.utils.security.AuthRoles;
-import nc.ird.module.utils.LogTools;
-import org.apache.commons.logging.Log;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.apache.wicket.AttributeModifier;
import org.apache.wicket.MarkupContainer;
import org.apache.wicket.ajax.AjaxRequestTarget;
@@ -84,7 +84,7 @@
final private String[] RETURN_PARAM = { "methodePurification", "opened" };
/** Logger */
- private static final Log LOG = LogTools.getLog();
+ private static final Logger LOG = LoggerFactory.getLogger(ManageMethodePurificationPage.class);
/** erreurTest Model */
private final IModel<MethodePurification> methodePurificationModel;
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/config/ManageMethodeTestBioPage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/config/ManageMethodeTestBioPage.java 2013-02-04 09:18:54 UTC (rev 67)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/config/ManageMethodeTestBioPage.java 2013-02-04 10:31:18 UTC (rev 68)
@@ -38,9 +38,9 @@
import nc.ird.cantharella.web.utils.forms.SubmittableButtonEvents;
import nc.ird.cantharella.web.utils.security.AuthRole;
import nc.ird.cantharella.web.utils.security.AuthRoles;
-import nc.ird.module.utils.LogTools;
-import org.apache.commons.logging.Log;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.apache.wicket.markup.html.form.Button;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.form.TextArea;
@@ -72,7 +72,7 @@
final private String[] RETURN_PARAM = { "methodeTestBio", "opened" };
/** Logger */
- private static final Log LOG = LogTools.getLog();
+ private static final Logger LOG = LoggerFactory.getLogger(ManageMethodeTestBioPage.class);
/** erreurTest Model */
private final IModel<MethodeTestBio> methodeTestModel;
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/config/ManagePartiePage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/config/ManagePartiePage.java 2013-02-04 09:18:54 UTC (rev 67)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/config/ManagePartiePage.java 2013-02-04 10:31:18 UTC (rev 68)
@@ -34,9 +34,9 @@
import nc.ird.cantharella.web.utils.forms.SubmittableButtonEvents;
import nc.ird.cantharella.web.utils.security.AuthRole;
import nc.ird.cantharella.web.utils.security.AuthRoles;
-import nc.ird.module.utils.LogTools;
-import org.apache.commons.logging.Log;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.apache.wicket.markup.html.form.Button;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.form.TextField;
@@ -68,7 +68,7 @@
final private String[] RETURN_PARAM = { "partie", "opened" };
/** Logger */
- private static final Log LOG = LogTools.getLog();
+ private static final Logger LOG = LoggerFactory.getLogger(ManagePartiePage.class);
/** partie Model */
private final IModel<Partie> partieModel;
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/extraction/ManageExtractionPage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/extraction/ManageExtractionPage.java 2013-02-04 09:18:54 UTC (rev 67)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/extraction/ManageExtractionPage.java 2013-02-04 10:31:18 UTC (rev 68)
@@ -59,9 +59,9 @@
import nc.ird.cantharella.web.utils.security.AuthRoles;
import nc.ird.module.utils.BeanTools.AccessType;
import nc.ird.module.utils.CollectionTools;
-import nc.ird.module.utils.LogTools;
-import org.apache.commons.logging.Log;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.apache.wicket.AttributeModifier;
import org.apache.wicket.MarkupContainer;
import org.apache.wicket.ajax.AjaxRequestTarget;
@@ -107,7 +107,7 @@
public static final String ACTION_DELETE = "Delete";
/** Logger */
- private static final Log LOG = LogTools.getLog();
+ private static final Logger LOG = LoggerFactory.getLogger(ManageExtractionPage.class);
/** extraction Model */
private final IModel<Extraction> extractionModel;
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/extraction/ReadExtractionPage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/extraction/ReadExtractionPage.java 2013-02-04 09:18:54 UTC (rev 67)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/extraction/ReadExtractionPage.java 2013-02-04 10:31:18 UTC (rev 68)
@@ -72,7 +72,7 @@
public static final String ACTION_DELETE = "Delete";
/** Logger */
- // private static final Log LOG = LogTools.getLog();
+ //private static final Logger LOG = LoggerFactory.getLogger(ReadExtractionPage.class);
/** extraction Model */
private final IModel<Extraction> extractionModel;
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/lot/ManageLotPage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/lot/ManageLotPage.java 2013-02-04 09:18:54 UTC (rev 67)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/lot/ManageLotPage.java 2013-02-04 10:31:18 UTC (rev 68)
@@ -51,9 +51,9 @@
import nc.ird.cantharella.web.utils.security.AuthRoles;
import nc.ird.module.utils.BeanTools.AccessType;
import nc.ird.module.utils.CollectionTools;
-import nc.ird.module.utils.LogTools;
-import org.apache.commons.logging.Log;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior;
import org.apache.wicket.ajax.markup.html.form.AjaxSubmitLink;
@@ -90,7 +90,7 @@
private static final String ACTION_UPDATE = "Update";
/** Logger */
- private static final Log LOG = LogTools.getLog();
+ private static final Logger LOG = LoggerFactory.getLogger(ManageLotPage.class);
/** Campagnes */
private final List<Campagne> campagnes;
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/lot/ReadLotPage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/lot/ReadLotPage.java 2013-02-04 09:18:54 UTC (rev 67)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/lot/ReadLotPage.java 2013-02-04 10:31:18 UTC (rev 68)
@@ -65,7 +65,7 @@
public static final String ACTION_DELETE = "Delete";
/** Logger */
- // private static final Log LOG = LogTools.getLog();
+ //private static final Logger LOG = LoggerFactory.getLogger(ReadLotPage.class);
/** Modèle : lot */
private final IModel<Lot> lotModel;
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule/ManageMoleculePage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule/ManageMoleculePage.java 2013-02-04 09:18:54 UTC (rev 67)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule/ManageMoleculePage.java 2013-02-04 10:31:18 UTC (rev 68)
@@ -60,9 +60,9 @@
import nc.ird.cantharella.web.utils.panels.PropertyLabelLinkProduitPanel;
import nc.ird.cantharella.web.utils.security.AuthRole;
import nc.ird.cantharella.web.utils.security.AuthRoles;
-import nc.ird.module.utils.LogTools;
-import org.apache.commons.logging.Log;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.apache.wicket.AttributeModifier;
import org.apache.wicket.MarkupContainer;
import org.apache.wicket.ajax.AjaxRequestTarget;
@@ -103,7 +103,7 @@
private static final String ACTION_UPDATE = "Update";
/** Logger */
- private static final Log LOG = LogTools.getLog();
+ private static final Logger LOG = LoggerFactory.getLogger(ManageMoleculePage.class);
/** Campagnes */
private final List<Campagne> campagnes;
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/personne/ListPersonnesPage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/personne/ListPersonnesPage.java 2013-02-04 09:18:54 UTC (rev 67)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/personne/ListPersonnesPage.java 2013-02-04 10:31:18 UTC (rev 68)
@@ -65,7 +65,7 @@
public final class ListPersonnesPage extends TemplatePage {
/** Logger */
- // private static final Log LOG = LogTools.getLog();
+ //private static final Logger LOG = LoggerFactory.getLogger(ListPersonnesPage.class);
/** Service : personne */
@SpringBean
private PersonneService personneService;
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/personne/ManagePersonnePage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/personne/ManagePersonnePage.java 2013-02-04 09:18:54 UTC (rev 67)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/personne/ManagePersonnePage.java 2013-02-04 10:31:18 UTC (rev 68)
@@ -37,9 +37,9 @@
import nc.ird.cantharella.web.utils.forms.SubmittableButtonEvents;
import nc.ird.cantharella.web.utils.security.AuthRole;
import nc.ird.cantharella.web.utils.security.AuthRoles;
-import nc.ird.module.utils.LogTools;
-import org.apache.commons.logging.Log;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.apache.wicket.markup.html.form.Button;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.link.Link;
@@ -68,7 +68,7 @@
private static final String ACTION_UPDATE = "Update";
/** Logger */
- private static final Log LOG = LogTools.getLog();
+ private static final Logger LOG = LoggerFactory.getLogger(ManagePersonnePage.class);
/** Page appelante */
private final CallerPage callerPage;
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/personne/ReadPersonnePage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/personne/ReadPersonnePage.java 2013-02-04 09:18:54 UTC (rev 67)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/personne/ReadPersonnePage.java 2013-02-04 10:31:18 UTC (rev 68)
@@ -50,7 +50,7 @@
public static final String ACTION_DELETE = "Delete";
/** Logger */
- // private static final Log LOG = LogTools.getLog();
+ //private static final Logger LOG = LoggerFactory.getLogger(ReadPersonnePage.class);
/** Page appelante */
private final CallerPage callerPage;
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/purification/ListPurificationsPage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/purification/ListPurificationsPage.java 2013-02-04 09:18:54 UTC (rev 67)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/purification/ListPurificationsPage.java 2013-02-04 10:31:18 UTC (rev 68)
@@ -65,7 +65,7 @@
public final class ListPurificationsPage extends TemplatePage {
/** Logger */
- // private static final Log LOG = LogTools.getLog();
+ //private static final Logger LOG = LoggerFactory.getLogger(ListPurificationsPage.class);
/** Service : manipPurification */
@SpringBean
private PurificationService purificationService;
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/purification/ManagePurificationPage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/purification/ManagePurificationPage.java 2013-02-04 09:18:54 UTC (rev 67)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/purification/ManagePurificationPage.java 2013-02-04 10:31:18 UTC (rev 68)
@@ -58,9 +58,9 @@
import nc.ird.cantharella.web.utils.security.AuthRoles;
import nc.ird.module.utils.BeanTools.AccessType;
import nc.ird.module.utils.CollectionTools;
-import nc.ird.module.utils.LogTools;
-import org.apache.commons.logging.Log;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.apache.wicket.AttributeModifier;
import org.apache.wicket.MarkupContainer;
import org.apache.wicket.ajax.AjaxRequestTarget;
@@ -96,7 +96,7 @@
public final class ManagePurificationPage extends TemplatePage {
/** Logger */
- private static final Log LOG = LogTools.getLog();
+ private static final Logger LOG = LoggerFactory.getLogger(ManagePurificationPage.class);
/** Action : create */
private static final String ACTION_CREATE = "Create";
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/purification/ReadPurificationPage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/purification/ReadPurificationPage.java 2013-02-04 09:18:54 UTC (rev 67)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/purification/ReadPurificationPage.java 2013-02-04 10:31:18 UTC (rev 68)
@@ -73,7 +73,7 @@
public final class ReadPurificationPage extends TemplatePage {
/** Logger */
- // private static final Log LOG = LogTools.getLog();
+ //private static final Logger LOG = LoggerFactory.getLogger(ReadPurificationPage.class);
/** Action : delete */
public static final String ACTION_DELETE = "Delete";
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/specimen/ManageSpecimenPage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/specimen/ManageSpecimenPage.java 2013-02-04 09:18:54 UTC (rev 67)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/specimen/ManageSpecimenPage.java 2013-02-04 10:31:18 UTC (rev 68)
@@ -52,9 +52,9 @@
import nc.ird.cantharella.web.utils.security.AuthRoles;
import nc.ird.module.utils.BeanTools.AccessType;
import nc.ird.module.utils.CollectionTools;
-import nc.ird.module.utils.LogTools;
-import org.apache.commons.logging.Log;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.markup.html.form.AjaxSubmitLink;
import org.apache.wicket.extensions.markup.html.form.DateTextField;
@@ -89,7 +89,7 @@
private static final String ACTION_UPDATE = "Update";
/** Logger */
- private static final Log LOG = LogTools.getLog();
+ private static final Logger LOG = LoggerFactory.getLogger(ManageSpecimenPage.class);
/** Modèle : specimen */
private final IModel<Specimen> specimenModel;
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/specimen/ReadSpecimenPage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/specimen/ReadSpecimenPage.java 2013-02-04 09:18:54 UTC (rev 67)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/specimen/ReadSpecimenPage.java 2013-02-04 10:31:18 UTC (rev 68)
@@ -61,7 +61,7 @@
public static final String ACTION_DELETE = "Delete";
/** Logger */
- // private static final Log LOG = LogTools.getLog();
+ //private static final Logger LOG = LoggerFactory.getLogger(ReadSpecimenPage.class);
/** Modèle : specimen */
private final IModel<Specimen> specimenModel;
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/station/ManageStationPage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/station/ManageStationPage.java 2013-02-04 09:18:54 UTC (rev 67)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/station/ManageStationPage.java 2013-02-04 10:31:18 UTC (rev 68)
@@ -46,9 +46,9 @@
import nc.ird.cantharella.web.utils.security.AuthRole;
import nc.ird.cantharella.web.utils.security.AuthRoles;
import nc.ird.module.utils.CoordTools;
-import nc.ird.module.utils.LogTools;
-import org.apache.commons.logging.Log;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.form.Button;
import org.apache.wicket.markup.html.form.DropDownChoice;
@@ -79,7 +79,7 @@
public static final String ACTION_UPDATE = "Update";
/** Logger */
- private static final Log LOG = LogTools.getLog();
+ private static final Logger LOG = LoggerFactory.getLogger(ManageStationPage.class);
/** Page appelante */
private final CallerPage callerPage;
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/station/ReadStationPage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/station/ReadStationPage.java 2013-02-04 09:18:54 UTC (rev 67)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/station/ReadStationPage.java 2013-02-04 10:31:18 UTC (rev 68)
@@ -56,7 +56,7 @@
public final class ReadStationPage extends TemplatePage {
/** Logger */
- // private static final Log LOG = LogTools.getLog();
+ //private static final Logger LOG = LoggerFactory.getLogger(ReadStationPage.class);
/** Action : delete */
public static final String ACTION_DELETE = "Delete";
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/testBio/ManageTestBioPage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/testBio/ManageTestBioPage.java 2013-02-04 09:18:54 UTC (rev 67)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/testBio/ManageTestBioPage.java 2013-02-04 10:31:18 UTC (rev 68)
@@ -68,10 +68,10 @@
import nc.ird.cantharella.web.utils.security.AuthRoles;
import nc.ird.module.utils.BeanTools.AccessType;
import nc.ird.module.utils.CollectionTools;
-import nc.ird.module.utils.LogTools;
import org.apache.commons.lang3.StringUtils;
-import org.apache.commons.logging.Log;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.apache.wicket.AttributeModifier;
import org.apache.wicket.MarkupContainer;
import org.apache.wicket.ajax.AjaxRequestTarget;
@@ -107,7 +107,7 @@
public final class ManageTestBioPage extends TemplatePage {
/** Logger */
- private static final Log LOG = LogTools.getLog();
+ private static final Logger LOG = LoggerFactory.getLogger(ManageTestBioPage.class);
/** Action : create */
private static final String ACTION_CREATE = "Create";
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/testBio/ReadTestBioPage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/testBio/ReadTestBioPage.java 2013-02-04 09:18:54 UTC (rev 67)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/testBio/ReadTestBioPage.java 2013-02-04 10:31:18 UTC (rev 68)
@@ -78,7 +78,7 @@
public final class ReadTestBioPage extends TemplatePage {
/** Logger */
- // private static final Log LOG = LogTools.getLog();
+ //private static final Logger LOG = LoggerFactory.getLogger(ReadTestBioPage.class);
/** Action : update */
private static final String ACTION_DELETE = "Delete";
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/utilisateur/ManageUtilisateurPage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/utilisateur/ManageUtilisateurPage.java 2013-02-04 09:18:54 UTC (rev 67)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/utilisateur/ManageUtilisateurPage.java 2013-02-04 10:31:18 UTC (rev 68)
@@ -53,10 +53,10 @@
import nc.ird.module.utils.BeanTools;
import nc.ird.module.utils.BeanTools.AccessType;
import nc.ird.module.utils.CollectionTools;
-import nc.ird.module.utils.LogTools;
import org.apache.commons.collections.comparators.ComparatorChain;
-import org.apache.commons.logging.Log;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.apache.wicket.AttributeModifier;
import org.apache.wicket.MarkupContainer;
import org.apache.wicket.ajax.AjaxRequestTarget;
@@ -98,7 +98,7 @@
public static final String ACTION_VALID = "Valid";
/** Logger */
- private static final Log LOG = LogTools.getLog();
+ private static final Logger LOG = LoggerFactory.getLogger(ManageUtilisateurPage.class);
/** Ajout d'une autorisation sur une campagne ou un lot */
private final Button addAuthorization;
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/utilisateur/ReadUtilisateurPage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/utilisateur/ReadUtilisateurPage.java 2013-02-04 09:18:54 UTC (rev 67)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/utilisateur/ReadUtilisateurPage.java 2013-02-04 10:31:18 UTC (rev 68)
@@ -56,7 +56,7 @@
public static final String ACTION_DELETE = "Delete";
/** Logger */
- // private static final Log LOG = LogTools.getLog();
+ //private static final Logger LOG = LoggerFactory.getLogger(ReadUtilisateurPage.class);
/** Page appelante */
private final CallerPage callerPage;
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/behaviors/MoleculeEditorBehavior.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/behaviors/MoleculeEditorBehavior.java 2013-02-04 09:18:54 UTC (rev 67)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/behaviors/MoleculeEditorBehavior.java 2013-02-04 10:31:18 UTC (rev 68)
@@ -10,12 +10,12 @@
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* #L%
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/behaviors/MoleculeViewBehavior.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/behaviors/MoleculeViewBehavior.java 2013-02-04 09:18:54 UTC (rev 67)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/behaviors/MoleculeViewBehavior.java 2013-02-04 10:31:18 UTC (rev 68)
@@ -10,12 +10,12 @@
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* #L%
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/converters/BigDecimalConverterImpl.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/converters/BigDecimalConverterImpl.java 2013-02-04 09:18:54 UTC (rev 67)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/converters/BigDecimalConverterImpl.java 2013-02-04 10:31:18 UTC (rev 68)
@@ -45,7 +45,7 @@
public static final int DECIMAL_MIN_FRACTION_DIGIT = 0;
/** Logger */
- // private static final Log LOG = LogTools.getLog();
+ //private static final Logger LOG = LoggerFactory.getLogger(BigDecimalConverterImpl.class);
/** The singleton instance for a big integer converter */
public static final IConverter<BigDecimal> INSTANCE = new BigDecimalConverterImpl();
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/converters/DoubleConverterImpl.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/converters/DoubleConverterImpl.java 2013-02-04 09:18:54 UTC (rev 67)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/converters/DoubleConverterImpl.java 2013-02-04 10:31:18 UTC (rev 68)
@@ -41,7 +41,7 @@
public static final int DECIMAL_MIN_FRACTION_DIGIT = 0;
/** Logger */
- // private static final Log LOG = LogTools.getLog();
+ //private static final Logger LOG = LoggerFactory.getLogger(DoubleConverterImpl.class);
/** The singleton instance for a float converter */
public static final IConverter<Double> INSTANCE = new DoubleConverterImpl();
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/forms/SubmittableButton.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/forms/SubmittableButton.java 2013-02-04 09:18:54 UTC (rev 67)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/forms/SubmittableButton.java 2013-02-04 10:31:18 UTC (rev 68)
@@ -24,9 +24,9 @@
import nc.ird.cantharella.data.exceptions.UnexpectedException;
import nc.ird.cantharella.web.pages.TemplatePage;
-import nc.ird.module.utils.LogTools;
-import org.apache.commons.logging.Log;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.apache.wicket.markup.html.form.Button;
import org.apache.wicket.model.IModel;
@@ -37,7 +37,7 @@
public final class SubmittableButton extends Button {
/** Logger */
- private static final Log LOG = LogTools.getLog();
+ private static final Logger LOG = LoggerFactory.getLogger(SubmittableButton.class);
/** Submittable */
private final SubmittableButtonEvents submittable;
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/models/GenericLoadableDetachableModel.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/models/GenericLoadableDetachableModel.java 2013-02-04 09:18:54 UTC (rev 67)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/models/GenericLoadableDetachableModel.java 2013-02-04 10:31:18 UTC (rev 68)
@@ -29,9 +29,9 @@
import nc.ird.cantharella.data.model.utils.AbstractModel;
import nc.ird.cantharella.web.config.WebApplicationImpl;
import nc.ird.module.utils.AssertTools;
-import nc.ird.module.utils.LogTools;
-import org.apache.commons.logging.Log;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.apache.wicket.model.LoadableDetachableModel;
import org.apache.wicket.spring.injection.annot.SpringBean;
@@ -45,7 +45,7 @@
public final class GenericLoadableDetachableModel<M extends AbstractModel> extends LoadableDetachableModel<M> {
/** Logger */
- private static final Log LOG = LogTools.getLog();
+ private static final Logger LOG = LoggerFactory.getLogger(GenericLoadableDetachableModel.class);
/** DAO */
@SpringBean
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/models/LoadableDetachableSortableListDataProvider.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/models/LoadableDetachableSortableListDataProvider.java 2013-02-04 09:18:54 UTC (rev 67)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/models/LoadableDetachableSortableListDataProvider.java 2013-02-04 10:31:18 UTC (rev 68)
@@ -36,11 +36,11 @@
import nc.ird.module.utils.BeanTools;
import nc.ird.module.utils.BeanTools.AccessType;
import nc.ird.module.utils.GenericsTools;
-import nc.ird.module.utils.LogTools;
import org.apache.commons.collections.comparators.NullComparator;
import org.apache.commons.lang3.StringUtils;
-import org.apache.commons.logging.Log;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.apache.wicket.extensions.markup.html.repeater.util.SortableDataProvider;
/**
@@ -53,7 +53,7 @@
public final class LoadableDetachableSortableListDataProvider<M extends AbstractModel> extends SortableDataProvider<M> {
/** Logger */
- private static final Log LOG = LogTools.getLog();
+ private static final Logger LOG = LoggerFactory.getLogger(LoadableDetachableSortableListDataProvider.class);
/** Comparator */
private final Comparator<Object> comparator;
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/security/AuthSession.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/security/AuthSession.java 2013-02-04 09:18:54 UTC (rev 67)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/security/AuthSession.java 2013-02-04 10:31:18 UTC (rev 68)
@@ -32,10 +32,10 @@
import nc.ird.cantharella.data.model.Utilisateur.TypeDroit;
import nc.ird.cantharella.service.services.PersonneService;
import nc.ird.cantharella.web.config.WebApplicationImpl;
-import nc.ird.module.utils.LogTools;
import org.apache.commons.lang3.StringUtils;
-import org.apache.commons.logging.Log;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.apache.wicket.protocol.http.WebApplication;
import org.apache.wicket.protocol.http.WebSession;
import org.apache.wicket.request.Request;
@@ -49,7 +49,7 @@
public final class AuthSession extends WebSession implements Serializable {
/** Logger */
- private static final Log LOG = LogTools.getLog();
+ private static final Logger LOG = LoggerFactory.getLogger(AuthSession.class);
/** Attribute: rememberMe */
private static final String ATTRIBUTE_REMEMBER_ME = "rememberMe";
@@ -108,8 +108,9 @@
/** {@inheritDoc} */
@Override
public boolean authenticate(String username, String password) {
- LOG.debug(personneService.authenticateUtilisateur(username, password));
- return personneService.authenticateUtilisateur(username, password);
+ boolean authenticate = personneService.authenticateUtilisateur(username, password);
+ LOG.debug(String.valueOf(authenticate));
+ return authenticate;
}
/**
Added: trunk/cantharella.web/src/main/resources/commons/log4j.xml
===================================================================
(Binary files differ)
Property changes on: trunk/cantharella.web/src/main/resources/commons/log4j.xml
___________________________________________________________________
Added: svn:mime-type
+ application/xml
Modified: trunk/cantharella.web/src/main/webapp/js/moleditor.js
===================================================================
--- trunk/cantharella.web/src/main/webapp/js/moleditor.js 2013-02-04 09:18:54 UTC (rev 67)
+++ trunk/cantharella.web/src/main/webapp/js/moleditor.js 2013-02-04 10:31:18 UTC (rev 68)
@@ -1,3 +1,25 @@
+/*
+ * #%L
+ * Cantharella :: Web
+ * $Id:$
+ * $HeadURL:$
+ * %%
+ * Copyright (C) 2009 - 2013 IRD (Institut de Recherche pour le Developpement) and by respective authors (see below)
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
function addEditorMolecule(tagId) {
if (tagId) {
tagId = '#' + tagId.replace( /(:|\.)/g, "\\$1" );
Modified: trunk/cantharella.web/src/main/webapp/js/molviewer.js
===================================================================
--- trunk/cantharella.web/src/main/webapp/js/molviewer.js 2013-02-04 09:18:54 UTC (rev 67)
+++ trunk/cantharella.web/src/main/webapp/js/molviewer.js 2013-02-04 10:31:18 UTC (rev 68)
@@ -1,3 +1,25 @@
+/*
+ * #%L
+ * Cantharella :: Web
+ * $Id:$
+ * $HeadURL:$
+ * %%
+ * Copyright (C) 2009 - 2013 IRD (Institut de Recherche pour le Developpement) and by respective authors (see below)
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
function addViewerMolecule(tagId) {
if (tagId) {
tagId = '#' + tagId.replace( /(:|\.)/g, "\\$1" );
Modified: trunk/cantharella.web/src/site/rst/devel/integration-chemdoodle.rst
===================================================================
--- trunk/cantharella.web/src/site/rst/devel/integration-chemdoodle.rst 2013-02-04 09:18:54 UTC (rev 67)
+++ trunk/cantharella.web/src/site/rst/devel/integration-chemdoodle.rst 2013-02-04 10:31:18 UTC (rev 68)
@@ -1,3 +1,25 @@
+.. -
+.. * #%L
+.. * Cantharella :: Web
+.. * $Id:$
+.. * $HeadURL:$
+.. * %%
+.. * Copyright (C) 2009 - 2013 IRD (Institut de Recherche pour le Developpement) and by respective authors (see below)
+.. * %%
+.. * This program is free software: you can redistribute it and/or modify
+.. * it under the terms of the GNU Affero General Public License as published by
+.. * the Free Software Foundation, either version 3 of the License, or
+.. * (at your option) any later version.
+.. *
+.. * This program is distributed in the hope that it will be useful,
+.. * but WITHOUT ANY WARRANTY; without even the implied warranty of
+.. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+.. * GNU General Public License for more details.
+.. *
+.. * You should have received a copy of the GNU Affero General Public License
+.. * along with this program. If not, see <http://www.gnu.org/licenses/>.
+.. * #L%
+.. -
Principe
========
Deleted: trunk/licenses/icu4j-license.txt
===================================================================
--- trunk/licenses/icu4j-license.txt 2013-02-04 09:18:54 UTC (rev 67)
+++ trunk/licenses/icu4j-license.txt 2013-02-04 10:31:18 UTC (rev 68)
@@ -1,20 +0,0 @@
-Copyright (c) 1995-2012 International Business Machines Corporation and others
-
-All rights reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
-documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
-rights to use, copy, modify, merge, publish, distribute, and/or sell copies of the Software, and to permit persons to
-whom the Software is furnished to do so, provided that the above copyright notice(s) and this permission notice appear
-in all copies of the Software and that both the above copyright notice(s) and this permission notice appear in
-supporting documentation.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
-WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT
-SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR
-CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
-CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-Except as contained in this notice, the name of a copyright holder shall not be used in advertising or otherwise to
-promote the sale, use or other dealings in this Software without prior written authorization of the copyright holder.
\ No newline at end of file
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2013-02-04 09:18:54 UTC (rev 67)
+++ trunk/pom.xml 2013-02-04 10:31:18 UTC (rev 68)
@@ -98,18 +98,14 @@
<!-- license header configuration -->
<license.organizationName>
- IRD (Institut de Recherche pour le
- Developpement) and by respective authors (see below)
+ IRD (Institut de Recherche pour le Developpement) and by respective authors (see below)
</license.organizationName>
<license.licenseName>agpl_v3</license.licenseName>
- <commonsBeanutilsVersion>1.8.3</commonsBeanutilsVersion>
<version.commons-codec>1.7</version.commons-codec>
<commonsIoVersion>2.4</commonsIoVersion>
<commonsLang3Version>3.1</commonsLang3Version>
- <commonsLoggingVersion>1.1.1</commonsLoggingVersion>
<commonsCollectionsVersion>3.2.1</commonsCollectionsVersion>
- <log4jVersion>1.2.17</log4jVersion>
<junitVersion>4.11</junitVersion>
<version.slf4j>1.7.2</version.slf4j>
@@ -204,13 +200,25 @@
<dependencyManagement>
<dependencies>
- <!-- Dependencies for all layers -->
+ <!-- Dependencies for all layers -->
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>${version.commons-codec}</version>
</dependency>
+
+ <dependency>
+ <groupId>commons-beanutils</groupId>
+ <artifactId>commons-beanutils</artifactId>
+ <version>1.8.3</version>
+ <exclusions>
+ <exclusion>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
<dependency>
<groupId>net.sf.opencsv</groupId>
@@ -218,9 +226,6 @@
<version>${version.opencsv}</version>
</dependency>
- <!-- <dependency> <groupId>javassist</groupId> <artifactId>javassist</artifactId>
- <version>${version.javassist}</version> <scope>runtime</scope> </dependency> -->
-
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
@@ -233,13 +238,13 @@
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
- <artifactId>jcl-over-slf4j</artifactId>
+ <artifactId>slf4j-api</artifactId>
<version>${version.slf4j}</version>
- <scope>runtime</scope>
+ <scope>compile</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
+ <artifactId>jcl-over-slf4j</artifactId>
<version>${version.slf4j}</version>
<scope>runtime</scope>
</dependency>
@@ -278,6 +283,12 @@
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${version.spring}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
@@ -292,8 +303,6 @@
<version>${version.jpa}</version>
</dependency>
- <!--<dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-c3p0</artifactId>
- <version>${version.hibernate}</version> </dependency> -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
@@ -440,38 +449,4 @@
</dependencies>
</dependencyManagement>
-
- <!--dependencies -->
-
- <!-- Dependencies for all layers -->
-
- <!--dependency> <groupId>commons-codec</groupId> <artifactId>commons-codec</artifactId>
- <version>${version.commons-codec}</version> </dependency> <dependency> <groupId>javassist</groupId>
- <artifactId>javassist</artifactId> <version>${version.javassist}</version>
- <scope>runtime</scope> </dependency> <dependency> <groupId>org.aspectj</groupId>
- <artifactId>aspectjrt</artifactId> <version>${version.aspectj}</version>
- </dependency> <dependency> <groupId>org.aspectj</groupId> <artifactId>aspectjweaver</artifactId>
- <version>${version.aspectj}</version> </dependency> <dependency> <groupId>org.slf4j</groupId>
- <artifactId>jcl-over-slf4j</artifactId> <version>${version.slf4j}</version>
- <scope>runtime</scope> </dependency> <dependency> <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId> <version>${version.slf4j}</version> <scope>runtime</scope>
- </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-log4j12</artifactId>
- <version>${version.slf4j}</version> <scope>runtime</scope> </dependency>
- <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context</artifactId>
- <version>${version.spring}</version> </dependency> <dependency> <groupId>org.springframework</groupId>
- <artifactId>spring-context-support</artifactId> <version>${version.spring}</version>
- </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-test</artifactId>
- <version>${version.spring}</version> <scope>test</scope> </dependency> <dependency>
- <groupId>cglib</groupId> <artifactId>cglib-nodep</artifactId> <version>${version.cglib}</version>
- <scope>test</scope> </dependency> <dependency> <groupId>javax.mail</groupId>
- <artifactId>mail</artifactId> <version>${version.mail}</version> </dependency>
- <dependency> <groupId>com.ibm.icu</groupId> <artifactId>icu4j</artifactId>
- <version>${version.icu4j}</version> </dependency -->
-
- <!--/dependencies -->
-
-
- <!--repositories> <repository> <id>repository.springframework.milestone</id>
- <name>Spring Framework Maven Milestone Repository</name> <url>http://maven.springframework.org/milestone</url>
- </repository> </repositories -->
</project>
1
0
r67 - trunk/cantharella.utils/src/main/java/nc/ird/module/utils
by echatellier@users.forge.codelutin.com 04 Feb '13
by echatellier@users.forge.codelutin.com 04 Feb '13
04 Feb '13
Author: echatellier
Date: 2013-02-04 10:18:54 +0100 (Mon, 04 Feb 2013)
New Revision: 67
Url: http://forge.codelutin.com/projects/cantharella/repository/revisions/67
Log:
Replace deprecated method (shaHex > sha1Hex)
Modified:
trunk/cantharella.utils/src/main/java/nc/ird/module/utils/PasswordTools.java
Modified: trunk/cantharella.utils/src/main/java/nc/ird/module/utils/PasswordTools.java
===================================================================
--- trunk/cantharella.utils/src/main/java/nc/ird/module/utils/PasswordTools.java 2013-02-04 00:22:15 UTC (rev 66)
+++ trunk/cantharella.utils/src/main/java/nc/ird/module/utils/PasswordTools.java 2013-02-04 09:18:54 UTC (rev 67)
@@ -67,10 +67,9 @@
* @param password Password
* @return Hashed password
*/
- @SuppressWarnings("deprecation")
public static String sha1(String password) {
AssertTools.assertNotNull(password);
- return DigestUtils.shaHex(password);
+ return DigestUtils.sha1Hex(password);
}
/**
1
0
r66 - in trunk: cantharella.service/src/main/java/nc/ird/cantharella/service/config cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl cantharella.utils/src/main/java/nc/ird/module/utils cantharella.utils/src/test/java/nc/ird/module/utils cantharella.web/src/main/java/nc/ird/cantharella/web/utils/links
by acheype@users.forge.codelutin.com 04 Feb '13
by acheype@users.forge.codelutin.com 04 Feb '13
04 Feb '13
Author: acheype
Date: 2013-02-04 01:22:15 +0100 (Mon, 04 Feb 2013)
New Revision: 66
Url: http://forge.codelutin.com/projects/cantharella/repository/revisions/66
Log:
fix some warnings
Modified:
trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/config/ServiceContext.java
trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/SearchServiceImpl.java
trunk/cantharella.utils/src/main/java/nc/ird/module/utils/PasswordTools.java
trunk/cantharella.utils/src/test/java/nc/ird/module/utils/CoordToolsTest.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/links/CsvExportLink.java
Modified: trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/config/ServiceContext.java
===================================================================
--- trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/config/ServiceContext.java 2013-01-29 09:48:04 UTC (rev 65)
+++ trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/config/ServiceContext.java 2013-02-04 00:22:15 UTC (rev 66)
@@ -93,7 +93,7 @@
* mailActivated getter
* @return mailActivated
*/
- public static final boolean isMailActivated() {
+ public static boolean isMailActivated() {
return mailActivated;
}
@@ -101,7 +101,7 @@
* mailActivated setter
* @param mailActivated mailActivated
*/
- public static final void setMailActivated(boolean mailActivated) {
+ public static void setMailActivated(boolean mailActivated) {
ServiceContext.mailActivated = mailActivated;
}
Modified: trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/SearchServiceImpl.java
===================================================================
--- trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/SearchServiceImpl.java 2013-01-29 09:48:04 UTC (rev 65)
+++ trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/SearchServiceImpl.java 2013-02-04 00:22:15 UTC (rev 66)
@@ -72,6 +72,7 @@
@Resource
private SessionFactory sessionFactory;
+ @Override
public void reIndex() {
long before = System.currentTimeMillis();
if (LOG.isInfoEnabled()) {
@@ -90,11 +91,13 @@
LOG.info("Lucene index rebuilded in " + (after-before) + " ms");
}
} catch (InterruptedException e) {
+ LOG.error(e.toString());
e.printStackTrace();
}
}
@Override
+ @SuppressWarnings("unchecked")
public SearchResult search(String strQuery, Utilisateur utilisateur) {
SearchResult result = new SearchResult();
Modified: trunk/cantharella.utils/src/main/java/nc/ird/module/utils/PasswordTools.java
===================================================================
--- trunk/cantharella.utils/src/main/java/nc/ird/module/utils/PasswordTools.java 2013-01-29 09:48:04 UTC (rev 65)
+++ trunk/cantharella.utils/src/main/java/nc/ird/module/utils/PasswordTools.java 2013-02-04 00:22:15 UTC (rev 66)
@@ -67,6 +67,7 @@
* @param password Password
* @return Hashed password
*/
+ @SuppressWarnings("deprecation")
public static String sha1(String password) {
AssertTools.assertNotNull(password);
return DigestUtils.shaHex(password);
Modified: trunk/cantharella.utils/src/test/java/nc/ird/module/utils/CoordToolsTest.java
===================================================================
--- trunk/cantharella.utils/src/test/java/nc/ird/module/utils/CoordToolsTest.java 2013-01-29 09:48:04 UTC (rev 65)
+++ trunk/cantharella.utils/src/test/java/nc/ird/module/utils/CoordToolsTest.java 2013-02-04 00:22:15 UTC (rev 66)
@@ -24,12 +24,12 @@
import java.math.BigDecimal;
-import junit.framework.Assert;
-
+import org.junit.Assert;
import org.junit.Test;
/**
* Coordonnate tools test
+ *
* @author Mickael Tricot
* @author Adrien Cheype
*/
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/links/CsvExportLink.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/links/CsvExportLink.java 2013-01-29 09:48:04 UTC (rev 65)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/links/CsvExportLink.java 2013-02-04 00:22:15 UTC (rev 66)
@@ -41,9 +41,13 @@
public class CsvExportLink<T> extends Link<Void> {
+ /** For serializable methods */
+ private static final long serialVersionUID = 20130204L;
+
/** Date format for download filename. */
private static final DateFormat FILENAME_DF = new SimpleDateFormat("yyyy_MM_dd-HH_mm-");
-
+
+
private final DataTable<T> table;
private final String filename;
@@ -94,6 +98,7 @@
writer.close();
}
+ @SuppressWarnings("unchecked")
private List<ExportableColumn<T>> getExportableColumns() {
List<ExportableColumn<T>> exportable = new ArrayList<ExportableColumn<T>>(table.getColumns().size());
for (IColumn<?> column : table.getColumns()) {
1
0
29 Jan '13
Author: echatellier
Date: 2013-01-29 10:48:04 +0100 (Tue, 29 Jan 2013)
New Revision: 65
Url: http://forge.codelutin.com/projects/cantharella/repository/revisions/65
Log:
Use 4 spaces indentation instead of tab convention
Modified:
trunk/cantharella.data/pom.xml
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/config/DataContext.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/dao/AbstractModelDao.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/dao/GenericDao.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/dao/impl/CampagneDao.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/dao/impl/ExtractionDao.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/dao/impl/HibernateTemplateDao.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/dao/impl/MoleculeDao.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/dao/impl/PersonneDao.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/dao/impl/ProduitDao.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/dao/impl/PurificationDao.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/dao/impl/SpecimenDao.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/dao/impl/StationDao.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/dao/impl/TestBioDao.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/dao/utils/GenericDaoAspect.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/exceptions/AbstractException.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/exceptions/DataConstraintException.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/exceptions/DataNotFoundException.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/exceptions/UnexpectedException.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Campagne.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/CampagneGroupeDroits.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/CampagnePersonneDroits.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/CampagnePersonneParticipant.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Droits.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/ErreurTestBio.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Extraction.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Extrait.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Fraction.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Groupe.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Lot.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/LotGroupeDroits.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/LotPersonneDroits.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/MethodeExtraction.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/MethodePurification.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/MethodeTestBio.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/ParamMethoPuri.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/ParamMethoPuriEffectif.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Partie.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Personne.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Produit.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Purification.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Specimen.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Station.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/TestBio.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/TypeDocument.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/TypeExtrait.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Utilisateur.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/comparators/CampagnePersonneDroitsComp.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/comparators/ExtraitsOfExtractionComp.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/comparators/FractionsOfPurificationComp.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/comparators/LotPersonneDroitsComp.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/comparators/ResultatsOfTestBioComp.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/utils/AbstractModel.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/utils/CompositeId.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/CollectionUniqueField.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/CollectionUniqueFieldValidator.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/CountryCode.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/CountryCodeValidator.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/DbUniqueField.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/DbUniqueFieldValidator.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/Latitude.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/LatitudeOrientation.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/LatitudeOrientationValidator.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/LatitudeValidator.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/Longitude.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/LongitudeOrientation.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/LongitudeOrientationValidator.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/LongitudeValidator.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/QueryConstraint.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/QueryConstraintValidator.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/Referentiel.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/ReferentielValidator.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/utils/ModelValidator.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/utils/ModelValidatorEventListener.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/utils/ModelValidatorImpl.java
trunk/cantharella.data/src/test/java/nc/ird/cantharella/data/AbstractDataTest.java
trunk/cantharella.data/src/test/java/nc/ird/cantharella/data/DataContextTest.java
trunk/cantharella.data/src/test/java/nc/ird/cantharella/data/dao/GenericDaoTest.java
trunk/cantharella.data/src/test/java/nc/ird/cantharella/data/dao/utils/SpringTransactionTestAppender.java
trunk/cantharella.data/src/test/java/nc/ird/cantharella/data/dao/utils/TestAppender.java
trunk/cantharella.data/src/test/java/nc/ird/cantharella/data/model/GroupeTest.java
trunk/cantharella.data/src/test/java/nc/ird/cantharella/data/model/GroupeTransactionTest.java
trunk/cantharella.data/src/test/java/nc/ird/cantharella/data/model/ModelValidatorTest.java
trunk/cantharella.data/src/test/java/nc/ird/cantharella/data/model/PersonneTest.java
trunk/cantharella.service/pom.xml
trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/config/ServiceContext.java
trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/exceptions/EmailException.java
trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/CampagneService.java
trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/DocumentService.java
trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/ExtractionService.java
trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/LotService.java
trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/MailService.java
trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/MoleculeService.java
trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/PersonneService.java
trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/ProduitService.java
trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/PurificationService.java
trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/SpecimenService.java
trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/StationService.java
trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/TestBioService.java
trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/CampagneServiceImpl.java
trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/DocumentServiceImpl.java
trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/ExtractionServiceImpl.java
trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/LotServiceImpl.java
trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/MailServiceImpl.java
trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/MoleculeServiceImpl.java
trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/PersonneServiceImpl.java
trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/ProduitServiceImpl.java
trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/PurificationServiceImpl.java
trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/SpecimenServiceImpl.java
trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/StationServiceImpl.java
trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/TestBioServiceImpl.java
trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/utils/normalizers/CampagneNormalizer.java
trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/utils/normalizers/ConfigNameNormalizer.java
trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/utils/normalizers/EmailNormalizer.java
trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/utils/normalizers/ErreurTestNormalizer.java
trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/utils/normalizers/ExtractionNormalizer.java
trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/utils/normalizers/LotNormalizer.java
trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/utils/normalizers/MethodeExtractionNormalizer.java
trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/utils/normalizers/MethodePurificationNormalizer.java
trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/utils/normalizers/MethodeTestBioNormalizer.java
trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/utils/normalizers/MoleculeNormalizer.java
trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/utils/normalizers/PartieNormalizer.java
trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/utils/normalizers/PersonneNormalizer.java
trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/utils/normalizers/PurificationNormalizer.java
trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/utils/normalizers/SpecimenNormalizer.java
trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/utils/normalizers/StationNormalizer.java
trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/utils/normalizers/TestBioNormalizer.java
trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/utils/normalizers/TypeDocumentNormalizer.java
trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/utils/normalizers/UniqueFieldNormalizer.java
trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/utils/normalizers/utils/Normalize.java
trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/utils/normalizers/utils/Normalizer.java
trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/utils/normalizers/utils/NormalizerAspect.java
trunk/cantharella.service/src/test/java/nc/ird/cantharella/service/AbstractServiceTest.java
trunk/cantharella.service/src/test/java/nc/ird/cantharella/service/ServiceContextTest.java
trunk/cantharella.service/src/test/java/nc/ird/cantharella/service/exceptions/ExcelImportException.java
trunk/cantharella.service/src/test/java/nc/ird/cantharella/service/services/PersonneServiceTest.java
trunk/cantharella.service/src/test/java/nc/ird/cantharella/service/utils/ExcelColumnStructure.java
trunk/cantharella.service/src/test/java/nc/ird/cantharella/service/utils/ExcelColumnsReader.java
trunk/cantharella.service/src/test/java/nc/ird/cantharella/service/utils/ExcelSheetStructure.java
trunk/cantharella.service/src/test/java/nc/ird/cantharella/service/utils/PopulateDB.java
trunk/cantharella.utils/pom.xml
trunk/cantharella.utils/src/main/java/nc/ird/module/utils/AssertTools.java
trunk/cantharella.utils/src/main/java/nc/ird/module/utils/BeanLookup.java
trunk/cantharella.utils/src/main/java/nc/ird/module/utils/BeanTools.java
trunk/cantharella.utils/src/main/java/nc/ird/module/utils/CaptchaTools.java
trunk/cantharella.utils/src/main/java/nc/ird/module/utils/CollectionTools.java
trunk/cantharella.utils/src/main/java/nc/ird/module/utils/CoordTools.java
trunk/cantharella.utils/src/main/java/nc/ird/module/utils/GenerateCsv.java
trunk/cantharella.utils/src/main/java/nc/ird/module/utils/GenericsTools.java
trunk/cantharella.utils/src/main/java/nc/ird/module/utils/IntuitiveStringComparator.java
trunk/cantharella.utils/src/main/java/nc/ird/module/utils/LogTools.java
trunk/cantharella.utils/src/main/java/nc/ird/module/utils/NumberTools.java
trunk/cantharella.utils/src/main/java/nc/ird/module/utils/Pair.java
trunk/cantharella.utils/src/main/java/nc/ird/module/utils/PasswordTools.java
trunk/cantharella.utils/src/main/java/nc/ird/module/utils/StringTools.java
trunk/cantharella.utils/src/main/java/nc/ird/module/utils/StringTransformer.java
trunk/cantharella.utils/src/test/java/nc/ird/module/utils/AssertToolsTest.java
trunk/cantharella.utils/src/test/java/nc/ird/module/utils/BeanLookupTest.java
trunk/cantharella.utils/src/test/java/nc/ird/module/utils/BeanToolsTest.java
trunk/cantharella.utils/src/test/java/nc/ird/module/utils/CaptchaToolsTest.java
trunk/cantharella.utils/src/test/java/nc/ird/module/utils/CollectionToolsTest.java
trunk/cantharella.utils/src/test/java/nc/ird/module/utils/CoordToolsTest.java
trunk/cantharella.utils/src/test/java/nc/ird/module/utils/GenericsToolsTest.java
trunk/cantharella.utils/src/test/java/nc/ird/module/utils/LogToolsTest.java
trunk/cantharella.utils/src/test/java/nc/ird/module/utils/NumberToolsTest.java
trunk/cantharella.utils/src/test/java/nc/ird/module/utils/PairTest.java
trunk/cantharella.utils/src/test/java/nc/ird/module/utils/PasswordToolsTest.java
trunk/cantharella.utils/src/test/java/nc/ird/module/utils/StringToolsTest.java
trunk/cantharella.utils/src/test/java/nc/ird/module/utils/StringTransformerTest.java
trunk/cantharella.web/pom.xml
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/config/WebApplicationImpl.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/config/WebContext.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/ContactPage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/HomePage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/SandboxPage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/TemplatePage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/columns/LinkProduitPropertyColumn.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/columns/TaxonomyPropertyColumn.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/campagne/ListCampagnesPage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/campagne/ManageCampagnePage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/campagne/ReadCampagnePage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/config/ListConfigurationPage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/config/ManageErreurTestBioPage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/config/ManageMethodeExtractionPage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/config/ManageMethodePurificationPage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/config/ManageMethodeTestBioPage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/config/ManagePartiePage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/config/panels/ListErreurTestBioPanel.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/config/panels/ListMethodeExtractionPanel.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/config/panels/ListMethodePurificationPanel.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/config/panels/ListMethodeTestBioPanel.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/config/panels/ListPartiePanel.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/config/panels/RebuildLuceneIndexPanel.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/extraction/ListExtractionsPage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/extraction/ManageExtractionPage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/extraction/ReadExtractionPage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/lot/ListLotsPage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/lot/ManageLotPage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/lot/ReadLotPage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule/ManageMoleculePage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/personne/ListPersonnesPage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/personne/ManagePersonnePage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/personne/ReadPersonnePage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/personne/panels/ManagePersonnePanel.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/personne/panels/ReadPersonnePanel.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/purification/ListPurificationsPage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/purification/ManagePurificationPage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/purification/ReadPurificationPage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/specimen/ListSpecimensPage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/specimen/ManageSpecimenPage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/specimen/ReadSpecimenPage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/station/ListStationsPage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/station/ManageStationPage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/station/ReadStationPage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/testBio/ListTestsBioPage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/testBio/ManageTestBioPage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/testBio/ReadTestBioPage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/utilisateur/ManageUtilisateurPage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/utilisateur/ReadUtilisateurPage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/utilisateur/RegisterPage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/utilisateur/ResetPasswordPage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/utilisateur/UpdateUtilisateurPage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/utilisateur/panels/ReadDroitsUtilisateurPanel.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/errors/AccessDeniedPage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/errors/ErrorPage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/errors/InternalErrorPage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/errors/PageExpiredErrorPage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/model/CaptchaModel.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/model/ContactModel.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/model/LoginModel.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/model/ManageCampagneModel.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/model/ManageStationModel.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/model/ManageUtilisateurModel.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/model/RegisterModel.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/model/UpdateUtilisateurModel.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/renderers/PersonneRenderer.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/renderers/ProduitRenderer.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/CallerPage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/behaviors/JSConfirmationBehavior.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/behaviors/ReplaceEmptyLabelBehavior.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/columns/BooleanPropertyColumn.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/columns/DecimalPropertyColumn.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/columns/EnumPropertyColumn.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/columns/LinkPropertyColumn.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/columns/LinkableImagePropertyColumn.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/columns/MapValuePropertyColumn.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/columns/PercentPropertyColumn.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/columns/ShortDatePropertyColumn.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/converters/BigDecimalConverterImpl.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/converters/DoubleConverterImpl.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/forms/AutoCompleteTextFieldString.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/forms/SubmittableButton.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/forms/SubmittableButtonEvents.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/models/DisplayBooleanPropertyModel.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/models/DisplayDecimalPropertyModel.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/models/DisplayEnumPropertyModel.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/models/DisplayMapValuePropertyModel.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/models/DisplayPercentPropertyModel.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/models/DisplayShortDatePropertyModel.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/models/GenericLoadableDetachableModel.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/models/LoadableDetachableSortableListDataProvider.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/panels/CollapsiblePanel.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/panels/PropertyLabelLinkPanel.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/panels/PropertyLabelLinkProduitPanel.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/panels/SimpleTooltipPanel.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/renderers/EnumChoiceRenderer.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/renderers/MapChoiceRenderer.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/resources/WebMessages.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/security/AuthContainer.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/security/AuthRole.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/security/AuthRoles.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/security/AuthSession.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/security/AuthStrategy.java
trunk/cantharella.web/src/test/java/nc/ird/cantharella/web/AbstractWebTest.java
trunk/pom.xml
Modified: trunk/cantharella.data/pom.xml
===================================================================
--- trunk/cantharella.data/pom.xml 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.data/pom.xml 2013-01-29 09:48:04 UTC (rev 65)
@@ -1,219 +1,214 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>nc.ird</groupId>
- <artifactId>cantharella</artifactId>
- <version>1.1-SNAPSHOT</version>
- </parent>
+ <parent>
+ <groupId>nc.ird</groupId>
+ <artifactId>cantharella</artifactId>
+ <version>1.1-SNAPSHOT</version>
+ </parent>
- <artifactId>cantharella.data</artifactId>
- <name>Cantharella :: Data</name>
+ <artifactId>cantharella.data</artifactId>
+ <name>Cantharella :: Data</name>
- <build>
- <resources>
- <!-- Default resources for the data layer -->
- <resource>
- <directory>src/main/resources/commons</directory>
- </resource>
- </resources>
- <plugins>
- <!-- Plugins for the data layer -->
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>hibernate3-maven-plugin</artifactId>
- <configuration>
- <components>
- <component>
- <name>hbm2ddl</name>
- <implementation>annotationconfiguration</implementation>
- </component>
- </components>
- <componentProperties>
- <scan-classes>true</scan-classes>
- <format>true</format>
- <export>false</export>
- <update>false</update>
- <outputfilename>cantharella.sql</outputfilename>
- </componentProperties>
- </configuration>
- <dependencies>
- <dependency>
- <groupId>postgresql</groupId>
- <artifactId>postgresql</artifactId>
- <version>${version.postgresql}</version>
- </dependency>
- </dependencies>
- </plugin>
- </plugins>
- </build>
+ <build>
+ <resources>
+ <!-- Default resources for the data layer -->
+ <resource>
+ <directory>src/main/resources/commons</directory>
+ </resource>
+ </resources>
+ <plugins>
+ <!-- Plugins for the data layer -->
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>hibernate3-maven-plugin</artifactId>
+ <configuration>
+ <components>
+ <component>
+ <name>hbm2ddl</name>
+ <implementation>annotationconfiguration</implementation>
+ </component>
+ </components>
+ <componentProperties>
+ <scan-classes>true</scan-classes>
+ <format>true</format>
+ <export>false</export>
+ <update>false</update>
+ <outputfilename>cantharella.sql</outputfilename>
+ </componentProperties>
+ </configuration>
+ <dependencies>
+ <dependency>
+ <groupId>postgresql</groupId>
+ <artifactId>postgresql</artifactId>
+ <version>${version.postgresql}</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+ </plugins>
+ </build>
- <profiles>
- <profile>
- <id>development</id>
- <build>
- <resources>
- <!-- Development resources for the data layer -->
- <resource>
- <directory>src/main/resources/development</directory>
- </resource>
- </resources>
- </build>
- </profile>
- <profile>
- <id>integration</id>
- <build>
- <resources>
- <!-- Integration resources for the data layer -->
- <resource>
- <directory>src/main/resources/integration</directory>
- </resource>
- </resources>
- </build>
- </profile>
- <profile>
- <id>production</id>
- <build>
- <resources>
- <!-- Production resources for the data layer -->
- <resource>
- <directory>src/main/resources/production</directory>
- </resource>
- </resources>
- </build>
- </profile>
- </profiles>
+ <profiles>
+ <profile>
+ <id>development</id>
+ <build>
+ <resources>
+ <!-- Development resources for the data layer -->
+ <resource>
+ <directory>src/main/resources/development</directory>
+ </resource>
+ </resources>
+ </build>
+ </profile>
+ <profile>
+ <id>integration</id>
+ <build>
+ <resources>
+ <!-- Integration resources for the data layer -->
+ <resource>
+ <directory>src/main/resources/integration</directory>
+ </resource>
+ </resources>
+ </build>
+ </profile>
+ <profile>
+ <id>production</id>
+ <build>
+ <resources>
+ <!-- Production resources for the data layer -->
+ <resource>
+ <directory>src/main/resources/production</directory>
+ </resource>
+ </resources>
+ </build>
+ </profile>
+ </profiles>
- <dependencies>
+ <dependencies>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>cantharella.utils</artifactId>
- <version>${project.version}</version>
- </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>cantharella.utils</artifactId>
+ <version>${project.version}</version>
+ </dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-lang3</artifactId>
- </dependency>
- <dependency>
- <groupId>commons-beanutils</groupId>
- <artifactId>commons-beanutils</artifactId>
- </dependency>
- <dependency>
- <groupId>commons-collections</groupId>
- <artifactId>commons-collections</artifactId>
- </dependency>
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </dependency>
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-lang3</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>commons-beanutils</groupId>
+ <artifactId>commons-beanutils</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>commons-collections</groupId>
+ <artifactId>commons-collections</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </dependency>
- <dependency>
- <groupId>org.aspectj</groupId>
- <artifactId>aspectjrt</artifactId>
- </dependency>
+ <dependency>
+ <groupId>org.aspectj</groupId>
+ <artifactId>aspectjrt</artifactId>
+ </dependency>
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-core</artifactId>
- </dependency>
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-ehcache</artifactId>
- </dependency>
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-validator</artifactId>
- </dependency>
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-search-engine</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-orm</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-context</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-beans</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-core</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-tx</artifactId>
- </dependency>
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-ehcache</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-validator</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-search-engine</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-orm</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-context</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-beans</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-tx</artifactId>
+ </dependency>
- <dependency>
- <groupId>org.hibernate.javax.persistence</groupId>
- <artifactId>hibernate-jpa-2.0-api</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.apache.lucene</groupId>
- <artifactId>lucene-core</artifactId>
- </dependency>
+ <dependency>
+ <groupId>org.hibernate.javax.persistence</groupId>
+ <artifactId>hibernate-jpa-2.0-api</artifactId>
+ </dependency>
- <dependency>
- <groupId>c3p0</groupId>
- <artifactId>c3p0</artifactId>
- </dependency>
+ <dependency>
+ <groupId>org.apache.lucene</groupId>
+ <artifactId>lucene-core</artifactId>
+ </dependency>
- <!-- <dependency>
- <groupId>javassist</groupId>
- <artifactId>javassist</artifactId>
- </dependency> -->
+ <dependency>
+ <groupId>c3p0</groupId>
+ <artifactId>c3p0</artifactId>
+ </dependency>
- <dependency>
- <groupId>javax.validation</groupId>
- <artifactId>validation-api</artifactId>
- </dependency>
+ <dependency>
+ <groupId>javax.validation</groupId>
+ <artifactId>validation-api</artifactId>
+ </dependency>
- <dependency>
- <groupId>postgresql</groupId>
- <artifactId>postgresql</artifactId>
- </dependency>
+ <dependency>
+ <groupId>postgresql</groupId>
+ <artifactId>postgresql</artifactId>
+ </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>com.h2database</groupId>
- <artifactId>h2</artifactId>
- <scope>test</scope>
- </dependency>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <scope>test</scope>
+ </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-test</artifactId>
- </dependency>
+ <dependency>
+ <groupId>com.h2database</groupId>
+ <artifactId>h2</artifactId>
+ <scope>test</scope>
+ </dependency>
- <dependency>
- <groupId>cglib</groupId>
- <artifactId>cglib-nodep</artifactId>
- </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-test</artifactId>
+ </dependency>
- <dependency>
- <groupId>org.aspectj</groupId>
- <artifactId>aspectjweaver</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
+ <dependency>
+ <groupId>cglib</groupId>
+ <artifactId>cglib-nodep</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.aspectj</groupId>
+ <artifactId>aspectjweaver</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
</project>
\ No newline at end of file
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/config/DataContext.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/config/DataContext.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/config/DataContext.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -80,242 +80,242 @@
@Configuration
public abstract class DataContext {
- /** Logger */
- private static final Log LOG = LogTools.getLog();
+ /** Logger */
+ private static final Log LOG = LogTools.getLog();
- /** Country codes */
- public static final List<String> COUNTRY_CODES = Collections.unmodifiableList(Arrays.asList(Locale
- .getISOCountries()));
+ /** Country codes */
+ public static final List<String> COUNTRY_CODES = Collections.unmodifiableList(Arrays.asList(Locale
+ .getISOCountries()));
- /** DB connection: acquire retry attemps */
- private static final int DB_CONNECTION_ACQUIRE_RETRY_ATTEMPS = 30;
+ /** DB connection: acquire retry attemps */
+ private static final int DB_CONNECTION_ACQUIRE_RETRY_ATTEMPS = 30;
- /** DB connexion: acquire retry delay */
- private static final int DB_CONNECTION_ACQUIRE_RETRY_DELAY = 1000;
+ /** DB connexion: acquire retry delay */
+ private static final int DB_CONNECTION_ACQUIRE_RETRY_DELAY = 1000;
- /** DB pool: acquire increment */
- private static final int DB_POOL_ACQUIRE_INCREMENT = 3;
+ /** DB pool: acquire increment */
+ private static final int DB_POOL_ACQUIRE_INCREMENT = 3;
- /** DB pool: max size */
- private static final int DB_POOL_MAX_SIZE = 15;
+ /** DB pool: max size */
+ private static final int DB_POOL_MAX_SIZE = 15;
- /** DB pool: min size */
- private static final int DB_POOL_MIN_SIZE = 3;
+ /** DB pool: min size */
+ private static final int DB_POOL_MIN_SIZE = 3;
- /** Encoding */
- public static final String ENCODING = Charset.forName("UTF-8").name();
+ /** Encoding */
+ public static final String ENCODING = Charset.forName("UTF-8").name();
- /** Availables locales for the application */
- public static final List<Locale> LOCALES;
+ /** Availables locales for the application */
+ public static final List<Locale> LOCALES;
- /** Precision is the total number of digits */
- public static final int DECIMAL_PRECISION = 9;
+ /** Precision is the total number of digits */
+ public static final int DECIMAL_PRECISION = 9;
- /**
- * Scale is the number of digits to the right of the decimal point in a number. For example, the number 123.45 has a
- * precision of 5 and a scale of 2
- **/
- public static final int DECIMAL_SCALE = 4;
+ /**
+ * Scale is the number of digits to the right of the decimal point in a number. For example, the number 123.45 has a
+ * precision of 5 and a scale of 2
+ **/
+ public static final int DECIMAL_SCALE = 4;
- /**
- * According to DECIMAL_PRECISION and DECIMAL_SCALE, number max allowed for decimals. Attention to ensure that is
- * equal to 10^(DataContext.DECIMAL_PRECISION - DataContext.DECIMAL_SCALE) -1
- */
- public static final int DECIMAL_MAX = 99999;
+ /**
+ * According to DECIMAL_PRECISION and DECIMAL_SCALE, number max allowed for decimals. Attention to ensure that is
+ * equal to 10^(DataContext.DECIMAL_PRECISION - DataContext.DECIMAL_SCALE) -1
+ */
+ public static final int DECIMAL_MAX = 99999;
- /** Référentiels */
- public static final Map<Integer, String> REFERENTIELS;
+ /** Référentiels */
+ public static final Map<Integer, String> REFERENTIELS;
- /** DB debug */
- @Value("${db.debug}")
- protected boolean dbDebugProperty;
+ /** DB debug */
+ @Value("${db.debug}")
+ protected boolean dbDebugProperty;
- /** DB password */
- @Value("${db.password}")
- protected String dbPasswordProperty;
+ /** DB password */
+ @Value("${db.password}")
+ protected String dbPasswordProperty;
- /** DB URL */
- @Value("${db.url}")
- protected String dbUrlProperty;
+ /** DB URL */
+ @Value("${db.url}")
+ protected String dbUrlProperty;
- /** DB user */
- @Value("${db.user}")
- protected String dbUserProperty;
+ /** DB user */
+ @Value("${db.user}")
+ protected String dbUserProperty;
- /** DB user */
+ /** DB user */
@Value("${db.hbm2ddl:validate}")
- protected String hbm2ddl;
+ protected String hbm2ddl;
- static {
- // The first Locale in the list is the default one
- List<Locale> locales = new ArrayList<Locale>();
- locales.add(Locale.FRENCH);
- locales.add(Locale.ENGLISH);
-
- LOCALES = Collections.unmodifiableList(locales);
- Locale.setDefault(LOCALES.get(0));
+ static {
+ // The first Locale in the list is the default one
+ List<Locale> locales = new ArrayList<Locale>();
+ locales.add(Locale.FRENCH);
+ locales.add(Locale.ENGLISH);
+
+ LOCALES = Collections.unmodifiableList(locales);
+ Locale.setDefault(LOCALES.get(0));
- Map<Integer, String> referentiels = new HashMap<Integer, String>();
- referentiels.put(4326, "WGS84");
- REFERENTIELS = Collections.unmodifiableMap(referentiels);
- }
+ Map<Integer, String> referentiels = new HashMap<Integer, String>();
+ referentiels.put(4326, "WGS84");
+ REFERENTIELS = Collections.unmodifiableMap(referentiels);
+ }
- /**
- * @return Internationalization messages for data layer
- */
- @Bean
- public MessageSourceAccessor dataMessageSource() {
- // The ResourceBundleMessageSource does not handle UTF-8, so we use the Reloadable one
- ReloadableResourceBundleMessageSource dataMessageSource = new ReloadableResourceBundleMessageSource();
- dataMessageSource.setBasename("data");
- dataMessageSource.setDefaultEncoding(ENCODING);
- dataMessageSource.setCacheSeconds(-1);
- return new MessageSourceAccessor(dataMessageSource);
- }
+ /**
+ * @return Internationalization messages for data layer
+ */
+ @Bean
+ public MessageSourceAccessor dataMessageSource() {
+ // The ResourceBundleMessageSource does not handle UTF-8, so we use the Reloadable one
+ ReloadableResourceBundleMessageSource dataMessageSource = new ReloadableResourceBundleMessageSource();
+ dataMessageSource.setBasename("data");
+ dataMessageSource.setDefaultEncoding(ENCODING);
+ dataMessageSource.setCacheSeconds(-1);
+ return new MessageSourceAccessor(dataMessageSource);
+ }
- /**
- * @return Data source (for DB connection)
- */
- @Bean
- public DataSource dataSource() {
- ComboPooledDataSource dataSource = new ComboPooledDataSource();
- // Connexion
- try {
- dataSource.setDriverClass(Driver.class.getName());
- } catch (PropertyVetoException e) {
- LOG.fatal(e.getMessage(), e);
- throw new UnexpectedException(e);
- }
- dataSource.setJdbcUrl(dbUrlProperty);
- dataSource.setPassword(dbPasswordProperty);
- dataSource.setUser(dbUserProperty);
- // Pool: basic configuration
- dataSource.setInitialPoolSize(DB_POOL_MIN_SIZE);
- // Pool: size and connection age
- dataSource.setMaxConnectionAge(0);
- dataSource.setMaxIdleTimeExcessConnections(0);
- // Pool: connection testing
- dataSource.setAutomaticTestTable(null);
- try {
- dataSource.setConnectionTesterClassName(DefaultConnectionTester.class.getName());
- } catch (PropertyVetoException e) {
- LOG.fatal(e.getMessage(), e);
- throw new UnexpectedException(e);
- }
- dataSource.setPreferredTestQuery(null);
- dataSource.setTestConnectionOnCheckin(false);
- dataSource.setTestConnectionOnCheckout(false);
- // Pool: statement pooling
- dataSource.setMaxStatementsPerConnection(0);
- // Pool: recovery from database outages
- dataSource.setAcquireRetryAttempts(DB_CONNECTION_ACQUIRE_RETRY_ATTEMPS);
- dataSource.setAcquireRetryDelay(DB_CONNECTION_ACQUIRE_RETRY_DELAY);
- dataSource.setBreakAfterAcquireFailure(false);
- // Pool: connection lifecycles with connection customizer
- dataSource.setConnectionCustomizerClassName(null);
- // Pool: unresolved transaction handling
- dataSource.setAutoCommitOnClose(false);
- dataSource.setForceIgnoreUnresolvedTransactions(false);
- // Pool: debug and workaround broken client applications
- dataSource.setDebugUnreturnedConnectionStackTraces(false);
- dataSource.setUnreturnedConnectionTimeout(0);
- // Pool: dataSource
- dataSource.setCheckoutTimeout(0);
- dataSource.setFactoryClassLocation(null);
- dataSource.setMaxAdministrativeTaskTime(0);
- dataSource.setUsesTraditionalReflectiveProxies(false);
- return dataSource;
- }
+ /**
+ * @return Data source (for DB connection)
+ */
+ @Bean
+ public DataSource dataSource() {
+ ComboPooledDataSource dataSource = new ComboPooledDataSource();
+ // Connexion
+ try {
+ dataSource.setDriverClass(Driver.class.getName());
+ } catch (PropertyVetoException e) {
+ LOG.fatal(e.getMessage(), e);
+ throw new UnexpectedException(e);
+ }
+ dataSource.setJdbcUrl(dbUrlProperty);
+ dataSource.setPassword(dbPasswordProperty);
+ dataSource.setUser(dbUserProperty);
+ // Pool: basic configuration
+ dataSource.setInitialPoolSize(DB_POOL_MIN_SIZE);
+ // Pool: size and connection age
+ dataSource.setMaxConnectionAge(0);
+ dataSource.setMaxIdleTimeExcessConnections(0);
+ // Pool: connection testing
+ dataSource.setAutomaticTestTable(null);
+ try {
+ dataSource.setConnectionTesterClassName(DefaultConnectionTester.class.getName());
+ } catch (PropertyVetoException e) {
+ LOG.fatal(e.getMessage(), e);
+ throw new UnexpectedException(e);
+ }
+ dataSource.setPreferredTestQuery(null);
+ dataSource.setTestConnectionOnCheckin(false);
+ dataSource.setTestConnectionOnCheckout(false);
+ // Pool: statement pooling
+ dataSource.setMaxStatementsPerConnection(0);
+ // Pool: recovery from database outages
+ dataSource.setAcquireRetryAttempts(DB_CONNECTION_ACQUIRE_RETRY_ATTEMPS);
+ dataSource.setAcquireRetryDelay(DB_CONNECTION_ACQUIRE_RETRY_DELAY);
+ dataSource.setBreakAfterAcquireFailure(false);
+ // Pool: connection lifecycles with connection customizer
+ dataSource.setConnectionCustomizerClassName(null);
+ // Pool: unresolved transaction handling
+ dataSource.setAutoCommitOnClose(false);
+ dataSource.setForceIgnoreUnresolvedTransactions(false);
+ // Pool: debug and workaround broken client applications
+ dataSource.setDebugUnreturnedConnectionStackTraces(false);
+ dataSource.setUnreturnedConnectionTimeout(0);
+ // Pool: dataSource
+ dataSource.setCheckoutTimeout(0);
+ dataSource.setFactoryClassLocation(null);
+ dataSource.setMaxAdministrativeTaskTime(0);
+ dataSource.setUsesTraditionalReflectiveProxies(false);
+ return dataSource;
+ }
- /**
- * @return Session factory (for DB connections)
- */
- @Bean
- public SessionFactory sessionFactory() {
- LocalSessionFactoryBean sessionFactoryBean = new LocalSessionFactoryBean();
- sessionFactoryBean.setDataSource(dataSource());
- sessionFactoryBean.setPackagesToScan(new String[] { "nc.ird.cantharella.data.model" });
- Properties hibernateProperties = new Properties();
- // Hibernate: basic
- hibernateProperties.setProperty(Environment.DIALECT, PostgreSQL82Dialect.class.getName());
- //System.setProperty(Environment.BYTECODE_PROVIDER, "cglib");
- hibernateProperties.setProperty(Environment.HBM2DDL_AUTO, hbm2ddl);
- // hibernateProperties.setProperty("hibernate.hbm2ddl.auto", "create-drop");
- hibernateProperties.setProperty("hibernate.generate_statistics", String.valueOf(dbDebugProperty));
- hibernateProperties.setProperty("hibernate.cache.use_structured_entries", String.valueOf(dbDebugProperty));
- hibernateProperties.setProperty("hibernate.show_sql", String.valueOf(false));
- hibernateProperties.setProperty("hibernate.format_sql", String.valueOf(false));
- hibernateProperties.setProperty("hibernate.use_sql_comments", String.valueOf(dbDebugProperty));
- // Hibernate: cache
- hibernateProperties.setProperty("hibernate.cache.region.factory_class", SingletonEhCacheRegionFactory.class.getName());
- hibernateProperties.setProperty("hibernate.cache.use_query_cache", String.valueOf(true));
- hibernateProperties.setProperty("hibernate.cache.use_second_level_cache", String.valueOf(true));
- hibernateProperties.setProperty("hibernate.cache.use_structured_entries", String.valueOf(dbDebugProperty));
- // Hibernate: connection
- hibernateProperties.setProperty("hibernate.connection.autocommit", String.valueOf(false));
- hibernateProperties.setProperty("hibernate.connection.release_mode", "on_close");
- // Pool: c3p0 properties overrided by Hibernate
- // echatellier 20121129 : désactivé car la datasource est construite
- // à partir de c3p0, il ne faut donc pas que hibernate la gère
- // sur c3p0 en plus
- //hibernateProperties.setProperty(Environment.CONNECTION_PROVIDER, "org.hibernate.service.jdbc.connections.internal.C3P0ConnectionProvider");
- //hibernateProperties.setProperty("hibernate.c3p0.acquire_increment", String.valueOf(DB_POOL_ACQUIRE_INCREMENT)); // acquireIncrement
- //hibernateProperties.setProperty("hibernate.c3p0.idle_test_period", String.valueOf(0)); // idleConnectionTestPeriod
- //hibernateProperties.setProperty("hibernate.c3p0.timeout", String.valueOf(0)); // maxIdleTime
- //hibernateProperties.setProperty("hibernate.c3p0.max_size", String.valueOf(DB_POOL_MAX_SIZE)); // maxPoolSize
- //hibernateProperties.setProperty("hibernate.c3p0.max_statements", String.valueOf(0)); // maxStatements
- //hibernateProperties.setProperty("hibernate.c3p0.min_size", String.valueOf(DB_POOL_MIN_SIZE)); // minPoolSize
- // Hibernate search
- hibernateProperties.setProperty("hibernate.search.default.directory_provider", "filesystem");
- hibernateProperties.setProperty("hibernate.search.default.indexBase", "/tmp/cantharella/hs");
- hibernateProperties.setProperty("hibernate.search.analyzer", "org.apache.lucene.analysis.fr.FrenchAnalyzer");
+ /**
+ * @return Session factory (for DB connections)
+ */
+ @Bean
+ public SessionFactory sessionFactory() {
+ LocalSessionFactoryBean sessionFactoryBean = new LocalSessionFactoryBean();
+ sessionFactoryBean.setDataSource(dataSource());
+ sessionFactoryBean.setPackagesToScan(new String[] { "nc.ird.cantharella.data.model" });
+ Properties hibernateProperties = new Properties();
+ // Hibernate: basic
+ hibernateProperties.setProperty(Environment.DIALECT, PostgreSQL82Dialect.class.getName());
+ //System.setProperty(Environment.BYTECODE_PROVIDER, "cglib");
+ hibernateProperties.setProperty(Environment.HBM2DDL_AUTO, hbm2ddl);
+ // hibernateProperties.setProperty("hibernate.hbm2ddl.auto", "create-drop");
+ hibernateProperties.setProperty("hibernate.generate_statistics", String.valueOf(dbDebugProperty));
+ hibernateProperties.setProperty("hibernate.cache.use_structured_entries", String.valueOf(dbDebugProperty));
+ hibernateProperties.setProperty("hibernate.show_sql", String.valueOf(false));
+ hibernateProperties.setProperty("hibernate.format_sql", String.valueOf(false));
+ hibernateProperties.setProperty("hibernate.use_sql_comments", String.valueOf(dbDebugProperty));
+ // Hibernate: cache
+ hibernateProperties.setProperty("hibernate.cache.region.factory_class", SingletonEhCacheRegionFactory.class.getName());
+ hibernateProperties.setProperty("hibernate.cache.use_query_cache", String.valueOf(true));
+ hibernateProperties.setProperty("hibernate.cache.use_second_level_cache", String.valueOf(true));
+ hibernateProperties.setProperty("hibernate.cache.use_structured_entries", String.valueOf(dbDebugProperty));
+ // Hibernate: connection
+ hibernateProperties.setProperty("hibernate.connection.autocommit", String.valueOf(false));
+ hibernateProperties.setProperty("hibernate.connection.release_mode", "on_close");
+ // Pool: c3p0 properties overrided by Hibernate
+ // echatellier 20121129 : désactivé car la datasource est construite
+ // à partir de c3p0, il ne faut donc pas que hibernate la gère
+ // sur c3p0 en plus
+ //hibernateProperties.setProperty(Environment.CONNECTION_PROVIDER, "org.hibernate.service.jdbc.connections.internal.C3P0ConnectionProvider");
+ //hibernateProperties.setProperty("hibernate.c3p0.acquire_increment", String.valueOf(DB_POOL_ACQUIRE_INCREMENT)); // acquireIncrement
+ //hibernateProperties.setProperty("hibernate.c3p0.idle_test_period", String.valueOf(0)); // idleConnectionTestPeriod
+ //hibernateProperties.setProperty("hibernate.c3p0.timeout", String.valueOf(0)); // maxIdleTime
+ //hibernateProperties.setProperty("hibernate.c3p0.max_size", String.valueOf(DB_POOL_MAX_SIZE)); // maxPoolSize
+ //hibernateProperties.setProperty("hibernate.c3p0.max_statements", String.valueOf(0)); // maxStatements
+ //hibernateProperties.setProperty("hibernate.c3p0.min_size", String.valueOf(DB_POOL_MIN_SIZE)); // minPoolSize
+ // Hibernate search
+ hibernateProperties.setProperty("hibernate.search.default.directory_provider", "filesystem");
+ hibernateProperties.setProperty("hibernate.search.default.indexBase", "/tmp/cantharella/hs");
+ hibernateProperties.setProperty("hibernate.search.analyzer", "org.apache.lucene.analysis.fr.FrenchAnalyzer");
- // Hibernate: Session
- //hibernateProperties.setProperty("hibernate.current_session_context_class", "thread");
- //hibernateProperties.setProperty(Environment.JTA_PLATFORM, "hibernate.transaction.factory_class", SpringTransactionFactory.class.getName());
- // TODO batch_size à ajuster
- hibernateProperties.setProperty("hibernate.default_batch_fetch_size", String.valueOf(20));
+ // Hibernate: Session
+ //hibernateProperties.setProperty("hibernate.current_session_context_class", "thread");
+ //hibernateProperties.setProperty(Environment.JTA_PLATFORM, "hibernate.transaction.factory_class", SpringTransactionFactory.class.getName());
+ // TODO batch_size à ajuster
+ hibernateProperties.setProperty("hibernate.default_batch_fetch_size", String.valueOf(20));
- sessionFactoryBean.setHibernateProperties(hibernateProperties);
+ sessionFactoryBean.setHibernateProperties(hibernateProperties);
- //Map<String, Object> eventListeners = new HashMap<String, Object>();
- //ModelValidatorEventListener validationListener = new ModelValidatorEventListener(validatorFactory());
- //eventListeners.put("pre-insert", validationListener);
- //eventListeners.put("pre-update", validationListener);
- //sessionFactoryBean.setEventListeners(eventListeners);
+ //Map<String, Object> eventListeners = new HashMap<String, Object>();
+ //ModelValidatorEventListener validationListener = new ModelValidatorEventListener(validatorFactory());
+ //eventListeners.put("pre-insert", validationListener);
+ //eventListeners.put("pre-update", validationListener);
+ //sessionFactoryBean.setEventListeners(eventListeners);
- try {
- sessionFactoryBean.afterPropertiesSet();
- } catch (Exception e) {
- throw new RuntimeException("SessionFactory misconfiguration", e);
- }
- return sessionFactoryBean.getObject();
- }
+ try {
+ sessionFactoryBean.afterPropertiesSet();
+ } catch (Exception e) {
+ throw new RuntimeException("SessionFactory misconfiguration", e);
+ }
+ return sessionFactoryBean.getObject();
+ }
- /**
- * @return Transaction manager (for DB)
- */
- @Bean
- public HibernateTransactionManager transactionManager() {
- return new HibernateTransactionManager(sessionFactory());
- }
+ /**
+ * @return Transaction manager (for DB)
+ */
+ @Bean
+ public HibernateTransactionManager transactionManager() {
+ return new HibernateTransactionManager(sessionFactory());
+ }
- /**
- * @return Validator factory
- */
- @Bean
- public ValidatorFactory validatorFactory() {
- // LocalValidatorFactoryBean validatorFactory = new LocalValidatorFactoryBean();
- // return validatorFactory;
- return Validation.buildDefaultValidatorFactory();
- }
+ /**
+ * @return Validator factory
+ */
+ @Bean
+ public ValidatorFactory validatorFactory() {
+ // LocalValidatorFactoryBean validatorFactory = new LocalValidatorFactoryBean();
+ // return validatorFactory;
+ return Validation.buildDefaultValidatorFactory();
+ }
- /**
- * @return A Validator for models of the data layer
- */
- @Bean
- public ModelValidator dataModelValidator() {
- return new ModelValidatorImpl(validatorFactory(), dataMessageSource());
- }
+ /**
+ * @return A Validator for models of the data layer
+ */
+ @Bean
+ public ModelValidator dataModelValidator() {
+ return new ModelValidatorImpl(validatorFactory(), dataMessageSource());
+ }
}
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/dao/AbstractModelDao.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/dao/AbstractModelDao.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/dao/AbstractModelDao.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -27,5 +27,5 @@
* @author Adrien Cheype
*/
public abstract class AbstractModelDao {
- //
+ //
}
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/dao/GenericDao.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/dao/GenericDao.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/dao/GenericDao.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -39,255 +39,255 @@
*/
public interface GenericDao {
- /**
- * Count the number of rows
- * @param <M> Model type
- * @param modelClass Model class (not null)
- * @return Number of rows
- */
- @Transactional(readOnly = true)
- <M extends AbstractModel> long count(Class<M> modelClass);
+ /**
+ * Count the number of rows
+ * @param <M> Model type
+ * @param modelClass Model class (not null)
+ * @return Number of rows
+ */
+ @Transactional(readOnly = true)
+ <M extends AbstractModel> long count(Class<M> modelClass);
- /**
- * Count the number of result given by the search criteria. The criteria must contain the count projection.
- * @param criteria The criteria
- * @return The number
- */
- @Transactional(readOnly = true)
- long count(DetachedCriteria criteria);
+ /**
+ * Count the number of result given by the search criteria. The criteria must contain the count projection.
+ * @param criteria The criteria
+ * @return The number
+ */
+ @Transactional(readOnly = true)
+ long count(DetachedCriteria criteria);
- /**
- * Count the number of result given by the hql search. The hql query must contain the count operator.
- * @param hqlQuery The HQL query string
- * @param parameters Parameters (in replacement of ?)
- * @return The number
- */
- @Transactional(readOnly = true)
- long count(String hqlQuery, Object... parameters);
+ /**
+ * Count the number of result given by the hql search. The hql query must contain the count operator.
+ * @param hqlQuery The HQL query string
+ * @param parameters Parameters (in replacement of ?)
+ * @return The number
+ */
+ @Transactional(readOnly = true)
+ long count(String hqlQuery, Object... parameters);
- /**
- * Create a model
- * @param <M> Model type
- * @param model Model (not null)
- * @throws DataConstraintException When there is a problem of data integrity
- */
- @Transactional
- <M extends AbstractModel> void create(M model) throws DataConstraintException;
+ /**
+ * Create a model
+ * @param <M> Model type
+ * @param model Model (not null)
+ * @throws DataConstraintException When there is a problem of data integrity
+ */
+ @Transactional
+ <M extends AbstractModel> void create(M model) throws DataConstraintException;
- /**
- * Create or update a model
- * @param <M> Model type
- * @param model Model (not null)
- * @throws DataConstraintException When there is a problem of data integrity
- */
- @Transactional
- <M extends AbstractModel> void createOrUpdate(M model) throws DataConstraintException;
+ /**
+ * Create or update a model
+ * @param <M> Model type
+ * @param model Model (not null)
+ * @throws DataConstraintException When there is a problem of data integrity
+ */
+ @Transactional
+ <M extends AbstractModel> void createOrUpdate(M model) throws DataConstraintException;
- /**
- * Merge a model. Usefull when several detached objects are loaded (createOrUpdate throws NonUniqueObjectException
- * in this case).
- * @param <M> Model type
- * @param model Model (not null)
- * @throws DataConstraintException When there is a problem of data integrity
- */
- // @Transactional
- // public <M extends AbstractModel> void merge(M model) throws DataConstraintException;
- /**
- * Delete a model
- * @param <M> model type
- * @param modelClass Model class (not null)
- * @param id Model ID (not null)
- * @throws DataNotFoundException Model not found
- * @throws DataConstraintException Model linked to other objects
- */
- @Transactional
- <M extends AbstractModel> void delete(Class<M> modelClass, Serializable id) throws DataConstraintException,
- DataNotFoundException;
+ /**
+ * Merge a model. Usefull when several detached objects are loaded (createOrUpdate throws NonUniqueObjectException
+ * in this case).
+ * @param <M> Model type
+ * @param model Model (not null)
+ * @throws DataConstraintException When there is a problem of data integrity
+ */
+ // @Transactional
+ // public <M extends AbstractModel> void merge(M model) throws DataConstraintException;
+ /**
+ * Delete a model
+ * @param <M> model type
+ * @param modelClass Model class (not null)
+ * @param id Model ID (not null)
+ * @throws DataNotFoundException Model not found
+ * @throws DataConstraintException Model linked to other objects
+ */
+ @Transactional
+ <M extends AbstractModel> void delete(Class<M> modelClass, Serializable id) throws DataConstraintException,
+ DataNotFoundException;
- /**
- * Delete a model
- * @param <M> Model type
- * @param model Model (not null)
- * @throws DataNotFoundException Model not found
- * @throws DataConstraintException Model linked to other objects
- */
- @Transactional
- <M extends AbstractModel> void delete(M model) throws DataNotFoundException, DataConstraintException;
+ /**
+ * Delete a model
+ * @param <M> Model type
+ * @param model Model (not null)
+ * @throws DataNotFoundException Model not found
+ * @throws DataConstraintException Model linked to other objects
+ */
+ @Transactional
+ <M extends AbstractModel> void delete(M model) throws DataNotFoundException, DataConstraintException;
- /**
- * List entities given by the search criteria
- * @param criteria The criteria
- * @return List of results
- */
- @Transactional(readOnly = true)
- List<?> list(DetachedCriteria criteria);
+ /**
+ * List entities given by the search criteria
+ * @param criteria The criteria
+ * @return List of results
+ */
+ @Transactional(readOnly = true)
+ List<?> list(DetachedCriteria criteria);
- /**
- * List entities given by the hql query
- * @param hqlQuery The HQL query string
- * @param parameters Parameters (in replacement of ?)
- * @return List of results
- */
- @Transactional(readOnly = true)
- List<?> list(String hqlQuery, Object... parameters);
+ /**
+ * List entities given by the hql query
+ * @param hqlQuery The HQL query string
+ * @param parameters Parameters (in replacement of ?)
+ * @return List of results
+ */
+ @Transactional(readOnly = true)
+ List<?> list(String hqlQuery, Object... parameters);
- /**
- * Execute SQL query. This method is not recommanded because it shortcuts the Hibernate process. Do not use it if it
- * is not really necessary.
- * @param sqlQuery SQL query
- * @param parameters Parameters (in replacement of ?)
- * @return Number of rows affected
- * @throws DataConstraintException In case of data integrity exceptions
- */
- @Transactional
- int execute(String sqlQuery, Object... parameters) throws DataConstraintException;
+ /**
+ * Execute SQL query. This method is not recommanded because it shortcuts the Hibernate process. Do not use it if it
+ * is not really necessary.
+ * @param sqlQuery SQL query
+ * @param parameters Parameters (in replacement of ?)
+ * @return Number of rows affected
+ * @throws DataConstraintException In case of data integrity exceptions
+ */
+ @Transactional
+ int execute(String sqlQuery, Object... parameters) throws DataConstraintException;
- /**
- * Test model existence
- * @param <M> Model type
- * @param modelClass Model class (not null)
- * @param id ID (not null)
- * @return Existence
- */
- @Transactional(readOnly = true)
- <M extends AbstractModel> boolean exists(Class<M> modelClass, Serializable id);
+ /**
+ * Test model existence
+ * @param <M> Model type
+ * @param modelClass Model class (not null)
+ * @param id ID (not null)
+ * @return Existence
+ */
+ @Transactional(readOnly = true)
+ <M extends AbstractModel> boolean exists(Class<M> modelClass, Serializable id);
- /**
- * Test model existence
- * @param <M> Model type
- * @param modelClass Model class
- * @param property Property name
- * @param value Property value
- * @return Existence
- */
- @Transactional(readOnly = true)
- <M extends AbstractModel> boolean exists(Class<M> modelClass, String property, Serializable value);
+ /**
+ * Test model existence
+ * @param <M> Model type
+ * @param modelClass Model class
+ * @param property Property name
+ * @param value Property value
+ * @return Existence
+ */
+ @Transactional(readOnly = true)
+ <M extends AbstractModel> boolean exists(Class<M> modelClass, String property, Serializable value);
- /**
- * Test existence of a criteria
- * @param criteria The criteria
- * @return True if exists, otherwise false
- */
- @Transactional(readOnly = true)
- boolean exists(DetachedCriteria criteria);
+ /**
+ * Test existence of a criteria
+ * @param criteria The criteria
+ * @return True if exists, otherwise false
+ */
+ @Transactional(readOnly = true)
+ boolean exists(DetachedCriteria criteria);
- /**
- * Read models
- * @param <M> Model type
- * @param modelClass Model class (not null)
- * @return Models
- */
- @Transactional(readOnly = true)
- <M extends AbstractModel> List<M> readList(Class<M> modelClass);
+ /**
+ * Read models
+ * @param <M> Model type
+ * @param modelClass Model class (not null)
+ * @return Models
+ */
+ @Transactional(readOnly = true)
+ <M extends AbstractModel> List<M> readList(Class<M> modelClass);
- /**
- * Read models
- * @param <M> Model type
- * @param sortColumn column name for the models sort
- * @param modelClass Model class (not null)
- * @return Models
- */
- // @Transactional(readOnly = true)
- // <M extends AbstractModel> List<M> readList(Class<M> modelClass, String sortColumn);
- /**
- * Read models
- * @param <M> Model type
- * @param sortColumns column names for the models sort (with the order)
- * @param modelClass Model class (not null)
- * @return Models
- */
- @Transactional(readOnly = true)
- <M extends AbstractModel> List<M> readList(Class<M> modelClass, String... sortColumns);
+ /**
+ * Read models
+ * @param <M> Model type
+ * @param sortColumn column name for the models sort
+ * @param modelClass Model class (not null)
+ * @return Models
+ */
+ // @Transactional(readOnly = true)
+ // <M extends AbstractModel> List<M> readList(Class<M> modelClass, String sortColumn);
+ /**
+ * Read models
+ * @param <M> Model type
+ * @param sortColumns column names for the models sort (with the order)
+ * @param modelClass Model class (not null)
+ * @return Models
+ */
+ @Transactional(readOnly = true)
+ <M extends AbstractModel> List<M> readList(Class<M> modelClass, String... sortColumns);
- /**
- * Read models according to the order of @Id or @EmbeddedId column
- * @param <M> Model type
- * @param modelClass Model class (not null)
- * @param firstResult First result (not negative)
- * @param maxResults Max results (not negative)
- * @param sortColumns column names for the models sort (with the order)
- * @return Models
- */
- @Transactional(readOnly = true)
- <M extends AbstractModel> List<M> readList(Class<M> modelClass, int firstResult, int maxResults,
- String... sortColumns);
+ /**
+ * Read models according to the order of @Id or @EmbeddedId column
+ * @param <M> Model type
+ * @param modelClass Model class (not null)
+ * @param firstResult First result (not negative)
+ * @param maxResults Max results (not negative)
+ * @param sortColumns column names for the models sort (with the order)
+ * @return Models
+ */
+ @Transactional(readOnly = true)
+ <M extends AbstractModel> List<M> readList(Class<M> modelClass, int firstResult, int maxResults,
+ String... sortColumns);
- /**
- * Read models according to the order of @Id or @EmbeddedId column
- * @param <M> Model type
- * @param modelClass Model class (not null)
- * @param firstResult First result (not negative)
- * @param maxResults Max results (not negative)
- * @return Models
- */
- @Transactional(readOnly = true)
- <M extends AbstractModel> List<M> readList(Class<M> modelClass, int firstResult, int maxResults);
+ /**
+ * Read models according to the order of @Id or @EmbeddedId column
+ * @param <M> Model type
+ * @param modelClass Model class (not null)
+ * @param firstResult First result (not negative)
+ * @param maxResults Max results (not negative)
+ * @return Models
+ */
+ @Transactional(readOnly = true)
+ <M extends AbstractModel> List<M> readList(Class<M> modelClass, int firstResult, int maxResults);
- /**
- * Read a model
- * @param <M> Model type
- * @param modelClass Model class (not null)
- * @param id Model ID (not null)
- * @return Model (null if not found)
- * @throws DataNotFoundException Model not found
- */
- // if Transactional(readOnly = true) -> Bug ...
- // so nothing until this bug is fixed
- <M extends AbstractModel> M read(Class<M> modelClass, Serializable id) throws DataNotFoundException;
+ /**
+ * Read a model
+ * @param <M> Model type
+ * @param modelClass Model class (not null)
+ * @param id Model ID (not null)
+ * @return Model (null if not found)
+ * @throws DataNotFoundException Model not found
+ */
+ // if Transactional(readOnly = true) -> Bug ...
+ // so nothing until this bug is fixed
+ <M extends AbstractModel> M read(Class<M> modelClass, Serializable id) throws DataNotFoundException;
- /**
- * Read and fetch a model
- * @param <M> Model class
- * @param modelClass Model class
- * @param uniqueProperty Unique property name
- * @param value Unique property value
- * @return Model
- * @throws DataNotFoundException Model not found
- */
- @Transactional(readOnly = true)
- <M extends AbstractModel> M read(Class<M> modelClass, String uniqueProperty, Serializable value)
- throws DataNotFoundException;
+ /**
+ * Read and fetch a model
+ * @param <M> Model class
+ * @param modelClass Model class
+ * @param uniqueProperty Unique property name
+ * @param value Unique property value
+ * @return Model
+ * @throws DataNotFoundException Model not found
+ */
+ @Transactional(readOnly = true)
+ <M extends AbstractModel> M read(Class<M> modelClass, String uniqueProperty, Serializable value)
+ throws DataNotFoundException;
- /**
- * Refresh a model object
- * @param <M> Model type
- * @param model Model object
- */
- @Transactional(readOnly = true)
- <M extends AbstractModel> void refresh(M model);
+ /**
+ * Refresh a model object
+ * @param <M> Model type
+ * @param model Model object
+ */
+ @Transactional(readOnly = true)
+ <M extends AbstractModel> void refresh(M model);
- /**
- * Update a model
- * @param <M> Model type
- * @param model Model (not null)
- * @throws DataNotFoundException Model not found
- * @throws DataConstraintException Model already exists
- */
- @Transactional
- <M extends AbstractModel> void update(M model) throws DataNotFoundException, DataConstraintException;
+ /**
+ * Update a model
+ * @param <M> Model type
+ * @param model Model (not null)
+ * @throws DataNotFoundException Model not found
+ * @throws DataConstraintException Model already exists
+ */
+ @Transactional
+ <M extends AbstractModel> void update(M model) throws DataNotFoundException, DataConstraintException;
- /**
- * Evict a model. Remove from the hibernate session.
- * @param <M> Model type
- * @param model Model (not null)
- */
- @Transactional
- <M extends AbstractModel> void evict(M model);
+ /**
+ * Evict a model. Remove from the hibernate session.
+ * @param <M> Model type
+ * @param model Model (not null)
+ */
+ @Transactional
+ <M extends AbstractModel> void evict(M model);
- /**
- * Check if the given model is in the hibernate session.
- * @param <M> Model type
- * @param model Model (not null)
- * @return If the given model is in the hibernate session
- */
- @Transactional(readOnly = true)
- <M extends AbstractModel> boolean contains(M model);
+ /**
+ * Check if the given model is in the hibernate session.
+ * @param <M> Model type
+ * @param model Model (not null)
+ * @return If the given model is in the hibernate session
+ */
+ @Transactional(readOnly = true)
+ <M extends AbstractModel> boolean contains(M model);
- /**
- * Merge a model from the hibernate session.
- * @param <M> Model type
- * @param model Model (not null)
- */
- @Transactional
- <M extends AbstractModel> void merge(M model);
+ /**
+ * Merge a model from the hibernate session.
+ * @param <M> Model type
+ * @param model Model (not null)
+ */
+ @Transactional
+ <M extends AbstractModel> void merge(M model);
}
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/dao/impl/CampagneDao.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/dao/impl/CampagneDao.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/dao/impl/CampagneDao.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -36,15 +36,15 @@
*/
public final class CampagneDao extends AbstractModelDao {
- /** Criteria : différents programmes des campagnes déjà saisis */
- public static final DetachedCriteria CRITERIA_DISTINCT_CAMPAGNE_PROGRAMMES = DetachedCriteria
- .forClass(Campagne.class).setProjection(Projections.distinct(Projections.property("programme")))
- .addOrder(Order.asc("programme"));
+ /** Criteria : différents programmes des campagnes déjà saisis */
+ public static final DetachedCriteria CRITERIA_DISTINCT_CAMPAGNE_PROGRAMMES = DetachedCriteria
+ .forClass(Campagne.class).setProjection(Projections.distinct(Projections.property("programme")))
+ .addOrder(Order.asc("programme"));
- /**
- * Constructor (prevents from instantiation)
- */
- private CampagneDao() {
- //
- }
+ /**
+ * Constructor (prevents from instantiation)
+ */
+ private CampagneDao() {
+ //
+ }
}
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/dao/impl/ExtractionDao.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/dao/impl/ExtractionDao.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/dao/impl/ExtractionDao.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -35,21 +35,21 @@
*/
public class ExtractionDao {
- /**
- * Constructor (empêche l'instantiation)
- */
- private ExtractionDao() {
- //
- }
+ /**
+ * Constructor (empêche l'instantiation)
+ */
+ private ExtractionDao() {
+ //
+ }
- /**
- * Rend le criteria qui rend le nombre d'extrait qui référencent un type d'extrait
- * @param idTypeExtrait L'id du type extrait
- * @return Le criteria
- **/
- public static DetachedCriteria getCriteriaCountExtraitOfTypeExtrait(Integer idTypeExtrait) {
- return DetachedCriteria.forClass(Extrait.class).createAlias("typeExtrait", "type")
- .add(Restrictions.eq("type.idTypeExtrait", idTypeExtrait)).setProjection(Projections.rowCount());
- }
+ /**
+ * Rend le criteria qui rend le nombre d'extrait qui référencent un type d'extrait
+ * @param idTypeExtrait L'id du type extrait
+ * @return Le criteria
+ **/
+ public static DetachedCriteria getCriteriaCountExtraitOfTypeExtrait(Integer idTypeExtrait) {
+ return DetachedCriteria.forClass(Extrait.class).createAlias("typeExtrait", "type")
+ .add(Restrictions.eq("type.idTypeExtrait", idTypeExtrait)).setProjection(Projections.rowCount());
+ }
}
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/dao/impl/HibernateTemplateDao.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/dao/impl/HibernateTemplateDao.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/dao/impl/HibernateTemplateDao.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -53,251 +53,251 @@
@Resource
private SessionFactory sessionFactory;
- public HibernateTemplateDao() {
+ public HibernateTemplateDao() {
- }
+ }
- /**
- * Criteria : model from a property value
- * @param modelClass Model class
- * @param propertyName Property name
- * @param value Value
- * @return Criteria
- */
- private static DetachedCriteria criteriaByProperty(Class<? extends AbstractModel> modelClass, String propertyName,
- Serializable value) {
- return DetachedCriteria.forClass(modelClass).add(Restrictions.eq(propertyName, value));
- }
+ /**
+ * Criteria : model from a property value
+ * @param modelClass Model class
+ * @param propertyName Property name
+ * @param value Value
+ * @return Criteria
+ */
+ private static DetachedCriteria criteriaByProperty(Class<? extends AbstractModel> modelClass, String propertyName,
+ Serializable value) {
+ return DetachedCriteria.forClass(modelClass).add(Restrictions.eq(propertyName, value));
+ }
- /*
- * Constructor
- * @param sessionFactory Session factory
- *
- @Autowired
- public HibernateTemplateDao(SessionFactory sessionFactory) {
- setSessionFactory(sessionFactory);
- sessionFactory.getCurrentSession().setAllowCreate(false);
- sessionFactory.getCurrentSession().setCacheQueries(true);
- sessionFactory.getCurrentSession().afterPropertiesSet();
- }*/
+ /*
+ * Constructor
+ * @param sessionFactory Session factory
+ *
+ @Autowired
+ public HibernateTemplateDao(SessionFactory sessionFactory) {
+ setSessionFactory(sessionFactory);
+ sessionFactory.getCurrentSession().setAllowCreate(false);
+ sessionFactory.getCurrentSession().setCacheQueries(true);
+ sessionFactory.getCurrentSession().afterPropertiesSet();
+ }*/
- /**
- * {@inheritDoc}
- */
- @Override
- public long count(DetachedCriteria criteria) {
- AssertTools.assertNotNull(criteria);
- return (Long) list(criteria.setProjection(Projections.rowCount())).get(0);
- }
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public long count(DetachedCriteria criteria) {
+ AssertTools.assertNotNull(criteria);
+ return (Long) list(criteria.setProjection(Projections.rowCount())).get(0);
+ }
- /** {@inheritDoc} */
- @Override
- public <M extends AbstractModel> long count(Class<M> modelClass) {
- AssertTools.assertNotNull(modelClass);
- return (Long) list(DetachedCriteria.forClass(modelClass).setProjection(Projections.rowCount())).get(0);
- }
+ /** {@inheritDoc} */
+ @Override
+ public <M extends AbstractModel> long count(Class<M> modelClass) {
+ AssertTools.assertNotNull(modelClass);
+ return (Long) list(DetachedCriteria.forClass(modelClass).setProjection(Projections.rowCount())).get(0);
+ }
- /**
- * {@inheritDoc}
- */
- @Override
- public long count(String hqlQuery, Object... parameters) {
- AssertTools.assertNotEmpty(hqlQuery);
- Query query = sessionFactory.getCurrentSession().createQuery(hqlQuery);
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public long count(String hqlQuery, Object... parameters) {
+ AssertTools.assertNotEmpty(hqlQuery);
+ Query query = sessionFactory.getCurrentSession().createQuery(hqlQuery);
for (int i = 0; i < parameters.length; i++) {
query.setParameter(i, parameters[i]);
}
- return (Long)query.iterate().next();
- }
+ return (Long)query.iterate().next();
+ }
- /** {@inheritDoc} */
- @Override
- public <M extends AbstractModel> void create(M model) {
- AssertTools.assertNotNull(model);
- sessionFactory.getCurrentSession().save(model);
- }
+ /** {@inheritDoc} */
+ @Override
+ public <M extends AbstractModel> void create(M model) {
+ AssertTools.assertNotNull(model);
+ sessionFactory.getCurrentSession().save(model);
+ }
- /** {@inheritDoc} */
- @Override
- public <M extends AbstractModel> void createOrUpdate(M model) {
- AssertTools.assertNotNull(model);
- sessionFactory.getCurrentSession().saveOrUpdate(model);
- }
+ /** {@inheritDoc} */
+ @Override
+ public <M extends AbstractModel> void createOrUpdate(M model) {
+ AssertTools.assertNotNull(model);
+ sessionFactory.getCurrentSession().saveOrUpdate(model);
+ }
- /** {@inheritDoc} */
- @Override
- public <M extends AbstractModel> void delete(Class<M> modelClass, Serializable id) {
- AssertTools.assertNotNull(modelClass);
- AssertTools.assertNotNull(id);
- sessionFactory.getCurrentSession().delete(read(modelClass, id));
- }
+ /** {@inheritDoc} */
+ @Override
+ public <M extends AbstractModel> void delete(Class<M> modelClass, Serializable id) {
+ AssertTools.assertNotNull(modelClass);
+ AssertTools.assertNotNull(id);
+ sessionFactory.getCurrentSession().delete(read(modelClass, id));
+ }
- /** {@inheritDoc} */
- @Override
- public <M extends AbstractModel> void delete(M model) {
- AssertTools.assertNotNull(model);
- sessionFactory.getCurrentSession().delete(model);
- }
+ /** {@inheritDoc} */
+ @Override
+ public <M extends AbstractModel> void delete(M model) {
+ AssertTools.assertNotNull(model);
+ sessionFactory.getCurrentSession().delete(model);
+ }
- /** {@inheritDoc} */
- @Override
- public List<?> list(DetachedCriteria criteria) {
- AssertTools.assertNotNull(criteria);
- Criteria execCriteria = criteria.getExecutableCriteria(sessionFactory.getCurrentSession());
- return execCriteria.list();
- }
+ /** {@inheritDoc} */
+ @Override
+ public List<?> list(DetachedCriteria criteria) {
+ AssertTools.assertNotNull(criteria);
+ Criteria execCriteria = criteria.getExecutableCriteria(sessionFactory.getCurrentSession());
+ return execCriteria.list();
+ }
- /** {@inheritDoc} */
- @Override
- public List<?> list(String hqlQuery, Object... parameters) {
- Query query = sessionFactory.getCurrentSession().createQuery(hqlQuery);
- for (int i = 0; i < parameters.length; i++) {
+ /** {@inheritDoc} */
+ @Override
+ public List<?> list(String hqlQuery, Object... parameters) {
+ Query query = sessionFactory.getCurrentSession().createQuery(hqlQuery);
+ for (int i = 0; i < parameters.length; i++) {
query.setParameter(i, parameters[i]);
}
- return query.list();
- }
+ return query.list();
+ }
- /** {@inheritDoc} */
- @Override
- public int execute(final String sqlQuery, final Object... parameters) {
- AssertTools.assertNotEmpty(sqlQuery);
- Query query = sessionFactory.getCurrentSession().createSQLQuery(sqlQuery);
+ /** {@inheritDoc} */
+ @Override
+ public int execute(final String sqlQuery, final Object... parameters) {
+ AssertTools.assertNotEmpty(sqlQuery);
+ Query query = sessionFactory.getCurrentSession().createSQLQuery(sqlQuery);
for (int i = 0; i < parameters.length; i++) {
query.setParameter(i, parameters[i]);
}
int nbLines = Integer.valueOf(query.executeUpdate());
- // This way to execute requests shortcuts the Hibernate process, so we need to refresh the data cache
- sessionFactory.getCurrentSession().flush();
- sessionFactory.getCurrentSession().clear();
- return nbLines;
- }
+ // This way to execute requests shortcuts the Hibernate process, so we need to refresh the data cache
+ sessionFactory.getCurrentSession().flush();
+ sessionFactory.getCurrentSession().clear();
+ return nbLines;
+ }
- /** {@inheritDoc} */
- @Override
- public <M extends AbstractModel> boolean exists(Class<M> modelClass, Serializable id) {
- return count(criteriaByProperty(modelClass, AbstractModel.getIdField(modelClass).getName(), id).setProjection(
- Projections.rowCount())) > 0;
- }
+ /** {@inheritDoc} */
+ @Override
+ public <M extends AbstractModel> boolean exists(Class<M> modelClass, Serializable id) {
+ return count(criteriaByProperty(modelClass, AbstractModel.getIdField(modelClass).getName(), id).setProjection(
+ Projections.rowCount())) > 0;
+ }
- /** {@inheritDoc} */
- @Override
- public <M extends AbstractModel> boolean exists(Class<M> modelClass, String property, Serializable value) {
- return count(criteriaByProperty(modelClass, property, value).setProjection(Projections.rowCount())) > 0;
- }
+ /** {@inheritDoc} */
+ @Override
+ public <M extends AbstractModel> boolean exists(Class<M> modelClass, String property, Serializable value) {
+ return count(criteriaByProperty(modelClass, property, value).setProjection(Projections.rowCount())) > 0;
+ }
- /** {@inheritDoc} */
- @Override
- public boolean exists(DetachedCriteria criteria) {
- return count(criteria) > 0;
- }
+ /** {@inheritDoc} */
+ @Override
+ public boolean exists(DetachedCriteria criteria) {
+ return count(criteria) > 0;
+ }
- /** {@inheritDoc} */
- @Override
- public <M extends AbstractModel> List<M> readList(Class<M> modelClass) {
- AssertTools.assertNotNull(modelClass);
- Criteria criteria = sessionFactory.getCurrentSession().createCriteria(modelClass);
- criteria.addOrder(Order.asc(AbstractModel.getIdField(modelClass).getName()));
- return GenericsTools.cast(criteria.list());
- }
+ /** {@inheritDoc} */
+ @Override
+ public <M extends AbstractModel> List<M> readList(Class<M> modelClass) {
+ AssertTools.assertNotNull(modelClass);
+ Criteria criteria = sessionFactory.getCurrentSession().createCriteria(modelClass);
+ criteria.addOrder(Order.asc(AbstractModel.getIdField(modelClass).getName()));
+ return GenericsTools.cast(criteria.list());
+ }
- /** {@inheritDoc} */
- @Override
- public <M extends AbstractModel> List<M> readList(Class<M> modelClass, String... sortColumns) {
- AssertTools.assertNotNull(modelClass);
- AssertTools.assertNotEmpty(sortColumns);
- Criteria criteria = sessionFactory.getCurrentSession().createCriteria(modelClass);
- for (String sortCol : sortColumns) {
- criteria.addOrder(Order.asc(sortCol));
- }
- return GenericsTools.cast(criteria.list());
- }
+ /** {@inheritDoc} */
+ @Override
+ public <M extends AbstractModel> List<M> readList(Class<M> modelClass, String... sortColumns) {
+ AssertTools.assertNotNull(modelClass);
+ AssertTools.assertNotEmpty(sortColumns);
+ Criteria criteria = sessionFactory.getCurrentSession().createCriteria(modelClass);
+ for (String sortCol : sortColumns) {
+ criteria.addOrder(Order.asc(sortCol));
+ }
+ return GenericsTools.cast(criteria.list());
+ }
- /** {@inheritDoc} */
- @Override
- public <M extends AbstractModel> List<M> readList(Class<M> modelClass, int firstResult, int maxResults) {
- AssertTools.assertNotNull(modelClass);
- AssertTools.assertPositive(firstResult);
- AssertTools.assertPositive(maxResults);
- Criteria criteria = sessionFactory.getCurrentSession().createCriteria(modelClass);
- criteria.addOrder(Order.asc(AbstractModel.getIdField(modelClass).getName()));
- criteria.setFirstResult(firstResult);
- criteria.setMaxResults(maxResults);
- return GenericsTools.cast(criteria.list());
- }
+ /** {@inheritDoc} */
+ @Override
+ public <M extends AbstractModel> List<M> readList(Class<M> modelClass, int firstResult, int maxResults) {
+ AssertTools.assertNotNull(modelClass);
+ AssertTools.assertPositive(firstResult);
+ AssertTools.assertPositive(maxResults);
+ Criteria criteria = sessionFactory.getCurrentSession().createCriteria(modelClass);
+ criteria.addOrder(Order.asc(AbstractModel.getIdField(modelClass).getName()));
+ criteria.setFirstResult(firstResult);
+ criteria.setMaxResults(maxResults);
+ return GenericsTools.cast(criteria.list());
+ }
- /** {@inheritDoc} */
- @Override
- public <M extends AbstractModel> List<M> readList(Class<M> modelClass, int firstResult, int maxResults,
- String... sortColumns) {
- AssertTools.assertNotNull(modelClass);
- AssertTools.assertNotEmpty(sortColumns);
- AssertTools.assertPositive(firstResult);
- AssertTools.assertPositive(maxResults);
- Criteria criteria = sessionFactory.getCurrentSession().createCriteria(modelClass);
- for (String sortCol : sortColumns) {
- criteria.addOrder(Order.asc(sortCol));
- }
- criteria.setFirstResult(firstResult);
- criteria.setMaxResults(maxResults);
- return GenericsTools.cast(criteria.list());
- }
+ /** {@inheritDoc} */
+ @Override
+ public <M extends AbstractModel> List<M> readList(Class<M> modelClass, int firstResult, int maxResults,
+ String... sortColumns) {
+ AssertTools.assertNotNull(modelClass);
+ AssertTools.assertNotEmpty(sortColumns);
+ AssertTools.assertPositive(firstResult);
+ AssertTools.assertPositive(maxResults);
+ Criteria criteria = sessionFactory.getCurrentSession().createCriteria(modelClass);
+ for (String sortCol : sortColumns) {
+ criteria.addOrder(Order.asc(sortCol));
+ }
+ criteria.setFirstResult(firstResult);
+ criteria.setMaxResults(maxResults);
+ return GenericsTools.cast(criteria.list());
+ }
- /** {@inheritDoc} */
- @Override
- public <M extends AbstractModel> M read(Class<M> modelClass, Serializable id) {
- AssertTools.assertNotNull(modelClass);
- AssertTools.assertNotNull(id);
+ /** {@inheritDoc} */
+ @Override
+ public <M extends AbstractModel> M read(Class<M> modelClass, Serializable id) {
+ AssertTools.assertNotNull(modelClass);
+ AssertTools.assertNotNull(id);
- M m = modelClass.cast(sessionFactory.getCurrentSession().get(modelClass, id));
- if (m == null) {
- throw new ObjectRetrievalFailureException(modelClass, id);
- }
- return m;
- }
+ M m = modelClass.cast(sessionFactory.getCurrentSession().get(modelClass, id));
+ if (m == null) {
+ throw new ObjectRetrievalFailureException(modelClass, id);
+ }
+ return m;
+ }
- /** {@inheritDoc} */
- @SuppressWarnings("unchecked")
- @Override
- public <M extends AbstractModel> M read(Class<M> modelClass, String uniqueProperty, Serializable value) {
- List<M> list = (List<M>) list(criteriaByProperty(modelClass, uniqueProperty, value));
- if (list.size() != 1) {
- throw new ObjectRetrievalFailureException(modelClass, value);
- }
- return list.get(0);
- }
+ /** {@inheritDoc} */
+ @SuppressWarnings("unchecked")
+ @Override
+ public <M extends AbstractModel> M read(Class<M> modelClass, String uniqueProperty, Serializable value) {
+ List<M> list = (List<M>) list(criteriaByProperty(modelClass, uniqueProperty, value));
+ if (list.size() != 1) {
+ throw new ObjectRetrievalFailureException(modelClass, value);
+ }
+ return list.get(0);
+ }
- /** {@inheritDoc} */
- @Override
- public <M extends AbstractModel> void refresh(M model) {
- AssertTools.assertNotNull(model);
- sessionFactory.getCurrentSession().refresh(model);
- }
+ /** {@inheritDoc} */
+ @Override
+ public <M extends AbstractModel> void refresh(M model) {
+ AssertTools.assertNotNull(model);
+ sessionFactory.getCurrentSession().refresh(model);
+ }
- /** {@inheritDoc} */
- @Override
- public <M extends AbstractModel> void update(M model) {
- AssertTools.assertNotNull(model);
- sessionFactory.getCurrentSession().update(model);
- }
+ /** {@inheritDoc} */
+ @Override
+ public <M extends AbstractModel> void update(M model) {
+ AssertTools.assertNotNull(model);
+ sessionFactory.getCurrentSession().update(model);
+ }
- /** {@inheritDoc} */
- @Override
- public <M extends AbstractModel> void evict(M model) {
- AssertTools.assertNotNull(model);
- sessionFactory.getCurrentSession().evict(model);
- }
+ /** {@inheritDoc} */
+ @Override
+ public <M extends AbstractModel> void evict(M model) {
+ AssertTools.assertNotNull(model);
+ sessionFactory.getCurrentSession().evict(model);
+ }
- /** {@inheritDoc} */
- @Override
- public <M extends AbstractModel> boolean contains(M model) {
- AssertTools.assertNotNull(model);
- return sessionFactory.getCurrentSession().contains(model);
- }
+ /** {@inheritDoc} */
+ @Override
+ public <M extends AbstractModel> boolean contains(M model) {
+ AssertTools.assertNotNull(model);
+ return sessionFactory.getCurrentSession().contains(model);
+ }
- /** {@inheritDoc} */
- @Override
- public <M extends AbstractModel> void merge(M model) {
- AssertTools.assertNotNull(model);
- sessionFactory.getCurrentSession().merge(model);
- }
+ /** {@inheritDoc} */
+ @Override
+ public <M extends AbstractModel> void merge(M model) {
+ AssertTools.assertNotNull(model);
+ sessionFactory.getCurrentSession().merge(model);
+ }
}
\ No newline at end of file
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/dao/impl/MoleculeDao.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/dao/impl/MoleculeDao.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/dao/impl/MoleculeDao.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -37,15 +37,15 @@
*/
public final class MoleculeDao extends AbstractModelDao {
- /** Criteria : différents programmes des campagnes déjà saisis */
- public static final DetachedCriteria CRITERIA_DISTINCT_MOLECULE_ORGANISMES = DetachedCriteria
- .forClass(Molecule.class).setProjection(Projections.distinct(Projections.property("identifieePar")))
- .addOrder(Order.asc("identifieePar"));
+ /** Criteria : différents programmes des campagnes déjà saisis */
+ public static final DetachedCriteria CRITERIA_DISTINCT_MOLECULE_ORGANISMES = DetachedCriteria
+ .forClass(Molecule.class).setProjection(Projections.distinct(Projections.property("identifieePar")))
+ .addOrder(Order.asc("identifieePar"));
- /**
- * Constructor (prevents from instantiation)
- */
- private MoleculeDao() {
- //
- }
+ /**
+ * Constructor (prevents from instantiation)
+ */
+ private MoleculeDao() {
+ //
+ }
}
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/dao/impl/PersonneDao.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/dao/impl/PersonneDao.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/dao/impl/PersonneDao.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -35,55 +35,55 @@
/** DAO : personne */
public final class PersonneDao extends AbstractModelDao {
- /** Criteria : compte les administrateurs */
- public static final DetachedCriteria CRITERIA_COUNT_ADMINS = DetachedCriteria.forClass(Utilisateur.class)
- .add(Restrictions.eq("typeDroit", TypeDroit.ADMINISTRATEUR))
- .add(Restrictions.eq("estValide", Boolean.TRUE)).setProjection(Projections.rowCount());
+ /** Criteria : compte les administrateurs */
+ public static final DetachedCriteria CRITERIA_COUNT_ADMINS = DetachedCriteria.forClass(Utilisateur.class)
+ .add(Restrictions.eq("typeDroit", TypeDroit.ADMINISTRATEUR))
+ .add(Restrictions.eq("estValide", Boolean.TRUE)).setProjection(Projections.rowCount());
- /** Criteria : liste les administrateurs */
- public static final DetachedCriteria CRITERIA_LIST_ADMINS = DetachedCriteria.forClass(Utilisateur.class)
- .add(Restrictions.eq("typeDroit", TypeDroit.ADMINISTRATEUR))
- .add(Restrictions.eq("estValide", Boolean.TRUE));
+ /** Criteria : liste les administrateurs */
+ public static final DetachedCriteria CRITERIA_LIST_ADMINS = DetachedCriteria.forClass(Utilisateur.class)
+ .add(Restrictions.eq("typeDroit", TypeDroit.ADMINISTRATEUR))
+ .add(Restrictions.eq("estValide", Boolean.TRUE));
- /** Criteria : liste les utilisateurs à valider */
- public static final DetachedCriteria CRITERIA_LIST_UTILISATEURS_INVALID = DetachedCriteria
- .forClass(Utilisateur.class).add(Restrictions.eq("estValide", Boolean.FALSE)).addOrder(Order.asc("nom"))
- .addOrder(Order.asc("prenom"));
+ /** Criteria : liste les utilisateurs à valider */
+ public static final DetachedCriteria CRITERIA_LIST_UTILISATEURS_INVALID = DetachedCriteria
+ .forClass(Utilisateur.class).add(Restrictions.eq("estValide", Boolean.FALSE)).addOrder(Order.asc("nom"))
+ .addOrder(Order.asc("prenom"));
- /** Criteria : liste les utilisateurs qui sont déjà valides */
- public static final DetachedCriteria CRITERIA_LIST_UTILISATEURS_VALID = DetachedCriteria
- .forClass(Utilisateur.class).add(Restrictions.eq("estValide", Boolean.TRUE)).addOrder(Order.asc("nom"))
- .addOrder(Order.asc("prenom"));
+ /** Criteria : liste les utilisateurs qui sont déjà valides */
+ public static final DetachedCriteria CRITERIA_LIST_UTILISATEURS_VALID = DetachedCriteria
+ .forClass(Utilisateur.class).add(Restrictions.eq("estValide", Boolean.TRUE)).addOrder(Order.asc("nom"))
+ .addOrder(Order.asc("prenom"));
- /** SQL : créé un utilisateur à partir d'une personne */
- public static final String SQL_CREATE_UTILISATEUR_FROM_PERSONNE = String.format(
- "INSERT INTO %s(estValide, passwordHash, typeDroit, idPersonne) VALUES (?, ?, ?, ?);",
- Utilisateur.class.getSimpleName());
+ /** SQL : créé un utilisateur à partir d'une personne */
+ public static final String SQL_CREATE_UTILISATEUR_FROM_PERSONNE = String.format(
+ "INSERT INTO %s(estValide, passwordHash, typeDroit, idPersonne) VALUES (?, ?, ?, ?);",
+ Utilisateur.class.getSimpleName());
- /** SQL : supprime un utilisateur (mais pas la personne associée) */
- public static final String SQL_DELETE_UTILISATEUR = String.format("DELETE FROM %s WHERE idPersonne = ?;",
- Utilisateur.class.getSimpleName());
+ /** SQL : supprime un utilisateur (mais pas la personne associée) */
+ public static final String SQL_DELETE_UTILISATEUR = String.format("DELETE FROM %s WHERE idPersonne = ?;",
+ Utilisateur.class.getSimpleName());
- /** Criteria : valeurs existantes du champ 'organisme' pour les personnes existantes */
- public static final DetachedCriteria CRITERIA_DISTINCT_PERSONNE_ORGANISMES = DetachedCriteria
- .forClass(Personne.class).setProjection(Projections.distinct(Projections.property("organisme")))
- .addOrder(Order.asc("organisme"));
+ /** Criteria : valeurs existantes du champ 'organisme' pour les personnes existantes */
+ public static final DetachedCriteria CRITERIA_DISTINCT_PERSONNE_ORGANISMES = DetachedCriteria
+ .forClass(Personne.class).setProjection(Projections.distinct(Projections.property("organisme")))
+ .addOrder(Order.asc("organisme"));
- /**
- * Liste l'utilisateur qui a le courriel et le password donné et qui est un utilisateur validé
- * @param courriel Le courriel recherché
- * @param passwordHash Le password recherché
- * @return Le criteria
- **/
- public static DetachedCriteria getCriteriaAuthenticateUser(String courriel, String passwordHash) {
- return DetachedCriteria.forClass(Utilisateur.class).add(Restrictions.eq("courriel", courriel))
- .add(Restrictions.eq("passwordHash", passwordHash)).add(Restrictions.eq("estValide", Boolean.TRUE));
- }
+ /**
+ * Liste l'utilisateur qui a le courriel et le password donné et qui est un utilisateur validé
+ * @param courriel Le courriel recherché
+ * @param passwordHash Le password recherché
+ * @return Le criteria
+ **/
+ public static DetachedCriteria getCriteriaAuthenticateUser(String courriel, String passwordHash) {
+ return DetachedCriteria.forClass(Utilisateur.class).add(Restrictions.eq("courriel", courriel))
+ .add(Restrictions.eq("passwordHash", passwordHash)).add(Restrictions.eq("estValide", Boolean.TRUE));
+ }
- /**
- * Constructor (empêche l'instantiation)
- */
- private PersonneDao() {
- //
- }
+ /**
+ * Constructor (empêche l'instantiation)
+ */
+ private PersonneDao() {
+ //
+ }
}
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/dao/impl/ProduitDao.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/dao/impl/ProduitDao.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/dao/impl/ProduitDao.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -33,31 +33,31 @@
/** DAO : produit */
public final class ProduitDao extends AbstractModelDao {
- /**
- * Constructor (empêche l'instantiation)
- */
- private ProduitDao() {
- //
- }
+ /**
+ * Constructor (empêche l'instantiation)
+ */
+ private ProduitDao() {
+ //
+ }
- /**
- * Rend le criteria qui rend le nombre de purifications qui référencent un produit
- * @param refProduit La référence du produit
- * @return Le criteria
- **/
- public static DetachedCriteria getCriteriaCountPurifFromProduit(String refProduit) {
- return DetachedCriteria.forClass(Purification.class).createAlias("produit", "prod").add(
- Restrictions.eq("prod.ref", refProduit)).setProjection(Projections.rowCount());
- }
+ /**
+ * Rend le criteria qui rend le nombre de purifications qui référencent un produit
+ * @param refProduit La référence du produit
+ * @return Le criteria
+ **/
+ public static DetachedCriteria getCriteriaCountPurifFromProduit(String refProduit) {
+ return DetachedCriteria.forClass(Purification.class).createAlias("produit", "prod").add(
+ Restrictions.eq("prod.ref", refProduit)).setProjection(Projections.rowCount());
+ }
- /**
- * Rend le criteria qui rend le nombre de tests biologiques qui référencent un produit
- * @param refProduit La référence du produit
- * @return Le criteria
- **/
- public static DetachedCriteria getCriteriaCountTestBioFromProduit(String refProduit) {
- return DetachedCriteria.forClass(ResultatTestBio.class).createAlias("produit", "prod").add(
- Restrictions.eq("prod.ref", refProduit)).setProjection(Projections.rowCount());
- }
+ /**
+ * Rend le criteria qui rend le nombre de tests biologiques qui référencent un produit
+ * @param refProduit La référence du produit
+ * @return Le criteria
+ **/
+ public static DetachedCriteria getCriteriaCountTestBioFromProduit(String refProduit) {
+ return DetachedCriteria.forClass(ResultatTestBio.class).createAlias("produit", "prod").add(
+ Restrictions.eq("prod.ref", refProduit)).setProjection(Projections.rowCount());
+ }
}
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/dao/impl/PurificationDao.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/dao/impl/PurificationDao.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/dao/impl/PurificationDao.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -28,18 +28,18 @@
*/
public class PurificationDao {
- /**
- * Rend la requête HQL qui compte les purifications qui référencent un paramètre de méthode. Prend en paramètre l'id
- * du paramètre de la méthode.
- **/
- public final static String COUNT_PURIF_WITH_PARAM_METHO = "select count(purif) from Purification purif inner join purif.paramsMetho paramsEff "
- + "where paramsEff.id.pk2.idParamMethoPuri = ?";
+ /**
+ * Rend la requête HQL qui compte les purifications qui référencent un paramètre de méthode. Prend en paramètre l'id
+ * du paramètre de la méthode.
+ **/
+ public final static String COUNT_PURIF_WITH_PARAM_METHO = "select count(purif) from Purification purif inner join purif.paramsMetho paramsEff "
+ + "where paramsEff.id.pk2.idParamMethoPuri = ?";
- /**
- * Constructor (empêche l'instantiation)
- */
- private PurificationDao() {
- //
- }
+ /**
+ * Constructor (empêche l'instantiation)
+ */
+ private PurificationDao() {
+ //
+ }
}
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/dao/impl/SpecimenDao.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/dao/impl/SpecimenDao.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/dao/impl/SpecimenDao.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -35,43 +35,43 @@
*/
public class SpecimenDao extends AbstractModelDao {
- /** Criteria : valeurs existantes du champ 'embranchement' existants pour les spécimens existants */
- public static final DetachedCriteria CRITERIA_DISTINCT_SPECIMEN_EMBRANCHEMENTS = DetachedCriteria
- .forClass(Specimen.class).setProjection(Projections.distinct(Projections.property("embranchement")))
- .addOrder(Order.asc("embranchement"));
+ /** Criteria : valeurs existantes du champ 'embranchement' existants pour les spécimens existants */
+ public static final DetachedCriteria CRITERIA_DISTINCT_SPECIMEN_EMBRANCHEMENTS = DetachedCriteria
+ .forClass(Specimen.class).setProjection(Projections.distinct(Projections.property("embranchement")))
+ .addOrder(Order.asc("embranchement"));
- /** Criteria : valeurs existantes du champ 'famille' existants pour les spécimens existants */
- public static final DetachedCriteria CRITERIA_DISTINCT_SPECIMEN_FAMILLES = DetachedCriteria
- .forClass(Specimen.class).setProjection(Projections.distinct(Projections.property("famille")))
- .addOrder(Order.asc("famille"));
+ /** Criteria : valeurs existantes du champ 'famille' existants pour les spécimens existants */
+ public static final DetachedCriteria CRITERIA_DISTINCT_SPECIMEN_FAMILLES = DetachedCriteria
+ .forClass(Specimen.class).setProjection(Projections.distinct(Projections.property("famille")))
+ .addOrder(Order.asc("famille"));
- /** Criteria : valeurs existantes du champ 'genre' existants pour les spécimens existants */
- public static final DetachedCriteria CRITERIA_DISTINCT_SPECIMEN_GENRES = DetachedCriteria.forClass(Specimen.class)
- .setProjection(Projections.distinct(Projections.property("genre"))).addOrder(Order.asc("genre"));
+ /** Criteria : valeurs existantes du champ 'genre' existants pour les spécimens existants */
+ public static final DetachedCriteria CRITERIA_DISTINCT_SPECIMEN_GENRES = DetachedCriteria.forClass(Specimen.class)
+ .setProjection(Projections.distinct(Projections.property("genre"))).addOrder(Order.asc("genre"));
- /** Criteria : valeurs existantes du champ 'espece' existants pour les spécimens existants */
- public static final DetachedCriteria CRITERIA_DISTINCT_SPECIMEN_ESPECES = DetachedCriteria.forClass(Specimen.class)
- .setProjection(Projections.distinct(Projections.property("espece"))).addOrder(Order.asc("espece"));
+ /** Criteria : valeurs existantes du champ 'espece' existants pour les spécimens existants */
+ public static final DetachedCriteria CRITERIA_DISTINCT_SPECIMEN_ESPECES = DetachedCriteria.forClass(Specimen.class)
+ .setProjection(Projections.distinct(Projections.property("espece"))).addOrder(Order.asc("espece"));
- /** Criteria : valeurs existantes du champ 'sousEspece' existants pour les spécimens existants */
- public static final DetachedCriteria CRITERIA_DISTINCT_SPECIMEN_SOUSESPECES = DetachedCriteria
- .forClass(Specimen.class).setProjection(Projections.distinct(Projections.property("sousEspece")))
- .addOrder(Order.asc("sousEspece"));
+ /** Criteria : valeurs existantes du champ 'sousEspece' existants pour les spécimens existants */
+ public static final DetachedCriteria CRITERIA_DISTINCT_SPECIMEN_SOUSESPECES = DetachedCriteria
+ .forClass(Specimen.class).setProjection(Projections.distinct(Projections.property("sousEspece")))
+ .addOrder(Order.asc("sousEspece"));
- /** Criteria : valeurs existantes du champ 'variete' existants pour les spécimens existants */
- public static final DetachedCriteria CRITERIA_DISTINCT_SPECIMEN_VARIETES = DetachedCriteria
- .forClass(Specimen.class).setProjection(Projections.distinct(Projections.property("variete")))
- .addOrder(Order.asc("variete"));
+ /** Criteria : valeurs existantes du champ 'variete' existants pour les spécimens existants */
+ public static final DetachedCriteria CRITERIA_DISTINCT_SPECIMEN_VARIETES = DetachedCriteria
+ .forClass(Specimen.class).setProjection(Projections.distinct(Projections.property("variete")))
+ .addOrder(Order.asc("variete"));
- /** Criteria : valeurs existantes du champ 'variete' existants pour les spécimens existants */
- public static final DetachedCriteria CRITERIA_DISTINCT_LIEUX_DEPOT = DetachedCriteria.forClass(Specimen.class)
- .setProjection(Projections.distinct(Projections.property("lieuDepot"))).addOrder(Order.asc("lieuDepot"));
+ /** Criteria : valeurs existantes du champ 'variete' existants pour les spécimens existants */
+ public static final DetachedCriteria CRITERIA_DISTINCT_LIEUX_DEPOT = DetachedCriteria.forClass(Specimen.class)
+ .setProjection(Projections.distinct(Projections.property("lieuDepot"))).addOrder(Order.asc("lieuDepot"));
- /**
- * Constructeur (empêche l'instantiation)
- */
- private SpecimenDao() {
- //
- }
+ /**
+ * Constructeur (empêche l'instantiation)
+ */
+ private SpecimenDao() {
+ //
+ }
}
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/dao/impl/StationDao.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/dao/impl/StationDao.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/dao/impl/StationDao.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -36,14 +36,14 @@
*/
public final class StationDao extends AbstractModelDao {
- /** Criteria : différentes localités des stations déjà saisies */
- public static final DetachedCriteria CRITERIA_DISTINCT_STATION_LOCALITES = DetachedCriteria.forClass(Station.class)
- .setProjection(Projections.distinct(Projections.property("localite"))).addOrder(Order.asc("localite"));
+ /** Criteria : différentes localités des stations déjà saisies */
+ public static final DetachedCriteria CRITERIA_DISTINCT_STATION_LOCALITES = DetachedCriteria.forClass(Station.class)
+ .setProjection(Projections.distinct(Projections.property("localite"))).addOrder(Order.asc("localite"));
- /**
- * Constructeur (empêche l'instantiation)
- */
- private StationDao() {
- //
- }
+ /**
+ * Constructeur (empêche l'instantiation)
+ */
+ private StationDao() {
+ //
+ }
}
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/dao/impl/TestBioDao.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/dao/impl/TestBioDao.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/dao/impl/TestBioDao.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -38,40 +38,40 @@
*/
public class TestBioDao {
- /**
- * Criteria : liste les résultats de tests bio qui sont de type "produit". L'ensemble est trié par (cible, produit,
- * id)
- */
- public static final DetachedCriteria CRITERIA_LIST_RESULTATS_TYPE_PRODUIT = DetachedCriteria
- .forClass(ResultatTestBio.class, "r").add(Restrictions.eq("r.typeResultat", TypeResultat.PRODUIT))
- .createCriteria("testBio", "t").createCriteria("t.methode", "m").addOrder(Order.asc("m.cible"))
- .createCriteria("r.produit", "p").addOrder(Order.asc("p.ref")).addOrder(Order.asc("r.id"));
+ /**
+ * Criteria : liste les résultats de tests bio qui sont de type "produit". L'ensemble est trié par (cible, produit,
+ * id)
+ */
+ public static final DetachedCriteria CRITERIA_LIST_RESULTATS_TYPE_PRODUIT = DetachedCriteria
+ .forClass(ResultatTestBio.class, "r").add(Restrictions.eq("r.typeResultat", TypeResultat.PRODUIT))
+ .createCriteria("testBio", "t").createCriteria("t.methode", "m").addOrder(Order.asc("m.cible"))
+ .createCriteria("r.produit", "p").addOrder(Order.asc("p.ref")).addOrder(Order.asc("r.id"));
- /** Criteria : compte les résultats de tests bio qui sont de type "produit" */
- public static final DetachedCriteria CRITERIA_COUNT_RESULTATS_TYPE_PRODUIT = DetachedCriteria
- .forClass(ResultatTestBio.class).add(Restrictions.eq("typeResultat", TypeResultat.PRODUIT))
- .setProjection(Projections.rowCount());
+ /** Criteria : compte les résultats de tests bio qui sont de type "produit" */
+ public static final DetachedCriteria CRITERIA_COUNT_RESULTATS_TYPE_PRODUIT = DetachedCriteria
+ .forClass(ResultatTestBio.class).add(Restrictions.eq("typeResultat", TypeResultat.PRODUIT))
+ .setProjection(Projections.rowCount());
- /** Criteria : valeurs existantes du champ 'domaines' existants pour les méthodes de tests biologiques */
- public static final DetachedCriteria CRITERIA_DISTINCT_DOMAINES_METHODES = DetachedCriteria
- .forClass(MethodeTestBio.class).setProjection(Projections.distinct(Projections.property("domaine")))
- .addOrder(Order.asc("domaine"));
+ /** Criteria : valeurs existantes du champ 'domaines' existants pour les méthodes de tests biologiques */
+ public static final DetachedCriteria CRITERIA_DISTINCT_DOMAINES_METHODES = DetachedCriteria
+ .forClass(MethodeTestBio.class).setProjection(Projections.distinct(Projections.property("domaine")))
+ .addOrder(Order.asc("domaine"));
- /** Criteria : valeurs existantes du champ 'uniteResultat' existants pour les méthodes de tests biologiques */
- public static final DetachedCriteria CRITERIA_DISTINCT_UNITES_RESULTAT_METHODES = DetachedCriteria
- .forClass(MethodeTestBio.class).setProjection(Projections.distinct(Projections.property("uniteResultat")))
- .addOrder(Order.asc("uniteResultat"));
+ /** Criteria : valeurs existantes du champ 'uniteResultat' existants pour les méthodes de tests biologiques */
+ public static final DetachedCriteria CRITERIA_DISTINCT_UNITES_RESULTAT_METHODES = DetachedCriteria
+ .forClass(MethodeTestBio.class).setProjection(Projections.distinct(Projections.property("uniteResultat")))
+ .addOrder(Order.asc("uniteResultat"));
- /** Criteria : valeurs existantes du champ 'uniteResultat' existants pour les méthodes de tests biologiques */
- public static final DetachedCriteria CRITERIA_DISTINCT_PRODUITS_TEMOINS = DetachedCriteria
- .forClass(ResultatTestBio.class).setProjection(Projections.distinct(Projections.property("produitTemoin")))
- .addOrder(Order.asc("produitTemoin"));
+ /** Criteria : valeurs existantes du champ 'uniteResultat' existants pour les méthodes de tests biologiques */
+ public static final DetachedCriteria CRITERIA_DISTINCT_PRODUITS_TEMOINS = DetachedCriteria
+ .forClass(ResultatTestBio.class).setProjection(Projections.distinct(Projections.property("produitTemoin")))
+ .addOrder(Order.asc("produitTemoin"));
- /**
- * Constructor (empêche l'instantiation)
- */
- private TestBioDao() {
- //
- }
+ /**
+ * Constructor (empêche l'instantiation)
+ */
+ private TestBioDao() {
+ //
+ }
}
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/dao/utils/GenericDaoAspect.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/dao/utils/GenericDaoAspect.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/dao/utils/GenericDaoAspect.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -46,23 +46,23 @@
@Component
public final class GenericDaoAspect {
- /**
- * Convert a DataIntegrityViolationException into a DataConstraintException
- * @param e DataIntegrityViolationException
- * @throws DataConstraintException In any case
- */
- @AfterThrowing(pointcut = "execution(* nc.ird.cantharella.data.dao.GenericDao.*(..))", throwing = "e")
- public void afterThrowing(DataIntegrityViolationException e) throws DataConstraintException {
- throw new DataConstraintException(e);
- }
+ /**
+ * Convert a DataIntegrityViolationException into a DataConstraintException
+ * @param e DataIntegrityViolationException
+ * @throws DataConstraintException In any case
+ */
+ @AfterThrowing(pointcut = "execution(* nc.ird.cantharella.data.dao.GenericDao.*(..))", throwing = "e")
+ public void afterThrowing(DataIntegrityViolationException e) throws DataConstraintException {
+ throw new DataConstraintException(e);
+ }
- /**
- * Convert a DataRetrievalFailureException into a DataNotFoundException
- * @param e DataRetrievalFailureException
- * @throws DataNotFoundException In any case
- */
- @AfterThrowing(pointcut = "execution(* nc.ird.cantharella.data.dao.GenericDao.*(..))", throwing = "e")
- public void afterThrowing(DataRetrievalFailureException e) throws DataNotFoundException {
- throw new DataNotFoundException(e);
- }
+ /**
+ * Convert a DataRetrievalFailureException into a DataNotFoundException
+ * @param e DataRetrievalFailureException
+ * @throws DataNotFoundException In any case
+ */
+ @AfterThrowing(pointcut = "execution(* nc.ird.cantharella.data.dao.GenericDao.*(..))", throwing = "e")
+ public void afterThrowing(DataRetrievalFailureException e) throws DataNotFoundException {
+ throw new DataNotFoundException(e);
+ }
}
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/exceptions/AbstractException.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/exceptions/AbstractException.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/exceptions/AbstractException.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -29,35 +29,35 @@
*/
public abstract class AbstractException extends Exception {
- /**
- * Constructor
- */
- protected AbstractException() {
- //
- }
+ /**
+ * Constructor
+ */
+ protected AbstractException() {
+ //
+ }
- /**
- * Constructor
- * @param cause Cause
- */
- protected AbstractException(Exception cause) {
- super(cause.getMessage(), cause);
- }
+ /**
+ * Constructor
+ * @param cause Cause
+ */
+ protected AbstractException(Exception cause) {
+ super(cause.getMessage(), cause);
+ }
- /**
- * Constructor
- * @param message Message
- */
- protected AbstractException(String message) {
- super(message);
- }
+ /**
+ * Constructor
+ * @param message Message
+ */
+ protected AbstractException(String message) {
+ super(message);
+ }
- /**
- * Constructor
- * @param message Message
- * @param cause Cause
- */
- protected AbstractException(String message, Exception cause) {
- super(message, cause);
- }
+ /**
+ * Constructor
+ * @param message Message
+ * @param cause Cause
+ */
+ protected AbstractException(String message, Exception cause) {
+ super(message, cause);
+ }
}
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/exceptions/DataConstraintException.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/exceptions/DataConstraintException.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/exceptions/DataConstraintException.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -31,18 +31,18 @@
*/
public class DataConstraintException extends AbstractException {
- /**
- * Constructor
- */
- public DataConstraintException() {
- //
- }
+ /**
+ * Constructor
+ */
+ public DataConstraintException() {
+ //
+ }
- /**
- * Constructor
- * @param cause Cause
- */
- public DataConstraintException(DataIntegrityViolationException cause) {
- super(cause);
- }
+ /**
+ * Constructor
+ * @param cause Cause
+ */
+ public DataConstraintException(DataIntegrityViolationException cause) {
+ super(cause);
+ }
}
\ No newline at end of file
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/exceptions/DataNotFoundException.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/exceptions/DataNotFoundException.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/exceptions/DataNotFoundException.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -31,11 +31,11 @@
*/
public final class DataNotFoundException extends AbstractException {
- /**
- * Constructor
- * @param cause Cause
- */
- public DataNotFoundException(DataRetrievalFailureException cause) {
- super(cause);
- }
+ /**
+ * Constructor
+ * @param cause Cause
+ */
+ public DataNotFoundException(DataRetrievalFailureException cause) {
+ super(cause);
+ }
}
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/exceptions/UnexpectedException.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/exceptions/UnexpectedException.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/exceptions/UnexpectedException.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -29,12 +29,12 @@
*/
public final class UnexpectedException extends RuntimeException {
- /**
- * Constructor
- * @param cause Cause
- */
- public UnexpectedException(Exception cause) {
- super(cause.getMessage(), cause);
- }
+ /**
+ * Constructor
+ * @param cause Cause
+ */
+ public UnexpectedException(Exception cause) {
+ super(cause.getMessage(), cause);
+ }
}
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Campagne.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Campagne.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Campagne.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -66,335 +66,335 @@
@Embeddable
public class Campagne extends AbstractModel implements Comparable<Campagne> {
- /** ID */
- @Id
- @GeneratedValue
- private Integer idCampagne;
+ /** ID */
+ @Id
+ @GeneratedValue
+ private Integer idCampagne;
- /** Nom */
- @Column(unique = true)
- @NotNull
- @NotEmpty
- @Length(max = LENGTH_MEDIUM_TEXT)
- @Field(index=Index.YES, analyze=Analyze.YES, store=Store.YES)
- private String nom;
+ /** Nom */
+ @Column(unique = true)
+ @NotNull
+ @NotEmpty
+ @Length(max = LENGTH_MEDIUM_TEXT)
+ @Field(index=Index.YES, analyze=Analyze.YES, store=Store.YES)
+ private String nom;
- /** Code pays */
- @NotNull
- @CountryCode
- @Length(min = 2, max = 2)
- private String codePays;
+ /** Code pays */
+ @NotNull
+ @CountryCode
+ @Length(min = 2, max = 2)
+ private String codePays;
- /** Programme */
- @Length(max = LENGTH_MEDIUM_TEXT)
- private String programme;
+ /** Programme */
+ @Length(max = LENGTH_MEDIUM_TEXT)
+ private String programme;
- /** Mention légale décrivant les droits sur les données */
- @Lob
- @Type(type="org.hibernate.type.StringClobType") // see HHH-6105
- private String mentionLegale;
+ /** Mention légale décrivant les droits sur les données */
+ @Lob
+ @Type(type="org.hibernate.type.StringClobType") // see HHH-6105
+ private String mentionLegale;
- /** Complément */
- @Lob
- @Type(type="org.hibernate.type.StringClobType") // see HHH-6105
- private String complement;
+ /** Complément */
+ @Lob
+ @Type(type="org.hibernate.type.StringClobType") // see HHH-6105
+ private String complement;
- /** Date début */
- @NotNull
- @Temporal(TemporalType.DATE)
- private Date dateDeb;
+ /** Date début */
+ @NotNull
+ @Temporal(TemporalType.DATE)
+ private Date dateDeb;
- /** Date fin */
- @NotNull
- @Temporal(TemporalType.DATE)
- private Date dateFin;
+ /** Date fin */
+ @NotNull
+ @Temporal(TemporalType.DATE)
+ private Date dateFin;
- /** Droits groupes */
- @NotNull
- @OneToMany(mappedBy = "id.pk1", fetch = FetchType.LAZY)
- private List<CampagneGroupeDroits> groupesDroits;
+ /** Droits groupes */
+ @NotNull
+ @OneToMany(mappedBy = "id.pk1", fetch = FetchType.LAZY)
+ private List<CampagneGroupeDroits> groupesDroits;
- /** Lots */
- @NotNull
- @OneToMany(mappedBy = "campagne", fetch = FetchType.LAZY)
- private List<Lot> lots;
+ /** Lots */
+ @NotNull
+ @OneToMany(mappedBy = "campagne", fetch = FetchType.LAZY)
+ private List<Lot> lots;
- /** Créateur */
- @NotNull
- @ManyToOne(fetch = FetchType.LAZY, optional = false)
- private Personne createur;
+ /** Créateur */
+ @NotNull
+ @ManyToOne(fetch = FetchType.LAZY, optional = false)
+ private Personne createur;
- /** Participants */
- @NotNull
- @OneToMany(mappedBy = "id.pk1", fetch = FetchType.LAZY, orphanRemoval = true)
- @Cascade({ CascadeType.SAVE_UPDATE })
- private List<CampagnePersonneParticipant> participants;
+ /** Participants */
+ @NotNull
+ @OneToMany(mappedBy = "id.pk1", fetch = FetchType.LAZY, orphanRemoval = true)
+ @Cascade({ CascadeType.SAVE_UPDATE })
+ private List<CampagnePersonneParticipant> participants;
- /** Droits personnes */
- @NotNull
- @OneToMany(mappedBy = "id.pk1", fetch = FetchType.LAZY)
- private List<CampagnePersonneDroits> personnesDroits;
+ /** Droits personnes */
+ @NotNull
+ @OneToMany(mappedBy = "id.pk1", fetch = FetchType.LAZY)
+ private List<CampagnePersonneDroits> personnesDroits;
- /** Stations prospectées **/
- @NotNull
- @ManyToMany(fetch = FetchType.LAZY)
- @Cascade({ CascadeType.SAVE_UPDATE })
- private List<Station> stations;
+ /** Stations prospectées **/
+ @NotNull
+ @ManyToMany(fetch = FetchType.LAZY)
+ @Cascade({ CascadeType.SAVE_UPDATE })
+ private List<Station> stations;
- /**
- * Constructor
- */
- public Campagne() {
- lots = new ArrayList<Lot>();
- participants = new ArrayList<CampagnePersonneParticipant>();
- stations = new ArrayList<Station>();
- personnesDroits = new ArrayList<CampagnePersonneDroits>();
- groupesDroits = new ArrayList<CampagneGroupeDroits>();
- }
+ /**
+ * Constructor
+ */
+ public Campagne() {
+ lots = new ArrayList<Lot>();
+ participants = new ArrayList<CampagnePersonneParticipant>();
+ stations = new ArrayList<Station>();
+ personnesDroits = new ArrayList<CampagnePersonneDroits>();
+ groupesDroits = new ArrayList<CampagneGroupeDroits>();
+ }
- /** {@inheritDoc} */
- @Override
- public String toString() {
- return nom;
- }
+ /** {@inheritDoc} */
+ @Override
+ public String toString() {
+ return nom;
+ }
- /** {@inheritDoc} */
- @Override
- public int compareTo(Campagne campagne) {
- return new BeanComparator("nom").compare(this, campagne);
- }
+ /** {@inheritDoc} */
+ @Override
+ public int compareTo(Campagne campagne) {
+ return new BeanComparator("nom").compare(this, campagne);
+ }
- /**
- * Rend les stations triées par noms
- * @return Les stations triées
- */
- public List<Station> getSortedStations() {
- Collections.sort(stations);
- return stations;
- }
+ /**
+ * Rend les stations triées par noms
+ * @return Les stations triées
+ */
+ public List<Station> getSortedStations() {
+ Collections.sort(stations);
+ return stations;
+ }
- /**
- * idCampagne getter
- * @return idCampagne
- */
- public Integer getIdCampagne() {
- return idCampagne;
- }
+ /**
+ * idCampagne getter
+ * @return idCampagne
+ */
+ public Integer getIdCampagne() {
+ return idCampagne;
+ }
- /**
- * idCampagne setter
- * @param idCampagne idCampagne
- */
- public void setIdCampagne(Integer idCampagne) {
- this.idCampagne = idCampagne;
- }
+ /**
+ * idCampagne setter
+ * @param idCampagne idCampagne
+ */
+ public void setIdCampagne(Integer idCampagne) {
+ this.idCampagne = idCampagne;
+ }
- /**
- * nom getter
- * @return nom
- */
- public String getNom() {
- return nom;
- }
+ /**
+ * nom getter
+ * @return nom
+ */
+ public String getNom() {
+ return nom;
+ }
- /**
- * nom setter
- * @param nom nom
- */
- public void setNom(String nom) {
- this.nom = nom;
- }
+ /**
+ * nom setter
+ * @param nom nom
+ */
+ public void setNom(String nom) {
+ this.nom = nom;
+ }
- /**
- * codePays getter
- * @return codePays
- */
- public String getCodePays() {
- return codePays;
- }
+ /**
+ * codePays getter
+ * @return codePays
+ */
+ public String getCodePays() {
+ return codePays;
+ }
- /**
- * codePays setter
- * @param codePays codePays
- */
- public void setCodePays(String codePays) {
- this.codePays = codePays;
- }
+ /**
+ * codePays setter
+ * @param codePays codePays
+ */
+ public void setCodePays(String codePays) {
+ this.codePays = codePays;
+ }
- /**
- * programme getter
- * @return programme
- */
- public String getProgramme() {
- return programme;
- }
+ /**
+ * programme getter
+ * @return programme
+ */
+ public String getProgramme() {
+ return programme;
+ }
- /**
- * programme setter
- * @param programme programme
- */
- public void setProgramme(String programme) {
- this.programme = programme;
- }
+ /**
+ * programme setter
+ * @param programme programme
+ */
+ public void setProgramme(String programme) {
+ this.programme = programme;
+ }
- /**
- * mentionLegale getter
- * @return mentionLegale
- */
- public String getMentionLegale() {
- return mentionLegale;
- }
+ /**
+ * mentionLegale getter
+ * @return mentionLegale
+ */
+ public String getMentionLegale() {
+ return mentionLegale;
+ }
- /**
- * mentionLegale setter
- * @param mentionLegale mentionLegale
- */
- public void setMentionLegale(String mentionLegale) {
- this.mentionLegale = mentionLegale;
- }
+ /**
+ * mentionLegale setter
+ * @param mentionLegale mentionLegale
+ */
+ public void setMentionLegale(String mentionLegale) {
+ this.mentionLegale = mentionLegale;
+ }
- /**
- * complement getter
- * @return complement
- */
- public String getComplement() {
- return complement;
- }
+ /**
+ * complement getter
+ * @return complement
+ */
+ public String getComplement() {
+ return complement;
+ }
- /**
- * complement setter
- * @param complement complement
- */
- public void setComplement(String complement) {
- this.complement = complement;
- }
+ /**
+ * complement setter
+ * @param complement complement
+ */
+ public void setComplement(String complement) {
+ this.complement = complement;
+ }
- /**
- * dateDeb getter
- * @return dateDeb
- */
- public Date getDateDeb() {
- return dateDeb;
- }
+ /**
+ * dateDeb getter
+ * @return dateDeb
+ */
+ public Date getDateDeb() {
+ return dateDeb;
+ }
- /**
- * dateDeb setter
- * @param dateDeb dateDeb
- */
- public void setDateDeb(Date dateDeb) {
- this.dateDeb = dateDeb;
- }
+ /**
+ * dateDeb setter
+ * @param dateDeb dateDeb
+ */
+ public void setDateDeb(Date dateDeb) {
+ this.dateDeb = dateDeb;
+ }
- /**
- * dateFin getter
- * @return dateFin
- */
- public Date getDateFin() {
- return dateFin;
- }
+ /**
+ * dateFin getter
+ * @return dateFin
+ */
+ public Date getDateFin() {
+ return dateFin;
+ }
- /**
- * dateFin setter
- * @param dateFin dateFin
- */
- public void setDateFin(Date dateFin) {
- this.dateFin = dateFin;
- }
+ /**
+ * dateFin setter
+ * @param dateFin dateFin
+ */
+ public void setDateFin(Date dateFin) {
+ this.dateFin = dateFin;
+ }
- /**
- * groupesDroits getter
- * @return groupesDroits
- */
- public List<CampagneGroupeDroits> getGroupesDroits() {
- return groupesDroits;
- }
+ /**
+ * groupesDroits getter
+ * @return groupesDroits
+ */
+ public List<CampagneGroupeDroits> getGroupesDroits() {
+ return groupesDroits;
+ }
- /**
- * groupesDroits setter
- * @param groupesDroits groupesDroits
- */
- public void setGroupesDroits(List<CampagneGroupeDroits> groupesDroits) {
- this.groupesDroits = groupesDroits;
- }
+ /**
+ * groupesDroits setter
+ * @param groupesDroits groupesDroits
+ */
+ public void setGroupesDroits(List<CampagneGroupeDroits> groupesDroits) {
+ this.groupesDroits = groupesDroits;
+ }
- /**
- * lots getter
- * @return lots
- */
- public List<Lot> getLots() {
- return lots;
- }
+ /**
+ * lots getter
+ * @return lots
+ */
+ public List<Lot> getLots() {
+ return lots;
+ }
- /**
- * lots setter
- * @param lots lots
- */
- public void setLots(List<Lot> lots) {
- this.lots = lots;
- }
+ /**
+ * lots setter
+ * @param lots lots
+ */
+ public void setLots(List<Lot> lots) {
+ this.lots = lots;
+ }
- /**
- * createur getter
- * @return createur
- */
- public Personne getCreateur() {
- return createur;
- }
+ /**
+ * createur getter
+ * @return createur
+ */
+ public Personne getCreateur() {
+ return createur;
+ }
- /**
- * createur setter
- * @param createur createur
- */
- public void setCreateur(Personne createur) {
- this.createur = createur;
- }
+ /**
+ * createur setter
+ * @param createur createur
+ */
+ public void setCreateur(Personne createur) {
+ this.createur = createur;
+ }
- /**
- * participants getter
- * @return participants
- */
- public List<CampagnePersonneParticipant> getParticipants() {
- return participants;
- }
+ /**
+ * participants getter
+ * @return participants
+ */
+ public List<CampagnePersonneParticipant> getParticipants() {
+ return participants;
+ }
- /**
- * participants setter
- * @param participants participants
- */
- public void setParticipants(List<CampagnePersonneParticipant> participants) {
- this.participants = participants;
- }
+ /**
+ * participants setter
+ * @param participants participants
+ */
+ public void setParticipants(List<CampagnePersonneParticipant> participants) {
+ this.participants = participants;
+ }
- /**
- * personnesDroits getter
- * @return personnesDroits
- */
- public List<CampagnePersonneDroits> getPersonnesDroits() {
- return personnesDroits;
- }
+ /**
+ * personnesDroits getter
+ * @return personnesDroits
+ */
+ public List<CampagnePersonneDroits> getPersonnesDroits() {
+ return personnesDroits;
+ }
- /**
- * personnesDroits setter
- * @param personnesDroits personnesDroits
- */
- public void setPersonnesDroits(List<CampagnePersonneDroits> personnesDroits) {
- this.personnesDroits = personnesDroits;
- }
+ /**
+ * personnesDroits setter
+ * @param personnesDroits personnesDroits
+ */
+ public void setPersonnesDroits(List<CampagnePersonneDroits> personnesDroits) {
+ this.personnesDroits = personnesDroits;
+ }
- /**
- * stations getter
- * @return stations
- */
- public List<Station> getStations() {
- return stations;
- }
+ /**
+ * stations getter
+ * @return stations
+ */
+ public List<Station> getStations() {
+ return stations;
+ }
- /**
- * stations setter
- * @param stations stations
- */
- public void setStations(List<Station> stations) {
- this.stations = stations;
- }
+ /**
+ * stations setter
+ * @param stations stations
+ */
+ public void setStations(List<Station> stations) {
+ this.stations = stations;
+ }
}
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/CampagneGroupeDroits.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/CampagneGroupeDroits.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/CampagneGroupeDroits.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -39,53 +39,53 @@
@Table
public class CampagneGroupeDroits extends AbstractModel {
- /** Droits */
- @NotNull
- private Droits droits;
+ /** Droits */
+ @NotNull
+ private Droits droits;
- /** ID */
- @EmbeddedId
- @NotNull
- private CompositeId<Campagne, Groupe> id;
+ /** ID */
+ @EmbeddedId
+ @NotNull
+ private CompositeId<Campagne, Groupe> id;
- /**
- * Constructeur
- */
- public CampagneGroupeDroits() {
- droits = new Droits();
- id = new CompositeId<Campagne, Groupe>();
- }
+ /**
+ * Constructeur
+ */
+ public CampagneGroupeDroits() {
+ droits = new Droits();
+ id = new CompositeId<Campagne, Groupe>();
+ }
- /**
- * droits getter
- * @return droits
- */
- public Droits getDroits() {
- return droits;
- }
+ /**
+ * droits getter
+ * @return droits
+ */
+ public Droits getDroits() {
+ return droits;
+ }
- /**
- * droits setter
- * @param droits droits
- */
- public void setDroits(Droits droits) {
- this.droits = droits;
- }
+ /**
+ * droits setter
+ * @param droits droits
+ */
+ public void setDroits(Droits droits) {
+ this.droits = droits;
+ }
- /**
- * id getter
- * @return id
- */
- public CompositeId<Campagne, Groupe> getId() {
- return id;
- }
+ /**
+ * id getter
+ * @return id
+ */
+ public CompositeId<Campagne, Groupe> getId() {
+ return id;
+ }
- /**
- * id setter
- * @param id id
- */
- public void setId(CompositeId<Campagne, Groupe> id) {
- this.id = id;
- }
+ /**
+ * id setter
+ * @param id id
+ */
+ public void setId(CompositeId<Campagne, Groupe> id) {
+ this.id = id;
+ }
}
\ No newline at end of file
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/CampagnePersonneDroits.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/CampagnePersonneDroits.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/CampagnePersonneDroits.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -38,62 +38,62 @@
@Table
public class CampagnePersonneDroits extends AbstractModel {
- /** Droits */
- @NotNull
- private Droits droits;
+ /** Droits */
+ @NotNull
+ private Droits droits;
- /** ID */
- @EmbeddedId
- @NotNull
- private CompositeId<Campagne, Personne> id;
+ /** ID */
+ @EmbeddedId
+ @NotNull
+ private CompositeId<Campagne, Personne> id;
- /**
- * Constructeur
- */
- public CampagnePersonneDroits() {
- droits = new Droits();
- id = new CompositeId<Campagne, Personne>();
- }
+ /**
+ * Constructeur
+ */
+ public CampagnePersonneDroits() {
+ droits = new Droits();
+ id = new CompositeId<Campagne, Personne>();
+ }
- /** {@inheritDoc} */
- @Override
- public CampagnePersonneDroits clone() throws CloneNotSupportedException {
- CampagnePersonneDroits clone = new CampagnePersonneDroits();
- clone.id = id.clone();
- clone.droits = droits.clone();
- return clone;
- }
+ /** {@inheritDoc} */
+ @Override
+ public CampagnePersonneDroits clone() throws CloneNotSupportedException {
+ CampagnePersonneDroits clone = new CampagnePersonneDroits();
+ clone.id = id.clone();
+ clone.droits = droits.clone();
+ return clone;
+ }
- /**
- * droits getter
- * @return droits
- */
- public Droits getDroits() {
- return droits;
- }
+ /**
+ * droits getter
+ * @return droits
+ */
+ public Droits getDroits() {
+ return droits;
+ }
- /**
- * droits setter
- * @param droits droits
- */
- public void setDroits(Droits droits) {
- this.droits = droits;
- }
+ /**
+ * droits setter
+ * @param droits droits
+ */
+ public void setDroits(Droits droits) {
+ this.droits = droits;
+ }
- /**
- * id getter
- * @return id
- */
- public CompositeId<Campagne, Personne> getId() {
- return id;
- }
+ /**
+ * id getter
+ * @return id
+ */
+ public CompositeId<Campagne, Personne> getId() {
+ return id;
+ }
- /**
- * id setter
- * @param id id
- */
- public void setId(CompositeId<Campagne, Personne> id) {
- this.id = id;
- }
+ /**
+ * id setter
+ * @param id id
+ */
+ public void setId(CompositeId<Campagne, Personne> id) {
+ this.id = id;
+ }
}
\ No newline at end of file
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/CampagnePersonneParticipant.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/CampagnePersonneParticipant.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/CampagnePersonneParticipant.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -41,61 +41,61 @@
@Table
public class CampagnePersonneParticipant extends AbstractModel implements Cloneable {
- /** Complément */
- @Lob
- @Type(type="org.hibernate.type.StringClobType") // see HHH-6105
- private String complement;
+ /** Complément */
+ @Lob
+ @Type(type="org.hibernate.type.StringClobType") // see HHH-6105
+ private String complement;
- /** ID */
- @EmbeddedId
- @NotNull
- private CompositeId<Campagne, Personne> id;
+ /** ID */
+ @EmbeddedId
+ @NotNull
+ private CompositeId<Campagne, Personne> id;
- /**
- * Constructor
- */
- public CampagnePersonneParticipant() {
- id = new CompositeId<Campagne, Personne>();
- }
+ /**
+ * Constructor
+ */
+ public CampagnePersonneParticipant() {
+ id = new CompositeId<Campagne, Personne>();
+ }
- /** {@inheritDoc} */
- @Override
- public final CampagnePersonneParticipant clone() throws CloneNotSupportedException {
- CampagnePersonneParticipant clone = (CampagnePersonneParticipant) super.clone();
- clone.id = id.clone();
- clone.complement = complement;
- return clone;
- }
+ /** {@inheritDoc} */
+ @Override
+ public final CampagnePersonneParticipant clone() throws CloneNotSupportedException {
+ CampagnePersonneParticipant clone = (CampagnePersonneParticipant) super.clone();
+ clone.id = id.clone();
+ clone.complement = complement;
+ return clone;
+ }
- /**
- * complement getter
- * @return complement
- */
- public String getComplement() {
- return complement;
- }
+ /**
+ * complement getter
+ * @return complement
+ */
+ public String getComplement() {
+ return complement;
+ }
- /**
- * complement setter
- * @param complement complement
- */
- public void setComplement(String complement) {
- this.complement = complement;
- }
+ /**
+ * complement setter
+ * @param complement complement
+ */
+ public void setComplement(String complement) {
+ this.complement = complement;
+ }
- /**
- * id getter
- * @return id
- */
- public CompositeId<Campagne, Personne> getId() {
- return id;
- }
+ /**
+ * id getter
+ * @return id
+ */
+ public CompositeId<Campagne, Personne> getId() {
+ return id;
+ }
- /**
- * id setter
- * @param id id
- */
- public void setId(CompositeId<Campagne, Personne> id) {
- this.id = id;
- }
+ /**
+ * id setter
+ * @param id id
+ */
+ public void setId(CompositeId<Campagne, Personne> id) {
+ this.id = id;
+ }
}
\ No newline at end of file
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Droits.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Droits.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Droits.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -38,108 +38,108 @@
@Embeddable
public class Droits implements Serializable, Cloneable {
- /** Droits extrait */
- @NotNull
- private Boolean droitExtrait;
+ /** Droits extrait */
+ @NotNull
+ private Boolean droitExtrait;
- /** Droits purification */
- @NotNull
- private Boolean droitPuri;
+ /** Droits purification */
+ @NotNull
+ private Boolean droitPuri;
- /** Droits récolte */
- @NotNull
- private Boolean droitRecolte;
+ /** Droits récolte */
+ @NotNull
+ private Boolean droitRecolte;
- /** Droits test */
- @NotNull
- private Boolean droitTestBio;
+ /** Droits test */
+ @NotNull
+ private Boolean droitTestBio;
- /** {@inheritDoc} */
- @Override
- public Droits clone() throws CloneNotSupportedException {
- Droits clone = (Droits) super.clone();
- clone.droitExtrait = droitExtrait;
- clone.droitPuri = droitPuri;
- clone.droitRecolte = droitRecolte;
- clone.droitTestBio = droitTestBio;
- return clone;
- }
+ /** {@inheritDoc} */
+ @Override
+ public Droits clone() throws CloneNotSupportedException {
+ Droits clone = (Droits) super.clone();
+ clone.droitExtrait = droitExtrait;
+ clone.droitPuri = droitPuri;
+ clone.droitRecolte = droitRecolte;
+ clone.droitTestBio = droitTestBio;
+ return clone;
+ }
- /** {@inheritDoc} */
- @Override
- public boolean equals(Object obj) {
- return BeanTools.equals(this, obj, AccessType.GETTER, "droitExtrait", "droitPuri", "droitRecolte",
- "droitTestBio");
- }
+ /** {@inheritDoc} */
+ @Override
+ public boolean equals(Object obj) {
+ return BeanTools.equals(this, obj, AccessType.GETTER, "droitExtrait", "droitPuri", "droitRecolte",
+ "droitTestBio");
+ }
- /** {@inheritDoc} */
- @Override
- public int hashCode() {
- return BeanTools.hashCode(this, droitExtrait, droitPuri, droitRecolte, droitTestBio);
- }
+ /** {@inheritDoc} */
+ @Override
+ public int hashCode() {
+ return BeanTools.hashCode(this, droitExtrait, droitPuri, droitRecolte, droitTestBio);
+ }
- /**
- * droitExtrait getter
- * @return droitExtrait
- */
- public Boolean getDroitExtrait() {
- return droitExtrait;
- }
+ /**
+ * droitExtrait getter
+ * @return droitExtrait
+ */
+ public Boolean getDroitExtrait() {
+ return droitExtrait;
+ }
- /**
- * droitExtrait setter
- * @param droitExtrait droitExtrait
- */
- public void setDroitExtrait(Boolean droitExtrait) {
- this.droitExtrait = droitExtrait;
- }
+ /**
+ * droitExtrait setter
+ * @param droitExtrait droitExtrait
+ */
+ public void setDroitExtrait(Boolean droitExtrait) {
+ this.droitExtrait = droitExtrait;
+ }
- /**
- * droitPuri getter
- * @return droitPuri
- */
- public Boolean getDroitPuri() {
- return droitPuri;
- }
+ /**
+ * droitPuri getter
+ * @return droitPuri
+ */
+ public Boolean getDroitPuri() {
+ return droitPuri;
+ }
- /**
- * droitPuri setter
- * @param droitPuri droitPuri
- */
- public void setDroitPuri(Boolean droitPuri) {
- this.droitPuri = droitPuri;
- }
+ /**
+ * droitPuri setter
+ * @param droitPuri droitPuri
+ */
+ public void setDroitPuri(Boolean droitPuri) {
+ this.droitPuri = droitPuri;
+ }
- /**
- * droitRecolte getter
- * @return droitRecolte
- */
- public Boolean getDroitRecolte() {
- return droitRecolte;
- }
+ /**
+ * droitRecolte getter
+ * @return droitRecolte
+ */
+ public Boolean getDroitRecolte() {
+ return droitRecolte;
+ }
- /**
- * droitRecolte setter
- * @param droitRecolte droitRecolte
- */
- public void setDroitRecolte(Boolean droitRecolte) {
- this.droitRecolte = droitRecolte;
- }
+ /**
+ * droitRecolte setter
+ * @param droitRecolte droitRecolte
+ */
+ public void setDroitRecolte(Boolean droitRecolte) {
+ this.droitRecolte = droitRecolte;
+ }
- /**
- * droitTestBio getter
- * @return droitTestBio
- */
- public Boolean getDroitTestBio() {
- return droitTestBio;
- }
+ /**
+ * droitTestBio getter
+ * @return droitTestBio
+ */
+ public Boolean getDroitTestBio() {
+ return droitTestBio;
+ }
- /**
- * droitTestBio setter
- * @param droitTestBio droitTestBio
- */
- public void setDroitTestBio(Boolean droitTestBio) {
- this.droitTestBio = droitTestBio;
- }
+ /**
+ * droitTestBio setter
+ * @param droitTestBio droitTestBio
+ */
+ public void setDroitTestBio(Boolean droitTestBio) {
+ this.droitTestBio = droitTestBio;
+ }
}
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/ErreurTestBio.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/ErreurTestBio.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/ErreurTestBio.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -45,79 +45,79 @@
@Table(uniqueConstraints = @UniqueConstraint(columnNames = "nom"))
public class ErreurTestBio extends AbstractModel implements Comparable<ErreurTestBio> {
- /** Id de l'erreur */
- @Id
- @GeneratedValue
- private Integer idErreurTest;
+ /** Id de l'erreur */
+ @Id
+ @GeneratedValue
+ private Integer idErreurTest;
- /** Nom */
- @Length(max = LENGTH_MEDIUM_TEXT)
- @NotEmpty
- private String nom;
+ /** Nom */
+ @Length(max = LENGTH_MEDIUM_TEXT)
+ @NotEmpty
+ private String nom;
- /** Description */
- @Lob
- @Type(type="org.hibernate.type.StringClobType") // see HHH-6105
- @NotEmpty
- private String description;
+ /** Description */
+ @Lob
+ @Type(type="org.hibernate.type.StringClobType") // see HHH-6105
+ @NotEmpty
+ private String description;
- /** {@inheritDoc} */
- @Override
- public String toString() {
- return nom;
- }
+ /** {@inheritDoc} */
+ @Override
+ public String toString() {
+ return nom;
+ }
- /** {@inheritDoc} */
- @Override
- public int compareTo(ErreurTestBio erreurTest) {
- return new BeanComparator("nom").compare(this, erreurTest);
- }
+ /** {@inheritDoc} */
+ @Override
+ public int compareTo(ErreurTestBio erreurTest) {
+ return new BeanComparator("nom").compare(this, erreurTest);
+ }
- /**
- * idErreurTest getter
- * @return idErreurTest
- */
- public Integer getIdErreurTest() {
- return idErreurTest;
- }
+ /**
+ * idErreurTest getter
+ * @return idErreurTest
+ */
+ public Integer getIdErreurTest() {
+ return idErreurTest;
+ }
- /**
- * idErreurTest setter
- * @param idErreurTest idErreurTest
- */
- public void setIdErreurTest(Integer idErreurTest) {
- this.idErreurTest = idErreurTest;
- }
+ /**
+ * idErreurTest setter
+ * @param idErreurTest idErreurTest
+ */
+ public void setIdErreurTest(Integer idErreurTest) {
+ this.idErreurTest = idErreurTest;
+ }
- /**
- * nom getter
- * @return nom
- */
- public String getNom() {
- return nom;
- }
+ /**
+ * nom getter
+ * @return nom
+ */
+ public String getNom() {
+ return nom;
+ }
- /**
- * nom setter
- * @param nom nom
- */
- public void setNom(String nom) {
- this.nom = nom;
- }
+ /**
+ * nom setter
+ * @param nom nom
+ */
+ public void setNom(String nom) {
+ this.nom = nom;
+ }
- /**
- * description getter
- * @return description
- */
- public String getDescription() {
- return description;
- }
+ /**
+ * description getter
+ * @return description
+ */
+ public String getDescription() {
+ return description;
+ }
- /**
- * description setter
- * @param description description
- */
- public void setDescription(String description) {
- this.description = description;
- }
+ /**
+ * description setter
+ * @param description description
+ */
+ public void setDescription(String description) {
+ this.description = description;
+ }
}
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Extraction.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Extraction.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Extraction.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -75,254 +75,254 @@
})
public class Extraction extends AbstractModel implements Comparable<Extraction> {
- /** Id de l'extraction */
- @Id
- @GeneratedValue
- private Integer idExtraction;
+ /** Id de l'extraction */
+ @Id
+ @GeneratedValue
+ private Integer idExtraction;
- /** Référence de la manip */
- @Length(max = LENGTH_MEDIUM_TEXT)
- @Column(unique = true)
- @NotEmpty
- @Field(index=Index.YES, analyze=Analyze.YES, store=Store.YES)
- private String ref;
+ /** Référence de la manip */
+ @Length(max = LENGTH_MEDIUM_TEXT)
+ @Column(unique = true)
+ @NotEmpty
+ @Field(index=Index.YES, analyze=Analyze.YES, store=Store.YES)
+ private String ref;
- /** Manipulateur */
- @NotNull
- @ManyToOne(fetch = FetchType.LAZY, optional = false)
- private Personne manipulateur;
+ /** Manipulateur */
+ @NotNull
+ @ManyToOne(fetch = FetchType.LAZY, optional = false)
+ private Personne manipulateur;
- /** Méthode pour l'extraction **/
- @NotNull
- @ManyToOne(fetch = FetchType.EAGER, optional = false)
- private MethodeExtraction methode;
+ /** Méthode pour l'extraction **/
+ @NotNull
+ @ManyToOne(fetch = FetchType.EAGER, optional = false)
+ private MethodeExtraction methode;
- /** Date de la manip */
- @NotNull
- @Temporal(TemporalType.DATE)
- private Date date;
+ /** Date de la manip */
+ @NotNull
+ @Temporal(TemporalType.DATE)
+ private Date date;
- /** Lot utilisé pour l'extraction **/
- @NotNull
- @ManyToOne(fetch = FetchType.EAGER, optional = false)
- @IndexedEmbedded(depth=1)
- private Lot lot;
+ /** Lot utilisé pour l'extraction **/
+ @NotNull
+ @ManyToOne(fetch = FetchType.EAGER, optional = false)
+ @IndexedEmbedded(depth=1)
+ private Lot lot;
- /** Masse avant l'extraction **/
- @Min(value = 0)
- @Max(value = DataContext.DECIMAL_MAX)
- @Column(precision = DataContext.DECIMAL_PRECISION, scale = DataContext.DECIMAL_SCALE)
- private BigDecimal masseDepart;
+ /** Masse avant l'extraction **/
+ @Min(value = 0)
+ @Max(value = DataContext.DECIMAL_MAX)
+ @Column(precision = DataContext.DECIMAL_PRECISION, scale = DataContext.DECIMAL_SCALE)
+ private BigDecimal masseDepart;
- /** Commentaire pour la manip */
- @Lob
- @Type(type="org.hibernate.type.StringClobType") // see HHH-6105
- private String complement;
+ /** Commentaire pour la manip */
+ @Lob
+ @Type(type="org.hibernate.type.StringClobType") // see HHH-6105
+ private String complement;
- /** Créateur */
- @NotNull
- @ManyToOne(fetch = FetchType.LAZY, optional = false)
- @IndexedEmbedded
- private Personne createur;
+ /** Créateur */
+ @NotNull
+ @ManyToOne(fetch = FetchType.LAZY, optional = false)
+ @IndexedEmbedded
+ private Personne createur;
- /** Extraits produits par l'extraction */
- @NotNull
- @OneToMany(mappedBy = "extraction", fetch = FetchType.EAGER, orphanRemoval = true)
- @Cascade({ CascadeType.SAVE_UPDATE })
- @ContainedIn
- private List<Extrait> extraits;
+ /** Extraits produits par l'extraction */
+ @NotNull
+ @OneToMany(mappedBy = "extraction", fetch = FetchType.EAGER, orphanRemoval = true)
+ @Cascade({ CascadeType.SAVE_UPDATE })
+ @ContainedIn
+ private List<Extrait> extraits;
- /**
- * Constructeur
- */
- public Extraction() {
- extraits = new ArrayList<Extrait>();
- }
+ /**
+ * Constructeur
+ */
+ public Extraction() {
+ extraits = new ArrayList<Extrait>();
+ }
- /** {@inheritDoc} */
- @Override
- public String toString() {
- return ref;
- }
+ /** {@inheritDoc} */
+ @Override
+ public String toString() {
+ return ref;
+ }
- /** {@inheritDoc} */
- @Override
- public int compareTo(Extraction extraction) {
- ComparatorChain comparatorChain = new ComparatorChain();
- comparatorChain.addComparator(new BeanComparator("lot"));
- comparatorChain.addComparator(new BeanComparator("ref"));
- return comparatorChain.compare(this, extraction);
- }
+ /** {@inheritDoc} */
+ @Override
+ public int compareTo(Extraction extraction) {
+ ComparatorChain comparatorChain = new ComparatorChain();
+ comparatorChain.addComparator(new BeanComparator("lot"));
+ comparatorChain.addComparator(new BeanComparator("ref"));
+ return comparatorChain.compare(this, extraction);
+ }
- /**
- * Rend les extraits triés en utilisant le comparateur {@link ExtraitsOfExtractionComp}
- * @return resultats
- */
- public List<Extrait> getSortedExtraits() {
- // comme "@Sort(type = SortType.COMPARATOR, comparator = ExtraitsOfExtractionComp.class)" ne rend pas une
- // liste triée avec List, tri dans le getter
- Collections.sort(extraits, new ExtraitsOfExtractionComp());
- return extraits;
- }
+ /**
+ * Rend les extraits triés en utilisant le comparateur {@link ExtraitsOfExtractionComp}
+ * @return resultats
+ */
+ public List<Extrait> getSortedExtraits() {
+ // comme "@Sort(type = SortType.COMPARATOR, comparator = ExtraitsOfExtractionComp.class)" ne rend pas une
+ // liste triée avec List, tri dans le getter
+ Collections.sort(extraits, new ExtraitsOfExtractionComp());
+ return extraits;
+ }
- /**
- * idExtraction getter
- * @return idExtraction
- */
- public Integer getIdExtraction() {
- return idExtraction;
- }
+ /**
+ * idExtraction getter
+ * @return idExtraction
+ */
+ public Integer getIdExtraction() {
+ return idExtraction;
+ }
- /**
- * idExtraction setter
- * @param idExtraction idExtraction
- */
- public void setIdExtraction(Integer idExtraction) {
- this.idExtraction = idExtraction;
- }
+ /**
+ * idExtraction setter
+ * @param idExtraction idExtraction
+ */
+ public void setIdExtraction(Integer idExtraction) {
+ this.idExtraction = idExtraction;
+ }
- /**
- * ref getter
- * @return ref
- */
- public String getRef() {
- return ref;
- }
+ /**
+ * ref getter
+ * @return ref
+ */
+ public String getRef() {
+ return ref;
+ }
- /**
- * ref setter
- * @param ref ref
- */
- public void setRef(String ref) {
- this.ref = ref;
- }
+ /**
+ * ref setter
+ * @param ref ref
+ */
+ public void setRef(String ref) {
+ this.ref = ref;
+ }
- /**
- * manipulateur getter
- * @return manipulateur
- */
- public Personne getManipulateur() {
- return manipulateur;
- }
+ /**
+ * manipulateur getter
+ * @return manipulateur
+ */
+ public Personne getManipulateur() {
+ return manipulateur;
+ }
- /**
- * manipulateur setter
- * @param manipulateur manipulateur
- */
- public void setManipulateur(Personne manipulateur) {
- this.manipulateur = manipulateur;
- }
+ /**
+ * manipulateur setter
+ * @param manipulateur manipulateur
+ */
+ public void setManipulateur(Personne manipulateur) {
+ this.manipulateur = manipulateur;
+ }
- /**
- * methode getter
- * @return methode
- */
- public MethodeExtraction getMethode() {
- return methode;
- }
+ /**
+ * methode getter
+ * @return methode
+ */
+ public MethodeExtraction getMethode() {
+ return methode;
+ }
- /**
- * methode setter
- * @param methode methode
- */
- public void setMethode(MethodeExtraction methode) {
- this.methode = methode;
- }
+ /**
+ * methode setter
+ * @param methode methode
+ */
+ public void setMethode(MethodeExtraction methode) {
+ this.methode = methode;
+ }
- /**
- * date getter
- * @return date
- */
- public Date getDate() {
- return date;
- }
+ /**
+ * date getter
+ * @return date
+ */
+ public Date getDate() {
+ return date;
+ }
- /**
- * date setter
- * @param date date
- */
- public void setDate(Date date) {
- this.date = date;
- }
+ /**
+ * date setter
+ * @param date date
+ */
+ public void setDate(Date date) {
+ this.date = date;
+ }
- /**
- * lot getter
- * @return lot
- */
- public Lot getLot() {
- return lot;
- }
+ /**
+ * lot getter
+ * @return lot
+ */
+ public Lot getLot() {
+ return lot;
+ }
- /**
- * lot setter
- * @param lot lot
- */
- public void setLot(Lot lot) {
- this.lot = lot;
- }
+ /**
+ * lot setter
+ * @param lot lot
+ */
+ public void setLot(Lot lot) {
+ this.lot = lot;
+ }
- /**
- * masseDepart getter
- * @return masseDepart
- */
- public BigDecimal getMasseDepart() {
- return masseDepart;
- }
+ /**
+ * masseDepart getter
+ * @return masseDepart
+ */
+ public BigDecimal getMasseDepart() {
+ return masseDepart;
+ }
- /**
- * masseDepart setter
- * @param masseDepart masseDepart
- */
- public void setMasseDepart(BigDecimal masseDepart) {
- this.masseDepart = masseDepart;
- }
+ /**
+ * masseDepart setter
+ * @param masseDepart masseDepart
+ */
+ public void setMasseDepart(BigDecimal masseDepart) {
+ this.masseDepart = masseDepart;
+ }
- /**
- * complement getter
- * @return complement
- */
- public String getComplement() {
- return complement;
- }
+ /**
+ * complement getter
+ * @return complement
+ */
+ public String getComplement() {
+ return complement;
+ }
- /**
- * complement setter
- * @param complement complement
- */
- public void setComplement(String complement) {
- this.complement = complement;
- }
+ /**
+ * complement setter
+ * @param complement complement
+ */
+ public void setComplement(String complement) {
+ this.complement = complement;
+ }
- /**
- * createur getter
- * @return createur
- */
- public Personne getCreateur() {
- return createur;
- }
+ /**
+ * createur getter
+ * @return createur
+ */
+ public Personne getCreateur() {
+ return createur;
+ }
- /**
- * createur setter
- * @param createur createur
- */
- public void setCreateur(Personne createur) {
- this.createur = createur;
- }
+ /**
+ * createur setter
+ * @param createur createur
+ */
+ public void setCreateur(Personne createur) {
+ this.createur = createur;
+ }
- /**
- * extraits getter
- * @return extraits
- */
- public List<Extrait> getExtraits() {
- return extraits;
- }
+ /**
+ * extraits getter
+ * @return extraits
+ */
+ public List<Extrait> getExtraits() {
+ return extraits;
+ }
- /**
- * extraits setter
- * @param extraits extraits
- */
- public void setExtraits(List<Extrait> extraits) {
- this.extraits = extraits;
- }
+ /**
+ * extraits setter
+ * @param extraits extraits
+ */
+ public void setExtraits(List<Extrait> extraits) {
+ this.extraits = extraits;
+ }
}
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Extrait.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Extrait.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Extrait.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -41,90 +41,90 @@
@Embeddable
public class Extrait extends Produit {
- /** Type d'extrait */
- @NotNull
- @ManyToOne(fetch = FetchType.EAGER, optional = false)
- private TypeExtrait typeExtrait;
+ /** Type d'extrait */
+ @NotNull
+ @ManyToOne(fetch = FetchType.EAGER, optional = false)
+ private TypeExtrait typeExtrait;
- /** Manip d'extraction dont fait partie l'extrait */
- @NotNull
- @ManyToOne(fetch = FetchType.EAGER, optional = false)
- @IndexedEmbedded
- private Extraction extraction;
+ /** Manip d'extraction dont fait partie l'extrait */
+ @NotNull
+ @ManyToOne(fetch = FetchType.EAGER, optional = false)
+ @IndexedEmbedded
+ private Extraction extraction;
- /**
- * Constructor
- */
- public Extrait() {
- super();
- }
+ /**
+ * Constructor
+ */
+ public Extrait() {
+ super();
+ }
- /**
- * Rend le rendement calculé pour l'extrait (masseObtenue / masseDepart)
- * @return le résultat ou null si les valeurs actuelles ne donnent pas un résultat cohérent
- */
- public Float getRendement() {
- if (getExtraction() != null && getExtraction().getMasseDepart() != null
- && getExtraction().getMasseDepart().floatValue() != 0f && getMasseObtenue() != null) {
- Float rendement = getMasseObtenue().floatValue() / getExtraction().getMasseDepart().floatValue();
- if (rendement <= 1f && rendement >= 0) {
- return rendement;
- }
- }
- return null;
- }
+ /**
+ * Rend le rendement calculé pour l'extrait (masseObtenue / masseDepart)
+ * @return le résultat ou null si les valeurs actuelles ne donnent pas un résultat cohérent
+ */
+ public Float getRendement() {
+ if (getExtraction() != null && getExtraction().getMasseDepart() != null
+ && getExtraction().getMasseDepart().floatValue() != 0f && getMasseObtenue() != null) {
+ Float rendement = getMasseObtenue().floatValue() / getExtraction().getMasseDepart().floatValue();
+ if (rendement <= 1f && rendement >= 0) {
+ return rendement;
+ }
+ }
+ return null;
+ }
- /** {@inheritDoc} */
- @Override
- public boolean isExtrait() {
- return true;
- }
+ /** {@inheritDoc} */
+ @Override
+ public boolean isExtrait() {
+ return true;
+ }
- /** {@inheritDoc} */
- @Override
- public boolean isFraction() {
- return false;
- }
+ /** {@inheritDoc} */
+ @Override
+ public boolean isFraction() {
+ return false;
+ }
- /** {@inheritDoc} */
- @Override
- public Extrait clone() throws CloneNotSupportedException {
- Extrait clone = (Extrait) super.clone();
- clone.typeExtrait = typeExtrait;
- clone.extraction = extraction;
- return clone;
- }
+ /** {@inheritDoc} */
+ @Override
+ public Extrait clone() throws CloneNotSupportedException {
+ Extrait clone = (Extrait) super.clone();
+ clone.typeExtrait = typeExtrait;
+ clone.extraction = extraction;
+ return clone;
+ }
- /**
- * typeExtrait getter
- * @return typeExtrait
- */
- public TypeExtrait getTypeExtrait() {
- return typeExtrait;
- }
+ /**
+ * typeExtrait getter
+ * @return typeExtrait
+ */
+ public TypeExtrait getTypeExtrait() {
+ return typeExtrait;
+ }
- /**
- * typeExtrait setter
- * @param typeExtrait typeExtrait
- */
- public void setTypeExtrait(TypeExtrait typeExtrait) {
- this.typeExtrait = typeExtrait;
- }
+ /**
+ * typeExtrait setter
+ * @param typeExtrait typeExtrait
+ */
+ public void setTypeExtrait(TypeExtrait typeExtrait) {
+ this.typeExtrait = typeExtrait;
+ }
- /**
- * extraction getter
- * @return extraction
- */
- public Extraction getExtraction() {
- return extraction;
- }
+ /**
+ * extraction getter
+ * @return extraction
+ */
+ public Extraction getExtraction() {
+ return extraction;
+ }
- /**
- * extraction setter
- * @param extraction extraction
- */
- public void setExtraction(Extraction extraction) {
- this.extraction = extraction;
- }
+ /**
+ * extraction setter
+ * @param extraction extraction
+ */
+ public void setExtraction(Extraction extraction) {
+ this.extraction = extraction;
+ }
}
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Fraction.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Fraction.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Fraction.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -43,93 +43,93 @@
@Embeddable
public class Fraction extends Produit {
- /** indice de la fraction */
- @Length(max = 5)
- @NotEmpty
- private String indice;
+ /** indice de la fraction */
+ @Length(max = 5)
+ @NotEmpty
+ private String indice;
- // purification doit être à EAGER sinon dans certains cas, setProduit de ResultatTestBio rend une
- // LazyInitializationException (les setters semble être effectués après la requête http et par conséquent une fois
- // la session hibernate fermée)
- /** Manip de purification dont fait partie la fraction */
- @NotNull
- @ManyToOne(fetch = FetchType.EAGER, optional = false)
- @IndexedEmbedded
- private Purification purification;
+ // purification doit être à EAGER sinon dans certains cas, setProduit de ResultatTestBio rend une
+ // LazyInitializationException (les setters semble être effectués après la requête http et par conséquent une fois
+ // la session hibernate fermée)
+ /** Manip de purification dont fait partie la fraction */
+ @NotNull
+ @ManyToOne(fetch = FetchType.EAGER, optional = false)
+ @IndexedEmbedded
+ private Purification purification;
- /**
- * Constructor
- */
- public Fraction() {
- super();
- }
+ /**
+ * Constructor
+ */
+ public Fraction() {
+ super();
+ }
- /**
- * Rend le rendement calculé pour la fraction (masseObtenue / masseDepart)
- * @return le résultat ou null si les valeurs actuelles ne donnent pas un résultat cohérent
- */
- public Float getRendement() {
- if (getPurification() != null && getPurification().getMasseDepart() != null
- && getPurification().getMasseDepart().floatValue() != 0f && getMasseObtenue() != null) {
- Float rendement = getMasseObtenue().floatValue() / getPurification().getMasseDepart().floatValue();
- if (rendement <= 1f && rendement >= 0) {
- return rendement;
- }
- }
- return null;
- }
+ /**
+ * Rend le rendement calculé pour la fraction (masseObtenue / masseDepart)
+ * @return le résultat ou null si les valeurs actuelles ne donnent pas un résultat cohérent
+ */
+ public Float getRendement() {
+ if (getPurification() != null && getPurification().getMasseDepart() != null
+ && getPurification().getMasseDepart().floatValue() != 0f && getMasseObtenue() != null) {
+ Float rendement = getMasseObtenue().floatValue() / getPurification().getMasseDepart().floatValue();
+ if (rendement <= 1f && rendement >= 0) {
+ return rendement;
+ }
+ }
+ return null;
+ }
- /** {@inheritDoc} */
- @Override
- public boolean isExtrait() {
- return false;
- }
+ /** {@inheritDoc} */
+ @Override
+ public boolean isExtrait() {
+ return false;
+ }
- /** {@inheritDoc} */
- @Override
- public boolean isFraction() {
- return true;
- }
+ /** {@inheritDoc} */
+ @Override
+ public boolean isFraction() {
+ return true;
+ }
- /** {@inheritDoc} */
- @Override
- public Fraction clone() throws CloneNotSupportedException {
- Fraction clone = (Fraction) super.clone();
- clone.indice = indice;
- clone.purification = purification;
- return clone;
- }
+ /** {@inheritDoc} */
+ @Override
+ public Fraction clone() throws CloneNotSupportedException {
+ Fraction clone = (Fraction) super.clone();
+ clone.indice = indice;
+ clone.purification = purification;
+ return clone;
+ }
- /**
- * indice getter
- * @return indice
- */
- public String getIndice() {
- return indice;
- }
+ /**
+ * indice getter
+ * @return indice
+ */
+ public String getIndice() {
+ return indice;
+ }
- /**
- * indice setter
- * @param indice indice
- */
- public void setIndice(String indice) {
- this.indice = indice;
- }
+ /**
+ * indice setter
+ * @param indice indice
+ */
+ public void setIndice(String indice) {
+ this.indice = indice;
+ }
- /**
- * purification getter
- * @return purification
- */
- public Purification getPurification() {
- return purification;
- }
+ /**
+ * purification getter
+ * @return purification
+ */
+ public Purification getPurification() {
+ return purification;
+ }
- /**
- * purification setter
- * @param purification purification
- */
- public void setPurification(Purification purification) {
- this.purification = purification;
- }
+ /**
+ * purification setter
+ * @param purification purification
+ */
+ public void setPurification(Purification purification) {
+ this.purification = purification;
+ }
}
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Groupe.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Groupe.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Groupe.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -49,146 +49,146 @@
@Table
public class Groupe extends AbstractModel {
- /** Droits sur les campagnes */
- @OneToMany(mappedBy = "id.pk2", fetch = FetchType.LAZY)
- @NotNull
- private List<CampagneGroupeDroits> campagnesDroits;
+ /** Droits sur les campagnes */
+ @OneToMany(mappedBy = "id.pk2", fetch = FetchType.LAZY)
+ @NotNull
+ private List<CampagneGroupeDroits> campagnesDroits;
- /** Description */
- @Lob
- @Type(type="org.hibernate.type.StringClobType") // see HHH-6105
- private String description;
+ /** Description */
+ @Lob
+ @Type(type="org.hibernate.type.StringClobType") // see HHH-6105
+ private String description;
- /** Groupe */
- @Id
- @GeneratedValue
- private Integer idGroupe;
+ /** Groupe */
+ @Id
+ @GeneratedValue
+ private Integer idGroupe;
- /** Droits sur les lots */
- @OneToMany(mappedBy = "id.pk2", fetch = FetchType.LAZY)
- @NotNull
- private List<LotGroupeDroits> lotsDroits;
+ /** Droits sur les lots */
+ @OneToMany(mappedBy = "id.pk2", fetch = FetchType.LAZY)
+ @NotNull
+ private List<LotGroupeDroits> lotsDroits;
- /** Nom */
- @Column(unique = true)
- @Length(max = LENGTH_MEDIUM_TEXT)
- @NotEmpty
- private String nom;
+ /** Nom */
+ @Column(unique = true)
+ @Length(max = LENGTH_MEDIUM_TEXT)
+ @NotEmpty
+ private String nom;
- /** Utilisateurs */
- @OneToMany(mappedBy = "groupe", fetch = FetchType.LAZY)
- @NotNull
- private List<Utilisateur> utilisateurs;
+ /** Utilisateurs */
+ @OneToMany(mappedBy = "groupe", fetch = FetchType.LAZY)
+ @NotNull
+ private List<Utilisateur> utilisateurs;
- /**
- * Constructeur
- */
- public Groupe() {
- utilisateurs = new ArrayList<Utilisateur>();
- campagnesDroits = new ArrayList<CampagneGroupeDroits>();
- lotsDroits = new ArrayList<LotGroupeDroits>();
- }
+ /**
+ * Constructeur
+ */
+ public Groupe() {
+ utilisateurs = new ArrayList<Utilisateur>();
+ campagnesDroits = new ArrayList<CampagneGroupeDroits>();
+ lotsDroits = new ArrayList<LotGroupeDroits>();
+ }
- /** {@inheritDoc} */
- @Override
- public String toString() {
- return nom;
- }
+ /** {@inheritDoc} */
+ @Override
+ public String toString() {
+ return nom;
+ }
- /**
- * campagnesDroits getter
- * @return campagnesDroits
- */
- public List<CampagneGroupeDroits> getCampagnesDroits() {
- return campagnesDroits;
- }
+ /**
+ * campagnesDroits getter
+ * @return campagnesDroits
+ */
+ public List<CampagneGroupeDroits> getCampagnesDroits() {
+ return campagnesDroits;
+ }
- /**
- * campagnesDroits setter
- * @param campagnesDroits campagnesDroits
- */
- public void setCampagnesDroits(List<CampagneGroupeDroits> campagnesDroits) {
- this.campagnesDroits = campagnesDroits;
- }
+ /**
+ * campagnesDroits setter
+ * @param campagnesDroits campagnesDroits
+ */
+ public void setCampagnesDroits(List<CampagneGroupeDroits> campagnesDroits) {
+ this.campagnesDroits = campagnesDroits;
+ }
- /**
- * description getter
- * @return description
- */
- public String getDescription() {
- return description;
- }
+ /**
+ * description getter
+ * @return description
+ */
+ public String getDescription() {
+ return description;
+ }
- /**
- * description setter
- * @param description description
- */
- public void setDescription(String description) {
- this.description = description;
- }
+ /**
+ * description setter
+ * @param description description
+ */
+ public void setDescription(String description) {
+ this.description = description;
+ }
- /**
- * idGroupe getter
- * @return idGroupe
- */
- public Integer getIdGroupe() {
- return idGroupe;
- }
+ /**
+ * idGroupe getter
+ * @return idGroupe
+ */
+ public Integer getIdGroupe() {
+ return idGroupe;
+ }
- /**
- * idGroupe setter
- * @param idGroupe idGroupe
- */
- public void setIdGroupe(Integer idGroupe) {
- this.idGroupe = idGroupe;
- }
+ /**
+ * idGroupe setter
+ * @param idGroupe idGroupe
+ */
+ public void setIdGroupe(Integer idGroupe) {
+ this.idGroupe = idGroupe;
+ }
- /**
- * lotsDroits getter
- * @return lotsDroits
- */
- public List<LotGroupeDroits> getLotsDroits() {
- return lotsDroits;
- }
+ /**
+ * lotsDroits getter
+ * @return lotsDroits
+ */
+ public List<LotGroupeDroits> getLotsDroits() {
+ return lotsDroits;
+ }
- /**
- * lotsDroits setter
- * @param lotsDroits lotsDroits
- */
- public void setLotsDroits(List<LotGroupeDroits> lotsDroits) {
- this.lotsDroits = lotsDroits;
- }
+ /**
+ * lotsDroits setter
+ * @param lotsDroits lotsDroits
+ */
+ public void setLotsDroits(List<LotGroupeDroits> lotsDroits) {
+ this.lotsDroits = lotsDroits;
+ }
- /**
- * nom getter
- * @return nom
- */
- public String getNom() {
- return nom;
- }
+ /**
+ * nom getter
+ * @return nom
+ */
+ public String getNom() {
+ return nom;
+ }
- /**
- * nom setter
- * @param nom nom
- */
- public void setNom(String nom) {
- this.nom = nom;
- }
+ /**
+ * nom setter
+ * @param nom nom
+ */
+ public void setNom(String nom) {
+ this.nom = nom;
+ }
- /**
- * utilisateurs getter
- * @return utilisateurs
- */
- public List<Utilisateur> getUtilisateurs() {
- return utilisateurs;
- }
+ /**
+ * utilisateurs getter
+ * @return utilisateurs
+ */
+ public List<Utilisateur> getUtilisateurs() {
+ return utilisateurs;
+ }
- /**
- * utilisateurs setter
- * @param utilisateurs utilisateurs
- */
- public void setUtilisateurs(List<Utilisateur> utilisateurs) {
- this.utilisateurs = utilisateurs;
- }
+ /**
+ * utilisateurs setter
+ * @param utilisateurs utilisateurs
+ */
+ public void setUtilisateurs(List<Utilisateur> utilisateurs) {
+ this.utilisateurs = utilisateurs;
+ }
}
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Lot.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Lot.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Lot.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -75,386 +75,386 @@
})
public class Lot extends AbstractModel implements Comparable<Lot> {
- /** ID */
- @Id
- @GeneratedValue
- private Integer idLot;
+ /** ID */
+ @Id
+ @GeneratedValue
+ private Integer idLot;
- /** Référence */
- @Column(unique = true)
- @NotEmpty
- @Length(max = LENGTH_MEDIUM_TEXT)
- @Field(index=Index.YES, analyze=Analyze.YES, store=Store.YES)
- private String ref;
+ /** Référence */
+ @Column(unique = true)
+ @NotEmpty
+ @Length(max = LENGTH_MEDIUM_TEXT)
+ @Field(index=Index.YES, analyze=Analyze.YES, store=Store.YES)
+ private String ref;
- /** Campagne */
- @NotNull
- @ManyToOne(fetch = FetchType.EAGER, optional = false)
- @IndexedEmbedded(depth=1)
- private Campagne campagne;
+ /** Campagne */
+ @NotNull
+ @ManyToOne(fetch = FetchType.EAGER, optional = false)
+ @IndexedEmbedded(depth=1)
+ private Campagne campagne;
- /** complement */
- @Lob
- @Type(type="org.hibernate.type.StringClobType") // see HHH-6105
- private String complement;
+ /** complement */
+ @Lob
+ @Type(type="org.hibernate.type.StringClobType") // see HHH-6105
+ private String complement;
- /** createur */
- @NotNull
- @ManyToOne(fetch = FetchType.LAZY, optional = false)
- @IndexedEmbedded
- private Personne createur;
+ /** createur */
+ @NotNull
+ @ManyToOne(fetch = FetchType.LAZY, optional = false)
+ @IndexedEmbedded
+ private Personne createur;
- /** Date */
- @Past
- @Temporal(TemporalType.DATE)
- @NotNull
- private Date dateRecolte;
+ /** Date */
+ @Past
+ @Temporal(TemporalType.DATE)
+ @NotNull
+ private Date dateRecolte;
- /** Echantillon collecté */
- @NotNull
- private Boolean echantillonColl;
+ /** Echantillon collecté */
+ @NotNull
+ private Boolean echantillonColl;
- /** Echantillon identifié */
- @NotNull
- private Boolean echantillonIdent;
+ /** Echantillon identifié */
+ @NotNull
+ private Boolean echantillonIdent;
- /** Echantillon phylo */
- @NotNull
- private Boolean echantillonPhylo;
+ /** Echantillon phylo */
+ @NotNull
+ private Boolean echantillonPhylo;
- /** Droits attribués aux groupes */
- @OneToMany(mappedBy = "id.pk1", fetch = FetchType.LAZY)
- @NotNull
- private List<LotGroupeDroits> groupesDroits;
+ /** Droits attribués aux groupes */
+ @OneToMany(mappedBy = "id.pk1", fetch = FetchType.LAZY)
+ @NotNull
+ private List<LotGroupeDroits> groupesDroits;
- /** Masse fraîche */
- @Min(value = 0)
- @Max(value = DataContext.DECIMAL_MAX)
- @Column(precision = DataContext.DECIMAL_PRECISION, scale = DataContext.DECIMAL_SCALE)
- private BigDecimal masseFraiche;
+ /** Masse fraîche */
+ @Min(value = 0)
+ @Max(value = DataContext.DECIMAL_MAX)
+ @Column(precision = DataContext.DECIMAL_PRECISION, scale = DataContext.DECIMAL_SCALE)
+ private BigDecimal masseFraiche;
- /** Masse sèche */
- @Min(value = 0)
- @Max(value = DataContext.DECIMAL_MAX)
- @Column(precision = DataContext.DECIMAL_PRECISION, scale = DataContext.DECIMAL_SCALE)
- private BigDecimal masseSeche;
+ /** Masse sèche */
+ @Min(value = 0)
+ @Max(value = DataContext.DECIMAL_MAX)
+ @Column(precision = DataContext.DECIMAL_PRECISION, scale = DataContext.DECIMAL_SCALE)
+ private BigDecimal masseSeche;
- /** Partie */
- @ManyToOne(fetch = FetchType.EAGER, optional = true)
- private Partie partie;
+ /** Partie */
+ @ManyToOne(fetch = FetchType.EAGER, optional = true)
+ private Partie partie;
- /** Droits attribués aux personnes */
- @OneToMany(mappedBy = "id.pk1", fetch = FetchType.LAZY)
- @NotNull
- private List<LotPersonneDroits> personnesDroits;
+ /** Droits attribués aux personnes */
+ @OneToMany(mappedBy = "id.pk1", fetch = FetchType.LAZY)
+ @NotNull
+ private List<LotPersonneDroits> personnesDroits;
- /** Spécimen source */
- @NotNull
- @ManyToOne(fetch = FetchType.EAGER, optional = false)
- @IndexedEmbedded(depth=1)
- private Specimen specimenRef;
+ /** Spécimen source */
+ @NotNull
+ @ManyToOne(fetch = FetchType.EAGER, optional = false)
+ @IndexedEmbedded(depth=1)
+ private Specimen specimenRef;
- /** Station */
- @NotNull
- @ManyToOne(fetch = FetchType.EAGER, optional = false)
- @IndexedEmbedded(depth=1)
- private Station station;
+ /** Station */
+ @NotNull
+ @ManyToOne(fetch = FetchType.EAGER, optional = false)
+ @IndexedEmbedded(depth=1)
+ private Station station;
- /** Extractions provenants du lot */
- @OneToMany(mappedBy = "lot", fetch = FetchType.LAZY)
- @NotNull
- private List<Extraction> extractions;
+ /** Extractions provenants du lot */
+ @OneToMany(mappedBy = "lot", fetch = FetchType.LAZY)
+ @NotNull
+ private List<Extraction> extractions;
- /**
- * Constructeur
- */
- public Lot() {
- personnesDroits = new ArrayList<LotPersonneDroits>();
- groupesDroits = new ArrayList<LotGroupeDroits>();
- extractions = new ArrayList<Extraction>();
- }
+ /**
+ * Constructeur
+ */
+ public Lot() {
+ personnesDroits = new ArrayList<LotPersonneDroits>();
+ groupesDroits = new ArrayList<LotGroupeDroits>();
+ extractions = new ArrayList<Extraction>();
+ }
- /** {@inheritDoc} */
- @Override
- public String toString() {
- return ref;
- }
+ /** {@inheritDoc} */
+ @Override
+ public String toString() {
+ return ref;
+ }
- /** {@inheritDoc} */
- @Override
- public int compareTo(Lot lot) {
- return new BeanComparator("ref").compare(this, lot);
- }
+ /** {@inheritDoc} */
+ @Override
+ public int compareTo(Lot lot) {
+ return new BeanComparator("ref").compare(this, lot);
+ }
- /**
- * campagne getter
- * @return campagne
- */
- public Campagne getCampagne() {
- return campagne;
- }
+ /**
+ * campagne getter
+ * @return campagne
+ */
+ public Campagne getCampagne() {
+ return campagne;
+ }
- /**
- * campagne setter
- * @param campagne campagne
- */
- public void setCampagne(Campagne campagne) {
- this.campagne = campagne;
- }
+ /**
+ * campagne setter
+ * @param campagne campagne
+ */
+ public void setCampagne(Campagne campagne) {
+ this.campagne = campagne;
+ }
- /**
- * complement getter
- * @return complement
- */
- public String getComplement() {
- return complement;
- }
+ /**
+ * complement getter
+ * @return complement
+ */
+ public String getComplement() {
+ return complement;
+ }
- /**
- * complement setter
- * @param complement complement
- */
- public void setComplement(String complement) {
- this.complement = complement;
- }
+ /**
+ * complement setter
+ * @param complement complement
+ */
+ public void setComplement(String complement) {
+ this.complement = complement;
+ }
- /**
- * createur getter
- * @return createur
- */
- public Personne getCreateur() {
- return createur;
- }
+ /**
+ * createur getter
+ * @return createur
+ */
+ public Personne getCreateur() {
+ return createur;
+ }
- /**
- * createur setter
- * @param createur createur
- */
- public void setCreateur(Personne createur) {
- this.createur = createur;
- }
+ /**
+ * createur setter
+ * @param createur createur
+ */
+ public void setCreateur(Personne createur) {
+ this.createur = createur;
+ }
- /**
- * dateRecolte getter
- * @return dateRecolte
- */
- public Date getDateRecolte() {
- return dateRecolte;
- }
+ /**
+ * dateRecolte getter
+ * @return dateRecolte
+ */
+ public Date getDateRecolte() {
+ return dateRecolte;
+ }
- /**
- * dateRecolte setter
- * @param dateRecolte dateRecolte
- */
- public void setDateRecolte(Date dateRecolte) {
- this.dateRecolte = dateRecolte;
- }
+ /**
+ * dateRecolte setter
+ * @param dateRecolte dateRecolte
+ */
+ public void setDateRecolte(Date dateRecolte) {
+ this.dateRecolte = dateRecolte;
+ }
- /**
- * echantillonColl getter
- * @return echantillonColl
- */
- public Boolean getEchantillonColl() {
- return echantillonColl;
- }
+ /**
+ * echantillonColl getter
+ * @return echantillonColl
+ */
+ public Boolean getEchantillonColl() {
+ return echantillonColl;
+ }
- /**
- * echantillonColl setter
- * @param echantillonColl echantillonColl
- */
- public void setEchantillonColl(Boolean echantillonColl) {
- this.echantillonColl = echantillonColl;
- }
+ /**
+ * echantillonColl setter
+ * @param echantillonColl echantillonColl
+ */
+ public void setEchantillonColl(Boolean echantillonColl) {
+ this.echantillonColl = echantillonColl;
+ }
- /**
- * echantillonIdent getter
- * @return echantillonIdent
- */
- public Boolean getEchantillonIdent() {
- return echantillonIdent;
- }
+ /**
+ * echantillonIdent getter
+ * @return echantillonIdent
+ */
+ public Boolean getEchantillonIdent() {
+ return echantillonIdent;
+ }
- /**
- * echantillonIdent setter
- * @param echantillonIdent echantillonIdent
- */
- public void setEchantillonIdent(Boolean echantillonIdent) {
- this.echantillonIdent = echantillonIdent;
- }
+ /**
+ * echantillonIdent setter
+ * @param echantillonIdent echantillonIdent
+ */
+ public void setEchantillonIdent(Boolean echantillonIdent) {
+ this.echantillonIdent = echantillonIdent;
+ }
- /**
- * echantillonPhylo getter
- * @return echantillonPhylo
- */
- public Boolean getEchantillonPhylo() {
- return echantillonPhylo;
- }
+ /**
+ * echantillonPhylo getter
+ * @return echantillonPhylo
+ */
+ public Boolean getEchantillonPhylo() {
+ return echantillonPhylo;
+ }
- /**
- * echantillonPhylo setter
- * @param echantillonPhylo echantillonPhylo
- */
- public void setEchantillonPhylo(Boolean echantillonPhylo) {
- this.echantillonPhylo = echantillonPhylo;
- }
+ /**
+ * echantillonPhylo setter
+ * @param echantillonPhylo echantillonPhylo
+ */
+ public void setEchantillonPhylo(Boolean echantillonPhylo) {
+ this.echantillonPhylo = echantillonPhylo;
+ }
- /**
- * groupesDroits getter
- * @return groupesDroits
- */
- public List<LotGroupeDroits> getGroupesDroits() {
- return groupesDroits;
- }
+ /**
+ * groupesDroits getter
+ * @return groupesDroits
+ */
+ public List<LotGroupeDroits> getGroupesDroits() {
+ return groupesDroits;
+ }
- /**
- * groupesDroits setter
- * @param groupesDroits groupesDroits
- */
- public void setGroupesDroits(List<LotGroupeDroits> groupesDroits) {
- this.groupesDroits = groupesDroits;
- }
+ /**
+ * groupesDroits setter
+ * @param groupesDroits groupesDroits
+ */
+ public void setGroupesDroits(List<LotGroupeDroits> groupesDroits) {
+ this.groupesDroits = groupesDroits;
+ }
- /**
- * idLot getter
- * @return idLot
- */
- public Integer getIdLot() {
- return idLot;
- }
+ /**
+ * idLot getter
+ * @return idLot
+ */
+ public Integer getIdLot() {
+ return idLot;
+ }
- /**
- * idLot setter
- * @param idLot idLot
- */
- public void setIdLot(Integer idLot) {
- this.idLot = idLot;
- }
+ /**
+ * idLot setter
+ * @param idLot idLot
+ */
+ public void setIdLot(Integer idLot) {
+ this.idLot = idLot;
+ }
- /**
- * masseFraiche getter
- * @return masseFraiche
- */
- public BigDecimal getMasseFraiche() {
- return masseFraiche;
- }
+ /**
+ * masseFraiche getter
+ * @return masseFraiche
+ */
+ public BigDecimal getMasseFraiche() {
+ return masseFraiche;
+ }
- /**
- * masseFraiche setter
- * @param masseFraiche masseFraiche
- */
- public void setMasseFraiche(BigDecimal masseFraiche) {
- this.masseFraiche = masseFraiche;
- }
+ /**
+ * masseFraiche setter
+ * @param masseFraiche masseFraiche
+ */
+ public void setMasseFraiche(BigDecimal masseFraiche) {
+ this.masseFraiche = masseFraiche;
+ }
- /**
- * masseSeche getter
- * @return masseSeche
- */
- public BigDecimal getMasseSeche() {
- return masseSeche;
- }
+ /**
+ * masseSeche getter
+ * @return masseSeche
+ */
+ public BigDecimal getMasseSeche() {
+ return masseSeche;
+ }
- /**
- * masseSeche setter
- * @param masseSeche masseSeche
- */
- public void setMasseSeche(BigDecimal masseSeche) {
- this.masseSeche = masseSeche;
- }
+ /**
+ * masseSeche setter
+ * @param masseSeche masseSeche
+ */
+ public void setMasseSeche(BigDecimal masseSeche) {
+ this.masseSeche = masseSeche;
+ }
- /**
- * partie getter
- * @return partie
- */
- public Partie getPartie() {
- return partie;
- }
+ /**
+ * partie getter
+ * @return partie
+ */
+ public Partie getPartie() {
+ return partie;
+ }
- /**
- * partie setter
- * @param partie partie
- */
- public void setPartie(Partie partie) {
- this.partie = partie;
- }
+ /**
+ * partie setter
+ * @param partie partie
+ */
+ public void setPartie(Partie partie) {
+ this.partie = partie;
+ }
- /**
- * personnesDroits getter
- * @return personnesDroits
- */
- public List<LotPersonneDroits> getPersonnesDroits() {
- return personnesDroits;
- }
+ /**
+ * personnesDroits getter
+ * @return personnesDroits
+ */
+ public List<LotPersonneDroits> getPersonnesDroits() {
+ return personnesDroits;
+ }
- /**
- * personnesDroits setter
- * @param personnesDroits personnesDroits
- */
- public void setPersonnesDroits(List<LotPersonneDroits> personnesDroits) {
- this.personnesDroits = personnesDroits;
- }
+ /**
+ * personnesDroits setter
+ * @param personnesDroits personnesDroits
+ */
+ public void setPersonnesDroits(List<LotPersonneDroits> personnesDroits) {
+ this.personnesDroits = personnesDroits;
+ }
- /**
- * ref getter
- * @return ref
- */
- public String getRef() {
- return ref;
- }
+ /**
+ * ref getter
+ * @return ref
+ */
+ public String getRef() {
+ return ref;
+ }
- /**
- * ref setter
- * @param ref ref
- */
- public void setRef(String ref) {
- this.ref = ref;
- }
+ /**
+ * ref setter
+ * @param ref ref
+ */
+ public void setRef(String ref) {
+ this.ref = ref;
+ }
- /**
- * specimenRef getter
- * @return specimenRef
- */
- public Specimen getSpecimenRef() {
- return specimenRef;
- }
+ /**
+ * specimenRef getter
+ * @return specimenRef
+ */
+ public Specimen getSpecimenRef() {
+ return specimenRef;
+ }
- /**
- * specimenRef setter
- * @param specimenRef specimenRef
- */
- public void setSpecimenRef(Specimen specimenRef) {
- this.specimenRef = specimenRef;
- }
+ /**
+ * specimenRef setter
+ * @param specimenRef specimenRef
+ */
+ public void setSpecimenRef(Specimen specimenRef) {
+ this.specimenRef = specimenRef;
+ }
- /**
- * station getter
- * @return station
- */
- public Station getStation() {
- return station;
- }
+ /**
+ * station getter
+ * @return station
+ */
+ public Station getStation() {
+ return station;
+ }
- /**
- * station setter
- * @param station station
- */
- public void setStation(Station station) {
- this.station = station;
- }
+ /**
+ * station setter
+ * @param station station
+ */
+ public void setStation(Station station) {
+ this.station = station;
+ }
- /**
- * extractions getter
- * @return extractions
- */
- public List<Extraction> getExtractions() {
- return extractions;
- }
+ /**
+ * extractions getter
+ * @return extractions
+ */
+ public List<Extraction> getExtractions() {
+ return extractions;
+ }
- /**
- * extractions setter
- * @param extractions extractions
- */
- public void setExtractions(List<Extraction> extractions) {
- this.extractions = extractions;
- }
+ /**
+ * extractions setter
+ * @param extractions extractions
+ */
+ public void setExtractions(List<Extraction> extractions) {
+ this.extractions = extractions;
+ }
}
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/LotGroupeDroits.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/LotGroupeDroits.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/LotGroupeDroits.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -38,53 +38,53 @@
@Table
public class LotGroupeDroits extends AbstractModel {
- /** Droits */
- @NotNull
- private Droits droits;
+ /** Droits */
+ @NotNull
+ private Droits droits;
- /** ID */
- @EmbeddedId
- @NotNull
- private CompositeId<Lot, Groupe> id;
+ /** ID */
+ @EmbeddedId
+ @NotNull
+ private CompositeId<Lot, Groupe> id;
- /**
- * Constructeur
- */
- public LotGroupeDroits() {
- droits = new Droits();
- id = new CompositeId<Lot, Groupe>();
- }
+ /**
+ * Constructeur
+ */
+ public LotGroupeDroits() {
+ droits = new Droits();
+ id = new CompositeId<Lot, Groupe>();
+ }
- /**
- * droits getter
- * @return droits
- */
- public Droits getDroits() {
- return droits;
- }
+ /**
+ * droits getter
+ * @return droits
+ */
+ public Droits getDroits() {
+ return droits;
+ }
- /**
- * droits setter
- * @param droits droits
- */
- public void setDroits(Droits droits) {
- this.droits = droits;
- }
+ /**
+ * droits setter
+ * @param droits droits
+ */
+ public void setDroits(Droits droits) {
+ this.droits = droits;
+ }
- /**
- * id getter
- * @return id
- */
- public CompositeId<Lot, Groupe> getId() {
- return id;
- }
+ /**
+ * id getter
+ * @return id
+ */
+ public CompositeId<Lot, Groupe> getId() {
+ return id;
+ }
- /**
- * id setter
- * @param id id
- */
- public void setId(CompositeId<Lot, Groupe> id) {
- this.id = id;
- }
+ /**
+ * id setter
+ * @param id id
+ */
+ public void setId(CompositeId<Lot, Groupe> id) {
+ this.id = id;
+ }
}
\ No newline at end of file
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/LotPersonneDroits.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/LotPersonneDroits.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/LotPersonneDroits.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -38,62 +38,62 @@
@Table
public class LotPersonneDroits extends AbstractModel {
- /** Droits */
- @NotNull
- private Droits droits;
+ /** Droits */
+ @NotNull
+ private Droits droits;
- /** ID */
- @EmbeddedId
- @NotNull
- private CompositeId<Lot, Personne> id;
+ /** ID */
+ @EmbeddedId
+ @NotNull
+ private CompositeId<Lot, Personne> id;
- /**
- * Constructeur
- */
- public LotPersonneDroits() {
- droits = new Droits();
- id = new CompositeId<Lot, Personne>();
- }
+ /**
+ * Constructeur
+ */
+ public LotPersonneDroits() {
+ droits = new Droits();
+ id = new CompositeId<Lot, Personne>();
+ }
- /** {@inheritDoc} */
- @Override
- public final LotPersonneDroits clone() throws CloneNotSupportedException {
- LotPersonneDroits clone = new LotPersonneDroits();
- clone.id = id.clone();
- clone.droits = droits.clone();
- return clone;
- }
+ /** {@inheritDoc} */
+ @Override
+ public final LotPersonneDroits clone() throws CloneNotSupportedException {
+ LotPersonneDroits clone = new LotPersonneDroits();
+ clone.id = id.clone();
+ clone.droits = droits.clone();
+ return clone;
+ }
- /**
- * droits getter
- * @return droits
- */
- public Droits getDroits() {
- return droits;
- }
+ /**
+ * droits getter
+ * @return droits
+ */
+ public Droits getDroits() {
+ return droits;
+ }
- /**
- * droits setter
- * @param droits droits
- */
- public void setDroits(Droits droits) {
- this.droits = droits;
- }
+ /**
+ * droits setter
+ * @param droits droits
+ */
+ public void setDroits(Droits droits) {
+ this.droits = droits;
+ }
- /**
- * id getter
- * @return id
- */
- public CompositeId<Lot, Personne> getId() {
- return id;
- }
+ /**
+ * id getter
+ * @return id
+ */
+ public CompositeId<Lot, Personne> getId() {
+ return id;
+ }
- /**
- * id setter
- * @param id id
- */
- public void setId(CompositeId<Lot, Personne> id) {
- this.id = id;
- }
+ /**
+ * id setter
+ * @param id id
+ */
+ public void setId(CompositeId<Lot, Personne> id) {
+ this.id = id;
+ }
}
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/MethodeExtraction.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/MethodeExtraction.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/MethodeExtraction.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -51,118 +51,118 @@
@Entity
public class MethodeExtraction extends AbstractModel implements Comparable<MethodeExtraction> {
- /** Id de la méthode */
- @Id
- @GeneratedValue
- private Integer idMethodeExtraction;
+ /** Id de la méthode */
+ @Id
+ @GeneratedValue
+ private Integer idMethodeExtraction;
- /** Nom de la méthode */
- @Length(max = LENGTH_MEDIUM_TEXT)
- @Column(unique = true)
- @NotEmpty
- private String nom;
+ /** Nom de la méthode */
+ @Length(max = LENGTH_MEDIUM_TEXT)
+ @Column(unique = true)
+ @NotEmpty
+ private String nom;
- /** Description de la méthode */
- @NotEmpty
- @Lob
- @Type(type="org.hibernate.type.StringClobType") // see HHH-6105
- private String description;
+ /** Description de la méthode */
+ @NotEmpty
+ @Lob
+ @Type(type="org.hibernate.type.StringClobType") // see HHH-6105
+ private String description;
- /** Types extraits définis en sortie pour la méthode */
- @OneToMany(mappedBy = "methodeExtraction", fetch = FetchType.LAZY, orphanRemoval = true)
- @Cascade({ CascadeType.SAVE_UPDATE })
- private List<TypeExtrait> typesEnSortie;
+ /** Types extraits définis en sortie pour la méthode */
+ @OneToMany(mappedBy = "methodeExtraction", fetch = FetchType.LAZY, orphanRemoval = true)
+ @Cascade({ CascadeType.SAVE_UPDATE })
+ private List<TypeExtrait> typesEnSortie;
- /**
- * Constructor
- */
- public MethodeExtraction() {
- typesEnSortie = new ArrayList<TypeExtrait>();
- }
+ /**
+ * Constructor
+ */
+ public MethodeExtraction() {
+ typesEnSortie = new ArrayList<TypeExtrait>();
+ }
- /** {@inheritDoc} */
- @Override
- public String toString() {
- return nom;
- }
+ /** {@inheritDoc} */
+ @Override
+ public String toString() {
+ return nom;
+ }
- /** {@inheritDoc} */
- @Override
- public int compareTo(MethodeExtraction methodeExtraction) {
- return new BeanComparator("nom").compare(this, methodeExtraction);
- }
+ /** {@inheritDoc} */
+ @Override
+ public int compareTo(MethodeExtraction methodeExtraction) {
+ return new BeanComparator("nom").compare(this, methodeExtraction);
+ }
- /**
- * Rend les types d'extraits triés par initiales
- * @return Les types d'extraits
- */
- public List<TypeExtrait> getSortedTypesEnSortie() {
- Collections.sort(typesEnSortie);
- return typesEnSortie;
- }
+ /**
+ * Rend les types d'extraits triés par initiales
+ * @return Les types d'extraits
+ */
+ public List<TypeExtrait> getSortedTypesEnSortie() {
+ Collections.sort(typesEnSortie);
+ return typesEnSortie;
+ }
- /**
- * idMethodeExtraction getter
- * @return idMethodeExtraction
- */
- public Integer getIdMethodeExtraction() {
- return idMethodeExtraction;
- }
+ /**
+ * idMethodeExtraction getter
+ * @return idMethodeExtraction
+ */
+ public Integer getIdMethodeExtraction() {
+ return idMethodeExtraction;
+ }
- /**
- * idMethodeExtraction setter
- * @param idMethodeExtraction idMethodeExtraction
- */
- public void setIdMethodeExtraction(Integer idMethodeExtraction) {
- this.idMethodeExtraction = idMethodeExtraction;
- }
+ /**
+ * idMethodeExtraction setter
+ * @param idMethodeExtraction idMethodeExtraction
+ */
+ public void setIdMethodeExtraction(Integer idMethodeExtraction) {
+ this.idMethodeExtraction = idMethodeExtraction;
+ }
- /**
- * nom getter
- * @return nom
- */
- public String getNom() {
- return nom;
- }
+ /**
+ * nom getter
+ * @return nom
+ */
+ public String getNom() {
+ return nom;
+ }
- /**
- * nom setter
- * @param nom nom
- */
- public void setNom(String nom) {
- this.nom = nom;
- }
+ /**
+ * nom setter
+ * @param nom nom
+ */
+ public void setNom(String nom) {
+ this.nom = nom;
+ }
- /**
- * description getter
- * @return description
- */
- public String getDescription() {
- return description;
- }
+ /**
+ * description getter
+ * @return description
+ */
+ public String getDescription() {
+ return description;
+ }
- /**
- * description setter
- * @param description description
- */
- public void setDescription(String description) {
- this.description = description;
- }
+ /**
+ * description setter
+ * @param description description
+ */
+ public void setDescription(String description) {
+ this.description = description;
+ }
- /**
- * typesEnSortie getter
- * @return typesEnSortie
- */
- public List<TypeExtrait> getTypesEnSortie() {
- return typesEnSortie;
- }
+ /**
+ * typesEnSortie getter
+ * @return typesEnSortie
+ */
+ public List<TypeExtrait> getTypesEnSortie() {
+ return typesEnSortie;
+ }
- /**
- * typesEnSortie setter
- * @param typesEnSortie typesEnSortie
- */
- public void setTypesEnSortie(List<TypeExtrait> typesEnSortie) {
- this.typesEnSortie = typesEnSortie;
- }
+ /**
+ * typesEnSortie setter
+ * @param typesEnSortie typesEnSortie
+ */
+ public void setTypesEnSortie(List<TypeExtrait> typesEnSortie) {
+ this.typesEnSortie = typesEnSortie;
+ }
}
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/MethodePurification.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/MethodePurification.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/MethodePurification.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -51,119 +51,119 @@
@Entity
public class MethodePurification extends AbstractModel implements Comparable<MethodePurification> {
- /** Id de la méthode */
- @Id
- @GeneratedValue
- private Integer idMethodePurification;
+ /** Id de la méthode */
+ @Id
+ @GeneratedValue
+ private Integer idMethodePurification;
- /** Nom de la méthode */
- @Length(max = LENGTH_MEDIUM_TEXT)
- @Column(unique = true)
- @NotEmpty
- private String nom;
+ /** Nom de la méthode */
+ @Length(max = LENGTH_MEDIUM_TEXT)
+ @Column(unique = true)
+ @NotEmpty
+ private String nom;
- /** Description de la méthode */
- @NotEmpty
- @Lob
- @Type(type="org.hibernate.type.StringClobType") // see HHH-6105
- private String description;
+ /** Description de la méthode */
+ @NotEmpty
+ @Lob
+ @Type(type="org.hibernate.type.StringClobType") // see HHH-6105
+ private String description;
- /** Types extraits définis en sortie pour la méthode */
- @OneToMany(mappedBy = "methodePurification", fetch = FetchType.LAZY, orphanRemoval = true)
- @Cascade({ CascadeType.SAVE_UPDATE })
- @OrderBy("index")
- private List<ParamMethoPuri> parametres;
+ /** Types extraits définis en sortie pour la méthode */
+ @OneToMany(mappedBy = "methodePurification", fetch = FetchType.LAZY, orphanRemoval = true)
+ @Cascade({ CascadeType.SAVE_UPDATE })
+ @OrderBy("index")
+ private List<ParamMethoPuri> parametres;
- /**
- * Constructor
- */
- public MethodePurification() {
- parametres = new ArrayList<ParamMethoPuri>();
- }
+ /**
+ * Constructor
+ */
+ public MethodePurification() {
+ parametres = new ArrayList<ParamMethoPuri>();
+ }
- /** {@inheritDoc} */
- @Override
- public String toString() {
- return nom;
- }
+ /** {@inheritDoc} */
+ @Override
+ public String toString() {
+ return nom;
+ }
- /** {@inheritDoc} */
- @Override
- public int compareTo(MethodePurification methodePurification) {
- return new BeanComparator("nom").compare(this, methodePurification);
- }
+ /** {@inheritDoc} */
+ @Override
+ public int compareTo(MethodePurification methodePurification) {
+ return new BeanComparator("nom").compare(this, methodePurification);
+ }
- /**
- * Rend les paramètres triés par index
- * @return Les paramètres
- */
- public List<ParamMethoPuri> getSortedParametres() {
- Collections.sort(parametres);
- return parametres;
- }
+ /**
+ * Rend les paramètres triés par index
+ * @return Les paramètres
+ */
+ public List<ParamMethoPuri> getSortedParametres() {
+ Collections.sort(parametres);
+ return parametres;
+ }
- /**
- * idMethodePurification getter
- * @return idMethodePurification
- */
- public Integer getIdMethodePurification() {
- return idMethodePurification;
- }
+ /**
+ * idMethodePurification getter
+ * @return idMethodePurification
+ */
+ public Integer getIdMethodePurification() {
+ return idMethodePurification;
+ }
- /**
- * idMethodePurification setter
- * @param idMethodePurification idMethodePurification
- */
- public void setIdMethodePurification(Integer idMethodePurification) {
- this.idMethodePurification = idMethodePurification;
- }
+ /**
+ * idMethodePurification setter
+ * @param idMethodePurification idMethodePurification
+ */
+ public void setIdMethodePurification(Integer idMethodePurification) {
+ this.idMethodePurification = idMethodePurification;
+ }
- /**
- * nom getter
- * @return nom
- */
- public String getNom() {
- return nom;
- }
+ /**
+ * nom getter
+ * @return nom
+ */
+ public String getNom() {
+ return nom;
+ }
- /**
- * nom setter
- * @param nom nom
- */
- public void setNom(String nom) {
- this.nom = nom;
- }
+ /**
+ * nom setter
+ * @param nom nom
+ */
+ public void setNom(String nom) {
+ this.nom = nom;
+ }
- /**
- * description getter
- * @return description
- */
- public String getDescription() {
- return description;
- }
+ /**
+ * description getter
+ * @return description
+ */
+ public String getDescription() {
+ return description;
+ }
- /**
- * description setter
- * @param description description
- */
- public void setDescription(String description) {
- this.description = description;
- }
+ /**
+ * description setter
+ * @param description description
+ */
+ public void setDescription(String description) {
+ this.description = description;
+ }
- /**
- * parametres getter
- * @return parametres
- */
- public List<ParamMethoPuri> getParametres() {
- return parametres;
- }
+ /**
+ * parametres getter
+ * @return parametres
+ */
+ public List<ParamMethoPuri> getParametres() {
+ return parametres;
+ }
- /**
- * parametres setter
- * @param parametres parametres
- */
- public void setParametres(List<ParamMethoPuri> parametres) {
- this.parametres = parametres;
- }
+ /**
+ * parametres setter
+ * @param parametres parametres
+ */
+ public void setParametres(List<ParamMethoPuri> parametres) {
+ this.parametres = parametres;
+ }
}
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/MethodeTestBio.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/MethodeTestBio.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/MethodeTestBio.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -48,188 +48,188 @@
@Embeddable
public class MethodeTestBio extends AbstractModel implements Comparable<MethodeTestBio> {
- /** Id de la méthode */
- @Id
- @GeneratedValue
- private Integer idMethodeTest;
+ /** Id de la méthode */
+ @Id
+ @GeneratedValue
+ private Integer idMethodeTest;
- /** Nom de la méthode */
- @Length(max = LENGTH_MEDIUM_TEXT)
- @Column(unique = true)
- @NotEmpty
- @Field(index=Index.YES, analyze=Analyze.YES, store=Store.YES)
- private String nom;
+ /** Nom de la méthode */
+ @Length(max = LENGTH_MEDIUM_TEXT)
+ @Column(unique = true)
+ @NotEmpty
+ @Field(index=Index.YES, analyze=Analyze.YES, store=Store.YES)
+ private String nom;
- /** Cible pour un test (acronyme du nom de méthode) */
- @Length(max = LENGTH_MEDIUM_TEXT)
- @Column(unique = true)
- @NotEmpty
- @Field(index=Index.YES, analyze=Analyze.YES, store=Store.YES)
- private String cible;
+ /** Cible pour un test (acronyme du nom de méthode) */
+ @Length(max = LENGTH_MEDIUM_TEXT)
+ @Column(unique = true)
+ @NotEmpty
+ @Field(index=Index.YES, analyze=Analyze.YES, store=Store.YES)
+ private String cible;
- /** Domaine de recherche pour le test */
- @Length(max = LENGTH_MEDIUM_TEXT)
- @NotEmpty
- private String domaine;
+ /** Domaine de recherche pour le test */
+ @Length(max = LENGTH_MEDIUM_TEXT)
+ @NotEmpty
+ private String domaine;
- /** Description de la méthode */
- @NotEmpty
- @Lob
- @Type(type="org.hibernate.type.StringClobType") // see HHH-6105
- private String description;
+ /** Description de la méthode */
+ @NotEmpty
+ @Lob
+ @Type(type="org.hibernate.type.StringClobType") // see HHH-6105
+ private String description;
- /** Valeur mesurée pour la méthode */
- @Length(max = LENGTH_LONG_TEXT)
- @NotEmpty
- private String valeurMesuree;
+ /** Valeur mesurée pour la méthode */
+ @Length(max = LENGTH_LONG_TEXT)
+ @NotEmpty
+ private String valeurMesuree;
- /** Unité de mesure */
- @Length(max = LENGTH_TINY_TEXT)
- @NotEmpty
- private String uniteResultat;
+ /** Unité de mesure */
+ @Length(max = LENGTH_TINY_TEXT)
+ @NotEmpty
+ private String uniteResultat;
- /** Critère d'activité de la méthode */
- @Length(max = LENGTH_LONG_TEXT)
- private String critereActivite;
+ /** Critère d'activité de la méthode */
+ @Length(max = LENGTH_LONG_TEXT)
+ private String critereActivite;
- /** {@inheritDoc} */
- @Override
- public String toString() {
- return nom;
- }
+ /** {@inheritDoc} */
+ @Override
+ public String toString() {
+ return nom;
+ }
- /** {@inheritDoc} */
- @Override
- public int compareTo(MethodeTestBio methodeTest) {
- return new BeanComparator("nom").compare(this, methodeTest);
- }
+ /** {@inheritDoc} */
+ @Override
+ public int compareTo(MethodeTestBio methodeTest) {
+ return new BeanComparator("nom").compare(this, methodeTest);
+ }
- /**
- * idMethodeTest getter
- * @return idMethodeTest
- */
- public Integer getIdMethodeTest() {
- return idMethodeTest;
- }
+ /**
+ * idMethodeTest getter
+ * @return idMethodeTest
+ */
+ public Integer getIdMethodeTest() {
+ return idMethodeTest;
+ }
- /**
- * idMethodeTest setter
- * @param idMethodeTest idMethodeTest
- */
- public void setIdMethodeTest(Integer idMethodeTest) {
- this.idMethodeTest = idMethodeTest;
- }
+ /**
+ * idMethodeTest setter
+ * @param idMethodeTest idMethodeTest
+ */
+ public void setIdMethodeTest(Integer idMethodeTest) {
+ this.idMethodeTest = idMethodeTest;
+ }
- /**
- * nom getter
- * @return nom
- */
- public String getNom() {
- return nom;
- }
+ /**
+ * nom getter
+ * @return nom
+ */
+ public String getNom() {
+ return nom;
+ }
- /**
- * nom setter
- * @param nom nom
- */
- public void setNom(String nom) {
- this.nom = nom;
- }
+ /**
+ * nom setter
+ * @param nom nom
+ */
+ public void setNom(String nom) {
+ this.nom = nom;
+ }
- /**
- * cible getter
- * @return cible
- */
- public String getCible() {
- return cible;
- }
+ /**
+ * cible getter
+ * @return cible
+ */
+ public String getCible() {
+ return cible;
+ }
- /**
- * cible setter
- * @param cible cible
- */
- public void setCible(String cible) {
- this.cible = cible;
- }
+ /**
+ * cible setter
+ * @param cible cible
+ */
+ public void setCible(String cible) {
+ this.cible = cible;
+ }
- /**
- * domaine getter
- * @return domaine
- */
- public String getDomaine() {
- return domaine;
- }
+ /**
+ * domaine getter
+ * @return domaine
+ */
+ public String getDomaine() {
+ return domaine;
+ }
- /**
- * domaine setter
- * @param domaine domaine
- */
- public void setDomaine(String domaine) {
- this.domaine = domaine;
- }
+ /**
+ * domaine setter
+ * @param domaine domaine
+ */
+ public void setDomaine(String domaine) {
+ this.domaine = domaine;
+ }
- /**
- * description getter
- * @return description
- */
- public String getDescription() {
- return description;
- }
+ /**
+ * description getter
+ * @return description
+ */
+ public String getDescription() {
+ return description;
+ }
- /**
- * description setter
- * @param description description
- */
- public void setDescription(String description) {
- this.description = description;
- }
+ /**
+ * description setter
+ * @param description description
+ */
+ public void setDescription(String description) {
+ this.description = description;
+ }
- /**
- * valeurMesuree getter
- * @return valeurMesuree
- */
- public String getValeurMesuree() {
- return valeurMesuree;
- }
+ /**
+ * valeurMesuree getter
+ * @return valeurMesuree
+ */
+ public String getValeurMesuree() {
+ return valeurMesuree;
+ }
- /**
- * valeurMesuree setter
- * @param valeurMesuree valeurMesuree
- */
- public void setValeurMesuree(String valeurMesuree) {
- this.valeurMesuree = valeurMesuree;
- }
+ /**
+ * valeurMesuree setter
+ * @param valeurMesuree valeurMesuree
+ */
+ public void setValeurMesuree(String valeurMesuree) {
+ this.valeurMesuree = valeurMesuree;
+ }
- /**
- * uniteResultat getter
- * @return uniteResultat
- */
- public String getUniteResultat() {
- return uniteResultat;
- }
+ /**
+ * uniteResultat getter
+ * @return uniteResultat
+ */
+ public String getUniteResultat() {
+ return uniteResultat;
+ }
- /**
- * uniteResultat setter
- * @param uniteResultat uniteResultat
- */
- public void setUniteResultat(String uniteResultat) {
- this.uniteResultat = uniteResultat;
- }
+ /**
+ * uniteResultat setter
+ * @param uniteResultat uniteResultat
+ */
+ public void setUniteResultat(String uniteResultat) {
+ this.uniteResultat = uniteResultat;
+ }
- /**
- * critereActivite getter
- * @return critereActivite
- */
- public String getCritereActivite() {
- return critereActivite;
- }
+ /**
+ * critereActivite getter
+ * @return critereActivite
+ */
+ public String getCritereActivite() {
+ return critereActivite;
+ }
- /**
- * critereActivite setter
- * @param critereActivite critereActivite
- */
- public void setCritereActivite(String critereActivite) {
- this.critereActivite = critereActivite;
- }
+ /**
+ * critereActivite setter
+ * @param critereActivite critereActivite
+ */
+ public void setCritereActivite(String critereActivite) {
+ this.critereActivite = critereActivite;
+ }
}
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/ParamMethoPuri.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/ParamMethoPuri.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/ParamMethoPuri.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -47,132 +47,132 @@
@CollectionUniqueField(fieldName = "nom", pathToCollection = "methodePurification.parametres")
public class ParamMethoPuri extends AbstractModel implements Cloneable, Comparable<ParamMethoPuri> {
- /** Id du type d'extrait */
- @Id
- @GeneratedValue
- private Integer idParamMethoPuri;
+ /** Id du type d'extrait */
+ @Id
+ @GeneratedValue
+ private Integer idParamMethoPuri;
- /** Index to order parameters */
- @NotNull
- @Min(value = 0)
- private Integer index;
+ /** Index to order parameters */
+ @NotNull
+ @Min(value = 0)
+ private Integer index;
- /** Initiales du type d'extrait */
- @Length(max = LENGTH_MEDIUM_TEXT)
- @NotEmpty
- private String nom;
+ /** Initiales du type d'extrait */
+ @Length(max = LENGTH_MEDIUM_TEXT)
+ @NotEmpty
+ private String nom;
- /** Description du type d'extrait */
- @NotEmpty
- @Lob
- @Type(type="org.hibernate.type.StringClobType") // see HHH-6105
- private String description;
+ /** Description du type d'extrait */
+ @NotEmpty
+ @Lob
+ @Type(type="org.hibernate.type.StringClobType") // see HHH-6105
+ private String description;
- /** Méthode d'extraction pour laquelle est défini le type d'extrait */
- @NotNull
- @ManyToOne(fetch = FetchType.LAZY, optional = false)
- private MethodePurification methodePurification;
+ /** Méthode d'extraction pour laquelle est défini le type d'extrait */
+ @NotNull
+ @ManyToOne(fetch = FetchType.LAZY, optional = false)
+ private MethodePurification methodePurification;
- /** {@inheritDoc} */
- @Override
- public ParamMethoPuri clone() throws CloneNotSupportedException {
- ParamMethoPuri clone = (ParamMethoPuri) super.clone();
- clone.idParamMethoPuri = idParamMethoPuri;
- clone.nom = nom;
- clone.description = description;
- return clone;
- }
+ /** {@inheritDoc} */
+ @Override
+ public ParamMethoPuri clone() throws CloneNotSupportedException {
+ ParamMethoPuri clone = (ParamMethoPuri) super.clone();
+ clone.idParamMethoPuri = idParamMethoPuri;
+ clone.nom = nom;
+ clone.description = description;
+ return clone;
+ }
- /** {@inheritDoc} */
- @Override
- public String toString() {
- return this.nom;
- }
+ /** {@inheritDoc} */
+ @Override
+ public String toString() {
+ return this.nom;
+ }
- /** {@inheritDoc} */
- @Override
- public int compareTo(ParamMethoPuri paramMethoPuri) {
- return new BeanComparator("index").compare(this, paramMethoPuri);
- }
+ /** {@inheritDoc} */
+ @Override
+ public int compareTo(ParamMethoPuri paramMethoPuri) {
+ return new BeanComparator("index").compare(this, paramMethoPuri);
+ }
- /**
- * idParamMethoPuri getter
- * @return idParamMethoPuri
- */
- public Integer getIdParamMethoPuri() {
- return idParamMethoPuri;
- }
+ /**
+ * idParamMethoPuri getter
+ * @return idParamMethoPuri
+ */
+ public Integer getIdParamMethoPuri() {
+ return idParamMethoPuri;
+ }
- /**
- * idParamMethoPuri setter
- * @param idParamMethoPuri idParamMethoPuri
- */
- public void setIdParamMethoPuri(Integer idParamMethoPuri) {
- this.idParamMethoPuri = idParamMethoPuri;
- }
+ /**
+ * idParamMethoPuri setter
+ * @param idParamMethoPuri idParamMethoPuri
+ */
+ public void setIdParamMethoPuri(Integer idParamMethoPuri) {
+ this.idParamMethoPuri = idParamMethoPuri;
+ }
- /**
- * index getter
- * @return index
- */
- public Integer getIndex() {
- return index;
- }
+ /**
+ * index getter
+ * @return index
+ */
+ public Integer getIndex() {
+ return index;
+ }
- /**
- * index setter
- * @param index index
- */
- public void setIndex(Integer index) {
- this.index = index;
- }
+ /**
+ * index setter
+ * @param index index
+ */
+ public void setIndex(Integer index) {
+ this.index = index;
+ }
- /**
- * nom getter
- * @return nom
- */
- public String getNom() {
- return nom;
- }
+ /**
+ * nom getter
+ * @return nom
+ */
+ public String getNom() {
+ return nom;
+ }
- /**
- * nom setter
- * @param nom nom
- */
- public void setNom(String nom) {
- this.nom = nom;
- }
+ /**
+ * nom setter
+ * @param nom nom
+ */
+ public void setNom(String nom) {
+ this.nom = nom;
+ }
- /**
- * description getter
- * @return description
- */
- public String getDescription() {
- return description;
- }
+ /**
+ * description getter
+ * @return description
+ */
+ public String getDescription() {
+ return description;
+ }
- /**
- * description setter
- * @param description description
- */
- public void setDescription(String description) {
- this.description = description;
- }
+ /**
+ * description setter
+ * @param description description
+ */
+ public void setDescription(String description) {
+ this.description = description;
+ }
- /**
- * methodePurification getter
- * @return methodePurification
- */
- public MethodePurification getMethodePurification() {
- return methodePurification;
- }
+ /**
+ * methodePurification getter
+ * @return methodePurification
+ */
+ public MethodePurification getMethodePurification() {
+ return methodePurification;
+ }
- /**
- * methodePurification setter
- * @param methodePurification methodePurification
- */
- public void setMethodePurification(MethodePurification methodePurification) {
- this.methodePurification = methodePurification;
- }
+ /**
+ * methodePurification setter
+ * @param methodePurification methodePurification
+ */
+ public void setMethodePurification(MethodePurification methodePurification) {
+ this.methodePurification = methodePurification;
+ }
}
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/ParamMethoPuriEffectif.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/ParamMethoPuriEffectif.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/ParamMethoPuriEffectif.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -42,110 +42,110 @@
@Table
public class ParamMethoPuriEffectif extends AbstractModel implements Cloneable {
- /** Id du paramètre effectif */
- @Id
- @GeneratedValue
- private Integer idParamMethoPuriEffectif;
+ /** Id du paramètre effectif */
+ @Id
+ @GeneratedValue
+ private Integer idParamMethoPuriEffectif;
- /** Paramètre */
- @NotNull
- @ManyToOne(fetch = FetchType.EAGER)
- private ParamMethoPuri param;
+ /** Paramètre */
+ @NotNull
+ @ManyToOne(fetch = FetchType.EAGER)
+ private ParamMethoPuri param;
- /** Valeur du paramètre */
- @Length(max = LENGTH_LONG_TEXT)
- private String valeur;
+ /** Valeur du paramètre */
+ @Length(max = LENGTH_LONG_TEXT)
+ private String valeur;
- /** Purification à laquelle se rattache le paramètre effectif */
- @NotNull
- @ManyToOne(fetch = FetchType.LAZY, optional = false)
- private Purification purification;
+ /** Purification à laquelle se rattache le paramètre effectif */
+ @NotNull
+ @ManyToOne(fetch = FetchType.LAZY, optional = false)
+ private Purification purification;
- /**
- * Constructor
- */
- public ParamMethoPuriEffectif() {
- //
- }
+ /**
+ * Constructor
+ */
+ public ParamMethoPuriEffectif() {
+ //
+ }
- /** {@inheritDoc} */
- @Override
- public ParamMethoPuriEffectif clone() throws CloneNotSupportedException {
- ParamMethoPuriEffectif clone = (ParamMethoPuriEffectif) super.clone();
- clone.idParamMethoPuriEffectif = idParamMethoPuriEffectif;
- clone.param = param;
- clone.valeur = valeur;
- return clone;
- }
+ /** {@inheritDoc} */
+ @Override
+ public ParamMethoPuriEffectif clone() throws CloneNotSupportedException {
+ ParamMethoPuriEffectif clone = (ParamMethoPuriEffectif) super.clone();
+ clone.idParamMethoPuriEffectif = idParamMethoPuriEffectif;
+ clone.param = param;
+ clone.valeur = valeur;
+ return clone;
+ }
- /** {@inheritDoc} */
- @Override
- public String toString() {
- return param + " : " + valeur;
- }
+ /** {@inheritDoc} */
+ @Override
+ public String toString() {
+ return param + " : " + valeur;
+ }
- /**
- * idParamMethoPuriEffectif getter
- * @return idParamMethoPuriEffectif
- */
- public Integer getIdParamMethoPuriEffectif() {
- return idParamMethoPuriEffectif;
- }
+ /**
+ * idParamMethoPuriEffectif getter
+ * @return idParamMethoPuriEffectif
+ */
+ public Integer getIdParamMethoPuriEffectif() {
+ return idParamMethoPuriEffectif;
+ }
- /**
- * idParamMethoPuriEffectif setter
- * @param idParamMethoPuriEffectif idParamMethoPuriEffectif
- */
- public void setIdParamMethoPuriEffectif(Integer idParamMethoPuriEffectif) {
- this.idParamMethoPuriEffectif = idParamMethoPuriEffectif;
- }
+ /**
+ * idParamMethoPuriEffectif setter
+ * @param idParamMethoPuriEffectif idParamMethoPuriEffectif
+ */
+ public void setIdParamMethoPuriEffectif(Integer idParamMethoPuriEffectif) {
+ this.idParamMethoPuriEffectif = idParamMethoPuriEffectif;
+ }
- /**
- * param getter
- * @return param
- */
- public ParamMethoPuri getParam() {
- return param;
- }
+ /**
+ * param getter
+ * @return param
+ */
+ public ParamMethoPuri getParam() {
+ return param;
+ }
- /**
- * param setter
- * @param param param
- */
- public void setParam(ParamMethoPuri param) {
- this.param = param;
- }
+ /**
+ * param setter
+ * @param param param
+ */
+ public void setParam(ParamMethoPuri param) {
+ this.param = param;
+ }
- /**
- * valeur getter
- * @return valeur
- */
- public String getValeur() {
- return valeur;
- }
+ /**
+ * valeur getter
+ * @return valeur
+ */
+ public String getValeur() {
+ return valeur;
+ }
- /**
- * valeur setter
- * @param valeur valeur
- */
- public void setValeur(String valeur) {
- this.valeur = valeur;
- }
+ /**
+ * valeur setter
+ * @param valeur valeur
+ */
+ public void setValeur(String valeur) {
+ this.valeur = valeur;
+ }
- /**
- * purification getter
- * @return purification
- */
- public Purification getPurification() {
- return purification;
- }
+ /**
+ * purification getter
+ * @return purification
+ */
+ public Purification getPurification() {
+ return purification;
+ }
- /**
- * purification setter
- * @param purification purification
- */
- public void setPurification(Purification purification) {
- this.purification = purification;
- }
+ /**
+ * purification setter
+ * @param purification purification
+ */
+ public void setPurification(Purification purification) {
+ this.purification = purification;
+ }
}
\ No newline at end of file
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Partie.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Partie.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Partie.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -43,59 +43,59 @@
@Table
public class Partie extends AbstractModel implements Comparable<Partie> {
- /** Id de la partie */
- @Id
- @GeneratedValue
- private Integer idPartie;
+ /** Id de la partie */
+ @Id
+ @GeneratedValue
+ private Integer idPartie;
- /** Nom */
- @Length(max = LENGTH_MEDIUM_TEXT)
- @NotEmpty
- @Column(unique = true)
- private String nom;
+ /** Nom */
+ @Length(max = LENGTH_MEDIUM_TEXT)
+ @NotEmpty
+ @Column(unique = true)
+ private String nom;
- /** {@inheritDoc} */
- @Override
- public String toString() {
- return nom;
- }
+ /** {@inheritDoc} */
+ @Override
+ public String toString() {
+ return nom;
+ }
- /** {@inheritDoc} */
- @Override
- public int compareTo(Partie partie) {
- return new BeanComparator("nom").compare(this, partie);
- }
+ /** {@inheritDoc} */
+ @Override
+ public int compareTo(Partie partie) {
+ return new BeanComparator("nom").compare(this, partie);
+ }
- /**
- * idPartie getter
- * @return idPartie
- */
- public Integer getIdPartie() {
- return idPartie;
- }
+ /**
+ * idPartie getter
+ * @return idPartie
+ */
+ public Integer getIdPartie() {
+ return idPartie;
+ }
- /**
- * idPartie setter
- * @param idPartie idPartie
- */
- public void setIdPartie(Integer idPartie) {
- this.idPartie = idPartie;
- }
+ /**
+ * idPartie setter
+ * @param idPartie idPartie
+ */
+ public void setIdPartie(Integer idPartie) {
+ this.idPartie = idPartie;
+ }
- /**
- * nom getter
- * @return nom
- */
- public String getNom() {
- return nom;
- }
+ /**
+ * nom getter
+ * @return nom
+ */
+ public String getNom() {
+ return nom;
+ }
- /**
- * nom setter
- * @param nom nom
- */
- public void setNom(String nom) {
- this.nom = nom;
- }
+ /**
+ * nom setter
+ * @param nom nom
+ */
+ public void setNom(String nom) {
+ this.nom = nom;
+ }
}
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Personne.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Personne.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Personne.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -64,503 +64,503 @@
@Inheritance(strategy = InheritanceType.JOINED)
public class Personne extends AbstractModel implements Comparable<Personne> {
- /** ID */
- @Id
- @GeneratedValue
- private Integer idPersonne;
+ /** ID */
+ @Id
+ @GeneratedValue
+ private Integer idPersonne;
- /** Adresse postale */
- @NotEmpty
- @Lob
- @Type(type="org.hibernate.type.StringClobType") // see HHH-6105
- private String adressePostale;
+ /** Adresse postale */
+ @NotEmpty
+ @Lob
+ @Type(type="org.hibernate.type.StringClobType") // see HHH-6105
+ private String adressePostale;
- /** Campagnes créées */
- @OneToMany(mappedBy = "createur", fetch = FetchType.LAZY)
- @NotNull
- private List<Campagne> campagnesCreees;
+ /** Campagnes créées */
+ @OneToMany(mappedBy = "createur", fetch = FetchType.LAZY)
+ @NotNull
+ private List<Campagne> campagnesCreees;
- /** Droits sur les campagnes */
- @NotNull
- @OneToMany(mappedBy = "id.pk2", fetch = FetchType.LAZY, orphanRemoval = true)
- @MapKey(name = "id.pk1")
- @Cascade({ CascadeType.SAVE_UPDATE })
- private Map<Campagne, CampagnePersonneDroits> campagnesDroits;
+ /** Droits sur les campagnes */
+ @NotNull
+ @OneToMany(mappedBy = "id.pk2", fetch = FetchType.LAZY, orphanRemoval = true)
+ @MapKey(name = "id.pk1")
+ @Cascade({ CascadeType.SAVE_UPDATE })
+ private Map<Campagne, CampagnePersonneDroits> campagnesDroits;
- /** Campagnes participées */
- @OneToMany(mappedBy = "id.pk2", fetch = FetchType.LAZY)
- @NotNull
- private List<CampagnePersonneParticipant> campagnesParticipees;
+ /** Campagnes participées */
+ @OneToMany(mappedBy = "id.pk2", fetch = FetchType.LAZY)
+ @NotNull
+ private List<CampagnePersonneParticipant> campagnesParticipees;
- /** Code pays */
- @NotEmpty
- @Length(min = 2, max = 2)
- @CountryCode
- private String codePays;
+ /** Code pays */
+ @NotEmpty
+ @Length(min = 2, max = 2)
+ @CountryCode
+ private String codePays;
- /** Code postal */
- @Length(max = LENGTH_TINY_TEXT)
- @NotEmpty
- private String codePostal;
+ /** Code postal */
+ @Length(max = LENGTH_TINY_TEXT)
+ @NotEmpty
+ private String codePostal;
- /** Courriel */
- @Column(unique = true)
- @Length(max = LENGTH_MEDIUM_TEXT)
- @Email
- @NotEmpty
- @Index(name = "courriel")
- private String courriel;
+ /** Courriel */
+ @Column(unique = true)
+ @Length(max = LENGTH_MEDIUM_TEXT)
+ @Email
+ @NotEmpty
+ @Index(name = "courriel")
+ private String courriel;
- /** Fax */
- @Length(max = LENGTH_MEDIUM_TEXT)
- private String fax;
+ /** Fax */
+ @Length(max = LENGTH_MEDIUM_TEXT)
+ private String fax;
- /** Fonction */
- @Length(max = LENGTH_MEDIUM_TEXT)
- private String fonction;
+ /** Fonction */
+ @Length(max = LENGTH_MEDIUM_TEXT)
+ private String fonction;
- /** Lots créés */
- @OneToMany(mappedBy = "createur", fetch = FetchType.LAZY)
- @NotNull
- private List<Lot> lotsCrees;
+ /** Lots créés */
+ @OneToMany(mappedBy = "createur", fetch = FetchType.LAZY)
+ @NotNull
+ private List<Lot> lotsCrees;
- /** Droits lots */
- @NotNull
- @OneToMany(mappedBy = "id.pk2", fetch = FetchType.LAZY, orphanRemoval = true)
- @MapKey(name = "id.pk1")
- @Cascade({ CascadeType.SAVE_UPDATE })
- private Map<Lot, LotPersonneDroits> lotsDroits;
+ /** Droits lots */
+ @NotNull
+ @OneToMany(mappedBy = "id.pk2", fetch = FetchType.LAZY, orphanRemoval = true)
+ @MapKey(name = "id.pk1")
+ @Cascade({ CascadeType.SAVE_UPDATE })
+ private Map<Lot, LotPersonneDroits> lotsDroits;
- /** Nom */
- @Length(max = LENGTH_MEDIUM_TEXT)
- @NotEmpty
- private String nom;
+ /** Nom */
+ @Length(max = LENGTH_MEDIUM_TEXT)
+ @NotEmpty
+ private String nom;
- /** Organisme */
- @Length(max = LENGTH_MEDIUM_TEXT)
- @NotEmpty
- private String organisme;
+ /** Organisme */
+ @Length(max = LENGTH_MEDIUM_TEXT)
+ @NotEmpty
+ private String organisme;
- /** Prénom */
- @Length(max = LENGTH_MEDIUM_TEXT)
- @NotEmpty
- private String prenom;
+ /** Prénom */
+ @Length(max = LENGTH_MEDIUM_TEXT)
+ @NotEmpty
+ private String prenom;
- /** Téléphone */
- @Length(max = LENGTH_MEDIUM_TEXT)
- private String tel;
+ /** Téléphone */
+ @Length(max = LENGTH_MEDIUM_TEXT)
+ private String tel;
- /** Ville */
- @Length(max = LENGTH_MEDIUM_TEXT)
- @NotEmpty
- private String ville;
+ /** Ville */
+ @Length(max = LENGTH_MEDIUM_TEXT)
+ @NotEmpty
+ private String ville;
- /** Stations créées */
- @OneToMany(mappedBy = "createur", fetch = FetchType.LAZY)
- @NotNull
- private List<Station> stationsCrees;
+ /** Stations créées */
+ @OneToMany(mappedBy = "createur", fetch = FetchType.LAZY)
+ @NotNull
+ private List<Station> stationsCrees;
- /** Spécimens créés */
- @OneToMany(mappedBy = "createur", fetch = FetchType.LAZY)
- @NotNull
- private List<Specimen> specimensCrees;
+ /** Spécimens créés */
+ @OneToMany(mappedBy = "createur", fetch = FetchType.LAZY)
+ @NotNull
+ private List<Specimen> specimensCrees;
- /** Extractions créées */
- @OneToMany(mappedBy = "createur", fetch = FetchType.LAZY)
- @NotNull
- private List<Extraction> extractionsCrees;
+ /** Extractions créées */
+ @OneToMany(mappedBy = "createur", fetch = FetchType.LAZY)
+ @NotNull
+ private List<Extraction> extractionsCrees;
- /** Purification créées */
- @OneToMany(mappedBy = "createur", fetch = FetchType.LAZY)
- @NotNull
- private List<Purification> purificationsCrees;
+ /** Purification créées */
+ @OneToMany(mappedBy = "createur", fetch = FetchType.LAZY)
+ @NotNull
+ private List<Purification> purificationsCrees;
- /** Tests biologiques créés */
- @OneToMany(mappedBy = "createur", fetch = FetchType.LAZY)
- @NotNull
- private List<TestBio> testsBioCrees;
+ /** Tests biologiques créés */
+ @OneToMany(mappedBy = "createur", fetch = FetchType.LAZY)
+ @NotNull
+ private List<TestBio> testsBioCrees;
- /**
- * Constructeur
- */
- public Personne() {
- campagnesCreees = new ArrayList<Campagne>();
- campagnesParticipees = new ArrayList<CampagnePersonneParticipant>();
- campagnesDroits = new HashMap<Campagne, CampagnePersonneDroits>();
- lotsCrees = new ArrayList<Lot>();
- lotsDroits = new HashMap<Lot, LotPersonneDroits>();
- stationsCrees = new ArrayList<Station>();
- specimensCrees = new ArrayList<Specimen>();
- extractionsCrees = new ArrayList<Extraction>();
- purificationsCrees = new ArrayList<Purification>();
- testsBioCrees = new ArrayList<TestBio>();
- }
+ /**
+ * Constructeur
+ */
+ public Personne() {
+ campagnesCreees = new ArrayList<Campagne>();
+ campagnesParticipees = new ArrayList<CampagnePersonneParticipant>();
+ campagnesDroits = new HashMap<Campagne, CampagnePersonneDroits>();
+ lotsCrees = new ArrayList<Lot>();
+ lotsDroits = new HashMap<Lot, LotPersonneDroits>();
+ stationsCrees = new ArrayList<Station>();
+ specimensCrees = new ArrayList<Specimen>();
+ extractionsCrees = new ArrayList<Extraction>();
+ purificationsCrees = new ArrayList<Purification>();
+ testsBioCrees = new ArrayList<TestBio>();
+ }
- /** {@inheritDoc} */
- @Override
- public String toString() {
- return prenom + " " + nom;
- }
+ /** {@inheritDoc} */
+ @Override
+ public String toString() {
+ return prenom + " " + nom;
+ }
- /** {@inheritDoc} */
- @Override
- public int compareTo(Personne personne) {
- ComparatorChain comparatorChain = new ComparatorChain();
- comparatorChain.addComparator(new BeanComparator("nom"));
- comparatorChain.addComparator(new BeanComparator("prenom"));
- return comparatorChain.compare(this, personne);
- }
+ /** {@inheritDoc} */
+ @Override
+ public int compareTo(Personne personne) {
+ ComparatorChain comparatorChain = new ComparatorChain();
+ comparatorChain.addComparator(new BeanComparator("nom"));
+ comparatorChain.addComparator(new BeanComparator("prenom"));
+ return comparatorChain.compare(this, personne);
+ }
- /**
- * idPersonne getter
- * @return idPersonne
- */
- public Integer getIdPersonne() {
- return idPersonne;
- }
+ /**
+ * idPersonne getter
+ * @return idPersonne
+ */
+ public Integer getIdPersonne() {
+ return idPersonne;
+ }
- /**
- * idPersonne setter
- * @param idPersonne idPersonne
- */
- public void setIdPersonne(Integer idPersonne) {
- this.idPersonne = idPersonne;
- }
+ /**
+ * idPersonne setter
+ * @param idPersonne idPersonne
+ */
+ public void setIdPersonne(Integer idPersonne) {
+ this.idPersonne = idPersonne;
+ }
- /**
- * adressePostale getter
- * @return adressePostale
- */
- public String getAdressePostale() {
- return adressePostale;
- }
+ /**
+ * adressePostale getter
+ * @return adressePostale
+ */
+ public String getAdressePostale() {
+ return adressePostale;
+ }
- /**
- * adressePostale setter
- * @param adressePostale adressePostale
- */
- public void setAdressePostale(String adressePostale) {
- this.adressePostale = adressePostale;
- }
+ /**
+ * adressePostale setter
+ * @param adressePostale adressePostale
+ */
+ public void setAdressePostale(String adressePostale) {
+ this.adressePostale = adressePostale;
+ }
- /**
- * campagnesCreees getter
- * @return campagnesCreees
- */
- public List<Campagne> getCampagnesCreees() {
- return campagnesCreees;
- }
+ /**
+ * campagnesCreees getter
+ * @return campagnesCreees
+ */
+ public List<Campagne> getCampagnesCreees() {
+ return campagnesCreees;
+ }
- /**
- * campagnesCreees setter
- * @param campagnesCreees campagnesCreees
- */
- public void setCampagnesCreees(List<Campagne> campagnesCreees) {
- this.campagnesCreees = campagnesCreees;
- }
+ /**
+ * campagnesCreees setter
+ * @param campagnesCreees campagnesCreees
+ */
+ public void setCampagnesCreees(List<Campagne> campagnesCreees) {
+ this.campagnesCreees = campagnesCreees;
+ }
- /**
- * campagnesDroits getter
- * @return campagnesDroits
- */
- public Map<Campagne, CampagnePersonneDroits> getCampagnesDroits() {
- return campagnesDroits;
- }
+ /**
+ * campagnesDroits getter
+ * @return campagnesDroits
+ */
+ public Map<Campagne, CampagnePersonneDroits> getCampagnesDroits() {
+ return campagnesDroits;
+ }
- /**
- * campagnesDroits setter
- * @param campagnesDroits campagnesDroits
- */
- public void setCampagnesDroits(Map<Campagne, CampagnePersonneDroits> campagnesDroits) {
- this.campagnesDroits = campagnesDroits;
- }
+ /**
+ * campagnesDroits setter
+ * @param campagnesDroits campagnesDroits
+ */
+ public void setCampagnesDroits(Map<Campagne, CampagnePersonneDroits> campagnesDroits) {
+ this.campagnesDroits = campagnesDroits;
+ }
- /**
- * campagnesParticipees getter
- * @return campagnesParticipees
- */
- public List<CampagnePersonneParticipant> getCampagnesParticipees() {
- return campagnesParticipees;
- }
+ /**
+ * campagnesParticipees getter
+ * @return campagnesParticipees
+ */
+ public List<CampagnePersonneParticipant> getCampagnesParticipees() {
+ return campagnesParticipees;
+ }
- /**
- * campagnesParticipees setter
- * @param campagnesParticipees campagnesParticipees
- */
- public void setCampagnesParticipees(List<CampagnePersonneParticipant> campagnesParticipees) {
- this.campagnesParticipees = campagnesParticipees;
- }
+ /**
+ * campagnesParticipees setter
+ * @param campagnesParticipees campagnesParticipees
+ */
+ public void setCampagnesParticipees(List<CampagnePersonneParticipant> campagnesParticipees) {
+ this.campagnesParticipees = campagnesParticipees;
+ }
- /**
- * codePays getter
- * @return codePays
- */
- public String getCodePays() {
- return codePays;
- }
+ /**
+ * codePays getter
+ * @return codePays
+ */
+ public String getCodePays() {
+ return codePays;
+ }
- /**
- * codePays setter
- * @param codePays codePays
- */
- public void setCodePays(String codePays) {
- this.codePays = codePays;
- }
+ /**
+ * codePays setter
+ * @param codePays codePays
+ */
+ public void setCodePays(String codePays) {
+ this.codePays = codePays;
+ }
- /**
- * codePostal getter
- * @return codePostal
- */
- public String getCodePostal() {
- return codePostal;
- }
+ /**
+ * codePostal getter
+ * @return codePostal
+ */
+ public String getCodePostal() {
+ return codePostal;
+ }
- /**
- * codePostal setter
- * @param codePostal codePostal
- */
- public void setCodePostal(String codePostal) {
- this.codePostal = codePostal;
- }
+ /**
+ * codePostal setter
+ * @param codePostal codePostal
+ */
+ public void setCodePostal(String codePostal) {
+ this.codePostal = codePostal;
+ }
- /**
- * courriel getter
- * @return courriel
- */
- public String getCourriel() {
- return courriel;
- }
+ /**
+ * courriel getter
+ * @return courriel
+ */
+ public String getCourriel() {
+ return courriel;
+ }
- /**
- * courriel setter
- * @param courriel courriel
- */
- public void setCourriel(String courriel) {
- this.courriel = courriel;
- }
+ /**
+ * courriel setter
+ * @param courriel courriel
+ */
+ public void setCourriel(String courriel) {
+ this.courriel = courriel;
+ }
- /**
- * fax getter
- * @return fax
- */
- public String getFax() {
- return fax;
- }
+ /**
+ * fax getter
+ * @return fax
+ */
+ public String getFax() {
+ return fax;
+ }
- /**
- * fax setter
- * @param fax fax
- */
- public void setFax(String fax) {
- this.fax = fax;
- }
+ /**
+ * fax setter
+ * @param fax fax
+ */
+ public void setFax(String fax) {
+ this.fax = fax;
+ }
- /**
- * fonction getter
- * @return fonction
- */
- public String getFonction() {
- return fonction;
- }
+ /**
+ * fonction getter
+ * @return fonction
+ */
+ public String getFonction() {
+ return fonction;
+ }
- /**
- * fonction setter
- * @param fonction fonction
- */
- public void setFonction(String fonction) {
- this.fonction = fonction;
- }
+ /**
+ * fonction setter
+ * @param fonction fonction
+ */
+ public void setFonction(String fonction) {
+ this.fonction = fonction;
+ }
- /**
- * lotsCrees getter
- * @return lotsCrees
- */
- public List<Lot> getLotsCrees() {
- return lotsCrees;
- }
+ /**
+ * lotsCrees getter
+ * @return lotsCrees
+ */
+ public List<Lot> getLotsCrees() {
+ return lotsCrees;
+ }
- /**
- * lotsCrees setter
- * @param lotsCrees lotsCrees
- */
- public void setLotsCrees(List<Lot> lotsCrees) {
- this.lotsCrees = lotsCrees;
- }
+ /**
+ * lotsCrees setter
+ * @param lotsCrees lotsCrees
+ */
+ public void setLotsCrees(List<Lot> lotsCrees) {
+ this.lotsCrees = lotsCrees;
+ }
- /**
- * lotsDroits getter
- * @return lotsDroits
- */
- public Map<Lot, LotPersonneDroits> getLotsDroits() {
- return lotsDroits;
- }
+ /**
+ * lotsDroits getter
+ * @return lotsDroits
+ */
+ public Map<Lot, LotPersonneDroits> getLotsDroits() {
+ return lotsDroits;
+ }
- /**
- * lotsDroits setter
- * @param lotsDroits lotsDroits
- */
- public void setLotsDroits(Map<Lot, LotPersonneDroits> lotsDroits) {
- this.lotsDroits = lotsDroits;
- }
+ /**
+ * lotsDroits setter
+ * @param lotsDroits lotsDroits
+ */
+ public void setLotsDroits(Map<Lot, LotPersonneDroits> lotsDroits) {
+ this.lotsDroits = lotsDroits;
+ }
- /**
- * nom getter
- * @return nom
- */
- public String getNom() {
- return nom;
- }
+ /**
+ * nom getter
+ * @return nom
+ */
+ public String getNom() {
+ return nom;
+ }
- /**
- * nom setter
- * @param nom nom
- */
- public void setNom(String nom) {
- this.nom = nom;
- }
+ /**
+ * nom setter
+ * @param nom nom
+ */
+ public void setNom(String nom) {
+ this.nom = nom;
+ }
- /**
- * organisme getter
- * @return organisme
- */
- public String getOrganisme() {
- return organisme;
- }
+ /**
+ * organisme getter
+ * @return organisme
+ */
+ public String getOrganisme() {
+ return organisme;
+ }
- /**
- * organisme setter
- * @param organisme organisme
- */
- public void setOrganisme(String organisme) {
- this.organisme = organisme;
- }
+ /**
+ * organisme setter
+ * @param organisme organisme
+ */
+ public void setOrganisme(String organisme) {
+ this.organisme = organisme;
+ }
- /**
- * prenom getter
- * @return prenom
- */
- public String getPrenom() {
- return prenom;
- }
+ /**
+ * prenom getter
+ * @return prenom
+ */
+ public String getPrenom() {
+ return prenom;
+ }
- /**
- * prenom setter
- * @param prenom prenom
- */
- public void setPrenom(String prenom) {
- this.prenom = prenom;
- }
+ /**
+ * prenom setter
+ * @param prenom prenom
+ */
+ public void setPrenom(String prenom) {
+ this.prenom = prenom;
+ }
- /**
- * tel getter
- * @return tel
- */
- public String getTel() {
- return tel;
- }
+ /**
+ * tel getter
+ * @return tel
+ */
+ public String getTel() {
+ return tel;
+ }
- /**
- * tel setter
- * @param tel tel
- */
- public void setTel(String tel) {
- this.tel = tel;
- }
+ /**
+ * tel setter
+ * @param tel tel
+ */
+ public void setTel(String tel) {
+ this.tel = tel;
+ }
- /**
- * ville getter
- * @return ville
- */
- public String getVille() {
- return ville;
- }
+ /**
+ * ville getter
+ * @return ville
+ */
+ public String getVille() {
+ return ville;
+ }
- /**
- * ville setter
- * @param ville ville
- */
- public void setVille(String ville) {
- this.ville = ville;
- }
+ /**
+ * ville setter
+ * @param ville ville
+ */
+ public void setVille(String ville) {
+ this.ville = ville;
+ }
- /**
- * stationsCrees getter
- * @return stationsCrees
- */
- public List<Station> getStationsCrees() {
- return stationsCrees;
- }
+ /**
+ * stationsCrees getter
+ * @return stationsCrees
+ */
+ public List<Station> getStationsCrees() {
+ return stationsCrees;
+ }
- /**
- * stationsCrees setter
- * @param stationsCrees stationsCrees
- */
- public void setStationsCrees(List<Station> stationsCrees) {
- this.stationsCrees = stationsCrees;
- }
+ /**
+ * stationsCrees setter
+ * @param stationsCrees stationsCrees
+ */
+ public void setStationsCrees(List<Station> stationsCrees) {
+ this.stationsCrees = stationsCrees;
+ }
- /**
- * specimensCrees getter
- * @return specimensCrees
- */
- public List<Specimen> getSpecimensCrees() {
- return specimensCrees;
- }
+ /**
+ * specimensCrees getter
+ * @return specimensCrees
+ */
+ public List<Specimen> getSpecimensCrees() {
+ return specimensCrees;
+ }
- /**
- * specimensCrees setter
- * @param specimensCrees specimensCrees
- */
- public void setSpecimensCrees(List<Specimen> specimensCrees) {
- this.specimensCrees = specimensCrees;
- }
+ /**
+ * specimensCrees setter
+ * @param specimensCrees specimensCrees
+ */
+ public void setSpecimensCrees(List<Specimen> specimensCrees) {
+ this.specimensCrees = specimensCrees;
+ }
- /**
- * extractionsCrees getter
- * @return extractionsCrees
- */
- public List<Extraction> getExtractionsCrees() {
- return extractionsCrees;
- }
+ /**
+ * extractionsCrees getter
+ * @return extractionsCrees
+ */
+ public List<Extraction> getExtractionsCrees() {
+ return extractionsCrees;
+ }
- /**
- * extractionsCrees setter
- * @param extractionsCrees extractionsCrees
- */
- public void setExtractionsCrees(List<Extraction> extractionsCrees) {
- this.extractionsCrees = extractionsCrees;
- }
+ /**
+ * extractionsCrees setter
+ * @param extractionsCrees extractionsCrees
+ */
+ public void setExtractionsCrees(List<Extraction> extractionsCrees) {
+ this.extractionsCrees = extractionsCrees;
+ }
- /**
- * purificationsCrees getter
- * @return purificationsCrees
- */
- public List<Purification> getPurificationsCrees() {
- return purificationsCrees;
- }
+ /**
+ * purificationsCrees getter
+ * @return purificationsCrees
+ */
+ public List<Purification> getPurificationsCrees() {
+ return purificationsCrees;
+ }
- /**
- * purificationsCrees setter
- * @param purificationsCrees purificationsCrees
- */
- public void setPurificationsCrees(List<Purification> purificationsCrees) {
- this.purificationsCrees = purificationsCrees;
- }
+ /**
+ * purificationsCrees setter
+ * @param purificationsCrees purificationsCrees
+ */
+ public void setPurificationsCrees(List<Purification> purificationsCrees) {
+ this.purificationsCrees = purificationsCrees;
+ }
- /**
- * testsBioCrees getter
- * @return testsBioCrees
- */
- public List<TestBio> getTestsBioCrees() {
- return testsBioCrees;
- }
+ /**
+ * testsBioCrees getter
+ * @return testsBioCrees
+ */
+ public List<TestBio> getTestsBioCrees() {
+ return testsBioCrees;
+ }
- /**
- * testsBioCrees setter
- * @param testsBioCrees testsBioCrees
- */
- public void setTestsBioCrees(List<TestBio> testsBioCrees) {
- this.testsBioCrees = testsBioCrees;
- }
+ /**
+ * testsBioCrees setter
+ * @param testsBioCrees testsBioCrees
+ */
+ public void setTestsBioCrees(List<TestBio> testsBioCrees) {
+ this.testsBioCrees = testsBioCrees;
+ }
}
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Produit.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Produit.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Produit.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -64,157 +64,157 @@
impl = ProduitBridge.class)
public abstract class Produit extends AbstractModel implements Cloneable, Comparable<Produit> {
- /** Logger */
- // private static final Log LOG = LogTools.getLog();
- /** Id du produit */
- @Id
- @GeneratedValue
- private Integer id;
+ /** Logger */
+ // private static final Log LOG = LogTools.getLog();
+ /** Id du produit */
+ @Id
+ @GeneratedValue
+ private Integer id;
- /** Réference du produit */
- @Length(max = LENGTH_MEDIUM_TEXT)
- @NotEmpty
- @Column(unique = true)
- @Field(index=Index.YES, analyze=Analyze.YES, store=Store.YES)
- private String ref;
+ /** Réference du produit */
+ @Length(max = LENGTH_MEDIUM_TEXT)
+ @NotEmpty
+ @Column(unique = true)
+ @Field(index=Index.YES, analyze=Analyze.YES, store=Store.YES)
+ private String ref;
- /** Masse obtenue pour le produit **/
- @Min(value = 0)
- @Max(value = DataContext.DECIMAL_MAX)
- @Column(precision = DataContext.DECIMAL_PRECISION, scale = DataContext.DECIMAL_SCALE)
- private BigDecimal masseObtenue;
+ /** Masse obtenue pour le produit **/
+ @Min(value = 0)
+ @Max(value = DataContext.DECIMAL_MAX)
+ @Column(precision = DataContext.DECIMAL_PRECISION, scale = DataContext.DECIMAL_SCALE)
+ private BigDecimal masseObtenue;
- /** Purifications effectuées à partir du produit */
- @NotNull
- @OneToMany(mappedBy = "produit", fetch = FetchType.LAZY)
- private List<Purification> purificationsSuivantes;
+ /** Purifications effectuées à partir du produit */
+ @NotNull
+ @OneToMany(mappedBy = "produit", fetch = FetchType.LAZY)
+ private List<Purification> purificationsSuivantes;
- /** Résultats de tests biologiques effectués à partir du produit */
- @NotNull
- @OneToMany(mappedBy = "produit", fetch = FetchType.LAZY)
- @ContainedIn
- private List<ResultatTestBio> resultatsTestsBioSuivants;
+ /** Résultats de tests biologiques effectués à partir du produit */
+ @NotNull
+ @OneToMany(mappedBy = "produit", fetch = FetchType.LAZY)
+ @ContainedIn
+ private List<ResultatTestBio> resultatsTestsBioSuivants;
- /**
- * Constructor
- */
- public Produit() {
- super();
- purificationsSuivantes = new ArrayList<Purification>();
- resultatsTestsBioSuivants = new ArrayList<ResultatTestBio>();
- }
+ /**
+ * Constructor
+ */
+ public Produit() {
+ super();
+ purificationsSuivantes = new ArrayList<Purification>();
+ resultatsTestsBioSuivants = new ArrayList<ResultatTestBio>();
+ }
- /**
- * Détermine si le produit est un extrait
- * @return true si c'est un extrait
- */
- public abstract boolean isExtrait();
+ /**
+ * Détermine si le produit est un extrait
+ * @return true si c'est un extrait
+ */
+ public abstract boolean isExtrait();
- /**
- * Détermine si le produit est une fraction
- * @return true si c'est une fraction
- */
- public abstract boolean isFraction();
+ /**
+ * Détermine si le produit est une fraction
+ * @return true si c'est une fraction
+ */
+ public abstract boolean isFraction();
- /** {@inheritDoc} */
- @Override
- public Produit clone() throws CloneNotSupportedException {
- Produit clone = (Produit) super.clone();
- clone.id = id;
- clone.ref = ref;
- return clone;
- }
+ /** {@inheritDoc} */
+ @Override
+ public Produit clone() throws CloneNotSupportedException {
+ Produit clone = (Produit) super.clone();
+ clone.id = id;
+ clone.ref = ref;
+ return clone;
+ }
- /** {@inheritDoc} */
- @Override
- public String toString() {
- return this.ref;
- }
+ /** {@inheritDoc} */
+ @Override
+ public String toString() {
+ return this.ref;
+ }
- /** {@inheritDoc} */
- @Override
- public int compareTo(Produit produit) {
- return new BeanComparator("ref").compare(this, produit);
- }
+ /** {@inheritDoc} */
+ @Override
+ public int compareTo(Produit produit) {
+ return new BeanComparator("ref").compare(this, produit);
+ }
- /**
- * id getter
- * @return id
- */
- public Integer getId() {
- return id;
- }
+ /**
+ * id getter
+ * @return id
+ */
+ public Integer getId() {
+ return id;
+ }
- /**
- * id setter
- * @param id id
- */
- public void setId(Integer id) {
- this.id = id;
- }
+ /**
+ * id setter
+ * @param id id
+ */
+ public void setId(Integer id) {
+ this.id = id;
+ }
- /**
- * ref getter
- * @return ref
- */
- public String getRef() {
- return ref;
- }
+ /**
+ * ref getter
+ * @return ref
+ */
+ public String getRef() {
+ return ref;
+ }
- /**
- * ref setter
- * @param ref ref
- */
- public void setRef(String ref) {
- this.ref = ref;
- }
+ /**
+ * ref setter
+ * @param ref ref
+ */
+ public void setRef(String ref) {
+ this.ref = ref;
+ }
- /**
- * masseObtenue getter
- * @return masseObtenue
- */
- public BigDecimal getMasseObtenue() {
- return masseObtenue;
- }
+ /**
+ * masseObtenue getter
+ * @return masseObtenue
+ */
+ public BigDecimal getMasseObtenue() {
+ return masseObtenue;
+ }
- /**
- * masseObtenue setter
- * @param masseObtenue masseObtenue
- */
- public void setMasseObtenue(BigDecimal masseObtenue) {
- this.masseObtenue = masseObtenue;
- }
+ /**
+ * masseObtenue setter
+ * @param masseObtenue masseObtenue
+ */
+ public void setMasseObtenue(BigDecimal masseObtenue) {
+ this.masseObtenue = masseObtenue;
+ }
- /**
- * purificationsSuivantes getter
- * @return purificationsSuivantes
- */
- public List<Purification> getPurificationsSuivantes() {
- return purificationsSuivantes;
- }
+ /**
+ * purificationsSuivantes getter
+ * @return purificationsSuivantes
+ */
+ public List<Purification> getPurificationsSuivantes() {
+ return purificationsSuivantes;
+ }
- /**
- * purificationsSuivantes setter
- * @param purificationsSuivantes purificationsSuivantes
- */
- public void setPurificationsSuivantes(List<Purification> purificationsSuivantes) {
- this.purificationsSuivantes = purificationsSuivantes;
- }
+ /**
+ * purificationsSuivantes setter
+ * @param purificationsSuivantes purificationsSuivantes
+ */
+ public void setPurificationsSuivantes(List<Purification> purificationsSuivantes) {
+ this.purificationsSuivantes = purificationsSuivantes;
+ }
- /**
- * resultatsTestsBioSuivants getter
- * @return resultatsTestsBioSuivants
- */
- public List<ResultatTestBio> getResultatsTestsBioSuivants() {
- return resultatsTestsBioSuivants;
- }
+ /**
+ * resultatsTestsBioSuivants getter
+ * @return resultatsTestsBioSuivants
+ */
+ public List<ResultatTestBio> getResultatsTestsBioSuivants() {
+ return resultatsTestsBioSuivants;
+ }
- /**
- * resultatsTestsBioSuivants setter
- * @param resultatsTestsBioSuivants resultatsTestsBioSuivants
- */
- public void setResultatsTestsBioSuivants(List<ResultatTestBio> resultatsTestsBioSuivants) {
- this.resultatsTestsBioSuivants = resultatsTestsBioSuivants;
- }
+ /**
+ * resultatsTestsBioSuivants setter
+ * @param resultatsTestsBioSuivants resultatsTestsBioSuivants
+ */
+ public void setResultatsTestsBioSuivants(List<ResultatTestBio> resultatsTestsBioSuivants) {
+ this.resultatsTestsBioSuivants = resultatsTestsBioSuivants;
+ }
}
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Purification.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Purification.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Purification.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -76,370 +76,370 @@
})
public class Purification extends AbstractModel implements Comparable<Purification> {
- /** Logger */
- // private static final Log LOG = LogTools.getLog();
- /** Id de la purification */
- @Id
- @GeneratedValue
- private Integer idPurification;
+ /** Logger */
+ // private static final Log LOG = LogTools.getLog();
+ /** Id de la purification */
+ @Id
+ @GeneratedValue
+ private Integer idPurification;
- /** Référence de la manip */
- @Length(max = LENGTH_MEDIUM_TEXT)
- @Column(unique = true)
- @NotEmpty
- @Field(index=Index.YES, analyze=Analyze.YES, store=Store.YES)
- private String ref;
+ /** Référence de la manip */
+ @Length(max = LENGTH_MEDIUM_TEXT)
+ @Column(unique = true)
+ @NotEmpty
+ @Field(index=Index.YES, analyze=Analyze.YES, store=Store.YES)
+ private String ref;
- /** Manipulateur */
- @NotNull
- @ManyToOne(fetch = FetchType.LAZY, optional = false)
- private Personne manipulateur;
+ /** Manipulateur */
+ @NotNull
+ @ManyToOne(fetch = FetchType.LAZY, optional = false)
+ private Personne manipulateur;
- /** Date de la manip */
- @NotNull
- @Temporal(TemporalType.DATE)
- private Date date;
+ /** Date de la manip */
+ @NotNull
+ @Temporal(TemporalType.DATE)
+ private Date date;
- /** Méthode pour la purification **/
- @NotNull
- @ManyToOne(fetch = FetchType.EAGER, optional = false)
- private MethodePurification methode;
+ /** Méthode pour la purification **/
+ @NotNull
+ @ManyToOne(fetch = FetchType.EAGER, optional = false)
+ private MethodePurification methode;
- /** Paramètres qui caractérisent la méthode pour cette purification */
- @NotNull
- @OneToMany(mappedBy = "purification", fetch = FetchType.LAZY, orphanRemoval = true)
- @Cascade({ CascadeType.SAVE_UPDATE })
- private List<ParamMethoPuriEffectif> paramsMetho;
+ /** Paramètres qui caractérisent la méthode pour cette purification */
+ @NotNull
+ @OneToMany(mappedBy = "purification", fetch = FetchType.LAZY, orphanRemoval = true)
+ @Cascade({ CascadeType.SAVE_UPDATE })
+ private List<ParamMethoPuriEffectif> paramsMetho;
- /** Produit utilisé pour la purification **/
- @NotNull
- @ManyToOne(fetch = FetchType.EAGER, optional = false)
- @IndexedEmbedded
- private Produit produit;
+ /** Produit utilisé pour la purification **/
+ @NotNull
+ @ManyToOne(fetch = FetchType.EAGER, optional = false)
+ @IndexedEmbedded
+ private Produit produit;
- /** Masse avant l'extraction **/
- @Min(value = 0)
- @Max(value = DataContext.DECIMAL_MAX)
- @Column(precision = DataContext.DECIMAL_PRECISION, scale = DataContext.DECIMAL_SCALE)
- private BigDecimal masseDepart;
+ /** Masse avant l'extraction **/
+ @Min(value = 0)
+ @Max(value = DataContext.DECIMAL_MAX)
+ @Column(precision = DataContext.DECIMAL_PRECISION, scale = DataContext.DECIMAL_SCALE)
+ private BigDecimal masseDepart;
- /** Commentaire pour la manip */
- @Lob
- @Type(type="org.hibernate.type.StringClobType") // see HHH-6105
- private String complement;
+ /** Commentaire pour la manip */
+ @Lob
+ @Type(type="org.hibernate.type.StringClobType") // see HHH-6105
+ private String complement;
- /** Détermine si la manip doit être confidentielle */
- private boolean confidentiel;
+ /** Détermine si la manip doit être confidentielle */
+ private boolean confidentiel;
- /** Date jusqu'à laquelle la purification est confidentielle */
- @Future
- @Temporal(TemporalType.DATE)
- private Date dateConfidentialite;
+ /** Date jusqu'à laquelle la purification est confidentielle */
+ @Future
+ @Temporal(TemporalType.DATE)
+ private Date dateConfidentialite;
- /** Créateur */
- @NotNull
- @ManyToOne(fetch = FetchType.LAZY, optional = false)
- @IndexedEmbedded
- private Personne createur;
+ /** Créateur */
+ @NotNull
+ @ManyToOne(fetch = FetchType.LAZY, optional = false)
+ @IndexedEmbedded
+ private Personne createur;
- /** Fractions produites par la purification */
- @NotNull
- @OneToMany(mappedBy = "purification", fetch = FetchType.LAZY, orphanRemoval = true)
- @Cascade({ CascadeType.REFRESH, CascadeType.SAVE_UPDATE })
- private List<Fraction> fractions;
+ /** Fractions produites par la purification */
+ @NotNull
+ @OneToMany(mappedBy = "purification", fetch = FetchType.LAZY, orphanRemoval = true)
+ @Cascade({ CascadeType.REFRESH, CascadeType.SAVE_UPDATE })
+ private List<Fraction> fractions;
- /**
- * Lot dont provient la purification. Stocké en tant que propriété dans l'objet afin d'optimiser son accès
- */
- @ManyToOne(fetch = FetchType.EAGER, optional = false)
- @IndexedEmbedded
- private Lot lotSource;
+ /**
+ * Lot dont provient la purification. Stocké en tant que propriété dans l'objet afin d'optimiser son accès
+ */
+ @ManyToOne(fetch = FetchType.EAGER, optional = false)
+ @IndexedEmbedded
+ private Lot lotSource;
- /**
- * Constructeur
- */
- public Purification() {
- fractions = new ArrayList<Fraction>();
- paramsMetho = new ArrayList<ParamMethoPuriEffectif>();
- }
+ /**
+ * Constructeur
+ */
+ public Purification() {
+ fractions = new ArrayList<Fraction>();
+ paramsMetho = new ArrayList<ParamMethoPuriEffectif>();
+ }
- /** {@inheritDoc} */
- @Override
- public String toString() {
- return ref;
- }
+ /** {@inheritDoc} */
+ @Override
+ public String toString() {
+ return ref;
+ }
- /** {@inheritDoc} */
- @Override
- public int compareTo(Purification purification) {
- ComparatorChain comparatorChain = new ComparatorChain();
- comparatorChain.addComparator(new BeanComparator("produit"));
- comparatorChain.addComparator(new BeanComparator("ref"));
- return comparatorChain.compare(this, purification);
- }
+ /** {@inheritDoc} */
+ @Override
+ public int compareTo(Purification purification) {
+ ComparatorChain comparatorChain = new ComparatorChain();
+ comparatorChain.addComparator(new BeanComparator("produit"));
+ comparatorChain.addComparator(new BeanComparator("ref"));
+ return comparatorChain.compare(this, purification);
+ }
- /**
- * produit setter. Mise à jour du lot source dont provient le produit
- * @param produit produit
- */
- public void setProduit(Produit produit) {
- this.lotSource = findLotSourceFromProduit(produit);
- this.produit = produit;
- }
+ /**
+ * produit setter. Mise à jour du lot source dont provient le produit
+ * @param produit produit
+ */
+ public void setProduit(Produit produit) {
+ this.lotSource = findLotSourceFromProduit(produit);
+ this.produit = produit;
+ }
- /**
- * Rend les fractions triées en utilisant le comparateur {@link FractionsOfPurificationComp}
- * @return fractions
- */
- public List<Fraction> getSortedFractions() {
- // comme "@Sort(type = SortType.COMPARATOR, comparator = FractionsOfPurificationComp.class)" ne rend pas une
- // liste triée avec List, tri dans le getter
- Collections.sort(fractions, new FractionsOfPurificationComp());
- return fractions;
- }
+ /**
+ * Rend les fractions triées en utilisant le comparateur {@link FractionsOfPurificationComp}
+ * @return fractions
+ */
+ public List<Fraction> getSortedFractions() {
+ // comme "@Sort(type = SortType.COMPARATOR, comparator = FractionsOfPurificationComp.class)" ne rend pas une
+ // liste triée avec List, tri dans le getter
+ Collections.sort(fractions, new FractionsOfPurificationComp());
+ return fractions;
+ }
- /**
- * Rend les paramètres triés par index
- * @return Les paramètres
- */
- @SuppressWarnings("unchecked")
- public List<ParamMethoPuriEffectif> getSortedParamsMetho() {
- Collections.sort(paramsMetho, new BeanComparator("param.index"));
- return paramsMetho;
- }
+ /**
+ * Rend les paramètres triés par index
+ * @return Les paramètres
+ */
+ @SuppressWarnings("unchecked")
+ public List<ParamMethoPuriEffectif> getSortedParamsMetho() {
+ Collections.sort(paramsMetho, new BeanComparator("param.index"));
+ return paramsMetho;
+ }
- /**
- * idPurification getter
- * @return idPurification
- */
- public Integer getIdPurification() {
- return idPurification;
- }
+ /**
+ * idPurification getter
+ * @return idPurification
+ */
+ public Integer getIdPurification() {
+ return idPurification;
+ }
- /**
- * idPurification setter
- * @param idPurification idPurification
- */
- public void setIdPurification(Integer idPurification) {
- this.idPurification = idPurification;
- }
+ /**
+ * idPurification setter
+ * @param idPurification idPurification
+ */
+ public void setIdPurification(Integer idPurification) {
+ this.idPurification = idPurification;
+ }
- /**
- * ref getter
- * @return ref
- */
- public String getRef() {
- return ref;
- }
+ /**
+ * ref getter
+ * @return ref
+ */
+ public String getRef() {
+ return ref;
+ }
- /**
- * ref setter
- * @param ref ref
- */
- public void setRef(String ref) {
- this.ref = ref;
- }
+ /**
+ * ref setter
+ * @param ref ref
+ */
+ public void setRef(String ref) {
+ this.ref = ref;
+ }
- /**
- * manipulateur getter
- * @return manipulateur
- */
- public Personne getManipulateur() {
- return manipulateur;
- }
+ /**
+ * manipulateur getter
+ * @return manipulateur
+ */
+ public Personne getManipulateur() {
+ return manipulateur;
+ }
- /**
- * manipulateur setter
- * @param manipulateur manipulateur
- */
- public void setManipulateur(Personne manipulateur) {
- this.manipulateur = manipulateur;
- }
+ /**
+ * manipulateur setter
+ * @param manipulateur manipulateur
+ */
+ public void setManipulateur(Personne manipulateur) {
+ this.manipulateur = manipulateur;
+ }
- /**
- * date getter
- * @return date
- */
- public Date getDate() {
- return date;
- }
+ /**
+ * date getter
+ * @return date
+ */
+ public Date getDate() {
+ return date;
+ }
- /**
- * date setter
- * @param date date
- */
- public void setDate(Date date) {
- this.date = date;
- }
+ /**
+ * date setter
+ * @param date date
+ */
+ public void setDate(Date date) {
+ this.date = date;
+ }
- /**
- * methode getter
- * @return methode
- */
- public MethodePurification getMethode() {
- return methode;
- }
+ /**
+ * methode getter
+ * @return methode
+ */
+ public MethodePurification getMethode() {
+ return methode;
+ }
- /**
- * methode setter
- * @param methode methode
- */
- public void setMethode(MethodePurification methode) {
- this.methode = methode;
- }
+ /**
+ * methode setter
+ * @param methode methode
+ */
+ public void setMethode(MethodePurification methode) {
+ this.methode = methode;
+ }
- /**
- * paramsMetho getter
- * @return paramsMetho
- */
- public List<ParamMethoPuriEffectif> getParamsMetho() {
- return paramsMetho;
- }
+ /**
+ * paramsMetho getter
+ * @return paramsMetho
+ */
+ public List<ParamMethoPuriEffectif> getParamsMetho() {
+ return paramsMetho;
+ }
- /**
- * paramsMetho setter
- * @param paramsMetho paramsMetho
- */
- public void setParamsMetho(List<ParamMethoPuriEffectif> paramsMetho) {
- this.paramsMetho = paramsMetho;
- }
+ /**
+ * paramsMetho setter
+ * @param paramsMetho paramsMetho
+ */
+ public void setParamsMetho(List<ParamMethoPuriEffectif> paramsMetho) {
+ this.paramsMetho = paramsMetho;
+ }
- /**
- * masseDepart getter
- * @return masseDepart
- */
- public BigDecimal getMasseDepart() {
- return masseDepart;
- }
+ /**
+ * masseDepart getter
+ * @return masseDepart
+ */
+ public BigDecimal getMasseDepart() {
+ return masseDepart;
+ }
- /**
- * masseDepart setter
- * @param masseDepart masseDepart
- */
- public void setMasseDepart(BigDecimal masseDepart) {
- this.masseDepart = masseDepart;
- }
+ /**
+ * masseDepart setter
+ * @param masseDepart masseDepart
+ */
+ public void setMasseDepart(BigDecimal masseDepart) {
+ this.masseDepart = masseDepart;
+ }
- /**
- * complement getter
- * @return complement
- */
- public String getComplement() {
- return complement;
- }
+ /**
+ * complement getter
+ * @return complement
+ */
+ public String getComplement() {
+ return complement;
+ }
- /**
- * complement setter
- * @param complement complement
- */
- public void setComplement(String complement) {
- this.complement = complement;
- }
+ /**
+ * complement setter
+ * @param complement complement
+ */
+ public void setComplement(String complement) {
+ this.complement = complement;
+ }
- /**
- * confidentiel getter
- * @return confidentiel
- */
- public boolean isConfidentiel() {
- return confidentiel;
- }
+ /**
+ * confidentiel getter
+ * @return confidentiel
+ */
+ public boolean isConfidentiel() {
+ return confidentiel;
+ }
- /**
- * confidentiel setter
- * @param confidentiel confidentiel
- */
- public void setConfidentiel(boolean confidentiel) {
- this.confidentiel = confidentiel;
- }
+ /**
+ * confidentiel setter
+ * @param confidentiel confidentiel
+ */
+ public void setConfidentiel(boolean confidentiel) {
+ this.confidentiel = confidentiel;
+ }
- /**
- * dateConfidentialite getter
- * @return dateConfidentialite
- */
- public Date getDateConfidentialite() {
- return dateConfidentialite;
- }
+ /**
+ * dateConfidentialite getter
+ * @return dateConfidentialite
+ */
+ public Date getDateConfidentialite() {
+ return dateConfidentialite;
+ }
- /**
- * dateConfidentialite setter
- * @param dateConfidentialite dateConfidentialite
- */
- public void setDateConfidentialite(Date dateConfidentialite) {
- this.dateConfidentialite = dateConfidentialite;
- }
+ /**
+ * dateConfidentialite setter
+ * @param dateConfidentialite dateConfidentialite
+ */
+ public void setDateConfidentialite(Date dateConfidentialite) {
+ this.dateConfidentialite = dateConfidentialite;
+ }
- /**
- * createur getter
- * @return createur
- */
- public Personne getCreateur() {
- return createur;
- }
+ /**
+ * createur getter
+ * @return createur
+ */
+ public Personne getCreateur() {
+ return createur;
+ }
- /**
- * createur setter
- * @param createur createur
- */
- public void setCreateur(Personne createur) {
- this.createur = createur;
- }
+ /**
+ * createur setter
+ * @param createur createur
+ */
+ public void setCreateur(Personne createur) {
+ this.createur = createur;
+ }
- /**
- * lotSource getter
- * @return lotSource
- */
- public Lot getLotSource() {
- return lotSource;
- }
+ /**
+ * lotSource getter
+ * @return lotSource
+ */
+ public Lot getLotSource() {
+ return lotSource;
+ }
- /**
- * fractions getter
- * @return fractions
- */
- public List<Fraction> getFractions() {
- return fractions;
- }
+ /**
+ * fractions getter
+ * @return fractions
+ */
+ public List<Fraction> getFractions() {
+ return fractions;
+ }
- /**
- * fractions setter
- * @param fractions fractions
- */
- public void setFractions(List<Fraction> fractions) {
- this.fractions = fractions;
- }
+ /**
+ * fractions setter
+ * @param fractions fractions
+ */
+ public void setFractions(List<Fraction> fractions) {
+ this.fractions = fractions;
+ }
- /**
- * lotSource setter
- * @param lotSource lotSource
- */
- public void setLotSource(Lot lotSource) {
- this.lotSource = lotSource;
- }
+ /**
+ * lotSource setter
+ * @param lotSource lotSource
+ */
+ public void setLotSource(Lot lotSource) {
+ this.lotSource = lotSource;
+ }
- /**
- * produit getter
- * @return produit
- */
- public Produit getProduit() {
- return produit;
- }
+ /**
+ * produit getter
+ * @return produit
+ */
+ public Produit getProduit() {
+ return produit;
+ }
- /**
- * Remonte au lot dont provient le produit source de la purification
- * @param produit Le produit en question
- * @return Le lot
- */
- public Lot findLotSourceFromProduit(Produit produit) {
- Produit curProd = produit;
- while (curProd.isFraction()) {
- Fraction curFraction = (Fraction) curProd;
- curProd = curFraction.getPurification().getProduit();
- }
- AssertTools.assertClassOrInterface(curProd, Extrait.class);
+ /**
+ * Remonte au lot dont provient le produit source de la purification
+ * @param produit Le produit en question
+ * @return Le lot
+ */
+ public Lot findLotSourceFromProduit(Produit produit) {
+ Produit curProd = produit;
+ while (curProd.isFraction()) {
+ Fraction curFraction = (Fraction) curProd;
+ curProd = curFraction.getPurification().getProduit();
+ }
+ AssertTools.assertClassOrInterface(curProd, Extrait.class);
- Extrait extrait = (Extrait) curProd;
+ Extrait extrait = (Extrait) curProd;
- return extrait.getExtraction().getLot();
- }
+ return extrait.getExtraction().getLot();
+ }
}
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Specimen.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Specimen.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Specimen.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -69,370 +69,370 @@
})
public class Specimen extends AbstractModel implements Comparable<Specimen> {
- /**
- * Types d'organisme pour un spécimen
- */
- public enum TypeOrganisme implements Comparable<TypeOrganisme> {
- /** Plante */
- PLANTE,
- /** Organisme marin */
- ORGANISME_MARIN,
- /** Microorganisme */
- MICROORGANISME,
- /** Insecte */
- INSECTE,
- /** Champignon */
- CHAMPIGNON,
- /** Lichen */
- LICHEN,
- /** Autre */
- AUTRE
- }
+ /**
+ * Types d'organisme pour un spécimen
+ */
+ public enum TypeOrganisme implements Comparable<TypeOrganisme> {
+ /** Plante */
+ PLANTE,
+ /** Organisme marin */
+ ORGANISME_MARIN,
+ /** Microorganisme */
+ MICROORGANISME,
+ /** Insecte */
+ INSECTE,
+ /** Champignon */
+ CHAMPIGNON,
+ /** Lichen */
+ LICHEN,
+ /** Autre */
+ AUTRE
+ }
- /** ID */
- @Id
- @GeneratedValue
- private Integer idSpecimen;
+ /** ID */
+ @Id
+ @GeneratedValue
+ private Integer idSpecimen;
- /** Nom */
- @Column(unique = true)
- @NotEmpty
- @Length(max = LENGTH_TINY_TEXT)
- @Field(index=Index.YES, analyze=Analyze.YES, store=Store.YES)
- private String ref;
+ /** Nom */
+ @Column(unique = true)
+ @NotEmpty
+ @Length(max = LENGTH_TINY_TEXT)
+ @Field(index=Index.YES, analyze=Analyze.YES, store=Store.YES)
+ private String ref;
- /** Embranchement */
- @Length(max = LENGTH_MEDIUM_TEXT)
- @NotEmpty
- @Field(index=Index.YES, analyze=Analyze.YES, store=Store.YES)
- private String embranchement;
+ /** Embranchement */
+ @Length(max = LENGTH_MEDIUM_TEXT)
+ @NotEmpty
+ @Field(index=Index.YES, analyze=Analyze.YES, store=Store.YES)
+ private String embranchement;
- /** Famille */
- @Length(max = LENGTH_MEDIUM_TEXT)
- @Field(index=Index.YES, analyze=Analyze.YES, store=Store.YES)
- private String famille;
+ /** Famille */
+ @Length(max = LENGTH_MEDIUM_TEXT)
+ @Field(index=Index.YES, analyze=Analyze.YES, store=Store.YES)
+ private String famille;
- /** Genre */
- @Length(max = LENGTH_MEDIUM_TEXT)
- @Field(index=Index.YES, analyze=Analyze.YES, store=Store.YES)
- private String genre;
+ /** Genre */
+ @Length(max = LENGTH_MEDIUM_TEXT)
+ @Field(index=Index.YES, analyze=Analyze.YES, store=Store.YES)
+ private String genre;
- /** Espèce */
- @Length(max = LENGTH_MEDIUM_TEXT)
- @Field(index=Index.YES, analyze=Analyze.YES, store=Store.YES)
- private String espece;
+ /** Espèce */
+ @Length(max = LENGTH_MEDIUM_TEXT)
+ @Field(index=Index.YES, analyze=Analyze.YES, store=Store.YES)
+ private String espece;
- /** Sous-espèce */
- @Length(max = LENGTH_MEDIUM_TEXT)
- private String sousEspece;
+ /** Sous-espèce */
+ @Length(max = LENGTH_MEDIUM_TEXT)
+ private String sousEspece;
- /** Embranchement */
- @Length(max = LENGTH_MEDIUM_TEXT)
- private String variete;
+ /** Embranchement */
+ @Length(max = LENGTH_MEDIUM_TEXT)
+ private String variete;
- /** Type d'organisme */
- @NotNull
- @Enumerated(EnumType.ORDINAL)
- private TypeOrganisme typeOrganisme;
+ /** Type d'organisme */
+ @NotNull
+ @Enumerated(EnumType.ORDINAL)
+ private TypeOrganisme typeOrganisme;
- /** Créateur */
- @ManyToOne(fetch = FetchType.EAGER)
- private Personne identificateur;
+ /** Créateur */
+ @ManyToOne(fetch = FetchType.EAGER)
+ private Personne identificateur;
- /** Date dépôt */
- @Temporal(TemporalType.DATE)
- private Date dateDepot;
+ /** Date dépôt */
+ @Temporal(TemporalType.DATE)
+ private Date dateDepot;
- /** Embranchement */
- @Length(max = LENGTH_TINY_TEXT)
- private String numDepot;
+ /** Embranchement */
+ @Length(max = LENGTH_TINY_TEXT)
+ private String numDepot;
- /** Embranchement */
- @Length(max = LENGTH_MEDIUM_TEXT)
- private String lieuDepot;
+ /** Embranchement */
+ @Length(max = LENGTH_MEDIUM_TEXT)
+ private String lieuDepot;
- /** Station */
- @ManyToOne(fetch = FetchType.EAGER)
- @IndexedEmbedded(depth=1)
- private Station station;
+ /** Station */
+ @ManyToOne(fetch = FetchType.EAGER)
+ @IndexedEmbedded(depth=1)
+ private Station station;
- /** Compléments d'information */
- @Lob
- @Type(type="org.hibernate.type.StringClobType") // see HHH-6105
- private String complement;
+ /** Compléments d'information */
+ @Lob
+ @Type(type="org.hibernate.type.StringClobType") // see HHH-6105
+ private String complement;
- /** Créateur */
- @NotNull
- @ManyToOne(fetch = FetchType.LAZY, optional = false)
- @IndexedEmbedded
- private Personne createur;
+ /** Créateur */
+ @NotNull
+ @ManyToOne(fetch = FetchType.LAZY, optional = false)
+ @IndexedEmbedded
+ private Personne createur;
- /** {@inheritDoc} */
- @Override
- public String toString() {
- return ref;
- }
+ /** {@inheritDoc} */
+ @Override
+ public String toString() {
+ return ref;
+ }
- /** {@inheritDoc} */
- @Override
- public int compareTo(Specimen specimen) {
- return new BeanComparator("ref").compare(this, specimen);
- }
+ /** {@inheritDoc} */
+ @Override
+ public int compareTo(Specimen specimen) {
+ return new BeanComparator("ref").compare(this, specimen);
+ }
- /**
- * idSpecimen getter
- * @return idSpecimen
- */
- public Integer getIdSpecimen() {
- return idSpecimen;
- }
+ /**
+ * idSpecimen getter
+ * @return idSpecimen
+ */
+ public Integer getIdSpecimen() {
+ return idSpecimen;
+ }
- /**
- * idSpecimen setter
- * @param idSpecimen idSpecimen
- */
- public void setIdSpecimen(Integer idSpecimen) {
- this.idSpecimen = idSpecimen;
- }
+ /**
+ * idSpecimen setter
+ * @param idSpecimen idSpecimen
+ */
+ public void setIdSpecimen(Integer idSpecimen) {
+ this.idSpecimen = idSpecimen;
+ }
- /**
- * ref getter
- * @return ref
- */
- public String getRef() {
- return ref;
- }
+ /**
+ * ref getter
+ * @return ref
+ */
+ public String getRef() {
+ return ref;
+ }
- /**
- * ref setter
- * @param ref ref
- */
- public void setRef(String ref) {
- this.ref = ref;
- }
+ /**
+ * ref setter
+ * @param ref ref
+ */
+ public void setRef(String ref) {
+ this.ref = ref;
+ }
- /**
- * embranchement getter
- * @return embranchement
- */
- public String getEmbranchement() {
- return embranchement;
- }
+ /**
+ * embranchement getter
+ * @return embranchement
+ */
+ public String getEmbranchement() {
+ return embranchement;
+ }
- /**
- * embranchement setter
- * @param embranchement embranchement
- */
- public void setEmbranchement(String embranchement) {
- this.embranchement = embranchement;
- }
+ /**
+ * embranchement setter
+ * @param embranchement embranchement
+ */
+ public void setEmbranchement(String embranchement) {
+ this.embranchement = embranchement;
+ }
- /**
- * famille getter
- * @return famille
- */
- public String getFamille() {
- return famille;
- }
+ /**
+ * famille getter
+ * @return famille
+ */
+ public String getFamille() {
+ return famille;
+ }
- /**
- * famille setter
- * @param famille famille
- */
- public void setFamille(String famille) {
- this.famille = famille;
- }
+ /**
+ * famille setter
+ * @param famille famille
+ */
+ public void setFamille(String famille) {
+ this.famille = famille;
+ }
- /**
- * genre getter
- * @return genre
- */
- public String getGenre() {
- return genre;
- }
+ /**
+ * genre getter
+ * @return genre
+ */
+ public String getGenre() {
+ return genre;
+ }
- /**
- * genre setter
- * @param genre genre
- */
- public void setGenre(String genre) {
- this.genre = genre;
- }
+ /**
+ * genre setter
+ * @param genre genre
+ */
+ public void setGenre(String genre) {
+ this.genre = genre;
+ }
- /**
- * espece getter
- * @return espece
- */
- public String getEspece() {
- return espece;
- }
+ /**
+ * espece getter
+ * @return espece
+ */
+ public String getEspece() {
+ return espece;
+ }
- /**
- * espece setter
- * @param espece espece
- */
- public void setEspece(String espece) {
- this.espece = espece;
- }
+ /**
+ * espece setter
+ * @param espece espece
+ */
+ public void setEspece(String espece) {
+ this.espece = espece;
+ }
- /**
- * sousEspece getter
- * @return sousEspece
- */
- public String getSousEspece() {
- return sousEspece;
- }
+ /**
+ * sousEspece getter
+ * @return sousEspece
+ */
+ public String getSousEspece() {
+ return sousEspece;
+ }
- /**
- * sousEspece setter
- * @param sousEspece sousEspece
- */
- public void setSousEspece(String sousEspece) {
- this.sousEspece = sousEspece;
- }
+ /**
+ * sousEspece setter
+ * @param sousEspece sousEspece
+ */
+ public void setSousEspece(String sousEspece) {
+ this.sousEspece = sousEspece;
+ }
- /**
- * variete getter
- * @return variete
- */
- public String getVariete() {
- return variete;
- }
+ /**
+ * variete getter
+ * @return variete
+ */
+ public String getVariete() {
+ return variete;
+ }
- /**
- * variete setter
- * @param variete variete
- */
- public void setVariete(String variete) {
- this.variete = variete;
- }
+ /**
+ * variete setter
+ * @param variete variete
+ */
+ public void setVariete(String variete) {
+ this.variete = variete;
+ }
- /**
- * typeOrganisme getter
- * @return typeOrganisme
- */
- public TypeOrganisme getTypeOrganisme() {
- return typeOrganisme;
- }
+ /**
+ * typeOrganisme getter
+ * @return typeOrganisme
+ */
+ public TypeOrganisme getTypeOrganisme() {
+ return typeOrganisme;
+ }
- /**
- * typeOrganisme setter
- * @param typeOrganisme typeOrganisme
- */
- public void setTypeOrganisme(TypeOrganisme typeOrganisme) {
- this.typeOrganisme = typeOrganisme;
- }
+ /**
+ * typeOrganisme setter
+ * @param typeOrganisme typeOrganisme
+ */
+ public void setTypeOrganisme(TypeOrganisme typeOrganisme) {
+ this.typeOrganisme = typeOrganisme;
+ }
- /**
- * identificateur getter
- * @return identificateur
- */
- public Personne getIdentificateur() {
- return identificateur;
- }
+ /**
+ * identificateur getter
+ * @return identificateur
+ */
+ public Personne getIdentificateur() {
+ return identificateur;
+ }
- /**
- * identificateur setter
- * @param identificateur identificateur
- */
- public void setIdentificateur(Personne identificateur) {
- this.identificateur = identificateur;
- }
+ /**
+ * identificateur setter
+ * @param identificateur identificateur
+ */
+ public void setIdentificateur(Personne identificateur) {
+ this.identificateur = identificateur;
+ }
- /**
- * dateDepot getter
- * @return dateDepot
- */
- public Date getDateDepot() {
- return dateDepot;
- }
+ /**
+ * dateDepot getter
+ * @return dateDepot
+ */
+ public Date getDateDepot() {
+ return dateDepot;
+ }
- /**
- * dateDepot setter
- * @param dateDepot dateDepot
- */
- public void setDateDepot(Date dateDepot) {
- this.dateDepot = dateDepot;
- }
+ /**
+ * dateDepot setter
+ * @param dateDepot dateDepot
+ */
+ public void setDateDepot(Date dateDepot) {
+ this.dateDepot = dateDepot;
+ }
- /**
- * numDepot getter
- * @return numDepot
- */
- public String getNumDepot() {
- return numDepot;
- }
+ /**
+ * numDepot getter
+ * @return numDepot
+ */
+ public String getNumDepot() {
+ return numDepot;
+ }
- /**
- * numDepot setter
- * @param numDepot numDepot
- */
- public void setNumDepot(String numDepot) {
- this.numDepot = numDepot;
- }
+ /**
+ * numDepot setter
+ * @param numDepot numDepot
+ */
+ public void setNumDepot(String numDepot) {
+ this.numDepot = numDepot;
+ }
- /**
- * lieuDepot getter
- * @return lieuDepot
- */
- public String getLieuDepot() {
- return lieuDepot;
- }
+ /**
+ * lieuDepot getter
+ * @return lieuDepot
+ */
+ public String getLieuDepot() {
+ return lieuDepot;
+ }
- /**
- * lieuDepot setter
- * @param lieuDepot lieuDepot
- */
- public void setLieuDepot(String lieuDepot) {
- this.lieuDepot = lieuDepot;
- }
+ /**
+ * lieuDepot setter
+ * @param lieuDepot lieuDepot
+ */
+ public void setLieuDepot(String lieuDepot) {
+ this.lieuDepot = lieuDepot;
+ }
- /**
- * station getter
- * @return station
- */
- public Station getStation() {
- return station;
- }
+ /**
+ * station getter
+ * @return station
+ */
+ public Station getStation() {
+ return station;
+ }
- /**
- * station setter
- * @param station station
- */
- public void setStation(Station station) {
- this.station = station;
- }
+ /**
+ * station setter
+ * @param station station
+ */
+ public void setStation(Station station) {
+ this.station = station;
+ }
- /**
- * complement getter
- * @return complement
- */
- public String getComplement() {
- return complement;
- }
+ /**
+ * complement getter
+ * @return complement
+ */
+ public String getComplement() {
+ return complement;
+ }
- /**
- * complement setter
- * @param complement complement
- */
- public void setComplement(String complement) {
- this.complement = complement;
- }
+ /**
+ * complement setter
+ * @param complement complement
+ */
+ public void setComplement(String complement) {
+ this.complement = complement;
+ }
- /**
- * createur getter
- * @return createur
- */
- public Personne getCreateur() {
- return createur;
- }
+ /**
+ * createur getter
+ * @return createur
+ */
+ public Personne getCreateur() {
+ return createur;
+ }
- /**
- * createur setter
- * @param createur createur
- */
- public void setCreateur(Personne createur) {
- this.createur = createur;
- }
+ /**
+ * createur setter
+ * @param createur createur
+ */
+ public void setCreateur(Personne createur) {
+ this.createur = createur;
+ }
}
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Station.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Station.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Station.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -74,293 +74,293 @@
})
public class Station extends AbstractModel implements Cloneable, Comparable<Station> {
- /** ID */
- @Id
- @GeneratedValue
- private Integer idStation;
+ /** ID */
+ @Id
+ @GeneratedValue
+ private Integer idStation;
- /** Nom */
- @Column(unique = true)
- @NotEmpty
- @Length(max = LENGTH_MEDIUM_TEXT)
- @Field(index=Index.YES, analyze=Analyze.YES, store=Store.YES)
- private String nom;
+ /** Nom */
+ @Column(unique = true)
+ @NotEmpty
+ @Length(max = LENGTH_MEDIUM_TEXT)
+ @Field(index=Index.YES, analyze=Analyze.YES, store=Store.YES)
+ private String nom;
- /** Code pays */
- @NotNull
- @Length(min = 2, max = 2)
- @CountryCode
- @Field(index=Index.YES, analyze=Analyze.YES, store=Store.YES)
- private String codePays;
+ /** Code pays */
+ @NotNull
+ @Length(min = 2, max = 2)
+ @CountryCode
+ @Field(index=Index.YES, analyze=Analyze.YES, store=Store.YES)
+ private String codePays;
- /** Complément */
- @Lob
- @Type(type="org.hibernate.type.StringClobType") // see HHH-6105
- private String complement;
+ /** Complément */
+ @Lob
+ @Type(type="org.hibernate.type.StringClobType") // see HHH-6105
+ private String complement;
- /** Créateur */
- @NotNull
- @ManyToOne(fetch = FetchType.LAZY, optional = false)
- @IndexedEmbedded
- private Personne createur;
+ /** Créateur */
+ @NotNull
+ @ManyToOne(fetch = FetchType.LAZY, optional = false)
+ @IndexedEmbedded
+ private Personne createur;
- /** Localité */
- @Length(max = LENGTH_MEDIUM_TEXT)
- @Field(index=Index.YES, analyze=Analyze.YES, store=Store.YES)
- private String localite;
+ /** Localité */
+ @Length(max = LENGTH_MEDIUM_TEXT)
+ @Field(index=Index.YES, analyze=Analyze.YES, store=Store.YES)
+ private String localite;
- /** Latitude */
- @Latitude
- private String latitude;
+ /** Latitude */
+ @Latitude
+ private String latitude;
- /** Longitude */
- @Longitude
- private String longitude;
+ /** Longitude */
+ @Longitude
+ private String longitude;
- /** Référentiel */
- @Referentiel
- private Integer referentiel;
+ /** Référentiel */
+ @Referentiel
+ private Integer referentiel;
- /** Lots */
- @NotNull
- @OneToMany(mappedBy = "station", fetch = FetchType.LAZY)
- private List<Lot> lots;
+ /** Lots */
+ @NotNull
+ @OneToMany(mappedBy = "station", fetch = FetchType.LAZY)
+ private List<Lot> lots;
- /** Stations */
- @NotNull
- @ManyToMany(mappedBy = "stations", fetch = FetchType.LAZY)
- private List<Campagne> campagnes;
+ /** Stations */
+ @NotNull
+ @ManyToMany(mappedBy = "stations", fetch = FetchType.LAZY)
+ private List<Campagne> campagnes;
- /** Spécimens de référence qui sont rattachés à cette station */
- @OneToMany(mappedBy = "station", fetch = FetchType.LAZY)
- private List<Specimen> specimensRattaches;
+ /** Spécimens de référence qui sont rattachés à cette station */
+ @OneToMany(mappedBy = "station", fetch = FetchType.LAZY)
+ private List<Specimen> specimensRattaches;
- /**
- * Constructeur
- */
- public Station() {
- lots = new ArrayList<Lot>();
- campagnes = new ArrayList<Campagne>();
- }
+ /**
+ * Constructeur
+ */
+ public Station() {
+ lots = new ArrayList<Lot>();
+ campagnes = new ArrayList<Campagne>();
+ }
- /** {@inheritDoc} */
- @Override
- public Station clone() throws CloneNotSupportedException {
- Station clone = (Station) super.clone();
- clone.idStation = idStation;
- clone.nom = nom;
- clone.codePays = codePays;
- clone.complement = complement;
- clone.createur = createur;
- clone.localite = localite;
- clone.latitude = latitude;
- clone.longitude = longitude;
- clone.referentiel = referentiel;
- return clone;
- }
+ /** {@inheritDoc} */
+ @Override
+ public Station clone() throws CloneNotSupportedException {
+ Station clone = (Station) super.clone();
+ clone.idStation = idStation;
+ clone.nom = nom;
+ clone.codePays = codePays;
+ clone.complement = complement;
+ clone.createur = createur;
+ clone.localite = localite;
+ clone.latitude = latitude;
+ clone.longitude = longitude;
+ clone.referentiel = referentiel;
+ return clone;
+ }
- /** {@inheritDoc} */
- @Override
- public String toString() {
- return nom;
- }
+ /** {@inheritDoc} */
+ @Override
+ public String toString() {
+ return nom;
+ }
- /** {@inheritDoc} */
- @Override
- public int compareTo(Station station) {
- return new BeanComparator("nom").compare(this, station);
- }
+ /** {@inheritDoc} */
+ @Override
+ public int compareTo(Station station) {
+ return new BeanComparator("nom").compare(this, station);
+ }
- /**
- * idStation getter
- * @return idStation
- */
- public Integer getIdStation() {
- return idStation;
- }
+ /**
+ * idStation getter
+ * @return idStation
+ */
+ public Integer getIdStation() {
+ return idStation;
+ }
- /**
- * idStation setter
- * @param idStation idStation
- */
- public void setIdStation(Integer idStation) {
- this.idStation = idStation;
- }
+ /**
+ * idStation setter
+ * @param idStation idStation
+ */
+ public void setIdStation(Integer idStation) {
+ this.idStation = idStation;
+ }
- /**
- * nom getter
- * @return nom
- */
- public String getNom() {
- return nom;
- }
+ /**
+ * nom getter
+ * @return nom
+ */
+ public String getNom() {
+ return nom;
+ }
- /**
- * nom setter
- * @param nom nom
- */
- public void setNom(String nom) {
- this.nom = nom;
- }
+ /**
+ * nom setter
+ * @param nom nom
+ */
+ public void setNom(String nom) {
+ this.nom = nom;
+ }
- /**
- * codePays getter
- * @return codePays
- */
- public String getCodePays() {
- return codePays;
- }
+ /**
+ * codePays getter
+ * @return codePays
+ */
+ public String getCodePays() {
+ return codePays;
+ }
- /**
- * codePays setter
- * @param codePays codePays
- */
- public void setCodePays(String codePays) {
- this.codePays = codePays;
- }
+ /**
+ * codePays setter
+ * @param codePays codePays
+ */
+ public void setCodePays(String codePays) {
+ this.codePays = codePays;
+ }
- /**
- * complement getter
- * @return complement
- */
- public String getComplement() {
- return complement;
- }
+ /**
+ * complement getter
+ * @return complement
+ */
+ public String getComplement() {
+ return complement;
+ }
- /**
- * complement setter
- * @param complement complement
- */
- public void setComplement(String complement) {
- this.complement = complement;
- }
+ /**
+ * complement setter
+ * @param complement complement
+ */
+ public void setComplement(String complement) {
+ this.complement = complement;
+ }
- /**
- * createur getter
- * @return createur
- */
- public Personne getCreateur() {
- return createur;
- }
+ /**
+ * createur getter
+ * @return createur
+ */
+ public Personne getCreateur() {
+ return createur;
+ }
- /**
- * createur setter
- * @param createur createur
- */
- public void setCreateur(Personne createur) {
- this.createur = createur;
- }
+ /**
+ * createur setter
+ * @param createur createur
+ */
+ public void setCreateur(Personne createur) {
+ this.createur = createur;
+ }
- /**
- * localite getter
- * @return localite
- */
- public String getLocalite() {
- return localite;
- }
+ /**
+ * localite getter
+ * @return localite
+ */
+ public String getLocalite() {
+ return localite;
+ }
- /**
- * localite setter
- * @param localite localite
- */
- public void setLocalite(String localite) {
- this.localite = localite;
- }
+ /**
+ * localite setter
+ * @param localite localite
+ */
+ public void setLocalite(String localite) {
+ this.localite = localite;
+ }
- /**
- * latitude getter
- * @return latitude
- */
- public String getLatitude() {
- return latitude;
- }
+ /**
+ * latitude getter
+ * @return latitude
+ */
+ public String getLatitude() {
+ return latitude;
+ }
- /**
- * latitude setter
- * @param latitude latitude
- */
- public void setLatitude(String latitude) {
- this.latitude = latitude;
- }
+ /**
+ * latitude setter
+ * @param latitude latitude
+ */
+ public void setLatitude(String latitude) {
+ this.latitude = latitude;
+ }
- /**
- * longitude getter
- * @return longitude
- */
- public String getLongitude() {
- return longitude;
- }
+ /**
+ * longitude getter
+ * @return longitude
+ */
+ public String getLongitude() {
+ return longitude;
+ }
- /**
- * longitude setter
- * @param longitude longitude
- */
- public void setLongitude(String longitude) {
- this.longitude = longitude;
- }
+ /**
+ * longitude setter
+ * @param longitude longitude
+ */
+ public void setLongitude(String longitude) {
+ this.longitude = longitude;
+ }
- /**
- * referentiel getter
- * @return referentiel
- */
- public Integer getReferentiel() {
- return referentiel;
- }
+ /**
+ * referentiel getter
+ * @return referentiel
+ */
+ public Integer getReferentiel() {
+ return referentiel;
+ }
- /**
- * referentiel setter
- * @param referentiel referentiel
- */
- public void setReferentiel(Integer referentiel) {
- this.referentiel = referentiel;
- }
+ /**
+ * referentiel setter
+ * @param referentiel referentiel
+ */
+ public void setReferentiel(Integer referentiel) {
+ this.referentiel = referentiel;
+ }
- /**
- * lots getter
- * @return lots
- */
- public List<Lot> getLots() {
- return lots;
- }
+ /**
+ * lots getter
+ * @return lots
+ */
+ public List<Lot> getLots() {
+ return lots;
+ }
- /**
- * lots setter
- * @param lots lots
- */
- public void setLots(List<Lot> lots) {
- this.lots = lots;
- }
+ /**
+ * lots setter
+ * @param lots lots
+ */
+ public void setLots(List<Lot> lots) {
+ this.lots = lots;
+ }
- /**
- * campagnes getter
- * @return campagnes
- */
- public List<Campagne> getCampagnes() {
- return campagnes;
- }
+ /**
+ * campagnes getter
+ * @return campagnes
+ */
+ public List<Campagne> getCampagnes() {
+ return campagnes;
+ }
- /**
- * campagnes setter
- * @param campagnes campagnes
- */
- public void setCampagnes(List<Campagne> campagnes) {
- this.campagnes = campagnes;
- }
+ /**
+ * campagnes setter
+ * @param campagnes campagnes
+ */
+ public void setCampagnes(List<Campagne> campagnes) {
+ this.campagnes = campagnes;
+ }
- /**
- * specimensRattaches getter
- * @return specimensRattaches
- */
- public List<Specimen> getSpecimensRattaches() {
- return specimensRattaches;
- }
+ /**
+ * specimensRattaches getter
+ * @return specimensRattaches
+ */
+ public List<Specimen> getSpecimensRattaches() {
+ return specimensRattaches;
+ }
- /**
- * specimensRattaches setter
- * @param specimensRattaches specimensRattaches
- */
- public void setSpecimensRattaches(List<Specimen> specimensRattaches) {
- this.specimensRattaches = specimensRattaches;
- }
+ /**
+ * specimensRattaches setter
+ * @param specimensRattaches specimensRattaches
+ */
+ public void setSpecimensRattaches(List<Specimen> specimensRattaches) {
+ this.specimensRattaches = specimensRattaches;
+ }
}
\ No newline at end of file
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/TestBio.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/TestBio.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/TestBio.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -73,329 +73,329 @@
@Embeddable
public class TestBio extends AbstractModel implements Comparable<TestBio> {
- /** Id du test bio */
- @Id
- @GeneratedValue
- private Integer idTestBio;
+ /** Id du test bio */
+ @Id
+ @GeneratedValue
+ private Integer idTestBio;
- /** Référence de la manip */
- @Length(max = LENGTH_MEDIUM_TEXT)
- @Column(unique = true)
- @NotEmpty
- @Field(index=Index.YES, analyze=Analyze.YES, store=Store.YES)
- private String ref;
+ /** Référence de la manip */
+ @Length(max = LENGTH_MEDIUM_TEXT)
+ @Column(unique = true)
+ @NotEmpty
+ @Field(index=Index.YES, analyze=Analyze.YES, store=Store.YES)
+ private String ref;
- /** Manipulateur */
- @NotNull
- @ManyToOne(fetch = FetchType.LAZY, optional = false)
- private Personne manipulateur;
+ /** Manipulateur */
+ @NotNull
+ @ManyToOne(fetch = FetchType.LAZY, optional = false)
+ private Personne manipulateur;
- /** Organisme qui a effectué le test biologique **/
- @NotNull
- @Length(max = LENGTH_MEDIUM_TEXT)
- private String organismeTesteur;
+ /** Organisme qui a effectué le test biologique **/
+ @NotNull
+ @Length(max = LENGTH_MEDIUM_TEXT)
+ private String organismeTesteur;
- /** Date de la manip */
- @NotNull
- @Temporal(TemporalType.DATE)
- private Date date;
+ /** Date de la manip */
+ @NotNull
+ @Temporal(TemporalType.DATE)
+ private Date date;
- /** Méthode pour la purification **/
- @NotNull
- @ManyToOne(fetch = FetchType.EAGER, optional = false)
- @IndexedEmbedded
- private MethodeTestBio methode;
+ /** Méthode pour la purification **/
+ @NotNull
+ @ManyToOne(fetch = FetchType.EAGER, optional = false)
+ @IndexedEmbedded
+ private MethodeTestBio methode;
- /** Concentration/masse utilisé par défaut pour les résultats **/
- @Min(value = 0)
- @Max(value = DataContext.DECIMAL_MAX)
- @Column(precision = DataContext.DECIMAL_PRECISION, scale = DataContext.DECIMAL_SCALE)
- private BigDecimal concMasseDefaut;
+ /** Concentration/masse utilisé par défaut pour les résultats **/
+ @Min(value = 0)
+ @Max(value = DataContext.DECIMAL_MAX)
+ @Column(precision = DataContext.DECIMAL_PRECISION, scale = DataContext.DECIMAL_SCALE)
+ private BigDecimal concMasseDefaut;
- /** Unité utilisé pour la concentration/masse par défaut */
- @Enumerated(EnumType.ORDINAL)
- private UniteConcMasse uniteConcMasseDefaut;
+ /** Unité utilisé pour la concentration/masse par défaut */
+ @Enumerated(EnumType.ORDINAL)
+ private UniteConcMasse uniteConcMasseDefaut;
- /** Référence de la manip */
- private Stade stadeDefaut;
+ /** Référence de la manip */
+ private Stade stadeDefaut;
- /** Commentaire pour la manip */
- @Lob
- @Type(type="org.hibernate.type.StringClobType") // see HHH-6105
- private String complement;
+ /** Commentaire pour la manip */
+ @Lob
+ @Type(type="org.hibernate.type.StringClobType") // see HHH-6105
+ private String complement;
- /** Détermine si la manip doit être confidentielle */
- private boolean confidentiel;
+ /** Détermine si la manip doit être confidentielle */
+ private boolean confidentiel;
- /** Date jusqu'à laquelle la manip est confidentielle */
- @Future
- @Temporal(TemporalType.DATE)
- private Date dateConfidentialite;
+ /** Date jusqu'à laquelle la manip est confidentielle */
+ @Future
+ @Temporal(TemporalType.DATE)
+ private Date dateConfidentialite;
- /** Créateur */
- @NotNull
- @ManyToOne(fetch = FetchType.LAZY, optional = false)
- private Personne createur;
+ /** Créateur */
+ @NotNull
+ @ManyToOne(fetch = FetchType.LAZY, optional = false)
+ private Personne createur;
- /** Résultats produits par le test */
- @NotNull
- @OneToMany(mappedBy = "testBio", fetch = FetchType.LAZY, orphanRemoval = true)
- @Cascade({ CascadeType.SAVE_UPDATE })
- @ContainedIn
- private List<ResultatTestBio> resultats;
+ /** Résultats produits par le test */
+ @NotNull
+ @OneToMany(mappedBy = "testBio", fetch = FetchType.LAZY, orphanRemoval = true)
+ @Cascade({ CascadeType.SAVE_UPDATE })
+ @ContainedIn
+ private List<ResultatTestBio> resultats;
- /**
- * Constructeur
- */
- public TestBio() {
- resultats = new ArrayList<ResultatTestBio>();
- }
+ /**
+ * Constructeur
+ */
+ public TestBio() {
+ resultats = new ArrayList<ResultatTestBio>();
+ }
- /** {@inheritDoc} */
- @Override
- public String toString() {
- return ref;
- }
+ /** {@inheritDoc} */
+ @Override
+ public String toString() {
+ return ref;
+ }
- /** {@inheritDoc} */
- @Override
- public int compareTo(TestBio testBio) {
- return new BeanComparator("ref").compare(this, testBio);
- }
+ /** {@inheritDoc} */
+ @Override
+ public int compareTo(TestBio testBio) {
+ return new BeanComparator("ref").compare(this, testBio);
+ }
- /**
- * Rend les résultats triés en utilisant le comparateur {@link ResultatsOfTestBioComp}
- * @return resultats
- */
- public List<ResultatTestBio> getSortedResultats() {
- // comme "@Sort(type = SortType.COMPARATOR, comparator = ResultatsOfTestBioComp.class)" ne rend pas une
- // liste triée avec List, tri dans le getter
- Collections.sort(resultats, new ResultatsOfTestBioComp());
- return resultats;
- }
+ /**
+ * Rend les résultats triés en utilisant le comparateur {@link ResultatsOfTestBioComp}
+ * @return resultats
+ */
+ public List<ResultatTestBio> getSortedResultats() {
+ // comme "@Sort(type = SortType.COMPARATOR, comparator = ResultatsOfTestBioComp.class)" ne rend pas une
+ // liste triée avec List, tri dans le getter
+ Collections.sort(resultats, new ResultatsOfTestBioComp());
+ return resultats;
+ }
- /**
- * idTestBio getter
- * @return idTestBio
- */
- public Integer getIdTestBio() {
- return idTestBio;
- }
+ /**
+ * idTestBio getter
+ * @return idTestBio
+ */
+ public Integer getIdTestBio() {
+ return idTestBio;
+ }
- /**
- * idTestBio setter
- * @param idTestBio idTestBio
- */
- public void setIdTestBio(Integer idTestBio) {
- this.idTestBio = idTestBio;
- }
+ /**
+ * idTestBio setter
+ * @param idTestBio idTestBio
+ */
+ public void setIdTestBio(Integer idTestBio) {
+ this.idTestBio = idTestBio;
+ }
- /**
- * ref getter
- * @return ref
- */
- public String getRef() {
- return ref;
- }
+ /**
+ * ref getter
+ * @return ref
+ */
+ public String getRef() {
+ return ref;
+ }
- /**
- * ref setter
- * @param ref ref
- */
- public void setRef(String ref) {
- this.ref = ref;
- }
+ /**
+ * ref setter
+ * @param ref ref
+ */
+ public void setRef(String ref) {
+ this.ref = ref;
+ }
- /**
- * manipulateur getter
- * @return manipulateur
- */
- public Personne getManipulateur() {
- return manipulateur;
- }
+ /**
+ * manipulateur getter
+ * @return manipulateur
+ */
+ public Personne getManipulateur() {
+ return manipulateur;
+ }
- /**
- * manipulateur setter
- * @param manipulateur manipulateur
- */
- public void setManipulateur(Personne manipulateur) {
- this.manipulateur = manipulateur;
- }
+ /**
+ * manipulateur setter
+ * @param manipulateur manipulateur
+ */
+ public void setManipulateur(Personne manipulateur) {
+ this.manipulateur = manipulateur;
+ }
- /**
- * organismeTesteur getter
- * @return organismeTesteur
- */
- public String getOrganismeTesteur() {
- return organismeTesteur;
- }
+ /**
+ * organismeTesteur getter
+ * @return organismeTesteur
+ */
+ public String getOrganismeTesteur() {
+ return organismeTesteur;
+ }
- /**
- * organismeTesteur setter
- * @param organismeTesteur organismeTesteur
- */
- public void setOrganismeTesteur(String organismeTesteur) {
- this.organismeTesteur = organismeTesteur;
- }
+ /**
+ * organismeTesteur setter
+ * @param organismeTesteur organismeTesteur
+ */
+ public void setOrganismeTesteur(String organismeTesteur) {
+ this.organismeTesteur = organismeTesteur;
+ }
- /**
- * date getter
- * @return date
- */
- public Date getDate() {
- return date;
- }
+ /**
+ * date getter
+ * @return date
+ */
+ public Date getDate() {
+ return date;
+ }
- /**
- * date setter
- * @param date date
- */
- public void setDate(Date date) {
- this.date = date;
- }
+ /**
+ * date setter
+ * @param date date
+ */
+ public void setDate(Date date) {
+ this.date = date;
+ }
- /**
- * methode getter
- * @return methode
- */
- public MethodeTestBio getMethode() {
- return methode;
- }
+ /**
+ * methode getter
+ * @return methode
+ */
+ public MethodeTestBio getMethode() {
+ return methode;
+ }
- /**
- * methode setter
- * @param methode methode
- */
- public void setMethode(MethodeTestBio methode) {
- this.methode = methode;
- }
+ /**
+ * methode setter
+ * @param methode methode
+ */
+ public void setMethode(MethodeTestBio methode) {
+ this.methode = methode;
+ }
- /**
- * concMasseDefaut getter
- * @return concMasseDefaut
- */
- public BigDecimal getConcMasseDefaut() {
- return concMasseDefaut;
- }
+ /**
+ * concMasseDefaut getter
+ * @return concMasseDefaut
+ */
+ public BigDecimal getConcMasseDefaut() {
+ return concMasseDefaut;
+ }
- /**
- * concMasseDefaut setter
- * @param concMasseDefaut concMasseDefaut
- */
- public void setConcMasseDefaut(BigDecimal concMasseDefaut) {
- this.concMasseDefaut = concMasseDefaut;
- }
+ /**
+ * concMasseDefaut setter
+ * @param concMasseDefaut concMasseDefaut
+ */
+ public void setConcMasseDefaut(BigDecimal concMasseDefaut) {
+ this.concMasseDefaut = concMasseDefaut;
+ }
- /**
- * uniteConcMasseDefaut getter
- * @return uniteConcMasseDefaut
- */
- public UniteConcMasse getUniteConcMasseDefaut() {
- return uniteConcMasseDefaut;
- }
+ /**
+ * uniteConcMasseDefaut getter
+ * @return uniteConcMasseDefaut
+ */
+ public UniteConcMasse getUniteConcMasseDefaut() {
+ return uniteConcMasseDefaut;
+ }
- /**
- * uniteConcMasseDefaut setter
- * @param uniteConcMasseDefaut uniteConcMasseDefaut
- */
- public void setUniteConcMasseDefaut(UniteConcMasse uniteConcMasseDefaut) {
- this.uniteConcMasseDefaut = uniteConcMasseDefaut;
- }
+ /**
+ * uniteConcMasseDefaut setter
+ * @param uniteConcMasseDefaut uniteConcMasseDefaut
+ */
+ public void setUniteConcMasseDefaut(UniteConcMasse uniteConcMasseDefaut) {
+ this.uniteConcMasseDefaut = uniteConcMasseDefaut;
+ }
- /**
- * stadeDefaut getter
- * @return stadeDefaut
- */
- public Stade getStadeDefaut() {
- return stadeDefaut;
- }
+ /**
+ * stadeDefaut getter
+ * @return stadeDefaut
+ */
+ public Stade getStadeDefaut() {
+ return stadeDefaut;
+ }
- /**
- * stadeDefaut setter
- * @param stadeDefaut stadeDefaut
- */
- public void setStadeDefaut(Stade stadeDefaut) {
- this.stadeDefaut = stadeDefaut;
- }
+ /**
+ * stadeDefaut setter
+ * @param stadeDefaut stadeDefaut
+ */
+ public void setStadeDefaut(Stade stadeDefaut) {
+ this.stadeDefaut = stadeDefaut;
+ }
- /**
- * complement getter
- * @return complement
- */
- public String getComplement() {
- return complement;
- }
+ /**
+ * complement getter
+ * @return complement
+ */
+ public String getComplement() {
+ return complement;
+ }
- /**
- * complement setter
- * @param complement complement
- */
- public void setComplement(String complement) {
- this.complement = complement;
- }
+ /**
+ * complement setter
+ * @param complement complement
+ */
+ public void setComplement(String complement) {
+ this.complement = complement;
+ }
- /**
- * confidentiel getter
- * @return confidentiel
- */
- public boolean isConfidentiel() {
- return confidentiel;
- }
+ /**
+ * confidentiel getter
+ * @return confidentiel
+ */
+ public boolean isConfidentiel() {
+ return confidentiel;
+ }
- /**
- * confidentiel setter
- * @param confidentiel confidentiel
- */
- public void setConfidentiel(boolean confidentiel) {
- this.confidentiel = confidentiel;
- }
+ /**
+ * confidentiel setter
+ * @param confidentiel confidentiel
+ */
+ public void setConfidentiel(boolean confidentiel) {
+ this.confidentiel = confidentiel;
+ }
- /**
- * dateConfidentialite getter
- * @return dateConfidentialite
- */
- public Date getDateConfidentialite() {
- return dateConfidentialite;
- }
+ /**
+ * dateConfidentialite getter
+ * @return dateConfidentialite
+ */
+ public Date getDateConfidentialite() {
+ return dateConfidentialite;
+ }
- /**
- * dateConfidentialite setter
- * @param dateConfidentialite dateConfidentialite
- */
- public void setDateConfidentialite(Date dateConfidentialite) {
- this.dateConfidentialite = dateConfidentialite;
- }
+ /**
+ * dateConfidentialite setter
+ * @param dateConfidentialite dateConfidentialite
+ */
+ public void setDateConfidentialite(Date dateConfidentialite) {
+ this.dateConfidentialite = dateConfidentialite;
+ }
- /**
- * createur getter
- * @return createur
- */
- public Personne getCreateur() {
- return createur;
- }
+ /**
+ * createur getter
+ * @return createur
+ */
+ public Personne getCreateur() {
+ return createur;
+ }
- /**
- * createur setter
- * @param createur createur
- */
- public void setCreateur(Personne createur) {
- this.createur = createur;
- }
+ /**
+ * createur setter
+ * @param createur createur
+ */
+ public void setCreateur(Personne createur) {
+ this.createur = createur;
+ }
- /**
- * resultats getter
- * @return resultats
- */
- public List<ResultatTestBio> getResultats() {
- return resultats;
- }
+ /**
+ * resultats getter
+ * @return resultats
+ */
+ public List<ResultatTestBio> getResultats() {
+ return resultats;
+ }
- /**
- * resultats setter
- * @param resultats resultats
- */
- public void setResultats(List<ResultatTestBio> resultats) {
- this.resultats = resultats;
- }
+ /**
+ * resultats setter
+ * @param resultats resultats
+ */
+ public void setResultats(List<ResultatTestBio> resultats) {
+ this.resultats = resultats;
+ }
}
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/TypeDocument.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/TypeDocument.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/TypeDocument.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -46,133 +46,133 @@
@Table(uniqueConstraints = { @UniqueConstraint(columnNames = { "nom" }) })
public class TypeDocument extends AbstractModel implements Cloneable, Comparable<TypeDocument> {
- /** Document type ID */
- @Id
- @GeneratedValue
- private Integer idTypeDocument;
+ /** Document type ID */
+ @Id
+ @GeneratedValue
+ private Integer idTypeDocument;
- /** Document type name */
- @Length(max = LENGTH_MEDIUM_TEXT)
- @NotEmpty
- @Column(unique = true)
- private String nom;
+ /** Document type name */
+ @Length(max = LENGTH_MEDIUM_TEXT)
+ @NotEmpty
+ @Column(unique = true)
+ private String nom;
- /** Document type domain */
- @Length(max = LENGTH_MEDIUM_TEXT)
- private String domaine;
+ /** Document type domain */
+ @Length(max = LENGTH_MEDIUM_TEXT)
+ private String domaine;
- /** Document type description */
- @NotEmpty
- @Lob
- @Type(type="org.hibernate.type.StringClobType") // see HHH-6105
- private String description;
+ /** Document type description */
+ @NotEmpty
+ @Lob
+ @Type(type="org.hibernate.type.StringClobType") // see HHH-6105
+ private String description;
- /** If the type document represents an image ? */
- @NotNull
- private Boolean estImage;
+ /** If the type document represents an image ? */
+ @NotNull
+ private Boolean estImage;
- /** {@inheritDoc} */
- @Override
- public TypeDocument clone() throws CloneNotSupportedException {
- TypeDocument clone = (TypeDocument) super.clone();
- clone.idTypeDocument = idTypeDocument;
- clone.nom = nom;
- clone.domaine = domaine;
- clone.description = description;
- clone.estImage = estImage;
- return clone;
- }
+ /** {@inheritDoc} */
+ @Override
+ public TypeDocument clone() throws CloneNotSupportedException {
+ TypeDocument clone = (TypeDocument) super.clone();
+ clone.idTypeDocument = idTypeDocument;
+ clone.nom = nom;
+ clone.domaine = domaine;
+ clone.description = description;
+ clone.estImage = estImage;
+ return clone;
+ }
- /** {@inheritDoc} */
- @Override
- public String toString() {
- return this.nom;
- }
+ /** {@inheritDoc} */
+ @Override
+ public String toString() {
+ return this.nom;
+ }
- /** {@inheritDoc} */
- @Override
- public int compareTo(TypeDocument typeExtrait) {
- return new BeanComparator("nom").compare(this, typeExtrait);
- }
+ /** {@inheritDoc} */
+ @Override
+ public int compareTo(TypeDocument typeExtrait) {
+ return new BeanComparator("nom").compare(this, typeExtrait);
+ }
- /**
- * idTypeDocument getter
- * @return idTypeDocument
- */
- public Integer getIdTypeDocument() {
- return idTypeDocument;
- }
+ /**
+ * idTypeDocument getter
+ * @return idTypeDocument
+ */
+ public Integer getIdTypeDocument() {
+ return idTypeDocument;
+ }
- /**
- * idTypeDocument setter
- * @param idTypeDocument idTypeDocument
- */
- public void setIdTypeDocument(Integer idTypeDocument) {
- this.idTypeDocument = idTypeDocument;
- }
+ /**
+ * idTypeDocument setter
+ * @param idTypeDocument idTypeDocument
+ */
+ public void setIdTypeDocument(Integer idTypeDocument) {
+ this.idTypeDocument = idTypeDocument;
+ }
- /**
- * nom getter
- * @return nom
- */
- public String getNom() {
- return nom;
- }
+ /**
+ * nom getter
+ * @return nom
+ */
+ public String getNom() {
+ return nom;
+ }
- /**
- * nom setter
- * @param nom nom
- */
- public void setNom(String nom) {
- this.nom = nom;
- }
+ /**
+ * nom setter
+ * @param nom nom
+ */
+ public void setNom(String nom) {
+ this.nom = nom;
+ }
- /**
- * domaine getter
- * @return domaine
- */
- public String getDomaine() {
- return domaine;
- }
+ /**
+ * domaine getter
+ * @return domaine
+ */
+ public String getDomaine() {
+ return domaine;
+ }
- /**
- * domaine setter
- * @param domaine domaine
- */
- public void setDomaine(String domaine) {
- this.domaine = domaine;
- }
+ /**
+ * domaine setter
+ * @param domaine domaine
+ */
+ public void setDomaine(String domaine) {
+ this.domaine = domaine;
+ }
- /**
- * description getter
- * @return description
- */
- public String getDescription() {
- return description;
- }
+ /**
+ * description getter
+ * @return description
+ */
+ public String getDescription() {
+ return description;
+ }
- /**
- * description setter
- * @param description description
- */
- public void setDescription(String description) {
- this.description = description;
- }
+ /**
+ * description setter
+ * @param description description
+ */
+ public void setDescription(String description) {
+ this.description = description;
+ }
- /**
- * estImage getter
- * @return estImage
- */
- public Boolean getEstImage() {
- return estImage;
- }
+ /**
+ * estImage getter
+ * @return estImage
+ */
+ public Boolean getEstImage() {
+ return estImage;
+ }
- /**
- * estImage setter
- * @param estImage estImage
- */
- public void setEstImage(Boolean estImage) {
- this.estImage = estImage;
- }
+ /**
+ * estImage setter
+ * @param estImage estImage
+ */
+ public void setEstImage(Boolean estImage) {
+ this.estImage = estImage;
+ }
}
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/TypeExtrait.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/TypeExtrait.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/TypeExtrait.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -47,112 +47,112 @@
@CollectionUniqueField(fieldName = "initiales", pathToCollection = "methodeExtraction.typesEnSortie")
public class TypeExtrait extends AbstractModel implements Cloneable, Comparable<TypeExtrait> {
- /** Id du type d'extrait */
- @Id
- @GeneratedValue
- private Integer idTypeExtrait;
+ /** Id du type d'extrait */
+ @Id
+ @GeneratedValue
+ private Integer idTypeExtrait;
- /** Initiales du type d'extrait */
- @Length(max = LENGTH_TINY_TEXT)
- @NotEmpty
- private String initiales;
+ /** Initiales du type d'extrait */
+ @Length(max = LENGTH_TINY_TEXT)
+ @NotEmpty
+ private String initiales;
- /** Description du type d'extrait */
- @NotEmpty
- @Lob
- @Type(type="org.hibernate.type.StringClobType") // see HHH-6105
- private String description;
+ /** Description du type d'extrait */
+ @NotEmpty
+ @Lob
+ @Type(type="org.hibernate.type.StringClobType") // see HHH-6105
+ private String description;
- /** Méthode d'extraction pour laquelle est défini le type d'extrait */
- @NotNull
- @ManyToOne(fetch = FetchType.LAZY, optional = false)
- private MethodeExtraction methodeExtraction;
+ /** Méthode d'extraction pour laquelle est défini le type d'extrait */
+ @NotNull
+ @ManyToOne(fetch = FetchType.LAZY, optional = false)
+ private MethodeExtraction methodeExtraction;
- /** {@inheritDoc} */
- @Override
- public TypeExtrait clone() throws CloneNotSupportedException {
- TypeExtrait clone = (TypeExtrait) super.clone();
- clone.idTypeExtrait = idTypeExtrait;
- clone.initiales = initiales;
- clone.description = description;
- clone.methodeExtraction = methodeExtraction;
- return clone;
- }
+ /** {@inheritDoc} */
+ @Override
+ public TypeExtrait clone() throws CloneNotSupportedException {
+ TypeExtrait clone = (TypeExtrait) super.clone();
+ clone.idTypeExtrait = idTypeExtrait;
+ clone.initiales = initiales;
+ clone.description = description;
+ clone.methodeExtraction = methodeExtraction;
+ return clone;
+ }
- /** {@inheritDoc} */
- @Override
- public String toString() {
- return this.initiales;
- }
+ /** {@inheritDoc} */
+ @Override
+ public String toString() {
+ return this.initiales;
+ }
- /** {@inheritDoc} */
- @Override
- public int compareTo(TypeExtrait typeExtrait) {
- return new BeanComparator("initiales").compare(this, typeExtrait);
- }
+ /** {@inheritDoc} */
+ @Override
+ public int compareTo(TypeExtrait typeExtrait) {
+ return new BeanComparator("initiales").compare(this, typeExtrait);
+ }
- /**
- * idTypeExtrait getter
- * @return idTypeExtrait
- */
- public Integer getIdTypeExtrait() {
- return idTypeExtrait;
- }
+ /**
+ * idTypeExtrait getter
+ * @return idTypeExtrait
+ */
+ public Integer getIdTypeExtrait() {
+ return idTypeExtrait;
+ }
- /**
- * idTypeExtrait setter
- * @param idTypeExtrait idTypeExtrait
- */
- public void setIdTypeExtrait(Integer idTypeExtrait) {
- this.idTypeExtrait = idTypeExtrait;
- }
+ /**
+ * idTypeExtrait setter
+ * @param idTypeExtrait idTypeExtrait
+ */
+ public void setIdTypeExtrait(Integer idTypeExtrait) {
+ this.idTypeExtrait = idTypeExtrait;
+ }
- /**
- * initiales getter
- * @return initiales
- */
- public String getInitiales() {
- return initiales;
- }
+ /**
+ * initiales getter
+ * @return initiales
+ */
+ public String getInitiales() {
+ return initiales;
+ }
- /**
- * initiales setter
- * @param initiales initiales
- */
- public void setInitiales(String initiales) {
- this.initiales = initiales;
- }
+ /**
+ * initiales setter
+ * @param initiales initiales
+ */
+ public void setInitiales(String initiales) {
+ this.initiales = initiales;
+ }
- /**
- * description getter
- * @return description
- */
- public String getDescription() {
- return description;
- }
+ /**
+ * description getter
+ * @return description
+ */
+ public String getDescription() {
+ return description;
+ }
- /**
- * description setter
- * @param description description
- */
- public void setDescription(String description) {
- this.description = description;
- }
+ /**
+ * description setter
+ * @param description description
+ */
+ public void setDescription(String description) {
+ this.description = description;
+ }
- /**
- * methodeExtraction getter
- * @return methodeExtraction
- */
- public MethodeExtraction getMethodeExtraction() {
- return methodeExtraction;
- }
+ /**
+ * methodeExtraction getter
+ * @return methodeExtraction
+ */
+ public MethodeExtraction getMethodeExtraction() {
+ return methodeExtraction;
+ }
- /**
- * methodeExtraction setter
- * @param methodeExtraction methodeExtraction
- */
- public void setMethodeExtraction(MethodeExtraction methodeExtraction) {
- this.methodeExtraction = methodeExtraction;
- }
+ /**
+ * methodeExtraction setter
+ * @param methodeExtraction methodeExtraction
+ */
+ public void setMethodeExtraction(MethodeExtraction methodeExtraction) {
+ this.methodeExtraction = methodeExtraction;
+ }
}
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Utilisateur.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Utilisateur.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Utilisateur.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -50,125 +50,125 @@
@Embeddable
public class Utilisateur extends Personne {
- /**
- * Types droits
- */
- public enum TypeDroit implements Comparable<TypeDroit> {
- /** Administrateur */
- ADMINISTRATEUR,
- /** Utilisateur */
- UTILISATEUR
- }
+ /**
+ * Types droits
+ */
+ public enum TypeDroit implements Comparable<TypeDroit> {
+ /** Administrateur */
+ ADMINISTRATEUR,
+ /** Utilisateur */
+ UTILISATEUR
+ }
- /** Date de validité du compte */
- @Temporal(TemporalType.DATE)
- private Date dateValiditeCompte;
+ /** Date de validité du compte */
+ @Temporal(TemporalType.DATE)
+ private Date dateValiditeCompte;
- /** Est-il valide ? */
- @NotNull
- @Index(name = "estValide")
- private Boolean estValide;
+ /** Est-il valide ? */
+ @NotNull
+ @Index(name = "estValide")
+ private Boolean estValide;
- /** Groupe */
- @ManyToOne(fetch = FetchType.LAZY, optional = true)
- private Groupe groupe;
+ /** Groupe */
+ @ManyToOne(fetch = FetchType.LAZY, optional = true)
+ private Groupe groupe;
- /** Mot de passe haché */
- @Length(min = PasswordTools.SHA1_LENGTH, max = PasswordTools.SHA1_LENGTH)
- @NotNull
- private String passwordHash;
+ /** Mot de passe haché */
+ @Length(min = PasswordTools.SHA1_LENGTH, max = PasswordTools.SHA1_LENGTH)
+ @NotNull
+ private String passwordHash;
- /** Type de droit */
- @NotNull
- @Enumerated(EnumType.ORDINAL)
- @Index(name = "typeDroit")
- private TypeDroit typeDroit;
+ /** Type de droit */
+ @NotNull
+ @Enumerated(EnumType.ORDINAL)
+ @Index(name = "typeDroit")
+ private TypeDroit typeDroit;
- /**
- * Constructeur
- */
- public Utilisateur() {
- super();
- }
+ /**
+ * Constructeur
+ */
+ public Utilisateur() {
+ super();
+ }
- /**
- * dateValiditeCompte getter
- * @return dateValiditeCompte
- */
- public Date getDateValiditeCompte() {
- return dateValiditeCompte;
- }
+ /**
+ * dateValiditeCompte getter
+ * @return dateValiditeCompte
+ */
+ public Date getDateValiditeCompte() {
+ return dateValiditeCompte;
+ }
- /**
- * dateValiditeCompte setter
- * @param dateValiditeCompte dateValiditeCompte
- */
- public void setDateValiditeCompte(Date dateValiditeCompte) {
- this.dateValiditeCompte = dateValiditeCompte;
- }
+ /**
+ * dateValiditeCompte setter
+ * @param dateValiditeCompte dateValiditeCompte
+ */
+ public void setDateValiditeCompte(Date dateValiditeCompte) {
+ this.dateValiditeCompte = dateValiditeCompte;
+ }
- /**
- * estValide getter
- * @return estValide
- */
- public Boolean isValide() {
- return estValide;
- }
+ /**
+ * estValide getter
+ * @return estValide
+ */
+ public Boolean isValide() {
+ return estValide;
+ }
- /**
- * estValide setter
- * @param estValide estValide
- */
- public void setValide(Boolean estValide) {
- this.estValide = estValide;
- }
+ /**
+ * estValide setter
+ * @param estValide estValide
+ */
+ public void setValide(Boolean estValide) {
+ this.estValide = estValide;
+ }
- /**
- * groupe getter
- * @return groupe
- */
- public Groupe getGroupe() {
- return groupe;
- }
+ /**
+ * groupe getter
+ * @return groupe
+ */
+ public Groupe getGroupe() {
+ return groupe;
+ }
- /**
- * groupe setter
- * @param groupe groupe
- */
- public void setGroupe(Groupe groupe) {
- this.groupe = groupe;
- }
+ /**
+ * groupe setter
+ * @param groupe groupe
+ */
+ public void setGroupe(Groupe groupe) {
+ this.groupe = groupe;
+ }
- /**
- * passwordHash getter
- * @return passwordHash
- */
- public String getPasswordHash() {
- return passwordHash;
- }
+ /**
+ * passwordHash getter
+ * @return passwordHash
+ */
+ public String getPasswordHash() {
+ return passwordHash;
+ }
- /**
- * passwordHash setter
- * @param passwordHash passwordHash
- */
- public void setPasswordHash(String passwordHash) {
- this.passwordHash = passwordHash;
- }
+ /**
+ * passwordHash setter
+ * @param passwordHash passwordHash
+ */
+ public void setPasswordHash(String passwordHash) {
+ this.passwordHash = passwordHash;
+ }
- /**
- * typeDroit getter
- * @return typeDroit
- */
- public TypeDroit getTypeDroit() {
- return typeDroit;
- }
+ /**
+ * typeDroit getter
+ * @return typeDroit
+ */
+ public TypeDroit getTypeDroit() {
+ return typeDroit;
+ }
- /**
- * typeDroit setter
- * @param typeDroit typeDroit
- */
- public void setTypeDroit(TypeDroit typeDroit) {
- this.typeDroit = typeDroit;
- }
+ /**
+ * typeDroit setter
+ * @param typeDroit typeDroit
+ */
+ public void setTypeDroit(TypeDroit typeDroit) {
+ this.typeDroit = typeDroit;
+ }
}
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/comparators/CampagnePersonneDroitsComp.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/comparators/CampagnePersonneDroitsComp.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/comparators/CampagnePersonneDroitsComp.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -37,13 +37,13 @@
*/
public class CampagnePersonneDroitsComp implements Comparator<CampagnePersonneDroits> {
- /** Logger */
- private static final Log LOG = LogTools.getLog();
+ /** Logger */
+ private static final Log LOG = LogTools.getLog();
- /** {@inheritDoc} */
- @Override
- public int compare(CampagnePersonneDroits obj1, CampagnePersonneDroits obj2) {
- LOG.debug("compare personnes droit");
- return new BeanComparator("id.pk1").compare(obj1, obj2);
- }
+ /** {@inheritDoc} */
+ @Override
+ public int compare(CampagnePersonneDroits obj1, CampagnePersonneDroits obj2) {
+ LOG.debug("compare personnes droit");
+ return new BeanComparator("id.pk1").compare(obj1, obj2);
+ }
}
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/comparators/ExtraitsOfExtractionComp.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/comparators/ExtraitsOfExtractionComp.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/comparators/ExtraitsOfExtractionComp.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -34,11 +34,11 @@
*/
public class ExtraitsOfExtractionComp implements Comparator<Extrait> {
- /** Logger */
- // private static final Log LOG = LogTools.getLog();
- /** {@inheritDoc} */
- @Override
- public int compare(Extrait obj1, Extrait obj2) {
- return new BeanComparator("typeExtrait.initiales").compare(obj1, obj2);
- }
+ /** Logger */
+ // private static final Log LOG = LogTools.getLog();
+ /** {@inheritDoc} */
+ @Override
+ public int compare(Extrait obj1, Extrait obj2) {
+ return new BeanComparator("typeExtrait.initiales").compare(obj1, obj2);
+ }
}
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/comparators/FractionsOfPurificationComp.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/comparators/FractionsOfPurificationComp.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/comparators/FractionsOfPurificationComp.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -36,11 +36,11 @@
*/
public class FractionsOfPurificationComp implements Comparator<Fraction> {
- /** Logger */
- // private static final Log LOG = LogTools.getLog();
- /** {@inheritDoc} */
- @Override
- public int compare(Fraction obj1, Fraction obj2) {
- return new BeanComparator("indice", new IntuitiveStringComparator<String>()).compare(obj1, obj2);
- }
+ /** Logger */
+ // private static final Log LOG = LogTools.getLog();
+ /** {@inheritDoc} */
+ @Override
+ public int compare(Fraction obj1, Fraction obj2) {
+ return new BeanComparator("indice", new IntuitiveStringComparator<String>()).compare(obj1, obj2);
+ }
}
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/comparators/LotPersonneDroitsComp.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/comparators/LotPersonneDroitsComp.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/comparators/LotPersonneDroitsComp.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -35,12 +35,12 @@
*/
public class LotPersonneDroitsComp implements Comparator<LotPersonneDroits> {
- /** {@inheritDoc} */
- @Override
- public int compare(LotPersonneDroits obj1, LotPersonneDroits obj2) {
- ComparatorChain comparatorChain = new ComparatorChain();
- comparatorChain.addComparator(new BeanComparator("id.pk1.campagne"));
- comparatorChain.addComparator(new BeanComparator("id.pk1"));
- return comparatorChain.compare(obj1, obj2);
- }
+ /** {@inheritDoc} */
+ @Override
+ public int compare(LotPersonneDroits obj1, LotPersonneDroits obj2) {
+ ComparatorChain comparatorChain = new ComparatorChain();
+ comparatorChain.addComparator(new BeanComparator("id.pk1.campagne"));
+ comparatorChain.addComparator(new BeanComparator("id.pk1"));
+ return comparatorChain.compare(obj1, obj2);
+ }
}
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/comparators/ResultatsOfTestBioComp.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/comparators/ResultatsOfTestBioComp.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/comparators/ResultatsOfTestBioComp.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -36,11 +36,11 @@
*/
public class ResultatsOfTestBioComp implements Comparator<ResultatTestBio> {
- /** Logger */
- // private static final Log LOG = LogTools.getLog();
- /** {@inheritDoc} */
- @Override
- public int compare(ResultatTestBio obj1, ResultatTestBio obj2) {
- return new BeanComparator("repere", new IntuitiveStringComparator<String>()).compare(obj1, obj2);
- }
+ /** Logger */
+ // private static final Log LOG = LogTools.getLog();
+ /** {@inheritDoc} */
+ @Override
+ public int compare(ResultatTestBio obj1, ResultatTestBio obj2) {
+ return new BeanComparator("repere", new IntuitiveStringComparator<String>()).compare(obj1, obj2);
+ }
}
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/utils/AbstractModel.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/utils/AbstractModel.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/utils/AbstractModel.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -49,66 +49,66 @@
*/
public abstract class AbstractModel implements Serializable {
- /** ID fields cache (for each model class name) */
- private static final Map<String, Field> ID_FIELDS = Collections.synchronizedMap(new TreeMap<String, Field>());
+ /** ID fields cache (for each model class name) */
+ private static final Map<String, Field> ID_FIELDS = Collections.synchronizedMap(new TreeMap<String, Field>());
- /** Length: big text */
+ /** Length: big text */
protected static final int LENGTH_BIG_TEXT = 255;
- /** Length: long text */
- protected static final int LENGTH_LONG_TEXT = 100;
+ /** Length: long text */
+ protected static final int LENGTH_LONG_TEXT = 100;
- /** Length: medium text */
- protected static final int LENGTH_MEDIUM_TEXT = 60;
+ /** Length: medium text */
+ protected static final int LENGTH_MEDIUM_TEXT = 60;
- /** Length: tiny text */
- protected static final int LENGTH_TINY_TEXT = 10;
+ /** Length: tiny text */
+ protected static final int LENGTH_TINY_TEXT = 10;
- /** Logger */
- private static final Log LOG = LogTools.getLog();
+ /** Logger */
+ private static final Log LOG = LogTools.getLog();
- /**
- * Retrieve the @Id or @EmbeddedId field
- * @return @Id or @EmbeddedId field
- * @throws UnexpectedException If it does not exist
- */
- public final Field getIdField() {
- return getIdField(this.getClass());
- }
+ /**
+ * Retrieve the @Id or @EmbeddedId field
+ * @return @Id or @EmbeddedId field
+ * @throws UnexpectedException If it does not exist
+ */
+ public final Field getIdField() {
+ return getIdField(this.getClass());
+ }
- /**
- * Retrieve the @Id or @EmbeddedId field
- * @param clazz the class of the model
- * @return @Id or @EmbeddedId field
- * @throws UnexpectedException If it does not exist
- */
- @SuppressWarnings("unchecked")
- public final static Field getIdField(final Class<? extends AbstractModel> clazz) {
- AssertTools.assertNotNull(clazz);
- Field field = null;
- String modelClassName = clazz.getName();
- field = ID_FIELDS.get(modelClassName);
+ /**
+ * Retrieve the @Id or @EmbeddedId field
+ * @param clazz the class of the model
+ * @return @Id or @EmbeddedId field
+ * @throws UnexpectedException If it does not exist
+ */
+ @SuppressWarnings("unchecked")
+ public final static Field getIdField(final Class<? extends AbstractModel> clazz) {
+ AssertTools.assertNotNull(clazz);
+ Field field = null;
+ String modelClassName = clazz.getName();
+ field = ID_FIELDS.get(modelClassName);
- if (field == null) {
- try {
- field = BeanTools.getAnnotatedPrivateField(clazz, Id.class, EmbeddedId.class);
- } catch (NoSuchFieldException e) {
- LOG.error(e.getMessage(), e);
- throw new UnexpectedException(e);
- }
- ID_FIELDS.put(modelClassName, field);
- }
+ if (field == null) {
+ try {
+ field = BeanTools.getAnnotatedPrivateField(clazz, Id.class, EmbeddedId.class);
+ } catch (NoSuchFieldException e) {
+ LOG.error(e.getMessage(), e);
+ throw new UnexpectedException(e);
+ }
+ ID_FIELDS.put(modelClassName, field);
+ }
- return field;
- }
+ return field;
+ }
- /**
- * Retrieve the @Id or @EmbeddedId field value
- * @return @Id or @EmbeddedId field value
- * @throws UnexpectedException If the field does not exist
- */
- public final Serializable getIdValue() {
- return (Serializable) BeanTools.getValue(this, AccessType.GETTER, getIdField().getName());
- }
+ /**
+ * Retrieve the @Id or @EmbeddedId field value
+ * @return @Id or @EmbeddedId field value
+ * @throws UnexpectedException If the field does not exist
+ */
+ public final Serializable getIdValue() {
+ return (Serializable) BeanTools.getValue(this, AccessType.GETTER, getIdField().getName());
+ }
}
\ No newline at end of file
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/utils/CompositeId.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/utils/CompositeId.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/utils/CompositeId.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -37,69 +37,69 @@
*/
@Embeddable
public class CompositeId<PK1 extends AbstractModel, PK2 extends AbstractModel> extends AbstractModel implements
- Cloneable {
+ Cloneable {
- /** Primary key 1 */
- @ManyToOne
- @NotNull
- private PK1 pk1;
+ /** Primary key 1 */
+ @ManyToOne
+ @NotNull
+ private PK1 pk1;
- /** Primary key 2 */
- @ManyToOne
- @NotNull
- private PK2 pk2;
+ /** Primary key 2 */
+ @ManyToOne
+ @NotNull
+ private PK2 pk2;
- /** {@inheritDoc} */
- @Override
- public CompositeId<PK1, PK2> clone() throws CloneNotSupportedException {
- CompositeId<PK1, PK2> clone = GenericsTools.cast(super.clone());
- clone.pk1 = pk1;
- clone.pk2 = pk2;
- return clone;
- }
+ /** {@inheritDoc} */
+ @Override
+ public CompositeId<PK1, PK2> clone() throws CloneNotSupportedException {
+ CompositeId<PK1, PK2> clone = GenericsTools.cast(super.clone());
+ clone.pk1 = pk1;
+ clone.pk2 = pk2;
+ return clone;
+ }
- /** {@inheritDoc} */
- @Override
- public boolean equals(Object obj) {
- return BeanTools.equals(this, obj, AccessType.GETTER, "pk1", "pk2");
- }
+ /** {@inheritDoc} */
+ @Override
+ public boolean equals(Object obj) {
+ return BeanTools.equals(this, obj, AccessType.GETTER, "pk1", "pk2");
+ }
- /** {@inheritDoc} */
- @Override
- public int hashCode() {
- return BeanTools.hashCode(this, pk1, pk2);
- }
+ /** {@inheritDoc} */
+ @Override
+ public int hashCode() {
+ return BeanTools.hashCode(this, pk1, pk2);
+ }
- /**
- * pk1 getter
- * @return pk1
- */
- public PK1 getPk1() {
- return pk1;
- }
+ /**
+ * pk1 getter
+ * @return pk1
+ */
+ public PK1 getPk1() {
+ return pk1;
+ }
- /**
- * pk1 setter
- * @param pk1 pk1
- */
- public void setPk1(PK1 pk1) {
- this.pk1 = pk1;
- }
+ /**
+ * pk1 setter
+ * @param pk1 pk1
+ */
+ public void setPk1(PK1 pk1) {
+ this.pk1 = pk1;
+ }
- /**
- * pk2 getter
- * @return pk2
- */
- public PK2 getPk2() {
- return pk2;
- }
+ /**
+ * pk2 getter
+ * @return pk2
+ */
+ public PK2 getPk2() {
+ return pk2;
+ }
- /**
- * pk2 setter
- * @param pk2 pk2
- */
- public void setPk2(PK2 pk2) {
- this.pk2 = pk2;
- }
+ /**
+ * pk2 setter
+ * @param pk2 pk2
+ */
+ public void setPk2(PK2 pk2) {
+ this.pk2 = pk2;
+ }
}
\ No newline at end of file
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/CollectionUniqueField.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/CollectionUniqueField.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/CollectionUniqueField.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -42,28 +42,28 @@
@Documented
public @interface CollectionUniqueField {
- /**
- * @return Groups
- */
- Class<?>[] groups() default {};
+ /**
+ * @return Groups
+ */
+ Class<?>[] groups() default {};
- /**
- * @return Message key
- */
- String message() default "{nc.ird.cantharella.data.validation.UniqueFieldList.message}";
+ /**
+ * @return Message key
+ */
+ String message() default "{nc.ird.cantharella.data.validation.UniqueFieldList.message}";
- /**
- * @return Payload
- */
- Class<? extends Payload>[] payload() default {};
+ /**
+ * @return Payload
+ */
+ Class<? extends Payload>[] payload() default {};
- /**
- * @return the properties path to access the collection which contain the beans. Example : beanX.cols
- */
- String pathToCollection();
+ /**
+ * @return the properties path to access the collection which contain the beans. Example : beanX.cols
+ */
+ String pathToCollection();
- /**
- * @return the name of the field which must be unique
- */
- String fieldName();
+ /**
+ * @return the name of the field which must be unique
+ */
+ String fieldName();
}
\ No newline at end of file
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/CollectionUniqueFieldValidator.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/CollectionUniqueFieldValidator.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/CollectionUniqueFieldValidator.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -38,35 +38,35 @@
*/
public final class CollectionUniqueFieldValidator implements ConstraintValidator<CollectionUniqueField, Object> {
- /** Logger */
- // private static final Log LOG = LogTools.getLog();
- /**
- * field name of the list which must be unique
- */
- String fieldName;
+ /** Logger */
+ // private static final Log LOG = LogTools.getLog();
+ /**
+ * field name of the list which must be unique
+ */
+ String fieldName;
- /**
- * properties path to access the collection which contain the beans, example : beanX.beanY.collZ
- */
- String pathToCollection;
+ /**
+ * properties path to access the collection which contain the beans, example : beanX.beanY.collZ
+ */
+ String pathToCollection;
- /** {@inheritDoc} */
- @Override
- public void initialize(CollectionUniqueField annotation) {
- this.fieldName = annotation.fieldName();
- this.pathToCollection = annotation.pathToCollection();
- }
+ /** {@inheritDoc} */
+ @Override
+ public void initialize(CollectionUniqueField annotation) {
+ this.fieldName = annotation.fieldName();
+ this.pathToCollection = annotation.pathToCollection();
+ }
- /** {@inheritDoc} */
- @Override
- public boolean isValid(Object value, ConstraintValidatorContext constraintContext) {
- Collection<Object> collection = GenericsTools.cast(BeanTools.getValueFromPath(value, AccessType.GETTER,
- this.pathToCollection));
- Object propertyVal = BeanTools.getValue(value, AccessType.GETTER, fieldName);
+ /** {@inheritDoc} */
+ @Override
+ public boolean isValid(Object value, ConstraintValidatorContext constraintContext) {
+ Collection<Object> collection = GenericsTools.cast(BeanTools.getValueFromPath(value, AccessType.GETTER,
+ this.pathToCollection));
+ Object propertyVal = BeanTools.getValue(value, AccessType.GETTER, fieldName);
- // each value of the field must have one occurrence in the collection
- return (propertyVal == null)
- || CollectionTools.countWithValue(collection, fieldName, AccessType.GETTER, propertyVal) == 1;
- }
+ // each value of the field must have one occurrence in the collection
+ return (propertyVal == null)
+ || CollectionTools.countWithValue(collection, fieldName, AccessType.GETTER, propertyVal) == 1;
+ }
}
\ No newline at end of file
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/CountryCode.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/CountryCode.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/CountryCode.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -41,18 +41,18 @@
@Constraint(validatedBy = CountryCodeValidator.class)
@Documented
public @interface CountryCode {
- /**
- * @return Groups
- */
- Class<?>[] groups() default {};
+ /**
+ * @return Groups
+ */
+ Class<?>[] groups() default {};
- /**
- * @return Message key
- */
- String message() default "{nc.ird.cantharella.data.validation.CountryCode.message}";
+ /**
+ * @return Message key
+ */
+ String message() default "{nc.ird.cantharella.data.validation.CountryCode.message}";
- /**
- * @return Payload
- */
- Class<? extends Payload>[] payload() default {};
+ /**
+ * @return Payload
+ */
+ Class<? extends Payload>[] payload() default {};
}
\ No newline at end of file
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/CountryCodeValidator.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/CountryCodeValidator.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/CountryCodeValidator.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -34,15 +34,15 @@
*/
public final class CountryCodeValidator implements ConstraintValidator<CountryCode, String> {
- /** {@inheritDoc} */
- @Override
- public void initialize(CountryCode annotation) {
- //
- }
+ /** {@inheritDoc} */
+ @Override
+ public void initialize(CountryCode annotation) {
+ //
+ }
- /** {@inheritDoc} */
- @Override
- public boolean isValid(String countryCode, ConstraintValidatorContext constraintContext) {
- return countryCode == null || DataContext.COUNTRY_CODES.contains(countryCode);
- }
+ /** {@inheritDoc} */
+ @Override
+ public boolean isValid(String countryCode, ConstraintValidatorContext constraintContext) {
+ return countryCode == null || DataContext.COUNTRY_CODES.contains(countryCode);
+ }
}
\ No newline at end of file
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/DbUniqueField.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/DbUniqueField.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/DbUniqueField.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -44,29 +44,29 @@
@Documented
public @interface DbUniqueField {
- /**
- * @return Groups
- */
- Class<?>[] groups() default {};
+ /**
+ * @return Groups
+ */
+ Class<?>[] groups() default {};
- /**
- * @return Message key
- */
- String message() default "{nc.ird.cantharella.data.validation.UniqueFieldList.message}";
+ /**
+ * @return Message key
+ */
+ String message() default "{nc.ird.cantharella.data.validation.UniqueFieldList.message}";
- /**
- * @return Payload
- */
- Class<? extends Payload>[] payload() default {};
+ /**
+ * @return Payload
+ */
+ Class<? extends Payload>[] payload() default {};
- /**
- * @return The classe which contain the unique field
- */
- Class<? extends AbstractModel> entity();
+ /**
+ * @return The classe which contain the unique field
+ */
+ Class<? extends AbstractModel> entity();
- /**
- * @return the name of the field which must be unique
- */
- String fieldName();
+ /**
+ * @return the name of the field which must be unique
+ */
+ String fieldName();
}
\ No newline at end of file
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/DbUniqueFieldValidator.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/DbUniqueFieldValidator.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/DbUniqueFieldValidator.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -42,50 +42,50 @@
*/
public final class DbUniqueFieldValidator implements ConstraintValidator<DbUniqueField, Object> {
- /** Logger */
- // private static final Log LOG = LogTools.getLog();
- /**
- * field name of the list which must be unique
- */
- String fieldName;
+ /** Logger */
+ // private static final Log LOG = LogTools.getLog();
+ /**
+ * field name of the list which must be unique
+ */
+ String fieldName;
- /**
- * The classe which contain the unique field
- */
- Class<? extends AbstractModel> entity;
+ /**
+ * The classe which contain the unique field
+ */
+ Class<? extends AbstractModel> entity;
- /** DAO */
- @Autowired
- private GenericDao dao;
+ /** DAO */
+ @Autowired
+ private GenericDao dao;
- /** {@inheritDoc} */
- @Override
- public void initialize(DbUniqueField annotation) {
- this.fieldName = annotation.fieldName();
- this.entity = annotation.entity();
- }
+ /** {@inheritDoc} */
+ @Override
+ public void initialize(DbUniqueField annotation) {
+ this.fieldName = annotation.fieldName();
+ this.entity = annotation.entity();
+ }
- /** {@inheritDoc} */
- @Override
- public boolean isValid(Object value, ConstraintValidatorContext constraintContext) {
- AssertTools.assertNotNull(value);
- Serializable fieldVal = (Serializable) BeanTools.getValue(value, AccessType.GETTER, fieldName);
- if (fieldVal == null) {
- return false;
- }
+ /** {@inheritDoc} */
+ @Override
+ public boolean isValid(Object value, ConstraintValidatorContext constraintContext) {
+ AssertTools.assertNotNull(value);
+ Serializable fieldVal = (Serializable) BeanTools.getValue(value, AccessType.GETTER, fieldName);
+ if (fieldVal == null) {
+ return false;
+ }
- // valid if it doesn't exist different value or if it exists but with the same id (so same row in the db)
- if (!dao.exists(entity, fieldName, fieldVal)) {
- return true;
- }
- AbstractModel modelForm = (AbstractModel) value;
- AbstractModel modelWithSameVal;
- try {
- modelWithSameVal = dao.read(entity, fieldName, fieldVal);
- } catch (DataNotFoundException e) {
- return true; // never call, cover by dao.exists...
- }
- return modelForm.getIdValue().equals(modelWithSameVal.getIdValue());
- }
+ // valid if it doesn't exist different value or if it exists but with the same id (so same row in the db)
+ if (!dao.exists(entity, fieldName, fieldVal)) {
+ return true;
+ }
+ AbstractModel modelForm = (AbstractModel) value;
+ AbstractModel modelWithSameVal;
+ try {
+ modelWithSameVal = dao.read(entity, fieldName, fieldVal);
+ } catch (DataNotFoundException e) {
+ return true; // never call, cover by dao.exists...
+ }
+ return modelForm.getIdValue().equals(modelWithSameVal.getIdValue());
+ }
}
\ No newline at end of file
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/Latitude.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/Latitude.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/Latitude.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -41,18 +41,18 @@
@Constraint(validatedBy = LatitudeValidator.class)
@Documented
public @interface Latitude {
- /**
- * @return Groups
- */
- Class<?>[] groups() default {};
+ /**
+ * @return Groups
+ */
+ Class<?>[] groups() default {};
- /**
- * @return Message key
- */
- String message() default "{nc.ird.cantharella.data.validation.Latitude.message}";
+ /**
+ * @return Message key
+ */
+ String message() default "{nc.ird.cantharella.data.validation.Latitude.message}";
- /**
- * @return Payload
- */
- Class<? extends Payload>[] payload() default {};
+ /**
+ * @return Payload
+ */
+ Class<? extends Payload>[] payload() default {};
}
\ No newline at end of file
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/LatitudeOrientation.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/LatitudeOrientation.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/LatitudeOrientation.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -41,18 +41,18 @@
@Constraint(validatedBy = LatitudeOrientationValidator.class)
@Documented
public @interface LatitudeOrientation {
- /**
- * @return Groups
- */
- Class<?>[] groups() default {};
+ /**
+ * @return Groups
+ */
+ Class<?>[] groups() default {};
- /**
- * @return Message key
- */
- String message() default "{nc.ird.cantharella.data.validation.LatitudeOrientation.message}";
+ /**
+ * @return Message key
+ */
+ String message() default "{nc.ird.cantharella.data.validation.LatitudeOrientation.message}";
- /**
- * @return Payload
- */
- Class<? extends Payload>[] payload() default {};
+ /**
+ * @return Payload
+ */
+ Class<? extends Payload>[] payload() default {};
}
\ No newline at end of file
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/LatitudeOrientationValidator.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/LatitudeOrientationValidator.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/LatitudeOrientationValidator.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -37,16 +37,16 @@
*/
public final class LatitudeOrientationValidator implements ConstraintValidator<LatitudeOrientation, Character> {
- /** {@inheritDoc} */
- @Override
- public void initialize(LatitudeOrientation annotation) {
- //
- }
+ /** {@inheritDoc} */
+ @Override
+ public void initialize(LatitudeOrientation annotation) {
+ //
+ }
- /** {@inheritDoc} */
- @Override
- public boolean isValid(Character latitudeOrientation, ConstraintValidatorContext constraintContext) {
- return latitudeOrientation == null
- || Arrays.asList(CoordTools.LATITUDE_ORIENTATIONS).contains(latitudeOrientation);
- }
+ /** {@inheritDoc} */
+ @Override
+ public boolean isValid(Character latitudeOrientation, ConstraintValidatorContext constraintContext) {
+ return latitudeOrientation == null
+ || Arrays.asList(CoordTools.LATITUDE_ORIENTATIONS).contains(latitudeOrientation);
+ }
}
\ No newline at end of file
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/LatitudeValidator.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/LatitudeValidator.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/LatitudeValidator.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -35,15 +35,15 @@
*/
public final class LatitudeValidator implements ConstraintValidator<Latitude, String> {
- /** {@inheritDoc} */
- @Override
- public void initialize(Latitude annotation) {
- //
- }
+ /** {@inheritDoc} */
+ @Override
+ public void initialize(Latitude annotation) {
+ //
+ }
- /** {@inheritDoc} */
- @Override
- public boolean isValid(String latitude, ConstraintValidatorContext constraintContext) {
- return latitude == null || CoordTools.validateLatitude(latitude);
- }
+ /** {@inheritDoc} */
+ @Override
+ public boolean isValid(String latitude, ConstraintValidatorContext constraintContext) {
+ return latitude == null || CoordTools.validateLatitude(latitude);
+ }
}
\ No newline at end of file
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/Longitude.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/Longitude.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/Longitude.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -41,18 +41,18 @@
@Constraint(validatedBy = LongitudeValidator.class)
@Documented
public @interface Longitude {
- /**
- * @return Groups
- */
- Class<?>[] groups() default {};
+ /**
+ * @return Groups
+ */
+ Class<?>[] groups() default {};
- /**
- * @return Message key
- */
- String message() default "{nc.ird.cantharella.data.validation.Longitude.message}";
+ /**
+ * @return Message key
+ */
+ String message() default "{nc.ird.cantharella.data.validation.Longitude.message}";
- /**
- * @return Payload
- */
- Class<? extends Payload>[] payload() default {};
+ /**
+ * @return Payload
+ */
+ Class<? extends Payload>[] payload() default {};
}
\ No newline at end of file
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/LongitudeOrientation.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/LongitudeOrientation.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/LongitudeOrientation.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -41,18 +41,18 @@
@Constraint(validatedBy = LongitudeOrientationValidator.class)
@Documented
public @interface LongitudeOrientation {
- /**
- * @return Groups
- */
- Class<?>[] groups() default {};
+ /**
+ * @return Groups
+ */
+ Class<?>[] groups() default {};
- /**
- * @return Message key
- */
- String message() default "{nc.ird.cantharella.data.validation.LongitudeOrientation.message}";
+ /**
+ * @return Message key
+ */
+ String message() default "{nc.ird.cantharella.data.validation.LongitudeOrientation.message}";
- /**
- * @return Payload
- */
- Class<? extends Payload>[] payload() default {};
+ /**
+ * @return Payload
+ */
+ Class<? extends Payload>[] payload() default {};
}
\ No newline at end of file
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/LongitudeOrientationValidator.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/LongitudeOrientationValidator.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/LongitudeOrientationValidator.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -37,16 +37,16 @@
*/
public final class LongitudeOrientationValidator implements ConstraintValidator<LongitudeOrientation, Character> {
- /** {@inheritDoc} */
- @Override
- public void initialize(LongitudeOrientation annotation) {
- //
- }
+ /** {@inheritDoc} */
+ @Override
+ public void initialize(LongitudeOrientation annotation) {
+ //
+ }
- /** {@inheritDoc} */
- @Override
- public boolean isValid(Character longitudeOrientation, ConstraintValidatorContext constraintContext) {
- return longitudeOrientation == null
- || Arrays.asList(CoordTools.LONGITUDE_ORIENTATIONS).contains(longitudeOrientation);
- }
+ /** {@inheritDoc} */
+ @Override
+ public boolean isValid(Character longitudeOrientation, ConstraintValidatorContext constraintContext) {
+ return longitudeOrientation == null
+ || Arrays.asList(CoordTools.LONGITUDE_ORIENTATIONS).contains(longitudeOrientation);
+ }
}
\ No newline at end of file
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/LongitudeValidator.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/LongitudeValidator.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/LongitudeValidator.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -35,15 +35,15 @@
*/
public final class LongitudeValidator implements ConstraintValidator<Longitude, String> {
- /** {@inheritDoc} */
- @Override
- public void initialize(Longitude annotation) {
- //
- }
+ /** {@inheritDoc} */
+ @Override
+ public void initialize(Longitude annotation) {
+ //
+ }
- /** {@inheritDoc} */
- @Override
- public boolean isValid(String longitude, ConstraintValidatorContext constraintContext) {
- return longitude == null || CoordTools.validateLongitude(longitude);
- }
+ /** {@inheritDoc} */
+ @Override
+ public boolean isValid(String longitude, ConstraintValidatorContext constraintContext) {
+ return longitude == null || CoordTools.validateLongitude(longitude);
+ }
}
\ No newline at end of file
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/QueryConstraint.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/QueryConstraint.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/QueryConstraint.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -40,26 +40,26 @@
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface QueryConstraint {
- /**
- * @return Groups
- */
- Class<?>[] groups() default {};
+ /**
+ * @return Groups
+ */
+ Class<?>[] groups() default {};
- /**
- * Error msg
- * @return the message
- */
- String message() default "{nc.ird.cantharella.data.validation.QueryConstraint.message}";
+ /**
+ * Error msg
+ * @return the message
+ */
+ String message() default "{nc.ird.cantharella.data.validation.QueryConstraint.message}";
- /**
- * @return Payload
- */
- Class<? extends Payload>[] payload() default {};
+ /**
+ * @return Payload
+ */
+ Class<? extends Payload>[] payload() default {};
- /**
- * Hql query to request
- * @return The query
- */
- String hql() default "";
+ /**
+ * Hql query to request
+ * @return The query
+ */
+ String hql() default "";
}
\ No newline at end of file
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/QueryConstraintValidator.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/QueryConstraintValidator.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/QueryConstraintValidator.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -49,91 +49,91 @@
*/
public class QueryConstraintValidator implements ConstraintValidator<QueryConstraint, String> {
- /** Logger */
- private static final Log LOG = LogTools.getLog();
+ /** Logger */
+ private static final Log LOG = LogTools.getLog();
- /** Hql query to request */
- private String hql;
- /** The collection of named parameters in the HQL statement */
- private String[] params;
+ /** Hql query to request */
+ private String hql;
+ /** The collection of named parameters in the HQL statement */
+ private String[] params;
- /** session factory injected */
- @Autowired
- private SessionFactory sessionFactory;
+ /** session factory injected */
+ @Autowired
+ private SessionFactory sessionFactory;
- /**
- * {@inheritDoc}
- */
- @Override
- public void initialize(QueryConstraint queryConstraint) {
- this.hql = queryConstraint.hql();
- this.params = createParameterList(this.hql);
- }
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void initialize(QueryConstraint queryConstraint) {
+ this.hql = queryConstraint.hql();
+ this.params = createParameterList(this.hql);
+ }
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean isValid(String domainObject, ConstraintValidatorContext context) {
- BeanWrapper beanWrapper = new BeanWrapperImpl(domainObject);
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean isValid(String domainObject, ConstraintValidatorContext context) {
+ BeanWrapper beanWrapper = new BeanWrapperImpl(domainObject);
- if (sessionFactory != null) {
- LOG.debug("Enabled - Validating constraint with: ");
- LOG.debug(hql);
+ if (sessionFactory != null) {
+ LOG.debug("Enabled - Validating constraint with: ");
+ LOG.debug(hql);
- Session session = sessionFactory.openSession();
- Transaction tx = session.beginTransaction();
- Query query = session.createQuery(this.hql);
+ Session session = sessionFactory.openSession();
+ Transaction tx = session.beginTransaction();
+ Query query = session.createQuery(this.hql);
- for (String parameterName : this.params) {
- query.setParameter(parameterName, beanWrapper.getPropertyValue(parameterName));
- }
+ for (String parameterName : this.params) {
+ query.setParameter(parameterName, beanWrapper.getPropertyValue(parameterName));
+ }
- boolean result = (Long) query.uniqueResult() == 0;
- // boolean result = query.list().size() == 0;
+ boolean result = (Long) query.uniqueResult() == 0;
+ // boolean result = query.list().size() == 0;
- tx.commit();
- session.close();
+ tx.commit();
+ session.close();
- return result;
- }
+ return result;
+ }
- return true;
- }
+ return true;
+ }
- /**
- * Extracts the named parameters from the specified HQL statement.
- * @param query the HQL statement to parse
- * @return an array of all the named parameters (of the form :name) found in the provided string
- */
- private String[] createParameterList(final String query) {
- final Matcher matcher = Pattern.compile(":[^\\s]*").matcher(query);
- List<String> paramList = new ArrayList<String>();
- while (matcher.find()) {
- paramList.add(this.hql.substring(matcher.start() + 1, matcher.end()));
- }
+ /**
+ * Extracts the named parameters from the specified HQL statement.
+ * @param query the HQL statement to parse
+ * @return an array of all the named parameters (of the form :name) found in the provided string
+ */
+ private String[] createParameterList(final String query) {
+ final Matcher matcher = Pattern.compile(":[^\\s]*").matcher(query);
+ List<String> paramList = new ArrayList<String>();
+ while (matcher.find()) {
+ paramList.add(this.hql.substring(matcher.start() + 1, matcher.end()));
+ }
- return paramList.toArray(new String[paramList.size()]);
- }
+ return paramList.toArray(new String[paramList.size()]);
+ }
- // public boolean isValid(String domainObject) {
- // return isValid(domainObject, null);
- // }
+ // public boolean isValid(String domainObject) {
+ // return isValid(domainObject, null);
+ // }
- /**
- * Method to determine whether or not the value passes validation.
- * <p>
- * Validation in this case refers to a value being unique.
- * @param value the value to validate for uniqueness
- * @return true if the value is unique, false otherwise
- */
- /*
- * public boolean isValid(final Object value) { Query query =
- * sessionFactory.getCurrentSession().createQuery(this.hql); Class valueClass = value.getClass(); Field field;
- * for(int i = 0; i < this.params.length; i++) { try { field = valueClass.getDeclaredField(this.params[i]);
- * field.setAccessible(true); query.setParameter(this.params[i], (null != field.get(value)) ? field.get(value) :
- * ""); } catch(final NoSuchFieldException e) { throw new SystemException(e.getMessage()); } catch(final
- * IllegalAccessException e) { throw new SystemException(e.getMessage()); } } return query.list().size() == 0; }
- */
+ /**
+ * Method to determine whether or not the value passes validation.
+ * <p>
+ * Validation in this case refers to a value being unique.
+ * @param value the value to validate for uniqueness
+ * @return true if the value is unique, false otherwise
+ */
+ /*
+ * public boolean isValid(final Object value) { Query query =
+ * sessionFactory.getCurrentSession().createQuery(this.hql); Class valueClass = value.getClass(); Field field;
+ * for(int i = 0; i < this.params.length; i++) { try { field = valueClass.getDeclaredField(this.params[i]);
+ * field.setAccessible(true); query.setParameter(this.params[i], (null != field.get(value)) ? field.get(value) :
+ * ""); } catch(final NoSuchFieldException e) { throw new SystemException(e.getMessage()); } catch(final
+ * IllegalAccessException e) { throw new SystemException(e.getMessage()); } } return query.list().size() == 0; }
+ */
}
\ No newline at end of file
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/Referentiel.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/Referentiel.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/Referentiel.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -41,18 +41,18 @@
@Constraint(validatedBy = ReferentielValidator.class)
@Documented
public @interface Referentiel {
- /**
- * @return Groups
- */
- Class<?>[] groups() default {};
+ /**
+ * @return Groups
+ */
+ Class<?>[] groups() default {};
- /**
- * @return Message key
- */
- String message() default "{nc.ird.cantharella.data.validation.Referentiel.message}";
+ /**
+ * @return Message key
+ */
+ String message() default "{nc.ird.cantharella.data.validation.Referentiel.message}";
- /**
- * @return Payload
- */
- Class<? extends Payload>[] payload() default {};
+ /**
+ * @return Payload
+ */
+ Class<? extends Payload>[] payload() default {};
}
\ No newline at end of file
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/ReferentielValidator.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/ReferentielValidator.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/ReferentielValidator.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -34,15 +34,15 @@
*/
public final class ReferentielValidator implements ConstraintValidator<Referentiel, Integer> {
- /** {@inheritDoc} */
- @Override
- public void initialize(Referentiel annotation) {
- //
- }
+ /** {@inheritDoc} */
+ @Override
+ public void initialize(Referentiel annotation) {
+ //
+ }
- /** {@inheritDoc} */
- @Override
- public boolean isValid(Integer referentiel, ConstraintValidatorContext constraintContext) {
- return referentiel == null || DataContext.REFERENTIELS.keySet().contains(referentiel);
- }
+ /** {@inheritDoc} */
+ @Override
+ public boolean isValid(Integer referentiel, ConstraintValidatorContext constraintContext) {
+ return referentiel == null || DataContext.REFERENTIELS.keySet().contains(referentiel);
+ }
}
\ No newline at end of file
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/utils/ModelValidator.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/utils/ModelValidator.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/utils/ModelValidator.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -34,31 +34,31 @@
*/
public interface ModelValidator {
- /**
- * Debug properties validation for a model
- * @param <M> Model type
- * @param modelClass Model class
- * @param model Model
- */
- <M extends AbstractModel> void debug(Class<M> modelClass, M model);
+ /**
+ * Debug properties validation for a model
+ * @param <M> Model type
+ * @param modelClass Model class
+ * @param model Model
+ */
+ <M extends AbstractModel> void debug(Class<M> modelClass, M model);
- /**
- * Validate properties for a model
- * @param <M> Model type
- * @param model Model
- * @param locale Locale for error messages
- * @param properties Property names (all properties if empty array)
- * @return Constraint error messages (not null)
- */
- <M> List<String> validate(M model, Locale locale, String... properties);
+ /**
+ * Validate properties for a model
+ * @param <M> Model type
+ * @param model Model
+ * @param locale Locale for error messages
+ * @param properties Property names (all properties if empty array)
+ * @return Constraint error messages (not null)
+ */
+ <M> List<String> validate(M model, Locale locale, String... properties);
- /**
- * Validate properties for a model
- * @param <M> Model type
- * @param model Model
- * @param locale Locale for error messages
- * @param properties Property names (all properties if empty array)
- * @return Constraint error messages (not null), pair of property + message
- */
- // <M> List<Pair<String, String>> validate(M model, Locale locale, String... properties);
+ /**
+ * Validate properties for a model
+ * @param <M> Model type
+ * @param model Model
+ * @param locale Locale for error messages
+ * @param properties Property names (all properties if empty array)
+ * @return Constraint error messages (not null), pair of property + message
+ */
+ // <M> List<Pair<String, String>> validate(M model, Locale locale, String... properties);
}
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/utils/ModelValidatorEventListener.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/utils/ModelValidatorEventListener.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/utils/ModelValidatorEventListener.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -48,62 +48,62 @@
*/
public final class ModelValidatorEventListener implements PreInsertEventListener, PreUpdateEventListener {
- /**
- * Operation
- */
- private enum Operation {
- /** Insert */
- INSERT,
- /** Update */
- UPDATE;
- }
+ /**
+ * Operation
+ */
+ private enum Operation {
+ /** Insert */
+ INSERT,
+ /** Update */
+ UPDATE;
+ }
- /** Logger */
- private static final Log LOG = LogTools.getLog();
+ /** Logger */
+ private static final Log LOG = LogTools.getLog();
- /** Validator */
- private final Validator validator;
+ /** Validator */
+ private final Validator validator;
- /**
- * Constructor
- * @param factory Validator factory
- */
- public ModelValidatorEventListener(ValidatorFactory factory) {
- AssertTools.assertNotNull(factory);
- validator = factory.getValidator();
- }
+ /**
+ * Constructor
+ * @param factory Validator factory
+ */
+ public ModelValidatorEventListener(ValidatorFactory factory) {
+ AssertTools.assertNotNull(factory);
+ validator = factory.getValidator();
+ }
- /** {@inheritDoc} */
- @Override
- public boolean onPreInsert(PreInsertEvent event) {
- validate(event, Operation.INSERT);
- return false;
- }
+ /** {@inheritDoc} */
+ @Override
+ public boolean onPreInsert(PreInsertEvent event) {
+ validate(event, Operation.INSERT);
+ return false;
+ }
- /** {@inheritDoc} */
- @Override
- public boolean onPreUpdate(PreUpdateEvent event) {
- validate(event, Operation.UPDATE);
- return false;
- }
+ /** {@inheritDoc} */
+ @Override
+ public boolean onPreUpdate(PreUpdateEvent event) {
+ validate(event, Operation.UPDATE);
+ return false;
+ }
- /**
- * Validation
- * @param event Event
- * @param operation Operation
- */
- private void validate(AbstractPreDatabaseOperationEvent event, Operation operation) {
- Object o = event.getEntity();
- if (event.getEntity() != null && event.getPersister().getEntityMode() == EntityMode.POJO) {
- Set<ConstraintViolation<Object>> violations = validator.validate(o);
- if (!violations.isEmpty()) {
- LOG.error("Validation before " + operation.name() + " " + o.getClass().getName() + ":");
- for (ConstraintViolation<Object> violation : violations) {
- LOG.error("- " + violation.getPropertyPath() + ": " + violation.getMessage());
- }
- throw new ConstraintViolationException("Validation failed before " + operation.name() + " "
- + o.getClass().getName(), new HashSet<ConstraintViolation<?>>(violations));
- }
- }
- }
+ /**
+ * Validation
+ * @param event Event
+ * @param operation Operation
+ */
+ private void validate(AbstractPreDatabaseOperationEvent event, Operation operation) {
+ Object o = event.getEntity();
+ if (event.getEntity() != null && event.getPersister().getEntityMode() == EntityMode.POJO) {
+ Set<ConstraintViolation<Object>> violations = validator.validate(o);
+ if (!violations.isEmpty()) {
+ LOG.error("Validation before " + operation.name() + " " + o.getClass().getName() + ":");
+ for (ConstraintViolation<Object> violation : violations) {
+ LOG.error("- " + violation.getPropertyPath() + ": " + violation.getMessage());
+ }
+ throw new ConstraintViolationException("Validation failed before " + operation.name() + " "
+ + o.getClass().getName(), new HashSet<ConstraintViolation<?>>(violations));
+ }
+ }
+ }
}
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/utils/ModelValidatorImpl.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/utils/ModelValidatorImpl.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/utils/ModelValidatorImpl.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -51,139 +51,139 @@
*/
public final class ModelValidatorImpl implements ModelValidator {
- /** Logger */
- static final Log LOG = LogTools.getLog();
+ /** Logger */
+ static final Log LOG = LogTools.getLog();
- /** Pattern error property: "property message" */
- private static final String PATTERN_ERROR_MESSAGE = "%s - %s";
+ /** Pattern error property: "property message" */
+ private static final String PATTERN_ERROR_MESSAGE = "%s - %s";
- /** Pattern error property: "simpleClassName.property" */
- private static final String PATTERN_ERROR_PROPERTY = "%s.%s";
+ /** Pattern error property: "simpleClassName.property" */
+ private static final String PATTERN_ERROR_PROPERTY = "%s.%s";
- /** Message interpolator */
- private final MessageInterpolator messageInterpolator;
+ /** Message interpolator */
+ private final MessageInterpolator messageInterpolator;
- /** Internationalization messages */
- private MessageSourceAccessor[] messageSources;
+ /** Internationalization messages */
+ private MessageSourceAccessor[] messageSources;
- /** Validator */
- private final Validator validator;
+ /** Validator */
+ private final Validator validator;
- /**
- * Constructor
- * @param validatorFactory Validator factory
- * @param messageSourceAccessor Message source accessor
- */
- public ModelValidatorImpl(ValidatorFactory validatorFactory, MessageSourceAccessor... messageSourceAccessor) {
- AssertTools.assertNotNull(validatorFactory);
- messageInterpolator = validatorFactory.getMessageInterpolator();
- validator = validatorFactory.getValidator();
- messageSources = messageSourceAccessor;
- }
+ /**
+ * Constructor
+ * @param validatorFactory Validator factory
+ * @param messageSourceAccessor Message source accessor
+ */
+ public ModelValidatorImpl(ValidatorFactory validatorFactory, MessageSourceAccessor... messageSourceAccessor) {
+ AssertTools.assertNotNull(validatorFactory);
+ messageInterpolator = validatorFactory.getMessageInterpolator();
+ validator = validatorFactory.getValidator();
+ messageSources = messageSourceAccessor;
+ }
- /** {@inheritDoc} */
- @Override
- public <M extends AbstractModel> void debug(Class<M> modelClass, M model) {
- if (LOG.isDebugEnabled()) {
- for (ConstraintViolation<M> violation : validator.validate(model)) {
- LOG.debug(violation.getMessage());
- }
- }
- }
+ /** {@inheritDoc} */
+ @Override
+ public <M extends AbstractModel> void debug(Class<M> modelClass, M model) {
+ if (LOG.isDebugEnabled()) {
+ for (ConstraintViolation<M> violation : validator.validate(model)) {
+ LOG.debug(violation.getMessage());
+ }
+ }
+ }
- /** {@inheritDoc} */
- @Override
- public <M> List<String> validate(M model, Locale locale, String... properties) {
- Set<ConstraintViolation<M>> violations = validate(model, properties);
- List<String> violationMessages = new ArrayList<String>(violations.size());
- for (final ConstraintViolation<M> violation : violations) {
- // Lookup in the bean class
- Class<?> clazz = violation.getRootBeanClass();
- // LOG.debug("clazz :" + clazz);
- String label = null;
- String labelDefault;
- // LOG.debug("getPropertyPath :" + violation.getPropertyPath().toString());
- if (StringUtils.isEmpty(violation.getPropertyPath().toString())) {
- labelDefault = getMessage(clazz.getSimpleName(), locale);
- } else {
- labelDefault = String
- .format(PATTERN_ERROR_PROPERTY, clazz.getSimpleName(), violation.getPropertyPath());
- }
- // LOG.debug("labelDefault :" + labelDefault);
- try {
- label = getMessage(labelDefault, locale);
- } catch (NoSuchMessageException e) {
- //
- }
- // LOG.debug("label :" + label);
- // Lookup in the bean superclasses
- while (label == null && !Object.class.equals(clazz)) {
- clazz = clazz.getSuperclass();
- try {
- if (StringUtils.isEmpty(violation.getPropertyPath().toString())) {
- getMessage(clazz.getSimpleName(), locale);
- } else {
- getMessage(
- String.format(PATTERN_ERROR_PROPERTY, clazz.getSimpleName(),
- violation.getPropertyPath()), locale);
- }
- } catch (NoSuchMessageException e) {
- //
- }
- }
- if (label == null) {
- label = labelDefault;
- }
+ /** {@inheritDoc} */
+ @Override
+ public <M> List<String> validate(M model, Locale locale, String... properties) {
+ Set<ConstraintViolation<M>> violations = validate(model, properties);
+ List<String> violationMessages = new ArrayList<String>(violations.size());
+ for (final ConstraintViolation<M> violation : violations) {
+ // Lookup in the bean class
+ Class<?> clazz = violation.getRootBeanClass();
+ // LOG.debug("clazz :" + clazz);
+ String label = null;
+ String labelDefault;
+ // LOG.debug("getPropertyPath :" + violation.getPropertyPath().toString());
+ if (StringUtils.isEmpty(violation.getPropertyPath().toString())) {
+ labelDefault = getMessage(clazz.getSimpleName(), locale);
+ } else {
+ labelDefault = String
+ .format(PATTERN_ERROR_PROPERTY, clazz.getSimpleName(), violation.getPropertyPath());
+ }
+ // LOG.debug("labelDefault :" + labelDefault);
+ try {
+ label = getMessage(labelDefault, locale);
+ } catch (NoSuchMessageException e) {
+ //
+ }
+ // LOG.debug("label :" + label);
+ // Lookup in the bean superclasses
+ while (label == null && !Object.class.equals(clazz)) {
+ clazz = clazz.getSuperclass();
+ try {
+ if (StringUtils.isEmpty(violation.getPropertyPath().toString())) {
+ getMessage(clazz.getSimpleName(), locale);
+ } else {
+ getMessage(
+ String.format(PATTERN_ERROR_PROPERTY, clazz.getSimpleName(),
+ violation.getPropertyPath()), locale);
+ }
+ } catch (NoSuchMessageException e) {
+ //
+ }
+ }
+ if (label == null) {
+ label = labelDefault;
+ }
- violationMessages.add(String.format(PATTERN_ERROR_MESSAGE, label,
- messageInterpolator.interpolate(violation.getMessageTemplate(), new Context() {
- @Override
- public ConstraintDescriptor<?> getConstraintDescriptor() {
- return violation.getConstraintDescriptor();
- }
+ violationMessages.add(String.format(PATTERN_ERROR_MESSAGE, label,
+ messageInterpolator.interpolate(violation.getMessageTemplate(), new Context() {
+ @Override
+ public ConstraintDescriptor<?> getConstraintDescriptor() {
+ return violation.getConstraintDescriptor();
+ }
- @Override
- public Object getValidatedValue() {
- return violation.getInvalidValue();
- }
- }, locale)));
- }
+ @Override
+ public Object getValidatedValue() {
+ return violation.getInvalidValue();
+ }
+ }, locale)));
+ }
- return violationMessages;
- }
+ return violationMessages;
+ }
- /**
- * Validate properties for a model
- * @param <M> Model type
- * @param model Model
- * @param properties Property names (all properties if empty array)
- * @return Constraint violations (not null)
- */
- private <M> Set<ConstraintViolation<M>> validate(M model, String... properties) {
- if (properties == null || properties.length == 0) {
- return validator.validate(model);
- }
- Set<ConstraintViolation<M>> violations = new HashSet<ConstraintViolation<M>>();
- for (String property : properties) {
- violations.addAll(validator.validateProperty(model, property));
- }
- return violations;
- }
+ /**
+ * Validate properties for a model
+ * @param <M> Model type
+ * @param model Model
+ * @param properties Property names (all properties if empty array)
+ * @return Constraint violations (not null)
+ */
+ private <M> Set<ConstraintViolation<M>> validate(M model, String... properties) {
+ if (properties == null || properties.length == 0) {
+ return validator.validate(model);
+ }
+ Set<ConstraintViolation<M>> violations = new HashSet<ConstraintViolation<M>>();
+ for (String property : properties) {
+ violations.addAll(validator.validateProperty(model, property));
+ }
+ return violations;
+ }
- /**
- * Recuperate a msg from the msg accessor given to the class
- * @param key The message key
- * @param locale The used locale
- * @return The corresponding msg, null if no such key
- */
- private String getMessage(String key, Locale locale) {
- String msg = null;
- int i = 0;
- while (msg == null && i < messageSources.length) {
- MessageSourceAccessor curMsgSource = messageSources[i];
- msg = curMsgSource.getMessage(key, null, null, locale);
- i++;
- }
- return msg;
- }
+ /**
+ * Recuperate a msg from the msg accessor given to the class
+ * @param key The message key
+ * @param locale The used locale
+ * @return The corresponding msg, null if no such key
+ */
+ private String getMessage(String key, Locale locale) {
+ String msg = null;
+ int i = 0;
+ while (msg == null && i < messageSources.length) {
+ MessageSourceAccessor curMsgSource = messageSources[i];
+ msg = curMsgSource.getMessage(key, null, null, locale);
+ i++;
+ }
+ return msg;
+ }
}
Modified: trunk/cantharella.data/src/test/java/nc/ird/cantharella/data/AbstractDataTest.java
===================================================================
--- trunk/cantharella.data/src/test/java/nc/ird/cantharella/data/AbstractDataTest.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.data/src/test/java/nc/ird/cantharella/data/AbstractDataTest.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -45,11 +45,11 @@
@Transactional
public abstract class AbstractDataTest extends AbstractTransactionalJUnit4SpringContextTests {
- /**
- * Initialization
- */
- @Before
- public void setUp() {
- applicationContext.getAutowireCapableBeanFactory().autowireBean(this);
- }
+ /**
+ * Initialization
+ */
+ @Before
+ public void setUp() {
+ applicationContext.getAutowireCapableBeanFactory().autowireBean(this);
+ }
}
Modified: trunk/cantharella.data/src/test/java/nc/ird/cantharella/data/DataContextTest.java
===================================================================
--- trunk/cantharella.data/src/test/java/nc/ird/cantharella/data/DataContextTest.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.data/src/test/java/nc/ird/cantharella/data/DataContextTest.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -35,15 +35,15 @@
*/
public final class DataContextTest extends AbstractDataTest {
- /** Message source */
- @Resource(name = "dataMessageSource")
- private MessageSourceAccessor serviceMessageSource;
+ /** Message source */
+ @Resource(name = "dataMessageSource")
+ private MessageSourceAccessor serviceMessageSource;
- /**
- * Message source test
- */
- @Test
- public void serviceMessageSource() {
- Assert.assertEquals("Prénom", serviceMessageSource.getMessage("Personne.prenom"));
- }
+ /**
+ * Message source test
+ */
+ @Test
+ public void serviceMessageSource() {
+ Assert.assertEquals("Prénom", serviceMessageSource.getMessage("Personne.prenom"));
+ }
}
Modified: trunk/cantharella.data/src/test/java/nc/ird/cantharella/data/dao/GenericDaoTest.java
===================================================================
--- trunk/cantharella.data/src/test/java/nc/ird/cantharella/data/dao/GenericDaoTest.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.data/src/test/java/nc/ird/cantharella/data/dao/GenericDaoTest.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -36,24 +36,24 @@
*/
public final class GenericDaoTest extends AbstractDataTest {
- /** DAO */
- @Autowired
- private GenericDao dao;
+ /** DAO */
+ @Autowired
+ private GenericDao dao;
- /**
- * Check that a wrong SQL request throws a DataAccessException
- * @throws DataConstraintException -
- */
- @Test(expected = SQLGrammarException.class)
- public void execute() throws DataConstraintException {
- dao.execute("SELECT * FROM Foo");
- }
+ /**
+ * Check that a wrong SQL request throws a DataAccessException
+ * @throws DataConstraintException -
+ */
+ @Test(expected = SQLGrammarException.class)
+ public void execute() throws DataConstraintException {
+ dao.execute("SELECT * FROM Foo");
+ }
- /**
- * Basic test
- */
- @Test
- public void test() {
- Assert.assertNotNull(dao);
- }
+ /**
+ * Basic test
+ */
+ @Test
+ public void test() {
+ Assert.assertNotNull(dao);
+ }
}
Modified: trunk/cantharella.data/src/test/java/nc/ird/cantharella/data/dao/utils/SpringTransactionTestAppender.java
===================================================================
--- trunk/cantharella.data/src/test/java/nc/ird/cantharella/data/dao/utils/SpringTransactionTestAppender.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.data/src/test/java/nc/ird/cantharella/data/dao/utils/SpringTransactionTestAppender.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -30,39 +30,39 @@
*/
public class SpringTransactionTestAppender extends TestAppender {
- /**
- * Constructor
- */
- public SpringTransactionTestAppender() {
- super(TransactionInterceptor.class);
- }
+ /**
+ * Constructor
+ */
+ public SpringTransactionTestAppender() {
+ super(TransactionInterceptor.class);
+ }
- /**
- * @param forClass -
- * @param forMethod -
- * @return -
- */
- public boolean isTransactionOpened(@SuppressWarnings("rawtypes") Class forClass, String forMethod) {
- return containsExactSingleLogRecord("Getting transaction for [" + forClass.getName() + "." + forMethod + "]");
- }
+ /**
+ * @param forClass -
+ * @param forMethod -
+ * @return -
+ */
+ public boolean isTransactionOpened(@SuppressWarnings("rawtypes") Class forClass, String forMethod) {
+ return containsExactSingleLogRecord("Getting transaction for [" + forClass.getName() + "." + forMethod + "]");
+ }
- /**
- * @param forClass -
- * @param forMethod -
- * @return -
- */
- public boolean isTransactionCompleted(@SuppressWarnings("rawtypes") Class forClass, String forMethod) {
- return containsExactSingleLogRecord("Completing transaction for [" + forClass.getName() + "." + forMethod + "]");
- }
+ /**
+ * @param forClass -
+ * @param forMethod -
+ * @return -
+ */
+ public boolean isTransactionCompleted(@SuppressWarnings("rawtypes") Class forClass, String forMethod) {
+ return containsExactSingleLogRecord("Completing transaction for [" + forClass.getName() + "." + forMethod + "]");
+ }
- /**
- * @param forClass -
- * @param forMethod -
- * @return -
- */
- public boolean isTransactionRollbacked(@SuppressWarnings("rawtypes") Class forClass, String forMethod) {
- return containsSingleLogRecord("Completing transaction for [" + forClass.getName() + "." + forMethod
- + "] after exception");
- }
+ /**
+ * @param forClass -
+ * @param forMethod -
+ * @return -
+ */
+ public boolean isTransactionRollbacked(@SuppressWarnings("rawtypes") Class forClass, String forMethod) {
+ return containsSingleLogRecord("Completing transaction for [" + forClass.getName() + "." + forMethod
+ + "] after exception");
+ }
}
\ No newline at end of file
Modified: trunk/cantharella.data/src/test/java/nc/ird/cantharella/data/dao/utils/TestAppender.java
===================================================================
--- trunk/cantharella.data/src/test/java/nc/ird/cantharella/data/dao/utils/TestAppender.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.data/src/test/java/nc/ird/cantharella/data/dao/utils/TestAppender.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -39,183 +39,183 @@
* @version $Id: $
*/
public class TestAppender extends AppenderSkeleton {
- /** */
- private static Log log = LogFactory.getLog(TestAppender.class);
- /** */
- @SuppressWarnings("rawtypes")
- private final Class[] monitoredClasses;
- /** */
- private final LoggerInfo[] backedUpLoggers;
- /** */
- private final List<LoggingEvent> events = new ArrayList<LoggingEvent>();
+ /** */
+ private static Log log = LogFactory.getLog(TestAppender.class);
+ /** */
+ @SuppressWarnings("rawtypes")
+ private final Class[] monitoredClasses;
+ /** */
+ private final LoggerInfo[] backedUpLoggers;
+ /** */
+ private final List<LoggingEvent> events = new ArrayList<LoggingEvent>();
- /**
- * Constructor
- * @param monitoredClass -
- */
- public TestAppender(@SuppressWarnings("rawtypes") Class monitoredClass) {
- this(new Class[] { monitoredClass });
- }
+ /**
+ * Constructor
+ * @param monitoredClass -
+ */
+ public TestAppender(@SuppressWarnings("rawtypes") Class monitoredClass) {
+ this(new Class[] { monitoredClass });
+ }
- /**
- * Constructor
- * @param monitoredClasses -
- */
- public TestAppender(@SuppressWarnings("rawtypes") Class[] monitoredClasses) {
- super();
- this.monitoredClasses = monitoredClasses;
- if (log.isInfoEnabled()) {
- log.info("***************************************************************");
- log.info(" APPENDING TEST CONTROLLED LOGGING ENVIRONMENT ");
- log.info("***************************************************************");
- }
- backedUpLoggers = new LoggerInfo[monitoredClasses.length];
- for (int i = 0; i < monitoredClasses.length; i++) {
- @SuppressWarnings("rawtypes")
- Class monitoredClass = monitoredClasses[i];
- Logger logger = LogManager.getLogger(monitoredClass);
- backedUpLoggers[i] = new LoggerInfo(logger.getLevel(), logger.getAdditivity());
- logger.setLevel(Level.TRACE);
- logger.addAppender(this);
- logger.setAdditivity(true);
- }
- }
+ /**
+ * Constructor
+ * @param monitoredClasses -
+ */
+ public TestAppender(@SuppressWarnings("rawtypes") Class[] monitoredClasses) {
+ super();
+ this.monitoredClasses = monitoredClasses;
+ if (log.isInfoEnabled()) {
+ log.info("***************************************************************");
+ log.info(" APPENDING TEST CONTROLLED LOGGING ENVIRONMENT ");
+ log.info("***************************************************************");
+ }
+ backedUpLoggers = new LoggerInfo[monitoredClasses.length];
+ for (int i = 0; i < monitoredClasses.length; i++) {
+ @SuppressWarnings("rawtypes")
+ Class monitoredClass = monitoredClasses[i];
+ Logger logger = LogManager.getLogger(monitoredClass);
+ backedUpLoggers[i] = new LoggerInfo(logger.getLevel(), logger.getAdditivity());
+ logger.setLevel(Level.TRACE);
+ logger.addAppender(this);
+ logger.setAdditivity(true);
+ }
+ }
- /**
- *
- */
- public void clearLogChanges() {
- for (int i = 0; i < monitoredClasses.length; i++) {
- @SuppressWarnings("rawtypes")
- Class monitoredClass = monitoredClasses[i];
- Logger logger = LogManager.getLogger(monitoredClass);
- logger.setLevel(backedUpLoggers[i].getOriginalLevel());
- logger.setAdditivity(backedUpLoggers[i].isOriginalAdditivity());
- logger.removeAppender(this);
- }
- if (log.isInfoEnabled()) {
- log.info("***************************************************************");
- log.info(" REMOVED TEST CONTROLLED LOGGING ENVIRONMENT ");
- log.info("***************************************************************");
- }
- }
+ /**
+ *
+ */
+ public void clearLogChanges() {
+ for (int i = 0; i < monitoredClasses.length; i++) {
+ @SuppressWarnings("rawtypes")
+ Class monitoredClass = monitoredClasses[i];
+ Logger logger = LogManager.getLogger(monitoredClass);
+ logger.setLevel(backedUpLoggers[i].getOriginalLevel());
+ logger.setAdditivity(backedUpLoggers[i].isOriginalAdditivity());
+ logger.removeAppender(this);
+ }
+ if (log.isInfoEnabled()) {
+ log.info("***************************************************************");
+ log.info(" REMOVED TEST CONTROLLED LOGGING ENVIRONMENT ");
+ log.info("***************************************************************");
+ }
+ }
- /** {@inheritDoc} */
- @Override
- protected void append(LoggingEvent event) {
- synchronized (events) {
- events.add(event);
- System.out.println(">>> Capturing : " + event.getMessage());
- }
- }
+ /** {@inheritDoc} */
+ @Override
+ protected void append(LoggingEvent event) {
+ synchronized (events) {
+ events.add(event);
+ System.out.println(">>> Capturing : " + event.getMessage());
+ }
+ }
- /**
- * @param messagePart -
- * @return -
- */
- public int countLogRecord(String messagePart) {
- int counter = 0;
- for (LoggingEvent event : events) {
- String message = (String) event.getMessage();
- if (message != null && message.indexOf(messagePart) > -1) {
- counter++;
- }
- }
- return counter;
- }
+ /**
+ * @param messagePart -
+ * @return -
+ */
+ public int countLogRecord(String messagePart) {
+ int counter = 0;
+ for (LoggingEvent event : events) {
+ String message = (String) event.getMessage();
+ if (message != null && message.indexOf(messagePart) > -1) {
+ counter++;
+ }
+ }
+ return counter;
+ }
- /**
- * @param comparedMessage -
- * @return -
- */
- public int countExactLogRecord(String comparedMessage) {
- int counter = 0;
- for (LoggingEvent event : events) {
- String message = (String) event.getMessage();
- if (message != null && message.equals(comparedMessage)) {
- counter++;
- }
- }
- return counter;
- }
+ /**
+ * @param comparedMessage -
+ * @return -
+ */
+ public int countExactLogRecord(String comparedMessage) {
+ int counter = 0;
+ for (LoggingEvent event : events) {
+ String message = (String) event.getMessage();
+ if (message != null && message.equals(comparedMessage)) {
+ counter++;
+ }
+ }
+ return counter;
+ }
- /**
- * @param messagePart -
- * @return -
- */
- public boolean containsLogRecord(String messagePart) {
- return countLogRecord(messagePart) > 0;
- }
+ /**
+ * @param messagePart -
+ * @return -
+ */
+ public boolean containsLogRecord(String messagePart) {
+ return countLogRecord(messagePart) > 0;
+ }
- /**
- * @param messagePart -
- * @return -
- */
- public boolean containsSingleLogRecord(String messagePart) {
- return countLogRecord(messagePart) == 1;
- }
+ /**
+ * @param messagePart -
+ * @return -
+ */
+ public boolean containsSingleLogRecord(String messagePart) {
+ return countLogRecord(messagePart) == 1;
+ }
- /**
- * @param completeMessage -
- * @return -
- */
- public boolean containsExactLogRecord(String completeMessage) {
- return countExactLogRecord(completeMessage) > 0;
- }
+ /**
+ * @param completeMessage -
+ * @return -
+ */
+ public boolean containsExactLogRecord(String completeMessage) {
+ return countExactLogRecord(completeMessage) > 0;
+ }
- /**
- * @param completeMessage -
- * @return -
- */
- public boolean containsExactSingleLogRecord(String completeMessage) {
- return countExactLogRecord(completeMessage) == 1;
- }
+ /**
+ * @param completeMessage -
+ * @return -
+ */
+ public boolean containsExactSingleLogRecord(String completeMessage) {
+ return countExactLogRecord(completeMessage) == 1;
+ }
- /** {@inheritDoc} */
- @Override
- public void close() {
- events.clear();
- clearLogChanges();
- }
+ /** {@inheritDoc} */
+ @Override
+ public void close() {
+ events.clear();
+ clearLogChanges();
+ }
- /** {@inheritDoc} */
- @Override
- public boolean requiresLayout() {
- return false;
- }
+ /** {@inheritDoc} */
+ @Override
+ public boolean requiresLayout() {
+ return false;
+ }
- /**
- * @author Jan Novotný
- */
- private class LoggerInfo {
- /** */
- Level originalLevel;
- /** */
- boolean originalAdditivity;
+ /**
+ * @author Jan Novotný
+ */
+ private class LoggerInfo {
+ /** */
+ Level originalLevel;
+ /** */
+ boolean originalAdditivity;
- /**
- * Constructor
- * @param originalLevel -
- * @param originalAdditivity -
- */
- public LoggerInfo(Level originalLevel, boolean originalAdditivity) {
- this.originalLevel = originalLevel;
- this.originalAdditivity = originalAdditivity;
- }
+ /**
+ * Constructor
+ * @param originalLevel -
+ * @param originalAdditivity -
+ */
+ public LoggerInfo(Level originalLevel, boolean originalAdditivity) {
+ this.originalLevel = originalLevel;
+ this.originalAdditivity = originalAdditivity;
+ }
- /**
- * @return -
- */
- public Level getOriginalLevel() {
- return originalLevel;
- }
+ /**
+ * @return -
+ */
+ public Level getOriginalLevel() {
+ return originalLevel;
+ }
- /**
- * @return -
- */
- public boolean isOriginalAdditivity() {
- return originalAdditivity;
- }
- }
+ /**
+ * @return -
+ */
+ public boolean isOriginalAdditivity() {
+ return originalAdditivity;
+ }
+ }
}
\ No newline at end of file
Modified: trunk/cantharella.data/src/test/java/nc/ird/cantharella/data/model/GroupeTest.java
===================================================================
--- trunk/cantharella.data/src/test/java/nc/ird/cantharella/data/model/GroupeTest.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.data/src/test/java/nc/ird/cantharella/data/model/GroupeTest.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -35,16 +35,16 @@
*/
public class GroupeTest extends AbstractDataTest {
- /** DAO */
- @Autowired
- private GenericDao dao;
+ /** DAO */
+ @Autowired
+ private GenericDao dao;
- /**
- * Read groupes
- */
- @Test
- public void read() {
- Assert.assertNotNull(dao);
- Assert.assertNotNull(dao.readList(Groupe.class));
- }
+ /**
+ * Read groupes
+ */
+ @Test
+ public void read() {
+ Assert.assertNotNull(dao);
+ Assert.assertNotNull(dao.readList(Groupe.class));
+ }
}
Modified: trunk/cantharella.data/src/test/java/nc/ird/cantharella/data/model/GroupeTransactionTest.java
===================================================================
--- trunk/cantharella.data/src/test/java/nc/ird/cantharella/data/model/GroupeTransactionTest.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.data/src/test/java/nc/ird/cantharella/data/model/GroupeTransactionTest.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -39,39 +39,39 @@
@Transactional
public class GroupeTransactionTest extends GroupeTest {
- /** For transaction logging */
- SpringTransactionTestAppender transactionTestAppender;
+ /** For transaction logging */
+ SpringTransactionTestAppender transactionTestAppender;
- /**
- * Initialization before tests
- */
- @Before
- public void initLogger() {
- transactionTestAppender = new SpringTransactionTestAppender();
- }
+ /**
+ * Initialization before tests
+ */
+ @Before
+ public void initLogger() {
+ transactionTestAppender = new SpringTransactionTestAppender();
+ }
- /**
- * Release after tests
- */
- @After
- public void closeLogger() {
- transactionTestAppender.close();
- }
+ /**
+ * Release after tests
+ */
+ @After
+ public void closeLogger() {
+ transactionTestAppender.close();
+ }
- /**
- * Test if transaction works when reading groups
- * @throws Exception -
- */
- @Test
- public void testReadGroupesTransaction() throws Exception {
- // again we run our integration test
- super.read();
+ /**
+ * Test if transaction works when reading groups
+ * @throws Exception -
+ */
+ @Test
+ public void testReadGroupesTransaction() throws Exception {
+ // again we run our integration test
+ super.read();
- // and now we verify, that opening and closing transaction operations were made by the TransactionInterceptor
- String methodName = "readList";
- assertTrue(transactionTestAppender.isTransactionOpened(HibernateTemplateDao.class, methodName));
- assertTrue(transactionTestAppender.isTransactionCompleted(HibernateTemplateDao.class, methodName));
- assertFalse(transactionTestAppender.isTransactionRollbacked(HibernateTemplateDao.class, methodName));
- }
+ // and now we verify, that opening and closing transaction operations were made by the TransactionInterceptor
+ String methodName = "readList";
+ assertTrue(transactionTestAppender.isTransactionOpened(HibernateTemplateDao.class, methodName));
+ assertTrue(transactionTestAppender.isTransactionCompleted(HibernateTemplateDao.class, methodName));
+ assertFalse(transactionTestAppender.isTransactionRollbacked(HibernateTemplateDao.class, methodName));
+ }
}
\ No newline at end of file
Modified: trunk/cantharella.data/src/test/java/nc/ird/cantharella/data/model/ModelValidatorTest.java
===================================================================
--- trunk/cantharella.data/src/test/java/nc/ird/cantharella/data/model/ModelValidatorTest.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.data/src/test/java/nc/ird/cantharella/data/model/ModelValidatorTest.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -39,24 +39,24 @@
*/
public final class ModelValidatorTest extends AbstractDataTest {
- /** Validator */
- @Autowired
- private ModelValidator validator;
+ /** Validator */
+ @Autowired
+ private ModelValidator validator;
- /**
- * Test: validate
- */
- @Test
- public void validateModel() {
- Assert.assertFalse(validator.validate(new Utilisateur(), Locale.getDefault()).isEmpty());
- }
+ /**
+ * Test: validate
+ */
+ @Test
+ public void validateModel() {
+ Assert.assertFalse(validator.validate(new Utilisateur(), Locale.getDefault()).isEmpty());
+ }
- /**
- * Test: validate properties
- * @throws ValidationException In case of validation errors
- */
- @Test
- public void validateModelProperty() throws ValidationException {
- Assert.assertFalse(validator.validate(new Utilisateur(), Locale.getDefault(), "courriel").isEmpty());
- }
+ /**
+ * Test: validate properties
+ * @throws ValidationException In case of validation errors
+ */
+ @Test
+ public void validateModelProperty() throws ValidationException {
+ Assert.assertFalse(validator.validate(new Utilisateur(), Locale.getDefault(), "courriel").isEmpty());
+ }
}
Modified: trunk/cantharella.data/src/test/java/nc/ird/cantharella/data/model/PersonneTest.java
===================================================================
--- trunk/cantharella.data/src/test/java/nc/ird/cantharella/data/model/PersonneTest.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.data/src/test/java/nc/ird/cantharella/data/model/PersonneTest.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -33,20 +33,20 @@
*/
public class PersonneTest extends AbstractDataTest {
- /** DAO */
- // @Autowired
- // private GenericDao dao;
+ /** DAO */
+ // @Autowired
+ // private GenericDao dao;
- /**
- * Read personne fail //* @throws DataNotFoundException -
- */
- // test desactivated because of an
- // "no method exception found Check that an AOP invocation is in progress, and that the ExposeInvocationInterceptor is in the interceptor chain"
- // only in the test environment
- // @Test(expected = DataNotFoundException.class)
- @Test
- public void readFail() { // throws DataNotFoundException {
- // dao.read(Personne.class, 999999999);
- }
+ /**
+ * Read personne fail //* @throws DataNotFoundException -
+ */
+ // test desactivated because of an
+ // "no method exception found Check that an AOP invocation is in progress, and that the ExposeInvocationInterceptor is in the interceptor chain"
+ // only in the test environment
+ // @Test(expected = DataNotFoundException.class)
+ @Test
+ public void readFail() { // throws DataNotFoundException {
+ // dao.read(Personne.class, 999999999);
+ }
}
\ No newline at end of file
Modified: trunk/cantharella.service/pom.xml
===================================================================
--- trunk/cantharella.service/pom.xml 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.service/pom.xml 2013-01-29 09:48:04 UTC (rev 65)
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
@@ -81,20 +80,20 @@
</dependency>
<dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-core</artifactId>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-core</artifactId>
</dependency>
<dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-search-engine</artifactId>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-search-engine</artifactId>
</dependency>
<dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-search-orm</artifactId>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-search-orm</artifactId>
</dependency>
<dependency>
- <groupId>org.apache.lucene</groupId>
- <artifactId>lucene-core</artifactId>
+ <groupId>org.apache.lucene</groupId>
+ <artifactId>lucene-core</artifactId>
</dependency>
<dependency>
@@ -159,7 +158,7 @@
<groupId>cglib</groupId>
<artifactId>cglib-nodep</artifactId>
</dependency>
-
+
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
Modified: trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/config/ServiceContext.java
===================================================================
--- trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/config/ServiceContext.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/config/ServiceContext.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -60,110 +60,110 @@
@Configuration
public abstract class ServiceContext {
- /** Mail SMTP: port */
- private static final int MAIL_SMTP_PORT = 25;
+ /** Mail SMTP: port */
+ private static final int MAIL_SMTP_PORT = 25;
- /** Mail SMTP: time out */
- private static final int MAIL_SMTP_TIMEOUT = 10000;
+ /** Mail SMTP: time out */
+ private static final int MAIL_SMTP_TIMEOUT = 10000;
- /** Mail activation (thus mails can be disabled for test purposes) */
- private static boolean mailActivated = true;
+ /** Mail activation (thus mails can be disabled for test purposes) */
+ private static boolean mailActivated = true;
- /** Admin default courriel */
- @Value("${admin.courriel}")
- protected String adminCourrielProperty;
+ /** Admin default courriel */
+ @Value("${admin.courriel}")
+ protected String adminCourrielProperty;
- /** Admin default password */
- @Value("${admin.password}")
- protected String adminPasswordProperty;
+ /** Admin default password */
+ @Value("${admin.password}")
+ protected String adminPasswordProperty;
- /** E-mail debug mode */
- @Value("${mail.debug}")
- protected boolean mailDebugProperty;
+ /** E-mail debug mode */
+ @Value("${mail.debug}")
+ protected boolean mailDebugProperty;
- /** E-mail "from" */
- @Value("${mail.from}")
- protected String mailFromProperty;
+ /** E-mail "from" */
+ @Value("${mail.from}")
+ protected String mailFromProperty;
- /** E-mail SMTP host */
- @Value("${mail.host}")
- protected String mailHostProperty;
+ /** E-mail SMTP host */
+ @Value("${mail.host}")
+ protected String mailHostProperty;
- /**
- * mailActivated getter
- * @return mailActivated
- */
- public static final boolean isMailActivated() {
- return mailActivated;
- }
+ /**
+ * mailActivated getter
+ * @return mailActivated
+ */
+ public static final boolean isMailActivated() {
+ return mailActivated;
+ }
- /**
- * mailActivated setter
- * @param mailActivated mailActivated
- */
- public static final void setMailActivated(boolean mailActivated) {
- ServiceContext.mailActivated = mailActivated;
- }
+ /**
+ * mailActivated setter
+ * @param mailActivated mailActivated
+ */
+ public static final void setMailActivated(boolean mailActivated) {
+ ServiceContext.mailActivated = mailActivated;
+ }
- /**
- * @return Default admin, if none already exists
- */
- @Bean
- public Utilisateur defaultAdmin() {
- Utilisateur admin = new Utilisateur();
- admin.setTypeDroit(TypeDroit.ADMINISTRATEUR);
- admin.setAdressePostale("BP A5");
- admin.setCodePostal("98848");
- admin.setCourriel(adminCourrielProperty);
- admin.setNom("ADMIN");
- admin.setOrganisme("IRD");
- admin.setPasswordHash(PasswordTools.sha1(adminPasswordProperty));
- admin.setCodePays("FR");
- admin.setPrenom("Admin");
- admin.setVille("Nouméa");
- Normalizer.normalize(PersonneNormalizer.class, admin);
- return admin;
- }
+ /**
+ * @return Default admin, if none already exists
+ */
+ @Bean
+ public Utilisateur defaultAdmin() {
+ Utilisateur admin = new Utilisateur();
+ admin.setTypeDroit(TypeDroit.ADMINISTRATEUR);
+ admin.setAdressePostale("BP A5");
+ admin.setCodePostal("98848");
+ admin.setCourriel(adminCourrielProperty);
+ admin.setNom("ADMIN");
+ admin.setOrganisme("IRD");
+ admin.setPasswordHash(PasswordTools.sha1(adminPasswordProperty));
+ admin.setCodePays("FR");
+ admin.setPrenom("Admin");
+ admin.setVille("Nouméa");
+ Normalizer.normalize(PersonneNormalizer.class, admin);
+ return admin;
+ }
- /**
- * @return E-mail message template
- */
- @Bean
- public SimpleMailMessage mailMessage() {
- SimpleMailMessage mailMessage = new SimpleMailMessage();
- mailMessage.setFrom(mailFromProperty);
- return mailMessage;
- }
+ /**
+ * @return E-mail message template
+ */
+ @Bean
+ public SimpleMailMessage mailMessage() {
+ SimpleMailMessage mailMessage = new SimpleMailMessage();
+ mailMessage.setFrom(mailFromProperty);
+ return mailMessage;
+ }
- /**
- * @return E-mail sender
- */
- @Bean
- public MailSender mailSender() {
- JavaMailSenderImpl mailSender = new JavaMailSenderImpl();
- Properties properties = new Properties();
- properties.put("mail.debug", mailDebugProperty);
- properties.put("mail.smtp.connectiontimeout", MAIL_SMTP_TIMEOUT);
- properties.put("mail.smtp.timeout", MAIL_SMTP_TIMEOUT);
- properties.put("mail.smtp.reportsuccess", Boolean.TRUE);
- mailSender.setJavaMailProperties(properties);
- mailSender.setHost(mailHostProperty);
- mailSender.setPort(MAIL_SMTP_PORT);
- mailSender.setDefaultEncoding(DataContext.ENCODING);
- mailSender.setProtocol(JavaMailSenderImpl.DEFAULT_PROTOCOL);
- return mailSender;
- }
+ /**
+ * @return E-mail sender
+ */
+ @Bean
+ public MailSender mailSender() {
+ JavaMailSenderImpl mailSender = new JavaMailSenderImpl();
+ Properties properties = new Properties();
+ properties.put("mail.debug", mailDebugProperty);
+ properties.put("mail.smtp.connectiontimeout", MAIL_SMTP_TIMEOUT);
+ properties.put("mail.smtp.timeout", MAIL_SMTP_TIMEOUT);
+ properties.put("mail.smtp.reportsuccess", Boolean.TRUE);
+ mailSender.setJavaMailProperties(properties);
+ mailSender.setHost(mailHostProperty);
+ mailSender.setPort(MAIL_SMTP_PORT);
+ mailSender.setDefaultEncoding(DataContext.ENCODING);
+ mailSender.setProtocol(JavaMailSenderImpl.DEFAULT_PROTOCOL);
+ return mailSender;
+ }
- /**
- * @return Internationalization messages
- */
- @Bean
- public MessageSourceAccessor serviceMessageSource() {
- // The ResourceBundleMessageSource does not handle UTF-8, so we use the Reloadable one
- ReloadableResourceBundleMessageSource serviceMessageSource = new ReloadableResourceBundleMessageSource();
- serviceMessageSource.setBasename("service");
- serviceMessageSource.setDefaultEncoding(DataContext.ENCODING);
- serviceMessageSource.setCacheSeconds(-1);
- return new MessageSourceAccessor(serviceMessageSource);
- }
+ /**
+ * @return Internationalization messages
+ */
+ @Bean
+ public MessageSourceAccessor serviceMessageSource() {
+ // The ResourceBundleMessageSource does not handle UTF-8, so we use the Reloadable one
+ ReloadableResourceBundleMessageSource serviceMessageSource = new ReloadableResourceBundleMessageSource();
+ serviceMessageSource.setBasename("service");
+ serviceMessageSource.setDefaultEncoding(DataContext.ENCODING);
+ serviceMessageSource.setCacheSeconds(-1);
+ return new MessageSourceAccessor(serviceMessageSource);
+ }
}
Modified: trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/exceptions/EmailException.java
===================================================================
--- trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/exceptions/EmailException.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/exceptions/EmailException.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -30,11 +30,11 @@
*/
public final class EmailException extends AbstractException {
- /**
- * Constructor
- * @param cause Cause
- */
- public EmailException(Exception cause) {
- super(cause);
- }
+ /**
+ * Constructor
+ * @param cause Cause
+ */
+ public EmailException(Exception cause) {
+ super(cause);
+ }
}
Modified: trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/CampagneService.java
===================================================================
--- trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/CampagneService.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/CampagneService.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -42,83 +42,83 @@
*/
public interface CampagneService {
- /**
- * Compte le nombre de campagnes
- * @return Nombre de campagnes
- */
- long countCampagnes();
+ /**
+ * Compte le nombre de campagnes
+ * @return Nombre de campagnes
+ */
+ long countCampagnes();
- /**
- * Créé une campagne
- * @param campagne Campagne
- * @throws DataConstraintException En cas de doublons (champs uniques)
- */
- void createCampagne((a)Normalize(CampagneNormalizer.class) Campagne campagne) throws DataConstraintException;
+ /**
+ * Créé une campagne
+ * @param campagne Campagne
+ * @throws DataConstraintException En cas de doublons (champs uniques)
+ */
+ void createCampagne((a)Normalize(CampagneNormalizer.class) Campagne campagne) throws DataConstraintException;
- /**
- * Supprime une campagne
- * @param campagne Campagne
- * @throws DataConstraintException Si des données liées empêchent la suppression
- */
- void deleteCampagne(Campagne campagne) throws DataConstraintException;
+ /**
+ * Supprime une campagne
+ * @param campagne Campagne
+ * @throws DataConstraintException Si des données liées empêchent la suppression
+ */
+ void deleteCampagne(Campagne campagne) throws DataConstraintException;
- /**
- * Liste les programmes des campagnes déjà saisis
- * @return Programmes des campagnes
- */
- @Transactional(readOnly = true)
- List<String> listCampagneProgrammes();
+ /**
+ * Liste les programmes des campagnes déjà saisis
+ * @return Programmes des campagnes
+ */
+ @Transactional(readOnly = true)
+ List<String> listCampagneProgrammes();
- /**
- * Liste les campagnes selon les droits d'un utilisateur (triés par nom)
- * @param utilisateur Utilisateur
- * @return Campagnes
- */
- @Transactional(readOnly = true)
- List<Campagne> listCampagnes(Utilisateur utilisateur);
+ /**
+ * Liste les campagnes selon les droits d'un utilisateur (triés par nom)
+ * @param utilisateur Utilisateur
+ * @return Campagnes
+ */
+ @Transactional(readOnly = true)
+ List<Campagne> listCampagnes(Utilisateur utilisateur);
- /**
- * Liste les campagnes selon les droits d'un utilisateur (triés par nom)
- * @param utilisateur Utilisateur
- * @return Campagnes
- */
- SortedSet<Campagne> listCampagnesForUser(Utilisateur utilisateur);
+ /**
+ * Liste les campagnes selon les droits d'un utilisateur (triés par nom)
+ * @param utilisateur Utilisateur
+ * @return Campagnes
+ */
+ SortedSet<Campagne> listCampagnesForUser(Utilisateur utilisateur);
- /**
- * Charger une campagne
- * @param idCampagne ID campagne
- * @return Campagne
- * @throws DataNotFoundException Si non trouvée
- */
- Campagne loadCampagne(Integer idCampagne) throws DataNotFoundException;
+ /**
+ * Charger une campagne
+ * @param idCampagne ID campagne
+ * @return Campagne
+ * @throws DataNotFoundException Si non trouvée
+ */
+ Campagne loadCampagne(Integer idCampagne) throws DataNotFoundException;
- /**
- * Charger une campagne
- * @param nom Nom
- * @return Campagne
- * @throws DataNotFoundException Si non trouvée
- */
- Campagne loadCampagne((a)Normalize(UniqueFieldNormalizer.class) String nom) throws DataNotFoundException;
+ /**
+ * Charger une campagne
+ * @param nom Nom
+ * @return Campagne
+ * @throws DataNotFoundException Si non trouvée
+ */
+ Campagne loadCampagne((a)Normalize(UniqueFieldNormalizer.class) String nom) throws DataNotFoundException;
- /**
- * Rafraichit une campagne (pour éviter des LazyLoadingException)
- * @param campagne Campagne
- */
- void refreshCampagne(Campagne campagne);
+ /**
+ * Rafraichit une campagne (pour éviter des LazyLoadingException)
+ * @param campagne Campagne
+ */
+ void refreshCampagne(Campagne campagne);
- /**
- * Met à jour une campagne
- * @param campagne Campagne
- * @throws DataConstraintException En cas de doublons (champs uniques)
- */
- void updateCampagne((a)Normalize(CampagneNormalizer.class) Campagne campagne) throws DataConstraintException;
+ /**
+ * Met à jour une campagne
+ * @param campagne Campagne
+ * @throws DataConstraintException En cas de doublons (champs uniques)
+ */
+ void updateCampagne((a)Normalize(CampagneNormalizer.class) Campagne campagne) throws DataConstraintException;
- /**
- * Détermine si un utilisateur peut modifier ou supprimer une campagne
- * @param campagne Campagne
- * @param utilisateur Utilisateur
- * @return TRUE si il a le droit
- */
- boolean updateOrdeleteCampagneEnabled(Campagne campagne, Utilisateur utilisateur);
+ /**
+ * Détermine si un utilisateur peut modifier ou supprimer une campagne
+ * @param campagne Campagne
+ * @param utilisateur Utilisateur
+ * @return TRUE si il a le droit
+ */
+ boolean updateOrdeleteCampagneEnabled(Campagne campagne, Utilisateur utilisateur);
}
Modified: trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/DocumentService.java
===================================================================
--- trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/DocumentService.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/DocumentService.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -40,50 +40,50 @@
*/
public interface DocumentService {
- /**
- * List the document types available
- * @return The list of document types
- */
- @Transactional(readOnly = true)
- List<TypeDocument> listTypeDocuments();
+ /**
+ * List the document types available
+ * @return The list of document types
+ */
+ @Transactional(readOnly = true)
+ List<TypeDocument> listTypeDocuments();
- /**
- * Create a document type
- * @param typeDocument The document type to create
- * @throws DataConstraintException If the document type already exists (unique constraints)
- */
- void createTypeDocument((a)Normalize(TypeDocumentNormalizer.class) TypeDocument typeDocument)
- throws DataConstraintException;
+ /**
+ * Create a document type
+ * @param typeDocument The document type to create
+ * @throws DataConstraintException If the document type already exists (unique constraints)
+ */
+ void createTypeDocument((a)Normalize(TypeDocumentNormalizer.class) TypeDocument typeDocument)
+ throws DataConstraintException;
- /**
- * Load a document type
- * @param idTypeDocument ID
- * @return The corresponding document type
- * @throws DataNotFoundException If not found
- */
- TypeDocument loadTypeDocument(Integer idTypeDocument) throws DataNotFoundException;
+ /**
+ * Load a document type
+ * @param idTypeDocument ID
+ * @return The corresponding document type
+ * @throws DataNotFoundException If not found
+ */
+ TypeDocument loadTypeDocument(Integer idTypeDocument) throws DataNotFoundException;
- /**
- * Charger a document type
- * @param nom The document type name
- * @return The corresponding document type
- * @throws DataNotFoundException If not found
- */
- TypeDocument loadTypeDocument((a)Normalize(UniqueFieldNormalizer.class) String nom) throws DataNotFoundException;
+ /**
+ * Charger a document type
+ * @param nom The document type name
+ * @return The corresponding document type
+ * @throws DataNotFoundException If not found
+ */
+ TypeDocument loadTypeDocument((a)Normalize(UniqueFieldNormalizer.class) String nom) throws DataNotFoundException;
- /**
- * Modify a document type
- * @param typeDocument The document type to modify
- * @throws DataConstraintException If an unique constraint is broken with another document type
- */
- void updateTypeDocument((a)Normalize(TypeDocumentNormalizer.class) TypeDocument typeDocument)
- throws DataConstraintException;
+ /**
+ * Modify a document type
+ * @param typeDocument The document type to modify
+ * @throws DataConstraintException If an unique constraint is broken with another document type
+ */
+ void updateTypeDocument((a)Normalize(TypeDocumentNormalizer.class) TypeDocument typeDocument)
+ throws DataConstraintException;
- /**
- * Delete a document type
- * @param typeDocument The document type to delete
- * @throws DataConstraintException If the document type has linked data
- */
- void deleteTypeDocument(TypeDocument typeDocument) throws DataConstraintException;
+ /**
+ * Delete a document type
+ * @param typeDocument The document type to delete
+ * @throws DataConstraintException If the document type has linked data
+ */
+ void deleteTypeDocument(TypeDocument typeDocument) throws DataConstraintException;
}
Modified: trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/ExtractionService.java
===================================================================
--- trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/ExtractionService.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/ExtractionService.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -45,143 +45,143 @@
*/
public interface ExtractionService {
- /**
- * Compte le nombre d'extractions
- * @return Nombre d'extractions
- */
- long countExtractions();
+ /**
+ * Compte le nombre d'extractions
+ * @return Nombre d'extractions
+ */
+ long countExtractions();
- /**
- * Créée une manipulation d'extraction
- * @param extraction La manipulation
- * @throws DataConstraintException Si la manipulation (réf) existe déjà
- */
- void createExtraction((a)Normalize(ExtractionNormalizer.class) Extraction extraction) throws DataConstraintException;
+ /**
+ * Créée une manipulation d'extraction
+ * @param extraction La manipulation
+ * @throws DataConstraintException Si la manipulation (réf) existe déjà
+ */
+ void createExtraction((a)Normalize(ExtractionNormalizer.class) Extraction extraction) throws DataConstraintException;
- /**
- * Supprime une manipulation d'extraction
- * @param extraction L'extraction
- * @throws DataConstraintException En cas de données liées
- */
- void deleteExtraction(Extraction extraction) throws DataConstraintException;
+ /**
+ * Supprime une manipulation d'extraction
+ * @param extraction L'extraction
+ * @throws DataConstraintException En cas de données liées
+ */
+ void deleteExtraction(Extraction extraction) throws DataConstraintException;
- /**
- * Liste les manipulations d'extraction selon les droits d'un utilisateur (triés par réf)
- * @param utilisateur L'utilisateur
- * @return la liste des extractions
- */
- @Transactional(readOnly = true)
- List<Extraction> listExtractions(Utilisateur utilisateur);
+ /**
+ * Liste les manipulations d'extraction selon les droits d'un utilisateur (triés par réf)
+ * @param utilisateur L'utilisateur
+ * @return la liste des extractions
+ */
+ @Transactional(readOnly = true)
+ List<Extraction> listExtractions(Utilisateur utilisateur);
- /**
- * Liste les manipulations d'extraction selon les droits d'un utilisateur (triés par réf)
- * @param utilisateur L'utilisateur non admin
- * @return la liste des manipulations
- */
- SortedSet<Extraction> listExtractionsForUser(Utilisateur utilisateur);
+ /**
+ * Liste les manipulations d'extraction selon les droits d'un utilisateur (triés par réf)
+ * @param utilisateur L'utilisateur non admin
+ * @return la liste des manipulations
+ */
+ SortedSet<Extraction> listExtractionsForUser(Utilisateur utilisateur);
- /**
- * Vérifie si l'extraction de référence donnée existe est unique dans la base
- * @param extraction L'extraction
- * @return TRUE si l'extraction est unique
- */
- boolean isExtractionUnique(Extraction extraction);
+ /**
+ * Vérifie si l'extraction de référence donnée existe est unique dans la base
+ * @param extraction L'extraction
+ * @return TRUE si l'extraction est unique
+ */
+ boolean isExtractionUnique(Extraction extraction);
- /**
- * Charge une manipulation d'extraction
- * @param idExtraction ID de la manipulation
- * @return La manipulation correspondante
- * @throws DataNotFoundException Si non trouvée
- */
- Extraction loadExtraction(Integer idExtraction) throws DataNotFoundException;
+ /**
+ * Charge une manipulation d'extraction
+ * @param idExtraction ID de la manipulation
+ * @return La manipulation correspondante
+ * @throws DataNotFoundException Si non trouvée
+ */
+ Extraction loadExtraction(Integer idExtraction) throws DataNotFoundException;
- /**
- * Charge une manipulation d'extraction
- * @param ref Référence de la manipulation
- * @return La manipulation correspondante
- * @throws DataNotFoundException Si non trouvée
- */
- Extraction loadExtraction((a)Normalize(UniqueFieldNormalizer.class) String ref) throws DataNotFoundException;
+ /**
+ * Charge une manipulation d'extraction
+ * @param ref Référence de la manipulation
+ * @return La manipulation correspondante
+ * @throws DataNotFoundException Si non trouvée
+ */
+ Extraction loadExtraction((a)Normalize(UniqueFieldNormalizer.class) String ref) throws DataNotFoundException;
- /**
- * Met à jour une manipulation d'extraction
- * @param extraction La manipulation
- * @throws DataConstraintException En cas de doublons (champs uniques)
- */
- void updateExtraction((a)Normalize(ExtractionNormalizer.class) Extraction extraction) throws DataConstraintException;
+ /**
+ * Met à jour une manipulation d'extraction
+ * @param extraction La manipulation
+ * @throws DataConstraintException En cas de doublons (champs uniques)
+ */
+ void updateExtraction((a)Normalize(ExtractionNormalizer.class) Extraction extraction) throws DataConstraintException;
- /**
- * Détermine si un utilisateur peut modifier ou supprimer une extraction
- * @param extraction L'extraction
- * @param utilisateur L'utilisateur
- * @return TRUE s'il a le droit
- */
- boolean updateOrdeleteExtractionEnabled(Extraction extraction, Utilisateur utilisateur);
+ /**
+ * Détermine si un utilisateur peut modifier ou supprimer une extraction
+ * @param extraction L'extraction
+ * @param utilisateur L'utilisateur
+ * @return TRUE s'il a le droit
+ */
+ boolean updateOrdeleteExtractionEnabled(Extraction extraction, Utilisateur utilisateur);
- /**
- * Créée une méthode pour une extraction
- * @param methode La méthode
- * @throws DataConstraintException Si la méthode (nom) existe déjà
- */
- void createMethodeExtraction((a)Normalize(MethodeExtractionNormalizer.class) MethodeExtraction methode)
- throws DataConstraintException;
+ /**
+ * Créée une méthode pour une extraction
+ * @param methode La méthode
+ * @throws DataConstraintException Si la méthode (nom) existe déjà
+ */
+ void createMethodeExtraction((a)Normalize(MethodeExtractionNormalizer.class) MethodeExtraction methode)
+ throws DataConstraintException;
- /**
- * Supprime une méthode pour une extraction
- * @param methode La méthode
- * @throws DataConstraintException En cas de données liées
- */
- void deleteMethodeExtraction(MethodeExtraction methode) throws DataConstraintException;
+ /**
+ * Supprime une méthode pour une extraction
+ * @param methode La méthode
+ * @throws DataConstraintException En cas de données liées
+ */
+ void deleteMethodeExtraction(MethodeExtraction methode) throws DataConstraintException;
- /**
- * Liste les méthodes existantes pour une extraction (triés par nom)
- * @return la liste des méthodes
- */
- List<MethodeExtraction> listMethodesExtraction();
+ /**
+ * Liste les méthodes existantes pour une extraction (triés par nom)
+ * @return la liste des méthodes
+ */
+ List<MethodeExtraction> listMethodesExtraction();
- /**
- * Charge une méthode pour une extraction
- * @param idMethode ID de la méthode
- * @return La méthode correspondante
- * @throws DataNotFoundException Si non trouvée
- */
- MethodeExtraction loadMethodeExtraction(Integer idMethode) throws DataNotFoundException;
+ /**
+ * Charge une méthode pour une extraction
+ * @param idMethode ID de la méthode
+ * @return La méthode correspondante
+ * @throws DataNotFoundException Si non trouvée
+ */
+ MethodeExtraction loadMethodeExtraction(Integer idMethode) throws DataNotFoundException;
- /**
- * Charge une méthode pour une extraction
- * @param nom Nom de la méthode
- * @return La méthode correspondante
- * @throws DataNotFoundException Si non trouvée
- */
- MethodeExtraction loadMethodeExtraction((a)Normalize(UniqueFieldNormalizer.class) String nom)
- throws DataNotFoundException;
+ /**
+ * Charge une méthode pour une extraction
+ * @param nom Nom de la méthode
+ * @return La méthode correspondante
+ * @throws DataNotFoundException Si non trouvée
+ */
+ MethodeExtraction loadMethodeExtraction((a)Normalize(UniqueFieldNormalizer.class) String nom)
+ throws DataNotFoundException;
- /**
- * Met à jour une méthode pour une extraction
- * @param methode La méthode
- * @throws DataConstraintException En cas de doublons (champs uniques)
- */
- void updateMethodeExtraction((a)Normalize(MethodeExtractionNormalizer.class) MethodeExtraction methode)
- throws DataConstraintException;
+ /**
+ * Met à jour une méthode pour une extraction
+ * @param methode La méthode
+ * @throws DataConstraintException En cas de doublons (champs uniques)
+ */
+ void updateMethodeExtraction((a)Normalize(MethodeExtractionNormalizer.class) MethodeExtraction methode)
+ throws DataConstraintException;
- /**
- * Rafraichit une méthode d'extraction (pour éviter des LazyLoadingException)
- * @param methode La méthode
- */
- void refreshMethodeExtraction(MethodeExtraction methode);
+ /**
+ * Rafraichit une méthode d'extraction (pour éviter des LazyLoadingException)
+ * @param methode La méthode
+ */
+ void refreshMethodeExtraction(MethodeExtraction methode);
- /**
- * Vérifie si au moins un extrait référence ce type d'extrait
- * @param typeExtrait Le type d'extrait
- * @return TRUE si le type d'extrait est référencé
- */
- boolean isTypeExtraitReferenced(TypeExtrait typeExtrait);
+ /**
+ * Vérifie si au moins un extrait référence ce type d'extrait
+ * @param typeExtrait Le type d'extrait
+ * @return TRUE si le type d'extrait est référencé
+ */
+ boolean isTypeExtraitReferenced(TypeExtrait typeExtrait);
- /**
- * Vérifie si l'extrait de référence donnée est unique dans la base
- * @param extrait L'extrait
- * @return TRUE si l'extrait est unique
- */
- boolean isExtraitUnique(Extrait extrait);
+ /**
+ * Vérifie si l'extrait de référence donnée est unique dans la base
+ * @param extrait L'extrait
+ * @return TRUE si l'extrait est unique
+ */
+ boolean isExtraitUnique(Extrait extrait);
}
Modified: trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/LotService.java
===================================================================
--- trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/LotService.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/LotService.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -44,122 +44,122 @@
*/
public interface LotService {
- /**
- * Compte le nombre de lots
- * @return Nombre de lots
- */
- long countLots();
+ /**
+ * Compte le nombre de lots
+ * @return Nombre de lots
+ */
+ long countLots();
- /**
- * Créée un lot
- * @param lot Lot
- * @throws DataConstraintException Si le lot (nom) existe déjà
- */
- void createLot((a)Normalize(LotNormalizer.class) Lot lot) throws DataConstraintException;
+ /**
+ * Créée un lot
+ * @param lot Lot
+ * @throws DataConstraintException Si le lot (nom) existe déjà
+ */
+ void createLot((a)Normalize(LotNormalizer.class) Lot lot) throws DataConstraintException;
- /**
- * Supprime un lot
- * @param lot Lot
- * @throws DataConstraintException Si le lot a des données liées
- */
- void deleteLot(Lot lot) throws DataConstraintException;
+ /**
+ * Supprime un lot
+ * @param lot Lot
+ * @throws DataConstraintException Si le lot a des données liées
+ */
+ void deleteLot(Lot lot) throws DataConstraintException;
- /**
- * Liste les lots pour lesquelles l'utilisateur a les droits (triés par réf)
- * @param utilisateur Utilisateur
- * @return Lots
- */
- @Transactional(readOnly = true)
- List<Lot> listLots(Utilisateur utilisateur);
+ /**
+ * Liste les lots pour lesquelles l'utilisateur a les droits (triés par réf)
+ * @param utilisateur Utilisateur
+ * @return Lots
+ */
+ @Transactional(readOnly = true)
+ List<Lot> listLots(Utilisateur utilisateur);
- /**
- * Liste les lots pour lesquelles l'utilisateur a les droits (triés par réf)
- * @param utilisateur Utilisateur non admin
- * @return Lots
- */
- SortedSet<Lot> listLotsForUser(Utilisateur utilisateur);
+ /**
+ * Liste les lots pour lesquelles l'utilisateur a les droits (triés par réf)
+ * @param utilisateur Utilisateur non admin
+ * @return Lots
+ */
+ SortedSet<Lot> listLotsForUser(Utilisateur utilisateur);
- /**
- * Détermine si un utilisateur peut modifier ou supprimer un lot
- * @param lot Lot
- * @param utilisateur Utilisateur
- * @return TRUE si il a le droit
- */
- boolean updateOrdeleteLotEnabled(Lot lot, Utilisateur utilisateur);
+ /**
+ * Détermine si un utilisateur peut modifier ou supprimer un lot
+ * @param lot Lot
+ * @param utilisateur Utilisateur
+ * @return TRUE si il a le droit
+ */
+ boolean updateOrdeleteLotEnabled(Lot lot, Utilisateur utilisateur);
- /**
- * Détermine si un utilisateur peut accéder à un lot
- * @param lot Lot
- * @param utilisateur Utilisateur
- * @return TRUE si il a le droit
- */
- boolean isLotAccessibleByUser(Lot lot, Utilisateur utilisateur);
+ /**
+ * Détermine si un utilisateur peut accéder à un lot
+ * @param lot Lot
+ * @param utilisateur Utilisateur
+ * @return TRUE si il a le droit
+ */
+ boolean isLotAccessibleByUser(Lot lot, Utilisateur utilisateur);
- /**
- * Liste les parties possibles pour un lot
- * @return Parties
- */
- @Transactional(readOnly = true)
- List<Partie> listParties();
+ /**
+ * Liste les parties possibles pour un lot
+ * @return Parties
+ */
+ @Transactional(readOnly = true)
+ List<Partie> listParties();
- /**
- * Charge un lot
- * @param idLot ID
- * @return Lot
- * @throws DataNotFoundException Si le lot n'existe pas
- */
- Lot loadLot(Integer idLot) throws DataNotFoundException;
+ /**
+ * Charge un lot
+ * @param idLot ID
+ * @return Lot
+ * @throws DataNotFoundException Si le lot n'existe pas
+ */
+ Lot loadLot(Integer idLot) throws DataNotFoundException;
- /**
- * Charge un lot
- * @param ref Référence
- * @return Le lot correspondant
- * @throws DataNotFoundException Si le lot n'existe pas
- */
- Lot loadLot((a)Normalize(UniqueFieldNormalizer.class) String ref) throws DataNotFoundException;
+ /**
+ * Charge un lot
+ * @param ref Référence
+ * @return Le lot correspondant
+ * @throws DataNotFoundException Si le lot n'existe pas
+ */
+ Lot loadLot((a)Normalize(UniqueFieldNormalizer.class) String ref) throws DataNotFoundException;
- /**
- * Met à jour un lot
- * @param lot Lot
- * @throws DataConstraintException Si le lot (nom) existe déjà
- */
- void updateLot((a)Normalize(LotNormalizer.class) Lot lot) throws DataConstraintException;
+ /**
+ * Met à jour un lot
+ * @param lot Lot
+ * @throws DataConstraintException Si le lot (nom) existe déjà
+ */
+ void updateLot((a)Normalize(LotNormalizer.class) Lot lot) throws DataConstraintException;
- /**
- * Créé une partie
- * @param partie Partie
- * @throws DataConstraintException En cas de doublons (champs uniques)
- */
- void createPartie((a)Normalize(PartieNormalizer.class) Partie partie) throws DataConstraintException;
+ /**
+ * Créé une partie
+ * @param partie Partie
+ * @throws DataConstraintException En cas de doublons (champs uniques)
+ */
+ void createPartie((a)Normalize(PartieNormalizer.class) Partie partie) throws DataConstraintException;
- /**
- * Charger une partie
- * @param idPartie ID
- * @return La partie correspondante
- * @throws DataNotFoundException Si non trouvée
- */
- Partie loadPartie(Integer idPartie) throws DataNotFoundException;
+ /**
+ * Charger une partie
+ * @param idPartie ID
+ * @return La partie correspondante
+ * @throws DataNotFoundException Si non trouvée
+ */
+ Partie loadPartie(Integer idPartie) throws DataNotFoundException;
- /**
- * Charger une partie
- * @param nom Nom
- * @return Partie
- * @throws DataNotFoundException Si non trouvée
- */
- Partie loadPartie((a)Normalize(UniqueFieldNormalizer.class) String nom) throws DataNotFoundException;
+ /**
+ * Charger une partie
+ * @param nom Nom
+ * @return Partie
+ * @throws DataNotFoundException Si non trouvée
+ */
+ Partie loadPartie((a)Normalize(UniqueFieldNormalizer.class) String nom) throws DataNotFoundException;
- /**
- * Modifie une partie
- * @param partie Partie
- * @throws DataConstraintException En cas de doublons (champs uniques)
- */
- void updatePartie((a)Normalize(PartieNormalizer.class) Partie partie) throws DataConstraintException;
+ /**
+ * Modifie une partie
+ * @param partie Partie
+ * @throws DataConstraintException En cas de doublons (champs uniques)
+ */
+ void updatePartie((a)Normalize(PartieNormalizer.class) Partie partie) throws DataConstraintException;
- /**
- * Supprime une partie
- * @param partie Partie
- * @throws DataConstraintException En cas de données liées
- */
- void deletePartie(Partie partie) throws DataConstraintException;
+ /**
+ * Supprime une partie
+ * @param partie Partie
+ * @throws DataConstraintException En cas de données liées
+ */
+ void deletePartie(Partie partie) throws DataConstraintException;
}
Modified: trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/MailService.java
===================================================================
--- trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/MailService.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/MailService.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -35,48 +35,48 @@
*/
public interface MailService {
- /**
- * Send an e-mail
- * @param recipients Recipients (not empty, no null object)
- * @param subject Subject (not empty)
- * @param text Text (not empty)
- * @throws EmailException When an e-mail error occurs
- */
- void sendMail(Collection<Utilisateur> recipients, String subject, String text) throws EmailException;
+ /**
+ * Send an e-mail
+ * @param recipients Recipients (not empty, no null object)
+ * @param subject Subject (not empty)
+ * @param text Text (not empty)
+ * @throws EmailException When an e-mail error occurs
+ */
+ void sendMail(Collection<Utilisateur> recipients, String subject, String text) throws EmailException;
- /**
- * Send an e-mail
- * @param recipients Recipients (not empty, no null object)
- * @param subject Subject (not empty)
- * @param text Text (not empty)
- * @param replyTo Reply to
- * @throws EmailException When an e-mail error occurs
- */
- void sendMail(Collection<Utilisateur> recipients, String subject, String text, String replyTo)
- throws EmailException;
+ /**
+ * Send an e-mail
+ * @param recipients Recipients (not empty, no null object)
+ * @param subject Subject (not empty)
+ * @param text Text (not empty)
+ * @param replyTo Reply to
+ * @throws EmailException When an e-mail error occurs
+ */
+ void sendMail(Collection<Utilisateur> recipients, String subject, String text, String replyTo)
+ throws EmailException;
- /**
- * Send an e-mail
- * @param recipient Recipient (not null)
- * @param subject Subject (not empty)
- * @param text Text (not empty)
- * @throws EmailException When an e-mail error occurs
- */
- void sendMail(Personne recipient, String subject, String text) throws EmailException;
+ /**
+ * Send an e-mail
+ * @param recipient Recipient (not null)
+ * @param subject Subject (not empty)
+ * @param text Text (not empty)
+ * @throws EmailException When an e-mail error occurs
+ */
+ void sendMail(Personne recipient, String subject, String text) throws EmailException;
- /**
- * Send an e-mail quietly (without throwing exceptions)
- * @param recipients Recipients (not empty, no null object)
- * @param subject Subject (not empty)
- * @param text Text (not empty)
- */
- void sendMailQuietly(Collection<Utilisateur> recipients, String subject, String text);
+ /**
+ * Send an e-mail quietly (without throwing exceptions)
+ * @param recipients Recipients (not empty, no null object)
+ * @param subject Subject (not empty)
+ * @param text Text (not empty)
+ */
+ void sendMailQuietly(Collection<Utilisateur> recipients, String subject, String text);
- /**
- * Send an e-mail quietly (without throwing exceptions)
- * @param recipient Recipient (not null)
- * @param subject Subject (not empty)
- * @param text Text (not empty)
- */
- void sendMailQuietly(Personne recipient, String subject, String text);
+ /**
+ * Send an e-mail quietly (without throwing exceptions)
+ * @param recipient Recipient (not null)
+ * @param subject Subject (not empty)
+ * @param text Text (not empty)
+ */
+ void sendMailQuietly(Personne recipient, String subject, String text);
}
\ No newline at end of file
Modified: trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/MoleculeService.java
===================================================================
--- trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/MoleculeService.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/MoleculeService.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -40,60 +40,60 @@
*/
public interface MoleculeService {
- /**
- * Compte le nombre de molecules
- * @return Nombre de Molecules
- */
- long countMolecules();
+ /**
+ * Compte le nombre de molecules
+ * @return Nombre de Molecules
+ */
+ long countMolecules();
- /**
- * Créée une molecule
- * @param molecule Molecule
- * @throws DataConstraintException Si la molecule existe déjà
- */
- void createMolecule((a)Normalize(MoleculeNormalizer.class) Molecule molecule) throws DataConstraintException;
+ /**
+ * Créée une molecule
+ * @param molecule Molecule
+ * @throws DataConstraintException Si la molecule existe déjà
+ */
+ void createMolecule((a)Normalize(MoleculeNormalizer.class) Molecule molecule) throws DataConstraintException;
- /**
- * Supprime une molecule
- * @param molecule Molecule
- * @throws DataConstraintException Si la molecule a des données liées
- */
- void deleteMolecule(Molecule molecule) throws DataConstraintException;
+ /**
+ * Supprime une molecule
+ * @param molecule Molecule
+ * @throws DataConstraintException Si la molecule a des données liées
+ */
+ void deleteMolecule(Molecule molecule) throws DataConstraintException;
- /**
- * Liste les molecules
- * @return Molecules
- */
- @Transactional(readOnly = true)
- List<Molecule> listMolecules();
+ /**
+ * Liste les molecules
+ * @return Molecules
+ */
+ @Transactional(readOnly = true)
+ List<Molecule> listMolecules();
- /**
- * Charge une molecule
- * @param numero numero
- * @return Le lot correspondant
- * @throws DataNotFoundException Si le lot n'existe pas
- */
- Molecule loadMolecule(Integer numero) throws DataNotFoundException;
+ /**
+ * Charge une molecule
+ * @param numero numero
+ * @return Le lot correspondant
+ * @throws DataNotFoundException Si le lot n'existe pas
+ */
+ Molecule loadMolecule(Integer numero) throws DataNotFoundException;
- /**
- * Met à jour une molecule
- * @param molecule Molecule
- * @throws DataConstraintException Si la molecule existe déjà
- */
- void updateMolecule((a)Normalize(MoleculeNormalizer.class) Molecule molecule) throws DataConstraintException;
+ /**
+ * Met à jour une molecule
+ * @param molecule Molecule
+ * @throws DataConstraintException Si la molecule existe déjà
+ */
+ void updateMolecule((a)Normalize(MoleculeNormalizer.class) Molecule molecule) throws DataConstraintException;
- /**
+ /**
* Détermine si un utilisateur peut modifier ou supprimer une molecule.
*
* @param molecule la molecule
* @param utilisateur L'utilisateur
* @return TRUE s'il a le droit
*/
- boolean updateOrdeleteMoleculeEnabled(Molecule molecule, Utilisateur utilisateur);
-
- /**
+ boolean updateOrdeleteMoleculeEnabled(Molecule molecule, Utilisateur utilisateur);
+
+ /**
* Liste les programmes des organismes déjà saisis
* @return Organisme des molécules
*/
- public List<String> listMoleculeOrganisme();
+ public List<String> listMoleculeOrganisme();
}
Modified: trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/PersonneService.java
===================================================================
--- trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/PersonneService.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/PersonneService.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -42,200 +42,200 @@
*/
public interface PersonneService {
- /**
- * Créée un administrateur par défaut s'il n'y en a pas
- * @throws DataConstraintException Si la personne existe déjà (champs uniques)
- */
- void checkOrCreateAdmin() throws DataConstraintException;
+ /**
+ * Créée un administrateur par défaut s'il n'y en a pas
+ * @throws DataConstraintException Si la personne existe déjà (champs uniques)
+ */
+ void checkOrCreateAdmin() throws DataConstraintException;
- /**
- * Compte le nombre de personnes
- * @return Nombre de personnes
- */
- long countPersonnes();
+ /**
+ * Compte le nombre de personnes
+ * @return Nombre de personnes
+ */
+ long countPersonnes();
- /**
- * Création d'une personne
- * @param personne Personne
- * @throws DataConstraintException Si la personne existe déjà (champs uniques)
- */
- void createPersonne((a)Normalize(PersonneNormalizer.class) Personne personne) throws DataConstraintException;
+ /**
+ * Création d'une personne
+ * @param personne Personne
+ * @throws DataConstraintException Si la personne existe déjà (champs uniques)
+ */
+ void createPersonne((a)Normalize(PersonneNormalizer.class) Personne personne) throws DataConstraintException;
- /**
- * Enregistrement d'un utilisateur
- * @param utilisateur Utilisateur
- * @throws DataConstraintException Si l'utilisateur existe déjà (champs uniques)
- */
- void createUtilisateur((a)Normalize(PersonneNormalizer.class) Utilisateur utilisateur) throws DataConstraintException;
+ /**
+ * Enregistrement d'un utilisateur
+ * @param utilisateur Utilisateur
+ * @throws DataConstraintException Si l'utilisateur existe déjà (champs uniques)
+ */
+ void createUtilisateur((a)Normalize(PersonneNormalizer.class) Utilisateur utilisateur) throws DataConstraintException;
- /**
- * Supprime une personne
- * @param personne Personne
- * @throws DataConstraintException Si des données sont liées à la personne
- */
- void deletePersonne(Personne personne) throws DataConstraintException;
+ /**
+ * Supprime une personne
+ * @param personne Personne
+ * @throws DataConstraintException Si des données sont liées à la personne
+ */
+ void deletePersonne(Personne personne) throws DataConstraintException;
- /**
- * Supprimer un utilisateur, le transformer en personne si il a des données liées. On vérifie avant qu'il y aura
- * toujours un administrateur.
- * @param utilisateur Utilisateur
- * @throws DataConstraintException Si l'utilisateur est encore référencé (créateur d'entités)
- * @throws EmailException En cas d'erreur dans l'envoi d'e-mail
- */
- void deleteUtilisateur(Utilisateur utilisateur) throws DataConstraintException, EmailException;
+ /**
+ * Supprimer un utilisateur, le transformer en personne si il a des données liées. On vérifie avant qu'il y aura
+ * toujours un administrateur.
+ * @param utilisateur Utilisateur
+ * @throws DataConstraintException Si l'utilisateur est encore référencé (créateur d'entités)
+ * @throws EmailException En cas d'erreur dans l'envoi d'e-mail
+ */
+ void deleteUtilisateur(Utilisateur utilisateur) throws DataConstraintException, EmailException;
- /**
- * Hachage du mot de passe
- * @param password Mot de passe
- * @return Mot de passe haché
- */
- String hashPassword(String password);
+ /**
+ * Hachage du mot de passe
+ * @param password Mot de passe
+ * @return Mot de passe haché
+ */
+ String hashPassword(String password);
- /**
- * Liste les personnes (triés par nom, prénom). Les utilisateurs non valides sont exclus.
- * @return Personnes
- */
- @Transactional(readOnly = true)
- List<Personne> listPersonnes();
+ /**
+ * Liste les personnes (triés par nom, prénom). Les utilisateurs non valides sont exclus.
+ * @return Personnes
+ */
+ @Transactional(readOnly = true)
+ List<Personne> listPersonnes();
- /**
- * Liste les personnes (triés par nom, prénom) avec y compris les utilisateurs invalides.
- * @return Personnes
- */
- @Transactional(readOnly = true)
- List<Personne> listPersonnesWithInvalidUsers();
+ /**
+ * Liste les personnes (triés par nom, prénom) avec y compris les utilisateurs invalides.
+ * @return Personnes
+ */
+ @Transactional(readOnly = true)
+ List<Personne> listPersonnesWithInvalidUsers();
- /**
- * Liste les organismes existants pour les personnes
- * @return Les organismes
- */
- @Transactional(readOnly = true)
- List<String> listPersonneOrganismes();
+ /**
+ * Liste les organismes existants pour les personnes
+ * @return Les organismes
+ */
+ @Transactional(readOnly = true)
+ List<String> listPersonneOrganismes();
- /**
- * Liste les utilisateurs à valider
- * @return Utilisateurs à valider
- */
- @Transactional(readOnly = true)
- List<Utilisateur> listUtilisateursInvalid();
+ /**
+ * Liste les utilisateurs à valider
+ * @return Utilisateurs à valider
+ */
+ @Transactional(readOnly = true)
+ List<Utilisateur> listUtilisateursInvalid();
- /**
- * Liste les utilisateurs valides
- * @return Utilisateurs valides
- */
- @Transactional(readOnly = true)
- List<Utilisateur> listUtilisateursValid();
+ /**
+ * Liste les utilisateurs valides
+ * @return Utilisateurs valides
+ */
+ @Transactional(readOnly = true)
+ List<Utilisateur> listUtilisateursValid();
- /**
- * Charge une personne
- * @param idPersonne Identifiant
- * @return Utilisateur
- * @throws DataNotFoundException Si la personne n'existe pas
- */
- Personne loadPersonne(Integer idPersonne) throws DataNotFoundException;
+ /**
+ * Charge une personne
+ * @param idPersonne Identifiant
+ * @return Utilisateur
+ * @throws DataNotFoundException Si la personne n'existe pas
+ */
+ Personne loadPersonne(Integer idPersonne) throws DataNotFoundException;
- /**
- * Charge une personne
- * @param courriel Courriel
- * @return Utilisateur
- * @throws DataNotFoundException Si la personne n'existe pas
- */
- Personne loadPersonne((a)Normalize(EmailNormalizer.class) String courriel) throws DataNotFoundException;
+ /**
+ * Charge une personne
+ * @param courriel Courriel
+ * @return Utilisateur
+ * @throws DataNotFoundException Si la personne n'existe pas
+ */
+ Personne loadPersonne((a)Normalize(EmailNormalizer.class) String courriel) throws DataNotFoundException;
- /**
- * Charge un utilisateur
- * @param idPersonne Identifiant
- * @return Utilisateur
- * @throws DataNotFoundException Si l'utilisateur n'existe pas
- */
- Utilisateur loadUtilisateur(Integer idPersonne) throws DataNotFoundException;
+ /**
+ * Charge un utilisateur
+ * @param idPersonne Identifiant
+ * @return Utilisateur
+ * @throws DataNotFoundException Si l'utilisateur n'existe pas
+ */
+ Utilisateur loadUtilisateur(Integer idPersonne) throws DataNotFoundException;
- /**
- * Charge un utilisateur
- * @param courriel Courriel
- * @return Utilisateur
- * @throws DataNotFoundException Si l'utilisateur n'existe pas
- */
- Utilisateur loadUtilisateur((a)Normalize(EmailNormalizer.class) String courriel) throws DataNotFoundException;
+ /**
+ * Charge un utilisateur
+ * @param courriel Courriel
+ * @return Utilisateur
+ * @throws DataNotFoundException Si l'utilisateur n'existe pas
+ */
+ Utilisateur loadUtilisateur((a)Normalize(EmailNormalizer.class) String courriel) throws DataNotFoundException;
- /**
- * Authentifie un utilisateur. L'utilisateur ne doit pas seulement exister mais être également validé.
- * @param courriel Courriel
- * @param passwordHash Mot de passe haché
- * @return Vrai si l'authentification réussit
- */
- boolean authenticateUtilisateur((a)Normalize(EmailNormalizer.class) String courriel, String passwordHash);
+ /**
+ * Authentifie un utilisateur. L'utilisateur ne doit pas seulement exister mais être également validé.
+ * @param courriel Courriel
+ * @param passwordHash Mot de passe haché
+ * @return Vrai si l'authentification réussit
+ */
+ boolean authenticateUtilisateur((a)Normalize(EmailNormalizer.class) String courriel, String passwordHash);
- /**
- * Rafraichit une personne (pour éviter des LazyLoadingException)
- * @param personne Personne
- */
- void refreshPersonne(Personne personne);
+ /**
+ * Rafraichit une personne (pour éviter des LazyLoadingException)
+ * @param personne Personne
+ */
+ void refreshPersonne(Personne personne);
- /**
- * Refuser un utilisateur, et le prévient par e-mail (supprimé de la BD ou transformé en personne si données liées)
- * @param utilisateur Utilisateur
- */
- void rejectUtilisateur(Utilisateur utilisateur);
+ /**
+ * Refuser un utilisateur, et le prévient par e-mail (supprimé de la BD ou transformé en personne si données liées)
+ * @param utilisateur Utilisateur
+ */
+ void rejectUtilisateur(Utilisateur utilisateur);
- /**
- * Met à jour le mot de passe (perdu) d'un utilisateur, et lui envoie un e-mail
- * @param courriel Courriel
- * @throws DataNotFoundException Si le courriel n'existe pas
- * @throws EmailException En cas d'erreur dans l'envoi d'e-mail
- */
- void resetPasswordUtilisateur((a)Normalize(EmailNormalizer.class) String courriel) throws DataNotFoundException,
- EmailException;
+ /**
+ * Met à jour le mot de passe (perdu) d'un utilisateur, et lui envoie un e-mail
+ * @param courriel Courriel
+ * @throws DataNotFoundException Si le courriel n'existe pas
+ * @throws EmailException En cas d'erreur dans l'envoi d'e-mail
+ */
+ void resetPasswordUtilisateur((a)Normalize(EmailNormalizer.class) String courriel) throws DataNotFoundException,
+ EmailException;
- /**
- * Envoie un e-mail aux administrateurs
- * @param subject Sujet
- * @param message Message
- * @param replyTo Expéditeur
- * @throws EmailException En cas d'erreur lors de l'envoi
- */
- void sendMailAdmins(String subject, String message, String replyTo) throws EmailException;
+ /**
+ * Envoie un e-mail aux administrateurs
+ * @param subject Sujet
+ * @param message Message
+ * @param replyTo Expéditeur
+ * @throws EmailException En cas d'erreur lors de l'envoi
+ */
+ void sendMailAdmins(String subject, String message, String replyTo) throws EmailException;
- /**
- * Met à jour et transforme une personne en utilisateur, génère un mot de passe automatique et le prévient par
- * e-mail
- * @param personne Personne
- * @return Utilisateur créé
- * @throws EmailException En cas d'erreur dans l'envoi d'e-mail
- * @throws DataConstraintException Si la personne existe déjà (champs uniques)
- */
- Utilisateur updateAndCreateUtilisateur((a)Normalize(PersonneNormalizer.class) Personne personne)
- throws EmailException, DataConstraintException;
+ /**
+ * Met à jour et transforme une personne en utilisateur, génère un mot de passe automatique et le prévient par
+ * e-mail
+ * @param personne Personne
+ * @return Utilisateur créé
+ * @throws EmailException En cas d'erreur dans l'envoi d'e-mail
+ * @throws DataConstraintException Si la personne existe déjà (champs uniques)
+ */
+ Utilisateur updateAndCreateUtilisateur((a)Normalize(PersonneNormalizer.class) Personne personne)
+ throws EmailException, DataConstraintException;
- /**
- * Met à jour une personne
- * @param personne Personne
- * @throws DataConstraintException Si la personne existe déjà (champs uniques)
- */
- void updatePersonne((a)Normalize(PersonneNormalizer.class) Personne personne) throws DataConstraintException;
+ /**
+ * Met à jour une personne
+ * @param personne Personne
+ * @throws DataConstraintException Si la personne existe déjà (champs uniques)
+ */
+ void updatePersonne((a)Normalize(PersonneNormalizer.class) Personne personne) throws DataConstraintException;
- /**
- * Met à jour un utilisateur, et lui envoie un e-mail si cela a été effectuée par un administrateur
- * @param utilisateur Utilisateur
- * @param admin Effectuée par un administrateur ?
- * @throws DataConstraintException Si l'utilisateur existe déjà (champs uniques)
- */
- void updateUtilisateur((a)Normalize(PersonneNormalizer.class) Utilisateur utilisateur, boolean admin)
- throws DataConstraintException;
+ /**
+ * Met à jour un utilisateur, et lui envoie un e-mail si cela a été effectuée par un administrateur
+ * @param utilisateur Utilisateur
+ * @param admin Effectuée par un administrateur ?
+ * @throws DataConstraintException Si l'utilisateur existe déjà (champs uniques)
+ */
+ void updateUtilisateur((a)Normalize(PersonneNormalizer.class) Utilisateur utilisateur, boolean admin)
+ throws DataConstraintException;
- /**
- * Valide et met à jour un utilisateur, et le prévient par e-mail
- * @param utilisateur Utilisateur
- * @throws DataConstraintException Si l'utilisateur existe déjà (champs uniques)
- */
- void validAndUpdateUtilisateur((a)Normalize(PersonneNormalizer.class) Utilisateur utilisateur)
- throws DataConstraintException;
+ /**
+ * Valide et met à jour un utilisateur, et le prévient par e-mail
+ * @param utilisateur Utilisateur
+ * @throws DataConstraintException Si l'utilisateur existe déjà (champs uniques)
+ */
+ void validAndUpdateUtilisateur((a)Normalize(PersonneNormalizer.class) Utilisateur utilisateur)
+ throws DataConstraintException;
- /**
- * Test de droits pour la modification ou suppression d'une personne (ou par héritage d'un utilisateur)
- * @param personne Personne à mettre à jour
- * @param modifieur L'utilisateur qui fait la modification
- * @return vrai si l'utilisateur peut modifier ou supprimer la personne
- */
- boolean updateOrDeletePersonneEnabled(Personne personne, Utilisateur modifieur);
+ /**
+ * Test de droits pour la modification ou suppression d'une personne (ou par héritage d'un utilisateur)
+ * @param personne Personne à mettre à jour
+ * @param modifieur L'utilisateur qui fait la modification
+ * @return vrai si l'utilisateur peut modifier ou supprimer la personne
+ */
+ boolean updateOrDeletePersonneEnabled(Personne personne, Utilisateur modifieur);
}
Modified: trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/ProduitService.java
===================================================================
--- trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/ProduitService.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/ProduitService.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -37,37 +37,37 @@
*/
public interface ProduitService {
- /**
- * Liste les produits disponibles selon les droits d'un utilisateur (trié par réf)
- * @param utilisateur L'utilisateur
- * @return la liste des produits
- */
- @Transactional(readOnly = true)
- List<Produit> listProduits(Utilisateur utilisateur);
+ /**
+ * Liste les produits disponibles selon les droits d'un utilisateur (trié par réf)
+ * @param utilisateur L'utilisateur
+ * @return la liste des produits
+ */
+ @Transactional(readOnly = true)
+ List<Produit> listProduits(Utilisateur utilisateur);
- /**
- * Liste les produits disponibles selon les droits d'un utilisateur (trié par réf)
- * @param utilisateur L'utilisateur non admin
- * @return la liste des produits
- */
- SortedSet<Produit> listProduitsForUser(Utilisateur utilisateur);
+ /**
+ * Liste les produits disponibles selon les droits d'un utilisateur (trié par réf)
+ * @param utilisateur L'utilisateur non admin
+ * @return la liste des produits
+ */
+ SortedSet<Produit> listProduitsForUser(Utilisateur utilisateur);
- /**
- * Liste les produits disponibles selon les droits d'un utilisateur. Enlève en plus tous les produits resultants de
- * la purification donnée
- * @param utilisateur L'utilisateur
- * @param purification La purification
- * @return la liste des produits
- */
- @Transactional(readOnly = true)
- List<Produit> listProduitsWithoutChildrenOfPuri(Utilisateur utilisateur, Purification purification);
+ /**
+ * Liste les produits disponibles selon les droits d'un utilisateur. Enlève en plus tous les produits resultants de
+ * la purification donnée
+ * @param utilisateur L'utilisateur
+ * @param purification La purification
+ * @return la liste des produits
+ */
+ @Transactional(readOnly = true)
+ List<Produit> listProduitsWithoutChildrenOfPuri(Utilisateur utilisateur, Purification purification);
- /**
- * Vérifie si des données référence le produit (purification ou test biologique)
- * @param produit Le produit
- * @return TRUE si le produit est référencé au moins une fois
- */
- @Transactional(readOnly = true)
- boolean isProduitReferenced(Produit produit);
+ /**
+ * Vérifie si des données référence le produit (purification ou test biologique)
+ * @param produit Le produit
+ * @return TRUE si le produit est référencé au moins une fois
+ */
+ @Transactional(readOnly = true)
+ boolean isProduitReferenced(Produit produit);
}
Modified: trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/PurificationService.java
===================================================================
--- trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/PurificationService.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/PurificationService.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -45,162 +45,162 @@
*/
public interface PurificationService {
- /**
- * Compte le nombre de purifications
- * @return Nombre de purifications
- */
- long countPurifications();
+ /**
+ * Compte le nombre de purifications
+ * @return Nombre de purifications
+ */
+ long countPurifications();
- /**
- * Créée une manipulation de purification
- * @param purification La manipulation
- * @throws DataConstraintException Si la manipulation (réf) existe déjà
- */
- void createPurification((a)Normalize(PurificationNormalizer.class) Purification purification)
- throws DataConstraintException;
+ /**
+ * Créée une manipulation de purification
+ * @param purification La manipulation
+ * @throws DataConstraintException Si la manipulation (réf) existe déjà
+ */
+ void createPurification((a)Normalize(PurificationNormalizer.class) Purification purification)
+ throws DataConstraintException;
- /**
- * Initialise les paramètres de la méthode avec des valeurs vides. Si certains paramètres existent déjà, aucune
- * modification sur eux
- * @param purification La purification
- */
- void initParamsMethoPuriEffectif(Purification purification);
+ /**
+ * Initialise les paramètres de la méthode avec des valeurs vides. Si certains paramètres existent déjà, aucune
+ * modification sur eux
+ * @param purification La purification
+ */
+ void initParamsMethoPuriEffectif(Purification purification);
- /**
- * Supprime une manipulation de purification
- * @param purification La manipulation
- * @throws DataConstraintException En cas de données liées
- */
- void deletePurification(Purification purification) throws DataConstraintException;
+ /**
+ * Supprime une manipulation de purification
+ * @param purification La manipulation
+ * @throws DataConstraintException En cas de données liées
+ */
+ void deletePurification(Purification purification) throws DataConstraintException;
- /**
- * Liste les manipulations de purification selon les droits d'un utilisateur (triés par réf)
- * @param utilisateur L'utilisateur
- * @return la liste des manipulations
- */
- @Transactional(readOnly = true)
- List<Purification> listPurifications(Utilisateur utilisateur);
+ /**
+ * Liste les manipulations de purification selon les droits d'un utilisateur (triés par réf)
+ * @param utilisateur L'utilisateur
+ * @return la liste des manipulations
+ */
+ @Transactional(readOnly = true)
+ List<Purification> listPurifications(Utilisateur utilisateur);
- /**
- * Liste les manipulations de purification selon les droits d'un utilisateur (triés par réf)
- * @param utilisateur L'utilisateur non admin
- * @return la liste des manipulations
- */
- SortedSet<Purification> listPurificationsForUser(Utilisateur utilisateur);
+ /**
+ * Liste les manipulations de purification selon les droits d'un utilisateur (triés par réf)
+ * @param utilisateur L'utilisateur non admin
+ * @return la liste des manipulations
+ */
+ SortedSet<Purification> listPurificationsForUser(Utilisateur utilisateur);
- /**
- * Vérifie si la purification de référence donnée existe est unique dans la base
- * @param purification La purification
- * @return TRUE si la purification est unique
- */
- @Transactional(readOnly = true)
- boolean isPurificationUnique(Purification purification);
+ /**
+ * Vérifie si la purification de référence donnée existe est unique dans la base
+ * @param purification La purification
+ * @return TRUE si la purification est unique
+ */
+ @Transactional(readOnly = true)
+ boolean isPurificationUnique(Purification purification);
- /**
- * Charge une manipulation de purification
- * @param idPurification ID de la manipulation
- * @return La manipulation
- * @throws DataNotFoundException Si non trouvée
- */
- Purification loadPurification(Integer idPurification) throws DataNotFoundException;
+ /**
+ * Charge une manipulation de purification
+ * @param idPurification ID de la manipulation
+ * @return La manipulation
+ * @throws DataNotFoundException Si non trouvée
+ */
+ Purification loadPurification(Integer idPurification) throws DataNotFoundException;
- /**
- * Charge une manipulation de purification
- * @param ref Référence de la manipulation
- * @return La manipulation correspondante
- * @throws DataNotFoundException Si non trouvée
- */
- Purification loadPurification((a)Normalize(UniqueFieldNormalizer.class) String ref) throws DataNotFoundException;
+ /**
+ * Charge une manipulation de purification
+ * @param ref Référence de la manipulation
+ * @return La manipulation correspondante
+ * @throws DataNotFoundException Si non trouvée
+ */
+ Purification loadPurification((a)Normalize(UniqueFieldNormalizer.class) String ref) throws DataNotFoundException;
- /**
- * Met à jour une manipulation de purification
- * @param purification La manipulation
- * @throws DataConstraintException En cas de doublons (champs uniques)
- */
- void updatePurification((a)Normalize(PurificationNormalizer.class) Purification purification)
- throws DataConstraintException;
+ /**
+ * Met à jour une manipulation de purification
+ * @param purification La manipulation
+ * @throws DataConstraintException En cas de doublons (champs uniques)
+ */
+ void updatePurification((a)Normalize(PurificationNormalizer.class) Purification purification)
+ throws DataConstraintException;
- /**
- * Rafraichit une purification (pour éviter des LazyLoadingException)
- * @param purification Purification
- */
- void refreshPurification(Purification purification);
+ /**
+ * Rafraichit une purification (pour éviter des LazyLoadingException)
+ * @param purification Purification
+ */
+ void refreshPurification(Purification purification);
- /**
- * Détermine si un utilisateur peut modifier ou supprimer une purification
- * @param purification La manipulation
- * @param utilisateur L'utilisateur
- * @return TRUE s'il a le droit
- */
- boolean updateOrdeletePurificationEnabled(Purification purification, Utilisateur utilisateur);
+ /**
+ * Détermine si un utilisateur peut modifier ou supprimer une purification
+ * @param purification La manipulation
+ * @param utilisateur L'utilisateur
+ * @return TRUE s'il a le droit
+ */
+ boolean updateOrdeletePurificationEnabled(Purification purification, Utilisateur utilisateur);
- /**
- * Créée une méthode pour une purification
- * @param methode La méthode
- * @throws DataConstraintException Si la méthode (nom) existe déjà
- */
- void createMethodePurification((a)Normalize(MethodePurificationNormalizer.class) MethodePurification methode)
- throws DataConstraintException;
+ /**
+ * Créée une méthode pour une purification
+ * @param methode La méthode
+ * @throws DataConstraintException Si la méthode (nom) existe déjà
+ */
+ void createMethodePurification((a)Normalize(MethodePurificationNormalizer.class) MethodePurification methode)
+ throws DataConstraintException;
- /**
- * Supprime une méthode pour une purification
- * @param methode La méthode
- * @throws DataConstraintException En cas de données liées
- */
- void deleteMethodePurification(MethodePurification methode) throws DataConstraintException;
+ /**
+ * Supprime une méthode pour une purification
+ * @param methode La méthode
+ * @throws DataConstraintException En cas de données liées
+ */
+ void deleteMethodePurification(MethodePurification methode) throws DataConstraintException;
- /**
- * Liste les méthodes existantes pour une purification (triés par nom)
- * @return la liste des méthodes
- */
- @Transactional(readOnly = true)
- List<MethodePurification> listMethodesPurification();
+ /**
+ * Liste les méthodes existantes pour une purification (triés par nom)
+ * @return la liste des méthodes
+ */
+ @Transactional(readOnly = true)
+ List<MethodePurification> listMethodesPurification();
- /**
- * Charge une méthode pour une purification
- * @param idMethode ID de la méthode
- * @return La méthode correspondante
- * @throws DataNotFoundException Si non trouvée
- */
- MethodePurification loadMethodePurification(Integer idMethode) throws DataNotFoundException;
+ /**
+ * Charge une méthode pour une purification
+ * @param idMethode ID de la méthode
+ * @return La méthode correspondante
+ * @throws DataNotFoundException Si non trouvée
+ */
+ MethodePurification loadMethodePurification(Integer idMethode) throws DataNotFoundException;
- /**
- * Charge une méthode pour une purification
- * @param nom Nom de la méthode
- * @return La méthode correspondante
- * @throws DataNotFoundException Si non trouvée
- */
- MethodePurification loadMethodePurification((a)Normalize(UniqueFieldNormalizer.class) String nom)
- throws DataNotFoundException;
+ /**
+ * Charge une méthode pour une purification
+ * @param nom Nom de la méthode
+ * @return La méthode correspondante
+ * @throws DataNotFoundException Si non trouvée
+ */
+ MethodePurification loadMethodePurification((a)Normalize(UniqueFieldNormalizer.class) String nom)
+ throws DataNotFoundException;
- /**
- * Met à jour une méthode pour une purification
- * @param methode La méthode
- * @throws DataConstraintException En cas de doublons (champs uniques)
- */
- void updateMethodePurification((a)Normalize(MethodePurificationNormalizer.class) MethodePurification methode)
- throws DataConstraintException;
+ /**
+ * Met à jour une méthode pour une purification
+ * @param methode La méthode
+ * @throws DataConstraintException En cas de doublons (champs uniques)
+ */
+ void updateMethodePurification((a)Normalize(MethodePurificationNormalizer.class) MethodePurification methode)
+ throws DataConstraintException;
- /**
- * Rafraichit une méthode de purification (pour éviter des LazyLoadingException)
- * @param methode La méthode
- */
- void refreshMethodePurification(MethodePurification methode);
+ /**
+ * Rafraichit une méthode de purification (pour éviter des LazyLoadingException)
+ * @param methode La méthode
+ */
+ void refreshMethodePurification(MethodePurification methode);
- /**
- * Vérifie si au moins une purification référence le paramètre
- * @param paramMetho Le paramètre de la méthode
- * @return TRUE si le paramètre est référencé
- */
- @Transactional(readOnly = true)
- boolean isParamMethoPuriReferenced(ParamMethoPuri paramMetho);
+ /**
+ * Vérifie si au moins une purification référence le paramètre
+ * @param paramMetho Le paramètre de la méthode
+ * @return TRUE si le paramètre est référencé
+ */
+ @Transactional(readOnly = true)
+ boolean isParamMethoPuriReferenced(ParamMethoPuri paramMetho);
- /**
- * Vérifie si la fraction de référence donnée est unique dans la base
- * @param fraction La fraction
- * @return TRUE si la fraction existe
- */
- @Transactional(readOnly = true)
- boolean isFractionUnique(Fraction fraction);
+ /**
+ * Vérifie si la fraction de référence donnée est unique dans la base
+ * @param fraction La fraction
+ * @return TRUE si la fraction existe
+ */
+ @Transactional(readOnly = true)
+ boolean isFractionUnique(Fraction fraction);
}
Modified: trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/SpecimenService.java
===================================================================
--- trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/SpecimenService.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/SpecimenService.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -42,119 +42,119 @@
*/
public interface SpecimenService {
- /**
- * Compte le nombre de specimens
- * @return Nombre de specimens
- */
- long countSpecimens();
+ /**
+ * Compte le nombre de specimens
+ * @return Nombre de specimens
+ */
+ long countSpecimens();
- /**
- * Créée un spécimen
- * @param specimen Spécimen
- * @throws DataConstraintException Si le spécimen (nom) existe déjà
- */
- void createSpecimen((a)Normalize(SpecimenNormalizer.class) Specimen specimen) throws DataConstraintException;
+ /**
+ * Créée un spécimen
+ * @param specimen Spécimen
+ * @throws DataConstraintException Si le spécimen (nom) existe déjà
+ */
+ void createSpecimen((a)Normalize(SpecimenNormalizer.class) Specimen specimen) throws DataConstraintException;
- /**
- * Supprime un spécimen
- * @param specimen Spécimen
- * @throws DataConstraintException Si le spécimen a des données liées
- */
- void deleteSpecimen(Specimen specimen) throws DataConstraintException;
+ /**
+ * Supprime un spécimen
+ * @param specimen Spécimen
+ * @throws DataConstraintException Si le spécimen a des données liées
+ */
+ void deleteSpecimen(Specimen specimen) throws DataConstraintException;
- /**
- * Liste les spécimens selon les droits d'un utilisateur (triés par réf)
- * @param utilisateur L'utilisateur
- * @return La liste des spécimens
- */
- @Transactional(readOnly = true)
- List<Specimen> listSpecimens(Utilisateur utilisateur);
+ /**
+ * Liste les spécimens selon les droits d'un utilisateur (triés par réf)
+ * @param utilisateur L'utilisateur
+ * @return La liste des spécimens
+ */
+ @Transactional(readOnly = true)
+ List<Specimen> listSpecimens(Utilisateur utilisateur);
- /**
- * Liste l'ensemble des specimens selon les droits d'un utilisateur (triés par réf)
- * @param utilisateur L'utilisateur
- * @return La liste des spécimens
- */
- SortedSet<Specimen> listSpecimensForUser(Utilisateur utilisateur);
+ /**
+ * Liste l'ensemble des specimens selon les droits d'un utilisateur (triés par réf)
+ * @param utilisateur L'utilisateur
+ * @return La liste des spécimens
+ */
+ SortedSet<Specimen> listSpecimensForUser(Utilisateur utilisateur);
- /**
- * Liste les embranchements existants pour les spécimens
- * @return Les embranchements
- */
- @Transactional(readOnly = true)
- List<String> listSpecimenEmbranchements();
+ /**
+ * Liste les embranchements existants pour les spécimens
+ * @return Les embranchements
+ */
+ @Transactional(readOnly = true)
+ List<String> listSpecimenEmbranchements();
- /**
- * Liste les embranchements existants pour les spécimens
- * @return Les familles
- */
- @Transactional(readOnly = true)
- List<String> listSpecimenFamilles();
+ /**
+ * Liste les embranchements existants pour les spécimens
+ * @return Les familles
+ */
+ @Transactional(readOnly = true)
+ List<String> listSpecimenFamilles();
- /**
- * Liste les genres existants pour les spécimens
- * @return Les genres
- */
- @Transactional(readOnly = true)
- List<String> listSpecimenGenres();
+ /**
+ * Liste les genres existants pour les spécimens
+ * @return Les genres
+ */
+ @Transactional(readOnly = true)
+ List<String> listSpecimenGenres();
- /**
- * Liste les espèces existants pour les spécimens
- * @return Les espèces
- */
- @Transactional(readOnly = true)
- List<String> listSpecimenEspeces();
+ /**
+ * Liste les espèces existants pour les spécimens
+ * @return Les espèces
+ */
+ @Transactional(readOnly = true)
+ List<String> listSpecimenEspeces();
- /**
- * Liste les sous-espèces existants pour les spécimens
- * @return Les sous-espèces
- */
- @Transactional(readOnly = true)
- List<String> listSpecimenSousEspeces();
+ /**
+ * Liste les sous-espèces existants pour les spécimens
+ * @return Les sous-espèces
+ */
+ @Transactional(readOnly = true)
+ List<String> listSpecimenSousEspeces();
- /**
- * Liste les variétés existants pour les spécimens
- * @return Les variétés
- */
- @Transactional(readOnly = true)
- List<String> listSpecimenVarietes();
+ /**
+ * Liste les variétés existants pour les spécimens
+ * @return Les variétés
+ */
+ @Transactional(readOnly = true)
+ List<String> listSpecimenVarietes();
- /**
- * Liste les lieux de dépots existants pour les spécimens
- * @return Les lieux de dépôt
- */
- @Transactional(readOnly = true)
- List<String> listLieuxDepot();
+ /**
+ * Liste les lieux de dépots existants pour les spécimens
+ * @return Les lieux de dépôt
+ */
+ @Transactional(readOnly = true)
+ List<String> listLieuxDepot();
- /**
- * Charge un spécimen
- * @param idSpecimen ID
- * @return Spécimen
- * @throws DataNotFoundException Si le spécimen n'existe pas
- */
- Specimen loadSpecimen(Integer idSpecimen) throws DataNotFoundException;
+ /**
+ * Charge un spécimen
+ * @param idSpecimen ID
+ * @return Spécimen
+ * @throws DataNotFoundException Si le spécimen n'existe pas
+ */
+ Specimen loadSpecimen(Integer idSpecimen) throws DataNotFoundException;
- /**
- * Charge un pécimen
- * @param ref Référence
- * @return Spécimen
- * @throws DataNotFoundException Si le spécimen n'existe pas
- */
- Specimen loadSpecimen((a)Normalize(UniqueFieldNormalizer.class) String ref) throws DataNotFoundException;
+ /**
+ * Charge un pécimen
+ * @param ref Référence
+ * @return Spécimen
+ * @throws DataNotFoundException Si le spécimen n'existe pas
+ */
+ Specimen loadSpecimen((a)Normalize(UniqueFieldNormalizer.class) String ref) throws DataNotFoundException;
- /**
- * Détermine si un utilisateur peut modifier ou supprimer un specimen
- * @param specimen Specimen
- * @param utilisateur Utilisateur
- * @return TRUE si il a le droit
- */
- boolean updateOrdeleteSpecimenEnabled(Specimen specimen, Utilisateur utilisateur);
+ /**
+ * Détermine si un utilisateur peut modifier ou supprimer un specimen
+ * @param specimen Specimen
+ * @param utilisateur Utilisateur
+ * @return TRUE si il a le droit
+ */
+ boolean updateOrdeleteSpecimenEnabled(Specimen specimen, Utilisateur utilisateur);
- /**
- * Met à jour un spécimen
- * @param specimen Spécimen
- * @throws DataConstraintException Si le pécimen (nom) existe déjà
- */
- void updateSpecimen((a)Normalize(SpecimenNormalizer.class) Specimen specimen) throws DataConstraintException;
+ /**
+ * Met à jour un spécimen
+ * @param specimen Spécimen
+ * @throws DataConstraintException Si le pécimen (nom) existe déjà
+ */
+ void updateSpecimen((a)Normalize(SpecimenNormalizer.class) Specimen specimen) throws DataConstraintException;
}
Modified: trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/StationService.java
===================================================================
--- trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/StationService.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/StationService.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -42,76 +42,76 @@
*/
public interface StationService {
- /**
- * Compte le nombre de stations
- * @return Nombre de stations
- */
- long countStations();
+ /**
+ * Compte le nombre de stations
+ * @return Nombre de stations
+ */
+ long countStations();
- /**
- * Créée une station
- * @param station Station
- * @throws DataConstraintException Si la station existe déjà
- */
- void createStation((a)Normalize(StationNormalizer.class) Station station) throws DataConstraintException;
+ /**
+ * Créée une station
+ * @param station Station
+ * @throws DataConstraintException Si la station existe déjà
+ */
+ void createStation((a)Normalize(StationNormalizer.class) Station station) throws DataConstraintException;
- /**
- * Supprime une station
- * @param station Station
- * @throws DataConstraintException Si des données liées empêchent la suppression
- */
- void deleteStation(Station station) throws DataConstraintException;
+ /**
+ * Supprime une station
+ * @param station Station
+ * @throws DataConstraintException Si des données liées empêchent la suppression
+ */
+ void deleteStation(Station station) throws DataConstraintException;
- /**
- * Liste les localités des stations
- * @return Localités
- */
- @Transactional(readOnly = true)
- List<String> listStationLocalites();
+ /**
+ * Liste les localités des stations
+ * @return Localités
+ */
+ @Transactional(readOnly = true)
+ List<String> listStationLocalites();
- /**
- * Liste les stations selon les droits d'un utilisateur (triés par nom)
- * @param utilisateur L'utilisateur
- * @return Stations
- */
- @Transactional(readOnly = true)
- List<Station> listStations(Utilisateur utilisateur);
+ /**
+ * Liste les stations selon les droits d'un utilisateur (triés par nom)
+ * @param utilisateur L'utilisateur
+ * @return Stations
+ */
+ @Transactional(readOnly = true)
+ List<Station> listStations(Utilisateur utilisateur);
- /**
- * Liste l'ensemble des stations selon les droits d'un utilisateur (triés par nom)
- * @param utilisateur L'utilisateur
- * @return la liste des stations
- */
- SortedSet<Station> listStationsForUser(Utilisateur utilisateur);
+ /**
+ * Liste l'ensemble des stations selon les droits d'un utilisateur (triés par nom)
+ * @param utilisateur L'utilisateur
+ * @return la liste des stations
+ */
+ SortedSet<Station> listStationsForUser(Utilisateur utilisateur);
- /**
- * Charge une station
- * @param idStation ID
- * @return Station
- * @throws DataNotFoundException Si la station n'existe pas
- */
- Station loadStation(Integer idStation) throws DataNotFoundException;
+ /**
+ * Charge une station
+ * @param idStation ID
+ * @return Station
+ * @throws DataNotFoundException Si la station n'existe pas
+ */
+ Station loadStation(Integer idStation) throws DataNotFoundException;
- /**
- * Charge une station
- * @param nom Nom
- * @return Station
- * @throws DataNotFoundException Si la station n'existe pas
- */
- Station loadStation((a)Normalize(UniqueFieldNormalizer.class) String nom) throws DataNotFoundException;
+ /**
+ * Charge une station
+ * @param nom Nom
+ * @return Station
+ * @throws DataNotFoundException Si la station n'existe pas
+ */
+ Station loadStation((a)Normalize(UniqueFieldNormalizer.class) String nom) throws DataNotFoundException;
- /**
- * Détermine si un utilisateur peut modifier ou supprimer une station
- * @param station Station
- * @param utilisateur Utilisateur
- * @return TRUE si il a le droit
- */
- boolean updateOrdeleteStationEnabled(Station station, Utilisateur utilisateur);
+ /**
+ * Détermine si un utilisateur peut modifier ou supprimer une station
+ * @param station Station
+ * @param utilisateur Utilisateur
+ * @return TRUE si il a le droit
+ */
+ boolean updateOrdeleteStationEnabled(Station station, Utilisateur utilisateur);
- /**
- * Met à jour une station
- * @param station Station
- * @throws DataConstraintException Si la station existe déjà
- */
- void updateStation((a)Normalize(StationNormalizer.class) Station station) throws DataConstraintException;
+ /**
+ * Met à jour une station
+ * @param station Station
+ * @throws DataConstraintException Si la station existe déjà
+ */
+ void updateStation((a)Normalize(StationNormalizer.class) Station station) throws DataConstraintException;
}
Modified: trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/TestBioService.java
===================================================================
--- trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/TestBioService.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/TestBioService.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -46,221 +46,221 @@
*/
public interface TestBioService {
- /**
- * Compte le nombre de resultats de tests biologiques
- * @return Nombre de resultats de tests biologiques
- */
- long countResultatsTestsBio();
+ /**
+ * Compte le nombre de resultats de tests biologiques
+ * @return Nombre de resultats de tests biologiques
+ */
+ long countResultatsTestsBio();
- /**
- * Créée une manipulation de testBio
- * @param testBio La manipulation
- * @throws DataConstraintException Si la manipulation (réf) existe déjà
- */
- void createTestBio((a)Normalize(TestBioNormalizer.class) TestBio testBio) throws DataConstraintException;
+ /**
+ * Créée une manipulation de testBio
+ * @param testBio La manipulation
+ * @throws DataConstraintException Si la manipulation (réf) existe déjà
+ */
+ void createTestBio((a)Normalize(TestBioNormalizer.class) TestBio testBio) throws DataConstraintException;
- /**
- * Supprime une manipulation de testBio
- * @param testBio La manipulation
- * @throws DataConstraintException En cas de données liées
- */
- void deleteTestBio(TestBio testBio) throws DataConstraintException;
+ /**
+ * Supprime une manipulation de testBio
+ * @param testBio La manipulation
+ * @throws DataConstraintException En cas de données liées
+ */
+ void deleteTestBio(TestBio testBio) throws DataConstraintException;
- /**
- * Liste l'ensemble des résultats de tests biologiques selon les droits d'un utilisateur (triés par réf produit)
- * @param utilisateur L'utilisateur
- * @return la liste des résultats
- */
- @Transactional(readOnly = true)
- List<ResultatTestBio> listResultatsTestBio(Utilisateur utilisateur);
+ /**
+ * Liste l'ensemble des résultats de tests biologiques selon les droits d'un utilisateur (triés par réf produit)
+ * @param utilisateur L'utilisateur
+ * @return la liste des résultats
+ */
+ @Transactional(readOnly = true)
+ List<ResultatTestBio> listResultatsTestBio(Utilisateur utilisateur);
- /**
- * Liste l'ensemble des résultats de tests biologiques selon les droits d'un utilisateur (triés par réf produit)
- * @param utilisateur L'utilisateur non admin
- * @return la liste des résultats
- */
- SortedSet<ResultatTestBio> listResultatsTestBioForUser(Utilisateur utilisateur);
+ /**
+ * Liste l'ensemble des résultats de tests biologiques selon les droits d'un utilisateur (triés par réf produit)
+ * @param utilisateur L'utilisateur non admin
+ * @return la liste des résultats
+ */
+ SortedSet<ResultatTestBio> listResultatsTestBioForUser(Utilisateur utilisateur);
- /**
- * Liste les produits témoins existants pour les résultats de tests biologiques
- * @return Les organismes
- */
- @Transactional(readOnly = true)
- List<String> listProduitsTemoins();
+ /**
+ * Liste les produits témoins existants pour les résultats de tests biologiques
+ * @return Les organismes
+ */
+ @Transactional(readOnly = true)
+ List<String> listProduitsTemoins();
- /**
- * Vérifie si le test biologique de référence donnée est unique dans la base
- * @param testBio Le test biologique
- * @return TRUE si le tet biologique est unique
- */
- @Transactional(readOnly = true)
- boolean isTestBioUnique(TestBio testBio);
+ /**
+ * Vérifie si le test biologique de référence donnée est unique dans la base
+ * @param testBio Le test biologique
+ * @return TRUE si le tet biologique est unique
+ */
+ @Transactional(readOnly = true)
+ boolean isTestBioUnique(TestBio testBio);
- /**
- * Charge une manipulation de test biologique
- * @param idTestBio ID de la manipulation
- * @return La manipulation
- * @throws DataNotFoundException Si non trouvée
- */
- TestBio loadTestBio(Integer idTestBio) throws DataNotFoundException;
+ /**
+ * Charge une manipulation de test biologique
+ * @param idTestBio ID de la manipulation
+ * @return La manipulation
+ * @throws DataNotFoundException Si non trouvée
+ */
+ TestBio loadTestBio(Integer idTestBio) throws DataNotFoundException;
- /**
- * Charge une manipulation de test biologique
- * @param ref Référence de la manipulation
- * @return La manipulation correspondante
- * @throws DataNotFoundException Si non trouvée
- */
- TestBio loadTestBio((a)Normalize(UniqueFieldNormalizer.class) String ref) throws DataNotFoundException;
+ /**
+ * Charge une manipulation de test biologique
+ * @param ref Référence de la manipulation
+ * @return La manipulation correspondante
+ * @throws DataNotFoundException Si non trouvée
+ */
+ TestBio loadTestBio((a)Normalize(UniqueFieldNormalizer.class) String ref) throws DataNotFoundException;
- /**
- * Met à jour une manipulation de test biologique
- * @param testBio La manipulation
- * @throws DataConstraintException En cas de doublons (champs uniques)
- */
- void updateTestBio((a)Normalize(TestBioNormalizer.class) TestBio testBio) throws DataConstraintException;
+ /**
+ * Met à jour une manipulation de test biologique
+ * @param testBio La manipulation
+ * @throws DataConstraintException En cas de doublons (champs uniques)
+ */
+ void updateTestBio((a)Normalize(TestBioNormalizer.class) TestBio testBio) throws DataConstraintException;
- /**
- * Rafraichit une testBio (pour éviter des LazyLoadingException)
- * @param testBio TestBio
- */
- void refreshTestBio(TestBio testBio);
+ /**
+ * Rafraichit une testBio (pour éviter des LazyLoadingException)
+ * @param testBio TestBio
+ */
+ void refreshTestBio(TestBio testBio);
- /**
- * Détermine si un utilisateur peut modifier ou supprimer un test biologique
- * @param testBio La manipulation
- * @param utilisateur L'utilisateur
- * @return TRUE s'il a le droit
- */
- boolean updateOrdeleteTestBioEnabled(TestBio testBio, Utilisateur utilisateur);
+ /**
+ * Détermine si un utilisateur peut modifier ou supprimer un test biologique
+ * @param testBio La manipulation
+ * @param utilisateur L'utilisateur
+ * @return TRUE s'il a le droit
+ */
+ boolean updateOrdeleteTestBioEnabled(TestBio testBio, Utilisateur utilisateur);
- /**
- * Détermine si un utilisateur peut accéder à un résultat de test biologique
- * @param resultatTestBio Le résultat
- * @param utilisateur L'utilisateur
- * @return TRUE s'il a le droit
- */
- @Transactional(readOnly = true)
- boolean isResultatTestBioAccessibleByUser(ResultatTestBio resultatTestBio, Utilisateur utilisateur);
+ /**
+ * Détermine si un utilisateur peut accéder à un résultat de test biologique
+ * @param resultatTestBio Le résultat
+ * @param utilisateur L'utilisateur
+ * @return TRUE s'il a le droit
+ */
+ @Transactional(readOnly = true)
+ boolean isResultatTestBioAccessibleByUser(ResultatTestBio resultatTestBio, Utilisateur utilisateur);
- /**
- * Détermine si un résultat est unique par rapport à une une liste (si blanc : unicité sur repère, si témoin :
- * unicité sur repère + produit_témoin, si produit : unicité sur repère + produit)
- * @param resultatTestBio Le résultat de test bio
- * @param liste La liste des résultats
- * @return TRUE
- */
- @Transactional(readOnly = true)
- boolean isResultatTestBioUniqueInList(final ResultatTestBio resultatTestBio, final List<ResultatTestBio> liste);
+ /**
+ * Détermine si un résultat est unique par rapport à une une liste (si blanc : unicité sur repère, si témoin :
+ * unicité sur repère + produit_témoin, si produit : unicité sur repère + produit)
+ * @param resultatTestBio Le résultat de test bio
+ * @param liste La liste des résultats
+ * @return TRUE
+ */
+ @Transactional(readOnly = true)
+ boolean isResultatTestBioUniqueInList(final ResultatTestBio resultatTestBio, final List<ResultatTestBio> liste);
- /**
- * Créée une méthode pour un test biologique
- * @param methode La méthode
- * @throws DataConstraintException Si la méthode (nom) existe déjà
- */
- void createMethodeTestBio((a)Normalize(MethodeTestBioNormalizer.class) MethodeTestBio methode)
- throws DataConstraintException;
+ /**
+ * Créée une méthode pour un test biologique
+ * @param methode La méthode
+ * @throws DataConstraintException Si la méthode (nom) existe déjà
+ */
+ void createMethodeTestBio((a)Normalize(MethodeTestBioNormalizer.class) MethodeTestBio methode)
+ throws DataConstraintException;
- /**
- * Supprime une méthode pour un test biologique
- * @param methode La méthode
- * @throws DataConstraintException En cas de données liées
- */
- void deleteMethodeTestBio(MethodeTestBio methode) throws DataConstraintException;
+ /**
+ * Supprime une méthode pour un test biologique
+ * @param methode La méthode
+ * @throws DataConstraintException En cas de données liées
+ */
+ void deleteMethodeTestBio(MethodeTestBio methode) throws DataConstraintException;
- /**
- * Liste les méthodes existantes pour un test biologique (triés par nom)
- * @return la liste des méthodes
- */
- @Transactional(readOnly = true)
- List<MethodeTestBio> listMethodesTestBio();
+ /**
+ * Liste les méthodes existantes pour un test biologique (triés par nom)
+ * @return la liste des méthodes
+ */
+ @Transactional(readOnly = true)
+ List<MethodeTestBio> listMethodesTestBio();
- /**
- * Liste les domaines existants pour les méthodes de test
- * @return Les cibles
- */
- @Transactional(readOnly = true)
- List<String> listDomainesMethodes();
+ /**
+ * Liste les domaines existants pour les méthodes de test
+ * @return Les cibles
+ */
+ @Transactional(readOnly = true)
+ List<String> listDomainesMethodes();
- /**
- * Liste les unités de résultat existants pour les méthodes de test
- * @return Les unités
- */
- @Transactional(readOnly = true)
- List<String> listUnitesResultatMethodes();
+ /**
+ * Liste les unités de résultat existants pour les méthodes de test
+ * @return Les unités
+ */
+ @Transactional(readOnly = true)
+ List<String> listUnitesResultatMethodes();
- /**
- * Charge une méthode pour un test biologique
- * @param idMethode ID de la méthode
- * @return La méthode correspondante
- * @throws DataNotFoundException Si non trouvée
- */
- MethodeTestBio loadMethodeTest(Integer idMethode) throws DataNotFoundException;
+ /**
+ * Charge une méthode pour un test biologique
+ * @param idMethode ID de la méthode
+ * @return La méthode correspondante
+ * @throws DataNotFoundException Si non trouvée
+ */
+ MethodeTestBio loadMethodeTest(Integer idMethode) throws DataNotFoundException;
- /**
- * Charge une méthode pour un test biologique
- * @param nom Nom de la méthode
- * @return La méthode correspondante
- * @throws DataNotFoundException Si non trouvée
- */
- MethodeTestBio loadMethodeTest((a)Normalize(UniqueFieldNormalizer.class) String nom) throws DataNotFoundException;
+ /**
+ * Charge une méthode pour un test biologique
+ * @param nom Nom de la méthode
+ * @return La méthode correspondante
+ * @throws DataNotFoundException Si non trouvée
+ */
+ MethodeTestBio loadMethodeTest((a)Normalize(UniqueFieldNormalizer.class) String nom) throws DataNotFoundException;
- /**
- * Met à jour une méthode pour un test biologique
- * @param methode La méthode
- * @throws DataConstraintException En cas de doublons (champs uniques)
- */
- void updateMethodeTest((a)Normalize(MethodeTestBioNormalizer.class) MethodeTestBio methode)
- throws DataConstraintException;
+ /**
+ * Met à jour une méthode pour un test biologique
+ * @param methode La méthode
+ * @throws DataConstraintException En cas de doublons (champs uniques)
+ */
+ void updateMethodeTest((a)Normalize(MethodeTestBioNormalizer.class) MethodeTestBio methode)
+ throws DataConstraintException;
- /**
- * Rafraichit une méthode de testBio (pour éviter des LazyLoadingException)
- * @param methode La méthode
- */
- void refreshMethodeTestBio(MethodeTestBio methode);
+ /**
+ * Rafraichit une méthode de testBio (pour éviter des LazyLoadingException)
+ * @param methode La méthode
+ */
+ void refreshMethodeTestBio(MethodeTestBio methode);
- /**
- * Créée une erreur pour un test biologique
- * @param erreurTest L'erreur
- * @throws DataConstraintException Si l'erreur (nom) existe déjà
- */
- void createErreurTest((a)Normalize(ErreurTestNormalizer.class) ErreurTestBio erreurTest)
- throws DataConstraintException;
+ /**
+ * Créée une erreur pour un test biologique
+ * @param erreurTest L'erreur
+ * @throws DataConstraintException Si l'erreur (nom) existe déjà
+ */
+ void createErreurTest((a)Normalize(ErreurTestNormalizer.class) ErreurTestBio erreurTest)
+ throws DataConstraintException;
- /**
- * Supprime une erreur pour un test biologique
- * @param erreurTest L'erreur
- * @throws DataConstraintException En cas de données liées
- */
- void deleteErreurTest(ErreurTestBio erreurTest) throws DataConstraintException;
+ /**
+ * Supprime une erreur pour un test biologique
+ * @param erreurTest L'erreur
+ * @throws DataConstraintException En cas de données liées
+ */
+ void deleteErreurTest(ErreurTestBio erreurTest) throws DataConstraintException;
- /**
- * Liste les erreurs existantes pour un test biologique
- * @return la liste des erreurs
- */
- List<ErreurTestBio> listErreursTestBio();
+ /**
+ * Liste les erreurs existantes pour un test biologique
+ * @return la liste des erreurs
+ */
+ List<ErreurTestBio> listErreursTestBio();
- /**
- * Charge une erreur pour un test biologique
- * @param idErreurTest ID de l'erreur
- * @return L'erreur
- * @throws DataNotFoundException Si non trouvée
- */
- ErreurTestBio loadErreurTestBio(Integer idErreurTest) throws DataNotFoundException;
+ /**
+ * Charge une erreur pour un test biologique
+ * @param idErreurTest ID de l'erreur
+ * @return L'erreur
+ * @throws DataNotFoundException Si non trouvée
+ */
+ ErreurTestBio loadErreurTestBio(Integer idErreurTest) throws DataNotFoundException;
- /**
- * Charge une erreur pour un test biologique
- * @param nom Nom de l'erreur
- * @return L'erreur
- * @throws DataNotFoundException Si non trouvée
- */
- ErreurTestBio loadErreurTestBio((a)Normalize(UniqueFieldNormalizer.class) String nom) throws DataNotFoundException;
+ /**
+ * Charge une erreur pour un test biologique
+ * @param nom Nom de l'erreur
+ * @return L'erreur
+ * @throws DataNotFoundException Si non trouvée
+ */
+ ErreurTestBio loadErreurTestBio((a)Normalize(UniqueFieldNormalizer.class) String nom) throws DataNotFoundException;
- /**
- * Met à jour une erreur pour un test biologique
- * @param erreurTest L'erreur
- * @throws DataConstraintException En cas de doublons (champs uniques)
- */
- void updateErreurTestBio((a)Normalize(ErreurTestNormalizer.class) ErreurTestBio erreurTest)
- throws DataConstraintException;
+ /**
+ * Met à jour une erreur pour un test biologique
+ * @param erreurTest L'erreur
+ * @throws DataConstraintException En cas de doublons (champs uniques)
+ */
+ void updateErreurTestBio((a)Normalize(ErreurTestNormalizer.class) ErreurTestBio erreurTest)
+ throws DataConstraintException;
}
Modified: trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/CampagneServiceImpl.java
===================================================================
--- trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/CampagneServiceImpl.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/CampagneServiceImpl.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -52,113 +52,113 @@
@Service
public final class CampagneServiceImpl implements CampagneService {
- /** Logger */
- private static final Log LOG = LogTools.getLog();
+ /** Logger */
+ private static final Log LOG = LogTools.getLog();
- /** Accès aux données */
- @Autowired
- private GenericDao dao;
+ /** Accès aux données */
+ @Autowired
+ private GenericDao dao;
- /** {@inheritDoc} */
- @Override
- public long countCampagnes() {
- return dao.count(Campagne.class);
- }
+ /** {@inheritDoc} */
+ @Override
+ public long countCampagnes() {
+ return dao.count(Campagne.class);
+ }
- /** {@inheritDoc} */
- @Override
- public void createCampagne(Campagne campagne) throws DataConstraintException {
- LOG.info("createCampagne " + campagne.getNom());
- dao.create(campagne);
- }
+ /** {@inheritDoc} */
+ @Override
+ public void createCampagne(Campagne campagne) throws DataConstraintException {
+ LOG.info("createCampagne " + campagne.getNom());
+ dao.create(campagne);
+ }
- /** {@inheritDoc} */
- @Override
- public void deleteCampagne(Campagne campagne) throws DataConstraintException {
- AssertTools.assertNotNull(campagne);
- LOG.info("deleteCampagne " + campagne.getIdCampagne());
- try {
- dao.delete(campagne);
- } catch (DataNotFoundException e) {
- LOG.error(e.getMessage(), e);
- throw new UnexpectedException(e);
- }
- }
+ /** {@inheritDoc} */
+ @Override
+ public void deleteCampagne(Campagne campagne) throws DataConstraintException {
+ AssertTools.assertNotNull(campagne);
+ LOG.info("deleteCampagne " + campagne.getIdCampagne());
+ try {
+ dao.delete(campagne);
+ } catch (DataNotFoundException e) {
+ LOG.error(e.getMessage(), e);
+ throw new UnexpectedException(e);
+ }
+ }
- /** {@inheritDoc} */
- @SuppressWarnings("unchecked")
- @Override
- public List<String> listCampagneProgrammes() {
- return (List<String>) dao.list(CampagneDao.CRITERIA_DISTINCT_CAMPAGNE_PROGRAMMES);
- }
+ /** {@inheritDoc} */
+ @SuppressWarnings("unchecked")
+ @Override
+ public List<String> listCampagneProgrammes() {
+ return (List<String>) dao.list(CampagneDao.CRITERIA_DISTINCT_CAMPAGNE_PROGRAMMES);
+ }
- /** {@inheritDoc} */
- @Override
- public List<Campagne> listCampagnes(Utilisateur utilisateur) {
- AssertTools.assertNotNull(utilisateur);
- if (utilisateur.getTypeDroit() == TypeDroit.ADMINISTRATEUR) {
- return dao.readList(Campagne.class, "nom");
- }
- SortedSet<Campagne> campagnes = listCampagnesForUser(utilisateur);
+ /** {@inheritDoc} */
+ @Override
+ public List<Campagne> listCampagnes(Utilisateur utilisateur) {
+ AssertTools.assertNotNull(utilisateur);
+ if (utilisateur.getTypeDroit() == TypeDroit.ADMINISTRATEUR) {
+ return dao.readList(Campagne.class, "nom");
+ }
+ SortedSet<Campagne> campagnes = listCampagnesForUser(utilisateur);
- return new ArrayList<Campagne>(campagnes);
- }
+ return new ArrayList<Campagne>(campagnes);
+ }
- /** {@inheritDoc} */
- @Override
- public SortedSet<Campagne> listCampagnesForUser(Utilisateur utilisateur) {
- // gestion des droits en plus pour les utilisateurs
- SortedSet<Campagne> campagnes = new TreeSet<Campagne>();
- campagnes.addAll(utilisateur.getCampagnesCreees());
- campagnes.addAll(utilisateur.getCampagnesDroits().keySet());
+ /** {@inheritDoc} */
+ @Override
+ public SortedSet<Campagne> listCampagnesForUser(Utilisateur utilisateur) {
+ // gestion des droits en plus pour les utilisateurs
+ SortedSet<Campagne> campagnes = new TreeSet<Campagne>();
+ campagnes.addAll(utilisateur.getCampagnesCreees());
+ campagnes.addAll(utilisateur.getCampagnesDroits().keySet());
- // accès aux campagnes des lots pour lesquels l'utilisateur a les droits
- for (Lot lot : utilisateur.getLotsCrees()) {
- campagnes.add(lot.getCampagne());
- }
- for (Lot lot : utilisateur.getLotsDroits().keySet()) {
- campagnes.add(lot.getCampagne());
- }
- return campagnes;
- }
+ // accès aux campagnes des lots pour lesquels l'utilisateur a les droits
+ for (Lot lot : utilisateur.getLotsCrees()) {
+ campagnes.add(lot.getCampagne());
+ }
+ for (Lot lot : utilisateur.getLotsDroits().keySet()) {
+ campagnes.add(lot.getCampagne());
+ }
+ return campagnes;
+ }
- /** {@inheritDoc} */
- @Override
- public Campagne loadCampagne(Integer idCampagne) throws DataNotFoundException {
- AssertTools.assertNotNull(idCampagne);
- return dao.read(Campagne.class, idCampagne);
- }
+ /** {@inheritDoc} */
+ @Override
+ public Campagne loadCampagne(Integer idCampagne) throws DataNotFoundException {
+ AssertTools.assertNotNull(idCampagne);
+ return dao.read(Campagne.class, idCampagne);
+ }
- /** {@inheritDoc} */
- @Override
- public Campagne loadCampagne(String nom) throws DataNotFoundException {
- AssertTools.assertNotEmpty(nom);
- return dao.read(Campagne.class, "nom", nom);
- }
+ /** {@inheritDoc} */
+ @Override
+ public Campagne loadCampagne(String nom) throws DataNotFoundException {
+ AssertTools.assertNotEmpty(nom);
+ return dao.read(Campagne.class, "nom", nom);
+ }
- /** {@inheritDoc} */
- @Override
- public void refreshCampagne(Campagne campagne) {
- AssertTools.assertNotNull(campagne);
- dao.refresh(campagne);
- }
+ /** {@inheritDoc} */
+ @Override
+ public void refreshCampagne(Campagne campagne) {
+ AssertTools.assertNotNull(campagne);
+ dao.refresh(campagne);
+ }
- /** {@inheritDoc} */
- @Override
- public void updateCampagne(Campagne campagne) throws DataConstraintException {
- LOG.info("updateCampagne " + campagne.getIdCampagne());
- try {
- dao.update(campagne);
- } catch (DataNotFoundException e) {
- LOG.error(e.getMessage(), e);
- throw new UnexpectedException(e);
- }
- }
+ /** {@inheritDoc} */
+ @Override
+ public void updateCampagne(Campagne campagne) throws DataConstraintException {
+ LOG.info("updateCampagne " + campagne.getIdCampagne());
+ try {
+ dao.update(campagne);
+ } catch (DataNotFoundException e) {
+ LOG.error(e.getMessage(), e);
+ throw new UnexpectedException(e);
+ }
+ }
- /** {@inheritDoc} */
- @Override
- public boolean updateOrdeleteCampagneEnabled(Campagne campagne, Utilisateur utilisateur) {
- return utilisateur.getTypeDroit() == TypeDroit.ADMINISTRATEUR
- || utilisateur.getIdPersonne() == campagne.getCreateur().getIdPersonne();
- }
+ /** {@inheritDoc} */
+ @Override
+ public boolean updateOrdeleteCampagneEnabled(Campagne campagne, Utilisateur utilisateur) {
+ return utilisateur.getTypeDroit() == TypeDroit.ADMINISTRATEUR
+ || utilisateur.getIdPersonne() == campagne.getCreateur().getIdPersonne();
+ }
}
Modified: trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/DocumentServiceImpl.java
===================================================================
--- trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/DocumentServiceImpl.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/DocumentServiceImpl.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -44,60 +44,60 @@
@Service
public final class DocumentServiceImpl implements DocumentService {
- /** Logger */
- private static final Log LOG = LogTools.getLog();
+ /** Logger */
+ private static final Log LOG = LogTools.getLog();
- /** DAO */
- @Autowired
- private GenericDao dao;
+ /** DAO */
+ @Autowired
+ private GenericDao dao;
- /** {@inheritDoc} */
- @Override
- public List<TypeDocument> listTypeDocuments() {
- return dao.readList(TypeDocument.class, "nom");
- }
+ /** {@inheritDoc} */
+ @Override
+ public List<TypeDocument> listTypeDocuments() {
+ return dao.readList(TypeDocument.class, "nom");
+ }
- /** {@inheritDoc} */
- @Override
- public void createTypeDocument(TypeDocument typeDocument) throws DataConstraintException {
- LOG.info("createTypeDocument: " + typeDocument.getNom());
- dao.create(typeDocument);
- }
+ /** {@inheritDoc} */
+ @Override
+ public void createTypeDocument(TypeDocument typeDocument) throws DataConstraintException {
+ LOG.info("createTypeDocument: " + typeDocument.getNom());
+ dao.create(typeDocument);
+ }
- /** {@inheritDoc} */
- @Override
- public TypeDocument loadTypeDocument(Integer idTypeDocument) throws DataNotFoundException {
- return dao.read(TypeDocument.class, idTypeDocument);
- }
+ /** {@inheritDoc} */
+ @Override
+ public TypeDocument loadTypeDocument(Integer idTypeDocument) throws DataNotFoundException {
+ return dao.read(TypeDocument.class, idTypeDocument);
+ }
- /** {@inheritDoc} */
- @Override
- public TypeDocument loadTypeDocument(String nom) throws DataNotFoundException {
- return dao.read(TypeDocument.class, "nom", nom);
- }
+ /** {@inheritDoc} */
+ @Override
+ public TypeDocument loadTypeDocument(String nom) throws DataNotFoundException {
+ return dao.read(TypeDocument.class, "nom", nom);
+ }
- /** {@inheritDoc} */
- @Override
- public void updateTypeDocument(TypeDocument typeDocument) throws DataConstraintException {
- LOG.info("updateTypeDocument: " + typeDocument.getNom());
- try {
- dao.update(typeDocument);
- } catch (DataNotFoundException e) {
- LOG.error(e.getMessage(), e);
- throw new UnexpectedException(e);
- }
- }
+ /** {@inheritDoc} */
+ @Override
+ public void updateTypeDocument(TypeDocument typeDocument) throws DataConstraintException {
+ LOG.info("updateTypeDocument: " + typeDocument.getNom());
+ try {
+ dao.update(typeDocument);
+ } catch (DataNotFoundException e) {
+ LOG.error(e.getMessage(), e);
+ throw new UnexpectedException(e);
+ }
+ }
- /** {@inheritDoc} */
- @Override
- public void deleteTypeDocument(TypeDocument typeDocument) throws DataConstraintException {
- AssertTools.assertNotNull(typeDocument);
- LOG.info("deleteTypeDocument: " + typeDocument.getNom());
- try {
- dao.delete(typeDocument);
- } catch (DataNotFoundException e) {
- LOG.error(e.getMessage(), e);
- throw new UnexpectedException(e);
- }
- }
+ /** {@inheritDoc} */
+ @Override
+ public void deleteTypeDocument(TypeDocument typeDocument) throws DataConstraintException {
+ AssertTools.assertNotNull(typeDocument);
+ LOG.info("deleteTypeDocument: " + typeDocument.getNom());
+ try {
+ dao.delete(typeDocument);
+ } catch (DataNotFoundException e) {
+ LOG.error(e.getMessage(), e);
+ throw new UnexpectedException(e);
+ }
+ }
}
Modified: trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/ExtractionServiceImpl.java
===================================================================
--- trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/ExtractionServiceImpl.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/ExtractionServiceImpl.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -56,212 +56,212 @@
@Service
public final class ExtractionServiceImpl implements ExtractionService {
- /** Logger */
- private static final Log LOG = LogTools.getLog();
+ /** Logger */
+ private static final Log LOG = LogTools.getLog();
- /** DAO */
- @Autowired
- private GenericDao dao;
+ /** DAO */
+ @Autowired
+ private GenericDao dao;
- /** Service : lots **/
- @Autowired
- private LotService lotService;
+ /** Service : lots **/
+ @Autowired
+ private LotService lotService;
- /** {@inheritDoc} */
- @Override
- public long countExtractions() {
- return dao.count(Extraction.class);
- }
+ /** {@inheritDoc} */
+ @Override
+ public long countExtractions() {
+ return dao.count(Extraction.class);
+ }
- /** {@inheritDoc} */
- @Override
- public void createExtraction(Extraction extraction) throws DataConstraintException {
- LOG.info("createExtraction: " + extraction.getRef());
- dao.create(extraction);
- }
+ /** {@inheritDoc} */
+ @Override
+ public void createExtraction(Extraction extraction) throws DataConstraintException {
+ LOG.info("createExtraction: " + extraction.getRef());
+ dao.create(extraction);
+ }
- /** {@inheritDoc} */
- @Override
- public void deleteExtraction(Extraction extraction) throws DataConstraintException {
- AssertTools.assertNotNull(extraction);
- LOG.info("deleteExtraction: " + extraction.getRef());
- try {
- dao.delete(extraction);
- } catch (DataNotFoundException e) {
- LOG.error(e.getMessage(), e);
- throw new UnexpectedException(e);
- }
+ /** {@inheritDoc} */
+ @Override
+ public void deleteExtraction(Extraction extraction) throws DataConstraintException {
+ AssertTools.assertNotNull(extraction);
+ LOG.info("deleteExtraction: " + extraction.getRef());
+ try {
+ dao.delete(extraction);
+ } catch (DataNotFoundException e) {
+ LOG.error(e.getMessage(), e);
+ throw new UnexpectedException(e);
+ }
- }
+ }
- /** {@inheritDoc} */
- @Override
- public List<Extraction> listExtractions(Utilisateur utilisateur) {
- AssertTools.assertNotNull(utilisateur);
- if (utilisateur.getTypeDroit() == TypeDroit.ADMINISTRATEUR) {
- // si admin, on ajoute toutes les extractions de la base
+ /** {@inheritDoc} */
+ @Override
+ public List<Extraction> listExtractions(Utilisateur utilisateur) {
+ AssertTools.assertNotNull(utilisateur);
+ if (utilisateur.getTypeDroit() == TypeDroit.ADMINISTRATEUR) {
+ // si admin, on ajoute toutes les extractions de la base
- // SortedSet pour garder une liste "DISTINCT", sinon une ligne par extrait (OUTER JOIN avec Fetch=EAGER)
- SortedSet<Extraction> extractions = new TreeSet<Extraction>(dao.readList(Extraction.class));
- return new ArrayList<Extraction>(extractions);
- }
- // gestion des droits en plus pour les utilisateurs
- return new ArrayList<Extraction>(listExtractionsForUser(utilisateur));
- }
+ // SortedSet pour garder une liste "DISTINCT", sinon une ligne par extrait (OUTER JOIN avec Fetch=EAGER)
+ SortedSet<Extraction> extractions = new TreeSet<Extraction>(dao.readList(Extraction.class));
+ return new ArrayList<Extraction>(extractions);
+ }
+ // gestion des droits en plus pour les utilisateurs
+ return new ArrayList<Extraction>(listExtractionsForUser(utilisateur));
+ }
- /** {@inheritDoc} */
- @Override
- public SortedSet<Extraction> listExtractionsForUser(Utilisateur utilisateur) {
- AssertTools.assertNotNull(utilisateur);
- SortedSet<Extraction> extractions = new TreeSet<Extraction>();
+ /** {@inheritDoc} */
+ @Override
+ public SortedSet<Extraction> listExtractionsForUser(Utilisateur utilisateur) {
+ AssertTools.assertNotNull(utilisateur);
+ SortedSet<Extraction> extractions = new TreeSet<Extraction>();
- extractions.addAll(utilisateur.getExtractionsCrees());
- SortedSet<Lot> lotsAllowed = lotService.listLotsForUser(utilisateur);
- for (Lot l : lotsAllowed) {
- extractions.addAll(l.getExtractions());
- }
- return extractions;
- }
+ extractions.addAll(utilisateur.getExtractionsCrees());
+ SortedSet<Lot> lotsAllowed = lotService.listLotsForUser(utilisateur);
+ for (Lot l : lotsAllowed) {
+ extractions.addAll(l.getExtractions());
+ }
+ return extractions;
+ }
- /** {@inheritDoc} */
- @Override
- public boolean isExtractionUnique(Extraction extraction) {
- AssertTools.assertNotNull(extraction);
+ /** {@inheritDoc} */
+ @Override
+ public boolean isExtractionUnique(Extraction extraction) {
+ AssertTools.assertNotNull(extraction);
- // unique if it doesn't exist different value or if it exists but with the same id (so same row in the db)
- if (!dao.exists(Extraction.class, "ref", extraction.getRef())) {
- return true;
- }
+ // unique if it doesn't exist different value or if it exists but with the same id (so same row in the db)
+ if (!dao.exists(Extraction.class, "ref", extraction.getRef())) {
+ return true;
+ }
- Extraction extrWithSameVal;
- try {
- extrWithSameVal = dao.read(Extraction.class, "ref", extraction.getRef());
- dao.evict(extrWithSameVal);
- } catch (DataNotFoundException e) {
- return true; // never call, cover by dao.exists...
- }
- // in case of new record, id is null
- return extraction.getIdExtraction() != null
- && extraction.getIdExtraction().equals(extrWithSameVal.getIdExtraction());
- }
+ Extraction extrWithSameVal;
+ try {
+ extrWithSameVal = dao.read(Extraction.class, "ref", extraction.getRef());
+ dao.evict(extrWithSameVal);
+ } catch (DataNotFoundException e) {
+ return true; // never call, cover by dao.exists...
+ }
+ // in case of new record, id is null
+ return extraction.getIdExtraction() != null
+ && extraction.getIdExtraction().equals(extrWithSameVal.getIdExtraction());
+ }
- /** {@inheritDoc} */
- @Override
- public Extraction loadExtraction(Integer idExtraction) throws DataNotFoundException {
- LOG.debug("read Extraction");
- return dao.read(Extraction.class, idExtraction);
- }
+ /** {@inheritDoc} */
+ @Override
+ public Extraction loadExtraction(Integer idExtraction) throws DataNotFoundException {
+ LOG.debug("read Extraction");
+ return dao.read(Extraction.class, idExtraction);
+ }
- /** {@inheritDoc} */
- @Override
- public Extraction loadExtraction(String ref) throws DataNotFoundException {
- return dao.read(Extraction.class, "ref", ref);
- }
+ /** {@inheritDoc} */
+ @Override
+ public Extraction loadExtraction(String ref) throws DataNotFoundException {
+ return dao.read(Extraction.class, "ref", ref);
+ }
- /** {@inheritDoc} */
- @Override
- public void updateExtraction(Extraction extraction) throws DataConstraintException {
- LOG.info("updateExtraction: " + extraction.getRef());
- try {
- dao.update(extraction);
- } catch (DataNotFoundException e) {
- LOG.error(e.getMessage(), e);
- throw new UnexpectedException(e);
- }
- }
+ /** {@inheritDoc} */
+ @Override
+ public void updateExtraction(Extraction extraction) throws DataConstraintException {
+ LOG.info("updateExtraction: " + extraction.getRef());
+ try {
+ dao.update(extraction);
+ } catch (DataNotFoundException e) {
+ LOG.error(e.getMessage(), e);
+ throw new UnexpectedException(e);
+ }
+ }
- /** {@inheritDoc} */
- @Override
- public boolean updateOrdeleteExtractionEnabled(Extraction extraction, Utilisateur utilisateur) {
- return utilisateur.getTypeDroit() == TypeDroit.ADMINISTRATEUR
- || utilisateur.getIdPersonne() == extraction.getCreateur().getIdPersonne();
- }
+ /** {@inheritDoc} */
+ @Override
+ public boolean updateOrdeleteExtractionEnabled(Extraction extraction, Utilisateur utilisateur) {
+ return utilisateur.getTypeDroit() == TypeDroit.ADMINISTRATEUR
+ || utilisateur.getIdPersonne() == extraction.getCreateur().getIdPersonne();
+ }
- /** {@inheritDoc} */
- @Override
- public void createMethodeExtraction(MethodeExtraction methode) throws DataConstraintException {
- LOG.info("createMethodeExtraction: " + methode.getNom());
- dao.create(methode);
- }
+ /** {@inheritDoc} */
+ @Override
+ public void createMethodeExtraction(MethodeExtraction methode) throws DataConstraintException {
+ LOG.info("createMethodeExtraction: " + methode.getNom());
+ dao.create(methode);
+ }
- /** {@inheritDoc} */
- @Override
- public void deleteMethodeExtraction(MethodeExtraction methode) throws DataConstraintException {
- AssertTools.assertNotNull(methode);
- LOG.info("deleteMethodeExtraction: " + methode.getNom());
- try {
- dao.delete(methode);
- } catch (DataNotFoundException e) {
- LOG.error(e.getMessage(), e);
- throw new UnexpectedException(e);
- }
+ /** {@inheritDoc} */
+ @Override
+ public void deleteMethodeExtraction(MethodeExtraction methode) throws DataConstraintException {
+ AssertTools.assertNotNull(methode);
+ LOG.info("deleteMethodeExtraction: " + methode.getNom());
+ try {
+ dao.delete(methode);
+ } catch (DataNotFoundException e) {
+ LOG.error(e.getMessage(), e);
+ throw new UnexpectedException(e);
+ }
- }
+ }
- /** {@inheritDoc} */
- @Override
- public List<MethodeExtraction> listMethodesExtraction() {
- return dao.readList(MethodeExtraction.class, "nom");
- }
+ /** {@inheritDoc} */
+ @Override
+ public List<MethodeExtraction> listMethodesExtraction() {
+ return dao.readList(MethodeExtraction.class, "nom");
+ }
- /** {@inheritDoc} */
- @Override
- public MethodeExtraction loadMethodeExtraction(Integer idMethode) throws DataNotFoundException {
- return dao.read(MethodeExtraction.class, idMethode);
- }
+ /** {@inheritDoc} */
+ @Override
+ public MethodeExtraction loadMethodeExtraction(Integer idMethode) throws DataNotFoundException {
+ return dao.read(MethodeExtraction.class, idMethode);
+ }
- /** {@inheritDoc} */
- @Override
- public MethodeExtraction loadMethodeExtraction(String nom) throws DataNotFoundException {
- return dao.read(MethodeExtraction.class, "nom", nom);
- }
+ /** {@inheritDoc} */
+ @Override
+ public MethodeExtraction loadMethodeExtraction(String nom) throws DataNotFoundException {
+ return dao.read(MethodeExtraction.class, "nom", nom);
+ }
- /** {@inheritDoc} */
- @Override
- public void updateMethodeExtraction(MethodeExtraction methode) throws DataConstraintException {
- LOG.info("updateMethodeExtraction: " + methode.getNom());
- try {
- dao.update(methode);
- } catch (DataNotFoundException e) {
- LOG.error(e.getMessage(), e);
- throw new UnexpectedException(e);
- }
+ /** {@inheritDoc} */
+ @Override
+ public void updateMethodeExtraction(MethodeExtraction methode) throws DataConstraintException {
+ LOG.info("updateMethodeExtraction: " + methode.getNom());
+ try {
+ dao.update(methode);
+ } catch (DataNotFoundException e) {
+ LOG.error(e.getMessage(), e);
+ throw new UnexpectedException(e);
+ }
- }
+ }
- /** {@inheritDoc} */
- @Override
- public void refreshMethodeExtraction(MethodeExtraction methode) {
- AssertTools.assertNotNull(methode);
- dao.refresh(methode);
- }
+ /** {@inheritDoc} */
+ @Override
+ public void refreshMethodeExtraction(MethodeExtraction methode) {
+ AssertTools.assertNotNull(methode);
+ dao.refresh(methode);
+ }
- /** {@inheritDoc} */
- @Override
- public boolean isTypeExtraitReferenced(TypeExtrait typeExtrait) {
- AssertTools.assertNotNull(typeExtrait);
- AssertTools.assertNotNull(typeExtrait.getIdTypeExtrait());
- return dao.count(ExtractionDao.getCriteriaCountExtraitOfTypeExtrait(typeExtrait.getIdTypeExtrait())) > 0;
- }
+ /** {@inheritDoc} */
+ @Override
+ public boolean isTypeExtraitReferenced(TypeExtrait typeExtrait) {
+ AssertTools.assertNotNull(typeExtrait);
+ AssertTools.assertNotNull(typeExtrait.getIdTypeExtrait());
+ return dao.count(ExtractionDao.getCriteriaCountExtraitOfTypeExtrait(typeExtrait.getIdTypeExtrait())) > 0;
+ }
- /** {@inheritDoc} */
- @Override
- public boolean isExtraitUnique(Extrait extrait) {
- AssertTools.assertNotNull(extrait);
+ /** {@inheritDoc} */
+ @Override
+ public boolean isExtraitUnique(Extrait extrait) {
+ AssertTools.assertNotNull(extrait);
- // unique if it doesn't exist different value or if it exists with the same id (so same row in the db)
- if (!dao.exists(Extrait.class, "ref", extrait.getRef())) {
- return true;
- }
- Extrait extrWithSameVal;
- try {
- extrWithSameVal = dao.read(Extrait.class, "ref", extrait.getRef());
- dao.evict(extrWithSameVal);
- } catch (DataNotFoundException e) {
- return true; // never call, covers by dao.exists...
- }
- // in case of new record, id is null
- return extrait.getId() != null && extrait.getId().equals(extrWithSameVal.getId());
- }
+ // unique if it doesn't exist different value or if it exists with the same id (so same row in the db)
+ if (!dao.exists(Extrait.class, "ref", extrait.getRef())) {
+ return true;
+ }
+ Extrait extrWithSameVal;
+ try {
+ extrWithSameVal = dao.read(Extrait.class, "ref", extrait.getRef());
+ dao.evict(extrWithSameVal);
+ } catch (DataNotFoundException e) {
+ return true; // never call, covers by dao.exists...
+ }
+ // in case of new record, id is null
+ return extrait.getId() != null && extrait.getId().equals(extrWithSameVal.getId());
+ }
}
\ No newline at end of file
Modified: trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/LotServiceImpl.java
===================================================================
--- trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/LotServiceImpl.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/LotServiceImpl.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -52,169 +52,169 @@
@Service
public final class LotServiceImpl implements LotService {
- /** Logger */
- private static final Log LOG = LogTools.getLog();
+ /** Logger */
+ private static final Log LOG = LogTools.getLog();
- /** DAO */
- @Autowired
- private GenericDao dao;
+ /** DAO */
+ @Autowired
+ private GenericDao dao;
- /** {@inheritDoc} */
- @Override
- public long countLots() {
- return dao.count(Lot.class);
- }
+ /** {@inheritDoc} */
+ @Override
+ public long countLots() {
+ return dao.count(Lot.class);
+ }
- /** {@inheritDoc} */
- @Override
- public void createLot(Lot lot) throws DataConstraintException {
- LOG.info("createLot " + lot.getRef());
- dao.create(lot);
- }
+ /** {@inheritDoc} */
+ @Override
+ public void createLot(Lot lot) throws DataConstraintException {
+ LOG.info("createLot " + lot.getRef());
+ dao.create(lot);
+ }
- /** {@inheritDoc} */
- @Override
- public void createPartie(Partie partie) throws DataConstraintException {
- LOG.info("createPartie: " + partie.getNom());
- dao.create(partie);
- }
+ /** {@inheritDoc} */
+ @Override
+ public void createPartie(Partie partie) throws DataConstraintException {
+ LOG.info("createPartie: " + partie.getNom());
+ dao.create(partie);
+ }
- /** {@inheritDoc} */
- @Override
- public void deleteLot(Lot lot) throws DataConstraintException {
- AssertTools.assertNotNull(lot);
- LOG.info("deleteLot " + lot.getRef());
- try {
- dao.delete(lot);
- } catch (DataNotFoundException e) {
- LOG.error(e.getMessage(), e);
- throw new UnexpectedException(e);
- }
+ /** {@inheritDoc} */
+ @Override
+ public void deleteLot(Lot lot) throws DataConstraintException {
+ AssertTools.assertNotNull(lot);
+ LOG.info("deleteLot " + lot.getRef());
+ try {
+ dao.delete(lot);
+ } catch (DataNotFoundException e) {
+ LOG.error(e.getMessage(), e);
+ throw new UnexpectedException(e);
+ }
- }
+ }
- /** {@inheritDoc} */
- @Override
- public void deletePartie(Partie partie) throws DataConstraintException {
- AssertTools.assertNotNull(partie);
- LOG.info("deletePartie: " + partie.getNom());
- try {
- dao.delete(partie);
- } catch (DataNotFoundException e) {
- LOG.error(e.getMessage(), e);
- throw new UnexpectedException(e);
- }
- }
+ /** {@inheritDoc} */
+ @Override
+ public void deletePartie(Partie partie) throws DataConstraintException {
+ AssertTools.assertNotNull(partie);
+ LOG.info("deletePartie: " + partie.getNom());
+ try {
+ dao.delete(partie);
+ } catch (DataNotFoundException e) {
+ LOG.error(e.getMessage(), e);
+ throw new UnexpectedException(e);
+ }
+ }
- /** {@inheritDoc} */
- @Override
- public List<Lot> listLots(Utilisateur utilisateur) {
- AssertTools.assertNotNull(utilisateur);
- if (utilisateur.getTypeDroit() == TypeDroit.ADMINISTRATEUR) {
- return dao.readList(Lot.class, "ref");
- }
- // gestion des droits en plus pour les utilisateurs
- return new ArrayList<Lot>(listLotsForUser(utilisateur));
- }
+ /** {@inheritDoc} */
+ @Override
+ public List<Lot> listLots(Utilisateur utilisateur) {
+ AssertTools.assertNotNull(utilisateur);
+ if (utilisateur.getTypeDroit() == TypeDroit.ADMINISTRATEUR) {
+ return dao.readList(Lot.class, "ref");
+ }
+ // gestion des droits en plus pour les utilisateurs
+ return new ArrayList<Lot>(listLotsForUser(utilisateur));
+ }
- /** {@inheritDoc} */
- @Override
- public SortedSet<Lot> listLotsForUser(Utilisateur utilisateur) {
- AssertTools.assertNotNull(utilisateur);
- SortedSet<Lot> lots = new TreeSet<Lot>();
- for (Campagne c : utilisateur.getCampagnesCreees()) {
- lots.addAll(c.getLots());
- }
- for (Campagne c : utilisateur.getCampagnesDroits().keySet()) {
- lots.addAll(c.getLots());
- }
- lots.addAll(utilisateur.getLotsCrees());
- lots.addAll(utilisateur.getLotsDroits().keySet());
- return lots;
- }
+ /** {@inheritDoc} */
+ @Override
+ public SortedSet<Lot> listLotsForUser(Utilisateur utilisateur) {
+ AssertTools.assertNotNull(utilisateur);
+ SortedSet<Lot> lots = new TreeSet<Lot>();
+ for (Campagne c : utilisateur.getCampagnesCreees()) {
+ lots.addAll(c.getLots());
+ }
+ for (Campagne c : utilisateur.getCampagnesDroits().keySet()) {
+ lots.addAll(c.getLots());
+ }
+ lots.addAll(utilisateur.getLotsCrees());
+ lots.addAll(utilisateur.getLotsDroits().keySet());
+ return lots;
+ }
- /** {@inheritDoc} */
- @Override
- public boolean updateOrdeleteLotEnabled(Lot lot, Utilisateur utilisateur) {
- return utilisateur.getTypeDroit() == TypeDroit.ADMINISTRATEUR
- || utilisateur.getIdPersonne() == lot.getCreateur().getIdPersonne();
- }
+ /** {@inheritDoc} */
+ @Override
+ public boolean updateOrdeleteLotEnabled(Lot lot, Utilisateur utilisateur) {
+ return utilisateur.getTypeDroit() == TypeDroit.ADMINISTRATEUR
+ || utilisateur.getIdPersonne() == lot.getCreateur().getIdPersonne();
+ }
- /** {@inheritDoc} */
- @Override
- public boolean isLotAccessibleByUser(Lot lot, Utilisateur utilisateur) {
- // si administrateur ou créateur, accès ok
- if (utilisateur.getTypeDroit() == TypeDroit.ADMINISTRATEUR || utilisateur.equals(lot.getCreateur())) {
- return true;
- }
- // accessible si l'utilisateur
- if (utilisateur.getCampagnesCreees().contains(lot.getCampagne())) {
- return true;
- }
- // accessible si l'utilisateur a le droit à la campagne
- if (utilisateur.getCampagnesDroits().containsKey(lot.getCampagne())) {
- return true;
- }
- // accessible si l'utilisateur a le droit au lot
- if (utilisateur.getLotsDroits().containsKey(lot)) {
- return true;
- }
- // pas d'accès sinon
- return false;
- }
+ /** {@inheritDoc} */
+ @Override
+ public boolean isLotAccessibleByUser(Lot lot, Utilisateur utilisateur) {
+ // si administrateur ou créateur, accès ok
+ if (utilisateur.getTypeDroit() == TypeDroit.ADMINISTRATEUR || utilisateur.equals(lot.getCreateur())) {
+ return true;
+ }
+ // accessible si l'utilisateur
+ if (utilisateur.getCampagnesCreees().contains(lot.getCampagne())) {
+ return true;
+ }
+ // accessible si l'utilisateur a le droit à la campagne
+ if (utilisateur.getCampagnesDroits().containsKey(lot.getCampagne())) {
+ return true;
+ }
+ // accessible si l'utilisateur a le droit au lot
+ if (utilisateur.getLotsDroits().containsKey(lot)) {
+ return true;
+ }
+ // pas d'accès sinon
+ return false;
+ }
- /** {@inheritDoc} */
- @Override
- public List<Partie> listParties() {
- return dao.readList(Partie.class, "nom");
- }
+ /** {@inheritDoc} */
+ @Override
+ public List<Partie> listParties() {
+ return dao.readList(Partie.class, "nom");
+ }
- /** {@inheritDoc} */
- @Override
- public Lot loadLot(Integer idLot) throws DataNotFoundException {
- return dao.read(Lot.class, idLot);
- }
+ /** {@inheritDoc} */
+ @Override
+ public Lot loadLot(Integer idLot) throws DataNotFoundException {
+ return dao.read(Lot.class, idLot);
+ }
- /** {@inheritDoc} */
- @Override
- public Lot loadLot(String ref) throws DataNotFoundException {
- AssertTools.assertNotEmpty(ref);
- return dao.read(Lot.class, "ref", ref);
- }
+ /** {@inheritDoc} */
+ @Override
+ public Lot loadLot(String ref) throws DataNotFoundException {
+ AssertTools.assertNotEmpty(ref);
+ return dao.read(Lot.class, "ref", ref);
+ }
- /** {@inheritDoc} */
- @Override
- public Partie loadPartie(Integer idPartie) throws DataNotFoundException {
- return dao.read(Partie.class, idPartie);
- }
+ /** {@inheritDoc} */
+ @Override
+ public Partie loadPartie(Integer idPartie) throws DataNotFoundException {
+ return dao.read(Partie.class, idPartie);
+ }
- /** {@inheritDoc} */
- @Override
- public Partie loadPartie(String nom) throws DataNotFoundException {
- return dao.read(Partie.class, "nom", nom);
- }
+ /** {@inheritDoc} */
+ @Override
+ public Partie loadPartie(String nom) throws DataNotFoundException {
+ return dao.read(Partie.class, "nom", nom);
+ }
- /** {@inheritDoc} */
- @Override
- public void updateLot(Lot lot) throws DataConstraintException {
- LOG.info("updateLot " + lot.getRef());
- try {
- dao.update(lot);
- } catch (DataNotFoundException e) {
- LOG.error(e.getMessage(), e);
- throw new UnexpectedException(e);
- }
- }
+ /** {@inheritDoc} */
+ @Override
+ public void updateLot(Lot lot) throws DataConstraintException {
+ LOG.info("updateLot " + lot.getRef());
+ try {
+ dao.update(lot);
+ } catch (DataNotFoundException e) {
+ LOG.error(e.getMessage(), e);
+ throw new UnexpectedException(e);
+ }
+ }
- /** {@inheritDoc} */
- @Override
- public void updatePartie(Partie partie) throws DataConstraintException {
- LOG.info("updatePartie: " + partie.getNom());
- try {
- dao.update(partie);
- } catch (DataNotFoundException e) {
- LOG.error(e.getMessage(), e);
- throw new UnexpectedException(e);
- }
- }
+ /** {@inheritDoc} */
+ @Override
+ public void updatePartie(Partie partie) throws DataConstraintException {
+ LOG.info("updatePartie: " + partie.getNom());
+ try {
+ dao.update(partie);
+ } catch (DataNotFoundException e) {
+ LOG.error(e.getMessage(), e);
+ throw new UnexpectedException(e);
+ }
+ }
}
Modified: trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/MailServiceImpl.java
===================================================================
--- trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/MailServiceImpl.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/MailServiceImpl.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -48,90 +48,90 @@
@Service
public final class MailServiceImpl implements MailService {
- /** Logger */
- private static final Log LOG = LogTools.getLog();
+ /** Logger */
+ private static final Log LOG = LogTools.getLog();
- /** E-mail message template */
- @Autowired
- private SimpleMailMessage mailMessage;
+ /** E-mail message template */
+ @Autowired
+ private SimpleMailMessage mailMessage;
- /** E-mail sender */
- @Autowired
- private MailSender mailSender;
+ /** E-mail sender */
+ @Autowired
+ private MailSender mailSender;
- /** {@inheritDoc} */
- @Override
- public void sendMail(Collection<Utilisateur> recipients, String subject, String text) throws EmailException {
- sendMail(recipients, subject, text, null);
- }
+ /** {@inheritDoc} */
+ @Override
+ public void sendMail(Collection<Utilisateur> recipients, String subject, String text) throws EmailException {
+ sendMail(recipients, subject, text, null);
+ }
- /** {@inheritDoc} */
- @Override
- public void sendMail(Collection<Utilisateur> recipients, String subject, String text, String replyTo)
- throws EmailException {
- AssertTools.assertCollectionNotNull(recipients);
- String[] courriels = new String[recipients.size()];
- int i = 0;
- for (Utilisateur recipient : recipients) {
- courriels[i++] = recipient.getCourriel();
- }
- sendMail(subject, text, replyTo, courriels);
- }
+ /** {@inheritDoc} */
+ @Override
+ public void sendMail(Collection<Utilisateur> recipients, String subject, String text, String replyTo)
+ throws EmailException {
+ AssertTools.assertCollectionNotNull(recipients);
+ String[] courriels = new String[recipients.size()];
+ int i = 0;
+ for (Utilisateur recipient : recipients) {
+ courriels[i++] = recipient.getCourriel();
+ }
+ sendMail(subject, text, replyTo, courriels);
+ }
- /** {@inheritDoc} */
- @Override
- public void sendMail(Personne recipient, String subject, String text) throws EmailException {
- AssertTools.assertNotNull(recipient);
- sendMail(subject, text, null, recipient.getCourriel());
- }
+ /** {@inheritDoc} */
+ @Override
+ public void sendMail(Personne recipient, String subject, String text) throws EmailException {
+ AssertTools.assertNotNull(recipient);
+ sendMail(subject, text, null, recipient.getCourriel());
+ }
- /**
- * Send an e-mail
- * @param subject Subject
- * @param text Text
- * @param replyTo Reply to
- * @param recipients Recipients
- * @throws EmailException In case of error while sending an e-mail
- */
- private void sendMail(String subject, String text, String replyTo, String... recipients) throws EmailException {
- LOG.info("sendMail " + subject + " [to] " + Arrays.toString(recipients));
- if (ServiceContext.isMailActivated()) {
- AssertTools.assertNotEmpty(subject);
- AssertTools.assertNotEmpty(text);
- AssertTools.assertNotEmpty(recipients);
- AssertTools.assertArrayNotEmpty(recipients);
- // Validate e-mail
- mailMessage.setTo(recipients);
- mailMessage.setSubject(subject);
- mailMessage.setText(text);
- if (!StringUtils.isEmpty(replyTo)) {
- mailMessage.setReplyTo(replyTo);
- }
- try {
- mailSender.send(mailMessage);
- } catch (Exception e) {
- throw new EmailException(e);
- }
- }
- }
+ /**
+ * Send an e-mail
+ * @param subject Subject
+ * @param text Text
+ * @param replyTo Reply to
+ * @param recipients Recipients
+ * @throws EmailException In case of error while sending an e-mail
+ */
+ private void sendMail(String subject, String text, String replyTo, String... recipients) throws EmailException {
+ LOG.info("sendMail " + subject + " [to] " + Arrays.toString(recipients));
+ if (ServiceContext.isMailActivated()) {
+ AssertTools.assertNotEmpty(subject);
+ AssertTools.assertNotEmpty(text);
+ AssertTools.assertNotEmpty(recipients);
+ AssertTools.assertArrayNotEmpty(recipients);
+ // Validate e-mail
+ mailMessage.setTo(recipients);
+ mailMessage.setSubject(subject);
+ mailMessage.setText(text);
+ if (!StringUtils.isEmpty(replyTo)) {
+ mailMessage.setReplyTo(replyTo);
+ }
+ try {
+ mailSender.send(mailMessage);
+ } catch (Exception e) {
+ throw new EmailException(e);
+ }
+ }
+ }
- /** {@inheritDoc} */
- @Override
- public void sendMailQuietly(Collection<Utilisateur> recipients, String subject, String text) {
- try {
- sendMail(recipients, subject, text);
- } catch (EmailException e) {
- LOG.warn(e.toString());
- }
- }
+ /** {@inheritDoc} */
+ @Override
+ public void sendMailQuietly(Collection<Utilisateur> recipients, String subject, String text) {
+ try {
+ sendMail(recipients, subject, text);
+ } catch (EmailException e) {
+ LOG.warn(e.toString());
+ }
+ }
- /** {@inheritDoc} */
- @Override
- public void sendMailQuietly(Personne recipient, String subject, String text) {
- try {
- sendMail(recipient, subject, text);
- } catch (EmailException e) {
- LOG.warn(e.toString());
- }
- }
+ /** {@inheritDoc} */
+ @Override
+ public void sendMailQuietly(Personne recipient, String subject, String text) {
+ try {
+ sendMail(recipient, subject, text);
+ } catch (EmailException e) {
+ LOG.warn(e.toString());
+ }
+ }
}
\ No newline at end of file
Modified: trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/MoleculeServiceImpl.java
===================================================================
--- trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/MoleculeServiceImpl.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/MoleculeServiceImpl.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -49,12 +49,12 @@
@Service
public final class MoleculeServiceImpl implements MoleculeService {
- /** Logger */
- private static final Log LOG = LogTools.getLog();
+ /** Logger */
+ private static final Log LOG = LogTools.getLog();
- /** DAO */
- @Autowired
- private GenericDao dao;
+ /** DAO */
+ @Autowired
+ private GenericDao dao;
@Override
public long countMolecules() {
Modified: trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/PersonneServiceImpl.java
===================================================================
--- trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/PersonneServiceImpl.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/PersonneServiceImpl.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -62,378 +62,378 @@
@Service
public final class PersonneServiceImpl implements PersonneService {
- /** Logger */
- private static final Log LOG = LogTools.getLog();
+ /** Logger */
+ private static final Log LOG = LogTools.getLog();
- /** Accès aux données */
- @Autowired
- private GenericDao dao;
+ /** Accès aux données */
+ @Autowired
+ private GenericDao dao;
- /** Administrateur par défaut */
- @Autowired
- private Utilisateur defaultAdmin;
+ /** Administrateur par défaut */
+ @Autowired
+ private Utilisateur defaultAdmin;
- /** Mail service */
- @Autowired
- private MailService mailService;
+ /** Mail service */
+ @Autowired
+ private MailService mailService;
- /** Messages d'internationalisation */
- @Resource(name = "serviceMessageSource")
- private MessageSourceAccessor messages;
+ /** Messages d'internationalisation */
+ @Resource(name = "serviceMessageSource")
+ private MessageSourceAccessor messages;
- /** {@inheritDoc} */
- @Override
- public void checkOrCreateAdmin() throws DataConstraintException {
- if (countAdmins() == 0L) {
- defaultAdmin.setTypeDroit(TypeDroit.ADMINISTRATEUR);
- defaultAdmin.setValide(Boolean.TRUE);
- plainCreateUtilisateur(defaultAdmin);
- }
- }
+ /** {@inheritDoc} */
+ @Override
+ public void checkOrCreateAdmin() throws DataConstraintException {
+ if (countAdmins() == 0L) {
+ defaultAdmin.setTypeDroit(TypeDroit.ADMINISTRATEUR);
+ defaultAdmin.setValide(Boolean.TRUE);
+ plainCreateUtilisateur(defaultAdmin);
+ }
+ }
- /**
- * Compte le nombre d'administrateurs
- * @return Nombre d'administrateurs
- */
- private Long countAdmins() {
- return dao.count(PersonneDao.CRITERIA_COUNT_ADMINS);
- }
+ /**
+ * Compte le nombre d'administrateurs
+ * @return Nombre d'administrateurs
+ */
+ private Long countAdmins() {
+ return dao.count(PersonneDao.CRITERIA_COUNT_ADMINS);
+ }
- /** {@inheritDoc} */
- @Override
- public long countPersonnes() {
- return dao.count(Personne.class);
- }
+ /** {@inheritDoc} */
+ @Override
+ public long countPersonnes() {
+ return dao.count(Personne.class);
+ }
- /** {@inheritDoc} */
- @Override
- public void createPersonne(Personne personne) throws DataConstraintException {
- LOG.info("createPersonne " + personne.getCourriel());
- try {
- dao.create(personne);
- } catch (DataIntegrityViolationException e) {
- throw new DataConstraintException(e);
- }
- }
+ /** {@inheritDoc} */
+ @Override
+ public void createPersonne(Personne personne) throws DataConstraintException {
+ LOG.info("createPersonne " + personne.getCourriel());
+ try {
+ dao.create(personne);
+ } catch (DataIntegrityViolationException e) {
+ throw new DataConstraintException(e);
+ }
+ }
- /** {@inheritDoc} */
- @Override
- public void createUtilisateur(Utilisateur utilisateur) throws DataConstraintException {
- try {
- plainCreateUtilisateur(utilisateur);
- } catch (DataIntegrityViolationException e) {
- throw new DataConstraintException(e);
- }
- mailService.sendMailQuietly(utilisateur, messages.getMessage("register.subject"),
- messages.getMessage("register.text"));
- mailService.sendMailQuietly(
- listAdmins(),
- messages.getMessage("register.subject.admin"),
- messages.getMessage("register.text.admin", new Object[] { utilisateur.getPrenom(),
- utilisateur.getNom(), utilisateur.getCourriel() }));
- }
+ /** {@inheritDoc} */
+ @Override
+ public void createUtilisateur(Utilisateur utilisateur) throws DataConstraintException {
+ try {
+ plainCreateUtilisateur(utilisateur);
+ } catch (DataIntegrityViolationException e) {
+ throw new DataConstraintException(e);
+ }
+ mailService.sendMailQuietly(utilisateur, messages.getMessage("register.subject"),
+ messages.getMessage("register.text"));
+ mailService.sendMailQuietly(
+ listAdmins(),
+ messages.getMessage("register.subject.admin"),
+ messages.getMessage("register.text.admin", new Object[] { utilisateur.getPrenom(),
+ utilisateur.getNom(), utilisateur.getCourriel() }));
+ }
- /** {@inheritDoc} */
- @Override
- public void deletePersonne(Personne personne) throws DataConstraintException {
- AssertTools.assertNotNull(personne);
- LOG.info("deletePersonne " + personne.getIdPersonne());
- AssertTools.assertNotNull(personne.getIdPersonne());
- try {
- dao.delete(personne);
- } catch (DataNotFoundException e) {
- LOG.error(e.getMessage(), e);
- throw new UnexpectedException(e);
- }
- }
+ /** {@inheritDoc} */
+ @Override
+ public void deletePersonne(Personne personne) throws DataConstraintException {
+ AssertTools.assertNotNull(personne);
+ LOG.info("deletePersonne " + personne.getIdPersonne());
+ AssertTools.assertNotNull(personne.getIdPersonne());
+ try {
+ dao.delete(personne);
+ } catch (DataNotFoundException e) {
+ LOG.error(e.getMessage(), e);
+ throw new UnexpectedException(e);
+ }
+ }
- /** {@inheritDoc} */
- @Override
- public void deleteUtilisateur(Utilisateur utilisateur) throws DataConstraintException, EmailException {
- deleteUtilisateur(utilisateur, messages.getMessage("delete.subject"), messages.getMessage("delete.text"));
- }
+ /** {@inheritDoc} */
+ @Override
+ public void deleteUtilisateur(Utilisateur utilisateur) throws DataConstraintException, EmailException {
+ deleteUtilisateur(utilisateur, messages.getMessage("delete.subject"), messages.getMessage("delete.text"));
+ }
- /**
- * @param utilisateur
- * @param mailSubject
- * @param mailText
- * @throws EmailException
- * @throws DataConstraintException
- */
- /**
- * Supprime un utilisateur, ou le transforme en personne s'il a des données liées, et lui envoie un e-mail
- * @param utilisateur Utilisateur
- * @param mailSubject E-mail subject
- * @param mailText E-mail text
- * @throws EmailException En cas d'erreur lors de l'envoi de mail
- * @throws DataConstraintException Si l'utilisateur est encore référencé (créateur d'entités)
- */
- @Transactional(rollbackFor = EmailException.class)
- public void deleteUtilisateur(Utilisateur utilisateur, String mailSubject, String mailText) throws EmailException,
- DataConstraintException {
- AssertTools.assertNotNull(utilisateur);
- LOG.info("deleteUtilisateur " + utilisateur.getIdPersonne());
- AssertTools.assertNotNull(utilisateur.getIdPersonne());
- try {
- dao.delete(utilisateur);
- } catch (DataConstraintException e) {
- dao.execute(PersonneDao.SQL_DELETE_UTILISATEUR, utilisateur.getIdPersonne());
- } catch (DataNotFoundException e) {
- LOG.error(e.getMessage(), e);
- throw new UnexpectedException(e);
- }
- mailService.sendMail(utilisateur, mailSubject, mailText);
- }
+ /**
+ * @param utilisateur
+ * @param mailSubject
+ * @param mailText
+ * @throws EmailException
+ * @throws DataConstraintException
+ */
+ /**
+ * Supprime un utilisateur, ou le transforme en personne s'il a des données liées, et lui envoie un e-mail
+ * @param utilisateur Utilisateur
+ * @param mailSubject E-mail subject
+ * @param mailText E-mail text
+ * @throws EmailException En cas d'erreur lors de l'envoi de mail
+ * @throws DataConstraintException Si l'utilisateur est encore référencé (créateur d'entités)
+ */
+ @Transactional(rollbackFor = EmailException.class)
+ public void deleteUtilisateur(Utilisateur utilisateur, String mailSubject, String mailText) throws EmailException,
+ DataConstraintException {
+ AssertTools.assertNotNull(utilisateur);
+ LOG.info("deleteUtilisateur " + utilisateur.getIdPersonne());
+ AssertTools.assertNotNull(utilisateur.getIdPersonne());
+ try {
+ dao.delete(utilisateur);
+ } catch (DataConstraintException e) {
+ dao.execute(PersonneDao.SQL_DELETE_UTILISATEUR, utilisateur.getIdPersonne());
+ } catch (DataNotFoundException e) {
+ LOG.error(e.getMessage(), e);
+ throw new UnexpectedException(e);
+ }
+ mailService.sendMail(utilisateur, mailSubject, mailText);
+ }
- /** {@inheritDoc} */
- @Override
- public String hashPassword(String password) {
- AssertTools.assertNotEmpty(password);
- return PasswordTools.sha1(password);
- }
+ /** {@inheritDoc} */
+ @Override
+ public String hashPassword(String password) {
+ AssertTools.assertNotEmpty(password);
+ return PasswordTools.sha1(password);
+ }
- /**
- * Liste les administrateurs
- * @return Administrateurs
- */
- @SuppressWarnings("unchecked")
- private List<Utilisateur> listAdmins() {
- return (List<Utilisateur>) dao.list(PersonneDao.CRITERIA_LIST_ADMINS);
- }
+ /**
+ * Liste les administrateurs
+ * @return Administrateurs
+ */
+ @SuppressWarnings("unchecked")
+ private List<Utilisateur> listAdmins() {
+ return (List<Utilisateur>) dao.list(PersonneDao.CRITERIA_LIST_ADMINS);
+ }
- /** {@inheritDoc} */
- @Override
- public List<Personne> listPersonnes() {
- List<Personne> allPersonnes = dao.readList(Personne.class, "nom", "prenom");
- allPersonnes.removeAll(listUtilisateursInvalid());
- return allPersonnes;
- }
+ /** {@inheritDoc} */
+ @Override
+ public List<Personne> listPersonnes() {
+ List<Personne> allPersonnes = dao.readList(Personne.class, "nom", "prenom");
+ allPersonnes.removeAll(listUtilisateursInvalid());
+ return allPersonnes;
+ }
- /** {@inheritDoc} */
- @Override
- public List<Personne> listPersonnesWithInvalidUsers() {
- return dao.readList(Personne.class, new String[] { "nom", "prenom" });
- }
+ /** {@inheritDoc} */
+ @Override
+ public List<Personne> listPersonnesWithInvalidUsers() {
+ return dao.readList(Personne.class, new String[] { "nom", "prenom" });
+ }
- /** {@inheritDoc} */
- @SuppressWarnings("unchecked")
- @Override
- public List<String> listPersonneOrganismes() {
- return (List<String>) dao.list(PersonneDao.CRITERIA_DISTINCT_PERSONNE_ORGANISMES);
- }
+ /** {@inheritDoc} */
+ @SuppressWarnings("unchecked")
+ @Override
+ public List<String> listPersonneOrganismes() {
+ return (List<String>) dao.list(PersonneDao.CRITERIA_DISTINCT_PERSONNE_ORGANISMES);
+ }
- /** {@inheritDoc} */
- @SuppressWarnings("unchecked")
- @Override
- public List<Utilisateur> listUtilisateursInvalid() {
- return (List<Utilisateur>) dao.list(PersonneDao.CRITERIA_LIST_UTILISATEURS_INVALID);
- }
+ /** {@inheritDoc} */
+ @SuppressWarnings("unchecked")
+ @Override
+ public List<Utilisateur> listUtilisateursInvalid() {
+ return (List<Utilisateur>) dao.list(PersonneDao.CRITERIA_LIST_UTILISATEURS_INVALID);
+ }
- /** {@inheritDoc} */
- @SuppressWarnings("unchecked")
- @Override
- public List<Utilisateur> listUtilisateursValid() {
- return (List<Utilisateur>) dao.list(PersonneDao.CRITERIA_LIST_UTILISATEURS_VALID);
- }
+ /** {@inheritDoc} */
+ @SuppressWarnings("unchecked")
+ @Override
+ public List<Utilisateur> listUtilisateursValid() {
+ return (List<Utilisateur>) dao.list(PersonneDao.CRITERIA_LIST_UTILISATEURS_VALID);
+ }
- /** {@inheritDoc} */
- @Override
- public Personne loadPersonne(Integer idPersonne) throws DataNotFoundException {
- AssertTools.assertNotNull(idPersonne);
- try {
- return dao.read(Personne.class, idPersonne);
- } catch (DataRetrievalFailureException e) {
- throw new DataNotFoundException(e);
- }
- }
+ /** {@inheritDoc} */
+ @Override
+ public Personne loadPersonne(Integer idPersonne) throws DataNotFoundException {
+ AssertTools.assertNotNull(idPersonne);
+ try {
+ return dao.read(Personne.class, idPersonne);
+ } catch (DataRetrievalFailureException e) {
+ throw new DataNotFoundException(e);
+ }
+ }
- /** {@inheritDoc} */
- @Override
- public Personne loadPersonne(String courriel) throws DataNotFoundException {
- AssertTools.assertNotNull(courriel);
- return dao.read(Personne.class, "courriel", courriel);
- }
+ /** {@inheritDoc} */
+ @Override
+ public Personne loadPersonne(String courriel) throws DataNotFoundException {
+ AssertTools.assertNotNull(courriel);
+ return dao.read(Personne.class, "courriel", courriel);
+ }
- /** {@inheritDoc} */
- @Override
- public Utilisateur loadUtilisateur(Integer idPersonne) throws DataNotFoundException {
- AssertTools.assertNotNull(idPersonne);
- try {
- return dao.read(Utilisateur.class, idPersonne);
- } catch (DataRetrievalFailureException e) {
- throw new DataNotFoundException(e);
- }
- }
+ /** {@inheritDoc} */
+ @Override
+ public Utilisateur loadUtilisateur(Integer idPersonne) throws DataNotFoundException {
+ AssertTools.assertNotNull(idPersonne);
+ try {
+ return dao.read(Utilisateur.class, idPersonne);
+ } catch (DataRetrievalFailureException e) {
+ throw new DataNotFoundException(e);
+ }
+ }
- /** {@inheritDoc} */
- @Override
- public Utilisateur loadUtilisateur(String courriel) throws DataNotFoundException {
- AssertTools.assertNotEmpty(courriel);
- Personne personne = loadPersonne(courriel);
- if (!(personne instanceof Utilisateur)) {
- throw new DataNotFoundException(new ObjectRetrievalFailureException(Utilisateur.class, courriel));
- }
- return (Utilisateur) personne;
- }
+ /** {@inheritDoc} */
+ @Override
+ public Utilisateur loadUtilisateur(String courriel) throws DataNotFoundException {
+ AssertTools.assertNotEmpty(courriel);
+ Personne personne = loadPersonne(courriel);
+ if (!(personne instanceof Utilisateur)) {
+ throw new DataNotFoundException(new ObjectRetrievalFailureException(Utilisateur.class, courriel));
+ }
+ return (Utilisateur) personne;
+ }
- /** {@inheritDoc} */
- @Override
- public boolean authenticateUtilisateur((a)Normalize(EmailNormalizer.class) String courriel, String passwordHash) {
- AssertTools.assertNotEmpty(courriel);
- AssertTools.assertNotEmpty(passwordHash);
- return dao.exists(PersonneDao.getCriteriaAuthenticateUser(courriel, passwordHash));
- }
+ /** {@inheritDoc} */
+ @Override
+ public boolean authenticateUtilisateur((a)Normalize(EmailNormalizer.class) String courriel, String passwordHash) {
+ AssertTools.assertNotEmpty(courriel);
+ AssertTools.assertNotEmpty(passwordHash);
+ return dao.exists(PersonneDao.getCriteriaAuthenticateUser(courriel, passwordHash));
+ }
- /**
- * Enregistre un utilisateur de façon brute (pas de conversion d'exceptions, ni d'envoi d'e-mail)
- * @param utilisateur Utilisateur
- * @throws DataConstraintException Si l'utilisateur existe déjà
- */
- private void plainCreateUtilisateur(Utilisateur utilisateur) throws DataConstraintException {
- AssertTools.assertNotNull(utilisateur);
- LOG.info("createUtilisateur " + utilisateur.getCourriel());
- if (utilisateur.getTypeDroit() == null) {
- utilisateur.setTypeDroit(TypeDroit.UTILISATEUR);
- }
- if (utilisateur.isValide() == null) {
- utilisateur.setValide(Boolean.FALSE);
- }
- dao.create(utilisateur);
- }
+ /**
+ * Enregistre un utilisateur de façon brute (pas de conversion d'exceptions, ni d'envoi d'e-mail)
+ * @param utilisateur Utilisateur
+ * @throws DataConstraintException Si l'utilisateur existe déjà
+ */
+ private void plainCreateUtilisateur(Utilisateur utilisateur) throws DataConstraintException {
+ AssertTools.assertNotNull(utilisateur);
+ LOG.info("createUtilisateur " + utilisateur.getCourriel());
+ if (utilisateur.getTypeDroit() == null) {
+ utilisateur.setTypeDroit(TypeDroit.UTILISATEUR);
+ }
+ if (utilisateur.isValide() == null) {
+ utilisateur.setValide(Boolean.FALSE);
+ }
+ dao.create(utilisateur);
+ }
- /** {@inheritDoc} */
- @Override
- public void refreshPersonne(Personne personne) {
- AssertTools.assertNotNull(personne);
- dao.refresh(personne);
- }
+ /** {@inheritDoc} */
+ @Override
+ public void refreshPersonne(Personne personne) {
+ AssertTools.assertNotNull(personne);
+ dao.refresh(personne);
+ }
- /**
- * {@inheritDoc}
- */
- @Override
- public void rejectUtilisateur(Utilisateur utilisateur) throws NoSuchMessageException {
- try {
- deleteUtilisateur(utilisateur, messages.getMessage("reject.subject"), messages.getMessage("reject.text"));
- } catch (EmailException e) {
- // Quiet
- } catch (DataConstraintException e) {
- LOG.error(e.getMessage());
- // cas impossible normalement car un utilisateur non validé ne peut avoir créé des entités
- }
- }
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void rejectUtilisateur(Utilisateur utilisateur) throws NoSuchMessageException {
+ try {
+ deleteUtilisateur(utilisateur, messages.getMessage("reject.subject"), messages.getMessage("reject.text"));
+ } catch (EmailException e) {
+ // Quiet
+ } catch (DataConstraintException e) {
+ LOG.error(e.getMessage());
+ // cas impossible normalement car un utilisateur non validé ne peut avoir créé des entités
+ }
+ }
- /** {@inheritDoc} */
- @Override
- @Transactional(rollbackFor = { DataNotFoundException.class, EmailException.class })
- public void resetPasswordUtilisateur(String courriel) throws DataNotFoundException, EmailException {
- LOG.info("reListPasswordUtilisateur " + courriel);
- Utilisateur utilisateur;
- try {
- utilisateur = loadUtilisateur(courriel);
- } catch (DataNotFoundException e) {
- LOG.warn("Unknown e-mail: " + courriel);
- throw e;
- }
+ /** {@inheritDoc} */
+ @Override
+ @Transactional(rollbackFor = { DataNotFoundException.class, EmailException.class })
+ public void resetPasswordUtilisateur(String courriel) throws DataNotFoundException, EmailException {
+ LOG.info("reListPasswordUtilisateur " + courriel);
+ Utilisateur utilisateur;
+ try {
+ utilisateur = loadUtilisateur(courriel);
+ } catch (DataNotFoundException e) {
+ LOG.warn("Unknown e-mail: " + courriel);
+ throw e;
+ }
- String newPassword = PasswordTools.random();
- utilisateur.setPasswordHash(hashPassword(newPassword));
- try {
- dao.update(utilisateur);
- } catch (DataConstraintException e) {
- LOG.error(e.getMessage(), e);
- throw new UnexpectedException(e);
- }
- mailService.sendMail(utilisateur, messages.getMessage("updatePassword.subject"),
- messages.getMessage("updatePassword.text", new Object[] { newPassword }));
- }
+ String newPassword = PasswordTools.random();
+ utilisateur.setPasswordHash(hashPassword(newPassword));
+ try {
+ dao.update(utilisateur);
+ } catch (DataConstraintException e) {
+ LOG.error(e.getMessage(), e);
+ throw new UnexpectedException(e);
+ }
+ mailService.sendMail(utilisateur, messages.getMessage("updatePassword.subject"),
+ messages.getMessage("updatePassword.text", new Object[] { newPassword }));
+ }
- /** {@inheritDoc} */
- @Override
- public void sendMailAdmins(String subject, String message, String replyTo) throws EmailException {
- LOG.info("sendMailAdmins " + subject + " [reply to] " + replyTo);
- mailService.sendMail(listAdmins(), messages.getMessage("contact.subject", new String[] { subject }),
- messages.getMessage("contact.body", new String[] { replyTo, message }), replyTo);
- }
+ /** {@inheritDoc} */
+ @Override
+ public void sendMailAdmins(String subject, String message, String replyTo) throws EmailException {
+ LOG.info("sendMailAdmins " + subject + " [reply to] " + replyTo);
+ mailService.sendMail(listAdmins(), messages.getMessage("contact.subject", new String[] { subject }),
+ messages.getMessage("contact.body", new String[] { replyTo, message }), replyTo);
+ }
- /** {@inheritDoc} */
- @Override
- @Transactional(rollbackFor = { EmailException.class, DataAccessException.class, UnexpectedException.class })
- public Utilisateur updateAndCreateUtilisateur(Personne personne) throws EmailException, DataConstraintException {
- LOG.info("updateAndCreateUtilisateur " + personne.getIdPersonne());
- String password = PasswordTools.random();
- try {
- dao.update(personne);
- } catch (DataNotFoundException e) {
- LOG.error(e.getMessage(), e);
- throw new UnexpectedException(e);
- }
- dao.execute(PersonneDao.SQL_CREATE_UTILISATEUR_FROM_PERSONNE, Boolean.TRUE, hashPassword(password),
- TypeDroit.UTILISATEUR.ordinal(), personne.getIdPersonne());
- Utilisateur utilisateur;
- try {
- utilisateur = dao.read(Utilisateur.class, personne.getIdPersonne());
- } catch (DataNotFoundException e) {
- LOG.error(e.getMessage(), e);
- throw new UnexpectedException(e);
- }
- mailService.sendMail(utilisateur, messages.getMessage("create.subject"),
- messages.getMessage("create.text", new Object[] { password }));
- return utilisateur;
- }
+ /** {@inheritDoc} */
+ @Override
+ @Transactional(rollbackFor = { EmailException.class, DataAccessException.class, UnexpectedException.class })
+ public Utilisateur updateAndCreateUtilisateur(Personne personne) throws EmailException, DataConstraintException {
+ LOG.info("updateAndCreateUtilisateur " + personne.getIdPersonne());
+ String password = PasswordTools.random();
+ try {
+ dao.update(personne);
+ } catch (DataNotFoundException e) {
+ LOG.error(e.getMessage(), e);
+ throw new UnexpectedException(e);
+ }
+ dao.execute(PersonneDao.SQL_CREATE_UTILISATEUR_FROM_PERSONNE, Boolean.TRUE, hashPassword(password),
+ TypeDroit.UTILISATEUR.ordinal(), personne.getIdPersonne());
+ Utilisateur utilisateur;
+ try {
+ utilisateur = dao.read(Utilisateur.class, personne.getIdPersonne());
+ } catch (DataNotFoundException e) {
+ LOG.error(e.getMessage(), e);
+ throw new UnexpectedException(e);
+ }
+ mailService.sendMail(utilisateur, messages.getMessage("create.subject"),
+ messages.getMessage("create.text", new Object[] { password }));
+ return utilisateur;
+ }
- /** {@inheritDoc} */
- @Override
- public void updatePersonne(Personne personne) throws DataConstraintException {
- LOG.info("updatePersonne " + personne.getIdPersonne());
- try {
- dao.update(personne);
- } catch (DataNotFoundException e) {
- LOG.error(e.getMessage(), e);
- throw new UnexpectedException(e);
- }
- }
+ /** {@inheritDoc} */
+ @Override
+ public void updatePersonne(Personne personne) throws DataConstraintException {
+ LOG.info("updatePersonne " + personne.getIdPersonne());
+ try {
+ dao.update(personne);
+ } catch (DataNotFoundException e) {
+ LOG.error(e.getMessage(), e);
+ throw new UnexpectedException(e);
+ }
+ }
- /**
- * Met à jour un utilisateur
- * @param utilisateur Utilisateur
- * @throws DataConstraintException Si l'utilisateur existe déjà (champs uniques)
- */
- private void updateUtilisateur(Utilisateur utilisateur) throws DataConstraintException {
- AssertTools.assertNotNull(utilisateur);
- LOG.info("updateUtilisateur " + utilisateur.getCourriel());
- try {
- dao.update(utilisateur);
- } catch (DataNotFoundException e) {
- LOG.error(e.getMessage(), e);
- throw new UnexpectedException(e);
- }
- }
+ /**
+ * Met à jour un utilisateur
+ * @param utilisateur Utilisateur
+ * @throws DataConstraintException Si l'utilisateur existe déjà (champs uniques)
+ */
+ private void updateUtilisateur(Utilisateur utilisateur) throws DataConstraintException {
+ AssertTools.assertNotNull(utilisateur);
+ LOG.info("updateUtilisateur " + utilisateur.getCourriel());
+ try {
+ dao.update(utilisateur);
+ } catch (DataNotFoundException e) {
+ LOG.error(e.getMessage(), e);
+ throw new UnexpectedException(e);
+ }
+ }
- /** {@inheritDoc} */
- @Override
- public void updateUtilisateur(Utilisateur utilisateur, boolean admin) throws DataConstraintException {
- updateUtilisateur(utilisateur);
- if (admin) {
- mailService.sendMailQuietly(utilisateur, messages.getMessage("update.subject"),
- messages.getMessage("update.text"));
- }
- }
+ /** {@inheritDoc} */
+ @Override
+ public void updateUtilisateur(Utilisateur utilisateur, boolean admin) throws DataConstraintException {
+ updateUtilisateur(utilisateur);
+ if (admin) {
+ mailService.sendMailQuietly(utilisateur, messages.getMessage("update.subject"),
+ messages.getMessage("update.text"));
+ }
+ }
- /** {@inheritDoc} */
- @Override
- public void validAndUpdateUtilisateur(Utilisateur utilisateur) throws DataConstraintException {
- utilisateur.setValide(true);
- updateUtilisateur(utilisateur);
- mailService.sendMailQuietly(utilisateur, messages.getMessage("valid.subject"),
- messages.getMessage("valid.text"));
- }
+ /** {@inheritDoc} */
+ @Override
+ public void validAndUpdateUtilisateur(Utilisateur utilisateur) throws DataConstraintException {
+ utilisateur.setValide(true);
+ updateUtilisateur(utilisateur);
+ mailService.sendMailQuietly(utilisateur, messages.getMessage("valid.subject"),
+ messages.getMessage("valid.text"));
+ }
- /** {@inheritDoc} */
- @Override
- public boolean updateOrDeletePersonneEnabled(Personne personne, Utilisateur modifieur) {
- AssertTools.assertNotNull(personne);
- AssertTools.assertNotNull(modifieur);
- return !(personne instanceof Utilisateur) || modifieur.getTypeDroit() == TypeDroit.ADMINISTRATEUR;
- }
+ /** {@inheritDoc} */
+ @Override
+ public boolean updateOrDeletePersonneEnabled(Personne personne, Utilisateur modifieur) {
+ AssertTools.assertNotNull(personne);
+ AssertTools.assertNotNull(modifieur);
+ return !(personne instanceof Utilisateur) || modifieur.getTypeDroit() == TypeDroit.ADMINISTRATEUR;
+ }
}
\ No newline at end of file
Modified: trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/ProduitServiceImpl.java
===================================================================
--- trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/ProduitServiceImpl.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/ProduitServiceImpl.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -52,77 +52,77 @@
@Service
public final class ProduitServiceImpl implements ProduitService {
- /** Logger */
- // private static final Log LOG = LogTools.getLog();
- /** DAO */
- @Autowired
- private GenericDao dao;
+ /** Logger */
+ // private static final Log LOG = LogTools.getLog();
+ /** DAO */
+ @Autowired
+ private GenericDao dao;
- /** Service pour les extractions **/
- @Autowired
- private ExtractionService extractionService;
+ /** Service pour les extractions **/
+ @Autowired
+ private ExtractionService extractionService;
- /** Service pour les purifications **/
- @Autowired
- private PurificationService purificationService;
+ /** Service pour les purifications **/
+ @Autowired
+ private PurificationService purificationService;
- /** {@inheritDoc} */
- @Override
- public List<Produit> listProduits(Utilisateur utilisateur) {
- AssertTools.assertNotNull(utilisateur);
+ /** {@inheritDoc} */
+ @Override
+ public List<Produit> listProduits(Utilisateur utilisateur) {
+ AssertTools.assertNotNull(utilisateur);
- if (utilisateur.getTypeDroit() == TypeDroit.ADMINISTRATEUR) {
- SortedSet<Produit> produits = new TreeSet<Produit>();
- produits.addAll(dao.readList(Extrait.class, "ref"));
- produits.addAll(dao.readList(Fraction.class, "ref"));
- return new ArrayList<Produit>(produits);
- }
- // gestion des droits en plus pour les utilisateurs
- return new ArrayList<Produit>(listProduitsForUser(utilisateur));
- }
+ if (utilisateur.getTypeDroit() == TypeDroit.ADMINISTRATEUR) {
+ SortedSet<Produit> produits = new TreeSet<Produit>();
+ produits.addAll(dao.readList(Extrait.class, "ref"));
+ produits.addAll(dao.readList(Fraction.class, "ref"));
+ return new ArrayList<Produit>(produits);
+ }
+ // gestion des droits en plus pour les utilisateurs
+ return new ArrayList<Produit>(listProduitsForUser(utilisateur));
+ }
- /** {@inheritDoc} */
- @Override
- public SortedSet<Produit> listProduitsForUser(Utilisateur utilisateur) {
- AssertTools.assertNotNull(utilisateur);
- SortedSet<Produit> produits = new TreeSet<Produit>();
+ /** {@inheritDoc} */
+ @Override
+ public SortedSet<Produit> listProduitsForUser(Utilisateur utilisateur) {
+ AssertTools.assertNotNull(utilisateur);
+ SortedSet<Produit> produits = new TreeSet<Produit>();
- for (Extraction curExtraction : extractionService.listExtractionsForUser(utilisateur)) {
- produits.addAll(curExtraction.getExtraits());
- }
- for (Purification curPurification : purificationService.listPurificationsForUser(utilisateur)) {
- produits.addAll(curPurification.getFractions());
- }
+ for (Extraction curExtraction : extractionService.listExtractionsForUser(utilisateur)) {
+ produits.addAll(curExtraction.getExtraits());
+ }
+ for (Purification curPurification : purificationService.listPurificationsForUser(utilisateur)) {
+ produits.addAll(curPurification.getFractions());
+ }
- return produits;
- }
+ return produits;
+ }
- /** {@inheritDoc} */
- @Override
- public List<Produit> listProduitsWithoutChildrenOfPuri(Utilisateur utilisateur, Purification purification) {
- AssertTools.assertNotNull(utilisateur);
- AssertTools.assertNotNull(purification);
+ /** {@inheritDoc} */
+ @Override
+ public List<Produit> listProduitsWithoutChildrenOfPuri(Utilisateur utilisateur, Purification purification) {
+ AssertTools.assertNotNull(utilisateur);
+ AssertTools.assertNotNull(purification);
- List<Produit> produits = listProduits(utilisateur);
+ List<Produit> produits = listProduits(utilisateur);
- // version itérative (dérécursification)
- LinkedList<Fraction> fractionsQueue = new LinkedList<Fraction>(purification.getFractions());
- while (!fractionsQueue.isEmpty()) {
- Fraction curFraction = fractionsQueue.remove();
- produits.remove(curFraction);
- // LOG.debug("-removeFraction : " + curFraction);
+ // version itérative (dérécursification)
+ LinkedList<Fraction> fractionsQueue = new LinkedList<Fraction>(purification.getFractions());
+ while (!fractionsQueue.isEmpty()) {
+ Fraction curFraction = fractionsQueue.remove();
+ produits.remove(curFraction);
+ // LOG.debug("-removeFraction : " + curFraction);
- for (Purification curPuriFromFraction : curFraction.getPurificationsSuivantes()) {
- fractionsQueue.addAll(curPuriFromFraction.getFractions());
- }
- }
- return produits;
- }
+ for (Purification curPuriFromFraction : curFraction.getPurificationsSuivantes()) {
+ fractionsQueue.addAll(curPuriFromFraction.getFractions());
+ }
+ }
+ return produits;
+ }
- /** {@inheritDoc} */
- @Override
- public boolean isProduitReferenced(Produit produit) {
- return dao.count(ProduitDao.getCriteriaCountPurifFromProduit(produit.getRef())) > 0
- && dao.count(ProduitDao.getCriteriaCountTestBioFromProduit(produit.getRef())) > 0;
- }
+ /** {@inheritDoc} */
+ @Override
+ public boolean isProduitReferenced(Produit produit) {
+ return dao.count(ProduitDao.getCriteriaCountPurifFromProduit(produit.getRef())) > 0
+ && dao.count(ProduitDao.getCriteriaCountTestBioFromProduit(produit.getRef())) > 0;
+ }
}
Modified: trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/PurificationServiceImpl.java
===================================================================
--- trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/PurificationServiceImpl.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/PurificationServiceImpl.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -59,258 +59,258 @@
@Service
public final class PurificationServiceImpl implements PurificationService {
- /** Logger */
- private static final Log LOG = LogTools.getLog();
+ /** Logger */
+ private static final Log LOG = LogTools.getLog();
- /** DAO */
- @Autowired
- private GenericDao dao;
+ /** DAO */
+ @Autowired
+ private GenericDao dao;
- /** Service : extractions */
- @Autowired
- private ExtractionService extractionService;
+ /** Service : extractions */
+ @Autowired
+ private ExtractionService extractionService;
- /** {@inheritDoc} */
- @Override
- public long countPurifications() {
- return dao.count(Purification.class);
- }
+ /** {@inheritDoc} */
+ @Override
+ public long countPurifications() {
+ return dao.count(Purification.class);
+ }
- /** {@inheritDoc} */
- @Override
- public void createPurification(Purification purification) throws DataConstraintException {
- LOG.info("createPurification: " + purification.getRef());
- dao.create(purification);
- }
+ /** {@inheritDoc} */
+ @Override
+ public void createPurification(Purification purification) throws DataConstraintException {
+ LOG.info("createPurification: " + purification.getRef());
+ dao.create(purification);
+ }
- /** {@inheritDoc} */
- @Override
- public void initParamsMethoPuriEffectif(Purification purification) {
- AssertTools.assertNotNull(purification);
- if (purification.getMethode() != null) {
- // rafraichi la méthode pour pouvoir accéder aux paramètres accédés en LAZY
- refreshMethodePurification(purification.getMethode());
+ /** {@inheritDoc} */
+ @Override
+ public void initParamsMethoPuriEffectif(Purification purification) {
+ AssertTools.assertNotNull(purification);
+ if (purification.getMethode() != null) {
+ // rafraichi la méthode pour pouvoir accéder aux paramètres accédés en LAZY
+ refreshMethodePurification(purification.getMethode());
- refreshMethodePurification(purification.getMethode());
- purification.getParamsMetho().clear();
- for (int paramInd = 0; paramInd < purification.getMethode().getParametres().size(); paramInd++) {
- ParamMethoPuri paramMetho = purification.getMethode().getParametres().get(paramInd);
+ refreshMethodePurification(purification.getMethode());
+ purification.getParamsMetho().clear();
+ for (int paramInd = 0; paramInd < purification.getMethode().getParametres().size(); paramInd++) {
+ ParamMethoPuri paramMetho = purification.getMethode().getParametres().get(paramInd);
- ParamMethoPuriEffectif effectifParam = new ParamMethoPuriEffectif();
- effectifParam.setParam(paramMetho);
- effectifParam.setPurification(purification);
+ ParamMethoPuriEffectif effectifParam = new ParamMethoPuriEffectif();
+ effectifParam.setParam(paramMetho);
+ effectifParam.setPurification(purification);
- // effectifParam.valeur is null
- purification.getParamsMetho().add(effectifParam);
- // LOG.debug("ajout param : " + paramMetho.getNom());
- }
- }
- }
+ // effectifParam.valeur is null
+ purification.getParamsMetho().add(effectifParam);
+ // LOG.debug("ajout param : " + paramMetho.getNom());
+ }
+ }
+ }
- /** {@inheritDoc} */
- @Override
- public void deletePurification(Purification purification) throws DataConstraintException {
- AssertTools.assertNotNull(purification);
- LOG.info("deletePurification: " + purification.getRef());
- try {
- dao.delete(purification);
- } catch (DataNotFoundException e) {
- LOG.error(e.getMessage(), e);
- throw new UnexpectedException(e);
- }
+ /** {@inheritDoc} */
+ @Override
+ public void deletePurification(Purification purification) throws DataConstraintException {
+ AssertTools.assertNotNull(purification);
+ LOG.info("deletePurification: " + purification.getRef());
+ try {
+ dao.delete(purification);
+ } catch (DataNotFoundException e) {
+ LOG.error(e.getMessage(), e);
+ throw new UnexpectedException(e);
+ }
- }
+ }
- /** {@inheritDoc} */
- @Override
- public List<Purification> listPurifications(Utilisateur utilisateur) {
- AssertTools.assertNotNull(utilisateur);
- if (utilisateur.getTypeDroit() == TypeDroit.ADMINISTRATEUR) {
- // si admin, on ajoute toutes les purifications de la base
- return dao.readList(Purification.class, "produit", "ref");
- }
- // gestion des droits en plus pour les utilisateurs
- return new ArrayList<Purification>(listPurificationsForUser(utilisateur));
- }
+ /** {@inheritDoc} */
+ @Override
+ public List<Purification> listPurifications(Utilisateur utilisateur) {
+ AssertTools.assertNotNull(utilisateur);
+ if (utilisateur.getTypeDroit() == TypeDroit.ADMINISTRATEUR) {
+ // si admin, on ajoute toutes les purifications de la base
+ return dao.readList(Purification.class, "produit", "ref");
+ }
+ // gestion des droits en plus pour les utilisateurs
+ return new ArrayList<Purification>(listPurificationsForUser(utilisateur));
+ }
- /** {@inheritDoc} */
- @Override
- public SortedSet<Purification> listPurificationsForUser(Utilisateur utilisateur) {
- SortedSet<Purification> purifications = new TreeSet<Purification>();
- purifications.addAll(utilisateur.getPurificationsCrees());
- addAllPurificationsOfExtractions(purifications, extractionService.listExtractionsForUser(utilisateur));
+ /** {@inheritDoc} */
+ @Override
+ public SortedSet<Purification> listPurificationsForUser(Utilisateur utilisateur) {
+ SortedSet<Purification> purifications = new TreeSet<Purification>();
+ purifications.addAll(utilisateur.getPurificationsCrees());
+ addAllPurificationsOfExtractions(purifications, extractionService.listExtractionsForUser(utilisateur));
- return purifications;
- }
+ return purifications;
+ }
- /**
- * Ajoute tous les purifications contenues dans un ensemble d'extraction à un ensemble de purifications
- * @param purifications l'ensemble de purifications destination
- * @param extractions l'ensemble des extractions sources
- */
- private void addAllPurificationsOfExtractions(Set<Purification> purifications, Set<Extraction> extractions) {
- for (Extraction curExtraction : extractions) {
- for (Extrait curExtrait : curExtraction.getExtraits()) {
- for (Purification curPurification : curExtrait.getPurificationsSuivantes()) {
- purifications.add(curPurification);
+ /**
+ * Ajoute tous les purifications contenues dans un ensemble d'extraction à un ensemble de purifications
+ * @param purifications l'ensemble de purifications destination
+ * @param extractions l'ensemble des extractions sources
+ */
+ private void addAllPurificationsOfExtractions(Set<Purification> purifications, Set<Extraction> extractions) {
+ for (Extraction curExtraction : extractions) {
+ for (Extrait curExtrait : curExtraction.getExtraits()) {
+ for (Purification curPurification : curExtrait.getPurificationsSuivantes()) {
+ purifications.add(curPurification);
- // version itérative (dérécursification)
- LinkedList<Fraction> fractionsQueue = new LinkedList<Fraction>(curPurification.getFractions());
- while (!fractionsQueue.isEmpty()) {
- Fraction curFraction = fractionsQueue.remove();
- for (Purification curPuriFromFraction : curFraction.getPurificationsSuivantes()) {
- purifications.add(curPuriFromFraction);
- fractionsQueue.addAll(curPuriFromFraction.getFractions());
- }
- }
- }
- }
- }
- }
+ // version itérative (dérécursification)
+ LinkedList<Fraction> fractionsQueue = new LinkedList<Fraction>(curPurification.getFractions());
+ while (!fractionsQueue.isEmpty()) {
+ Fraction curFraction = fractionsQueue.remove();
+ for (Purification curPuriFromFraction : curFraction.getPurificationsSuivantes()) {
+ purifications.add(curPuriFromFraction);
+ fractionsQueue.addAll(curPuriFromFraction.getFractions());
+ }
+ }
+ }
+ }
+ }
+ }
- /** {@inheritDoc} */
- @Override
- public boolean isPurificationUnique(Purification purification) {
- AssertTools.assertNotNull(purification);
+ /** {@inheritDoc} */
+ @Override
+ public boolean isPurificationUnique(Purification purification) {
+ AssertTools.assertNotNull(purification);
- // unique if it doesn't exist different value or if it exists but with the same id (so same row in the db)
- if (!dao.exists(Purification.class, "ref", purification.getRef())) {
- return true;
- }
+ // unique if it doesn't exist different value or if it exists but with the same id (so same row in the db)
+ if (!dao.exists(Purification.class, "ref", purification.getRef())) {
+ return true;
+ }
- Purification puriWithSameVal;
- try {
- puriWithSameVal = dao.read(Purification.class, "ref", purification.getRef());
- dao.evict(puriWithSameVal);
- } catch (DataNotFoundException e) {
- return true; // never call, cover by dao.exists...
- }
- // in case of new record, id is null
- return purification.getIdPurification() != null
- && purification.getIdPurification().equals(puriWithSameVal.getIdPurification());
- }
+ Purification puriWithSameVal;
+ try {
+ puriWithSameVal = dao.read(Purification.class, "ref", purification.getRef());
+ dao.evict(puriWithSameVal);
+ } catch (DataNotFoundException e) {
+ return true; // never call, cover by dao.exists...
+ }
+ // in case of new record, id is null
+ return purification.getIdPurification() != null
+ && purification.getIdPurification().equals(puriWithSameVal.getIdPurification());
+ }
- /** {@inheritDoc} */
- @Override
- public Purification loadPurification(Integer idPurification) throws DataNotFoundException {
- return dao.read(Purification.class, idPurification);
- }
+ /** {@inheritDoc} */
+ @Override
+ public Purification loadPurification(Integer idPurification) throws DataNotFoundException {
+ return dao.read(Purification.class, idPurification);
+ }
- /** {@inheritDoc} */
- @Override
- public Purification loadPurification(String nom) throws DataNotFoundException {
- return dao.read(Purification.class, "nom", nom);
- }
+ /** {@inheritDoc} */
+ @Override
+ public Purification loadPurification(String nom) throws DataNotFoundException {
+ return dao.read(Purification.class, "nom", nom);
+ }
- /** {@inheritDoc} */
- @Override
- public void updatePurification(Purification purification) throws DataConstraintException {
- LOG.info("updatePurification: " + purification.getRef());
- try {
- dao.update(purification);
- } catch (DataNotFoundException e) {
- LOG.error(e.getMessage(), e);
- throw new UnexpectedException(e);
- }
- }
+ /** {@inheritDoc} */
+ @Override
+ public void updatePurification(Purification purification) throws DataConstraintException {
+ LOG.info("updatePurification: " + purification.getRef());
+ try {
+ dao.update(purification);
+ } catch (DataNotFoundException e) {
+ LOG.error(e.getMessage(), e);
+ throw new UnexpectedException(e);
+ }
+ }
- /** {@inheritDoc} */
- @Override
- public void refreshPurification(Purification purification) {
- dao.refresh(purification);
- }
+ /** {@inheritDoc} */
+ @Override
+ public void refreshPurification(Purification purification) {
+ dao.refresh(purification);
+ }
- /** {@inheritDoc} */
- @Override
- public boolean updateOrdeletePurificationEnabled(Purification purification, Utilisateur utilisateur) {
- return utilisateur.getTypeDroit() == TypeDroit.ADMINISTRATEUR
- || utilisateur.getIdPersonne() == purification.getCreateur().getIdPersonne();
- }
+ /** {@inheritDoc} */
+ @Override
+ public boolean updateOrdeletePurificationEnabled(Purification purification, Utilisateur utilisateur) {
+ return utilisateur.getTypeDroit() == TypeDroit.ADMINISTRATEUR
+ || utilisateur.getIdPersonne() == purification.getCreateur().getIdPersonne();
+ }
- /** {@inheritDoc} */
- @Override
- public void createMethodePurification(MethodePurification methode) throws DataConstraintException {
- LOG.info("createMethodePurification: " + methode.getNom());
- dao.create(methode);
- }
+ /** {@inheritDoc} */
+ @Override
+ public void createMethodePurification(MethodePurification methode) throws DataConstraintException {
+ LOG.info("createMethodePurification: " + methode.getNom());
+ dao.create(methode);
+ }
- /** {@inheritDoc} */
- @Override
- public void deleteMethodePurification(MethodePurification methode) throws DataConstraintException {
- AssertTools.assertNotNull(methode);
- LOG.info("deleteMethodePurification: " + methode.getNom());
- try {
- dao.delete(methode);
- } catch (DataNotFoundException e) {
- LOG.error(e.getMessage(), e);
- throw new UnexpectedException(e);
- }
+ /** {@inheritDoc} */
+ @Override
+ public void deleteMethodePurification(MethodePurification methode) throws DataConstraintException {
+ AssertTools.assertNotNull(methode);
+ LOG.info("deleteMethodePurification: " + methode.getNom());
+ try {
+ dao.delete(methode);
+ } catch (DataNotFoundException e) {
+ LOG.error(e.getMessage(), e);
+ throw new UnexpectedException(e);
+ }
- }
+ }
- /** {@inheritDoc} */
- @Override
- public List<MethodePurification> listMethodesPurification() {
- return dao.readList(MethodePurification.class, "nom");
- }
+ /** {@inheritDoc} */
+ @Override
+ public List<MethodePurification> listMethodesPurification() {
+ return dao.readList(MethodePurification.class, "nom");
+ }
- /** {@inheritDoc} */
- @Override
- public MethodePurification loadMethodePurification(Integer idMethode) throws DataNotFoundException {
- return dao.read(MethodePurification.class, idMethode);
- }
+ /** {@inheritDoc} */
+ @Override
+ public MethodePurification loadMethodePurification(Integer idMethode) throws DataNotFoundException {
+ return dao.read(MethodePurification.class, idMethode);
+ }
- /** {@inheritDoc} */
- @Override
- public MethodePurification loadMethodePurification(String nom) throws DataNotFoundException {
- return dao.read(MethodePurification.class, "nom", nom);
- }
+ /** {@inheritDoc} */
+ @Override
+ public MethodePurification loadMethodePurification(String nom) throws DataNotFoundException {
+ return dao.read(MethodePurification.class, "nom", nom);
+ }
- /** {@inheritDoc} */
- @Override
- public void updateMethodePurification(MethodePurification methode) throws DataConstraintException {
- LOG.info("updateMethodePurification: " + methode.getNom());
- try {
- dao.update(methode);
- } catch (DataNotFoundException e) {
- LOG.error(e.getMessage(), e);
- throw new UnexpectedException(e);
- }
- }
+ /** {@inheritDoc} */
+ @Override
+ public void updateMethodePurification(MethodePurification methode) throws DataConstraintException {
+ LOG.info("updateMethodePurification: " + methode.getNom());
+ try {
+ dao.update(methode);
+ } catch (DataNotFoundException e) {
+ LOG.error(e.getMessage(), e);
+ throw new UnexpectedException(e);
+ }
+ }
- /** {@inheritDoc} */
- @Override
- public void refreshMethodePurification(MethodePurification methode) {
- AssertTools.assertNotNull(methode);
- dao.refresh(methode);
- }
+ /** {@inheritDoc} */
+ @Override
+ public void refreshMethodePurification(MethodePurification methode) {
+ AssertTools.assertNotNull(methode);
+ dao.refresh(methode);
+ }
- /** {@inheritDoc} */
- @Override
- public boolean isParamMethoPuriReferenced(ParamMethoPuri paramMetho) {
- AssertTools.assertNotNull(paramMetho);
- AssertTools.assertNotNull(paramMetho.getIdParamMethoPuri());
- return dao.count(PurificationDao.COUNT_PURIF_WITH_PARAM_METHO, paramMetho.getIdParamMethoPuri()) > 0;
- }
+ /** {@inheritDoc} */
+ @Override
+ public boolean isParamMethoPuriReferenced(ParamMethoPuri paramMetho) {
+ AssertTools.assertNotNull(paramMetho);
+ AssertTools.assertNotNull(paramMetho.getIdParamMethoPuri());
+ return dao.count(PurificationDao.COUNT_PURIF_WITH_PARAM_METHO, paramMetho.getIdParamMethoPuri()) > 0;
+ }
- /** {@inheritDoc} */
- @Override
- public boolean isFractionUnique(Fraction fraction) {
- AssertTools.assertNotNull(fraction);
+ /** {@inheritDoc} */
+ @Override
+ public boolean isFractionUnique(Fraction fraction) {
+ AssertTools.assertNotNull(fraction);
- // unique if it doesn't exist different value or if it exists with the same id (so same row in the db)
- if (!dao.exists(Fraction.class, "ref", fraction.getRef())) {
- return true;
- }
- Fraction fractWithSameVal;
- try {
- fractWithSameVal = dao.read(Fraction.class, "ref", fraction.getRef());
- dao.evict(fractWithSameVal);
- } catch (DataNotFoundException e) {
- return true; // never call, covers by dao.exists...
- }
- // in case of new record, id is null
- return fraction.getId() != null && fraction.getId().equals(fractWithSameVal.getId());
- }
+ // unique if it doesn't exist different value or if it exists with the same id (so same row in the db)
+ if (!dao.exists(Fraction.class, "ref", fraction.getRef())) {
+ return true;
+ }
+ Fraction fractWithSameVal;
+ try {
+ fractWithSameVal = dao.read(Fraction.class, "ref", fraction.getRef());
+ dao.evict(fractWithSameVal);
+ } catch (DataNotFoundException e) {
+ return true; // never call, covers by dao.exists...
+ }
+ // in case of new record, id is null
+ return fraction.getId() != null && fraction.getId().equals(fractWithSameVal.getId());
+ }
}
\ No newline at end of file
Modified: trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/SpecimenServiceImpl.java
===================================================================
--- trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/SpecimenServiceImpl.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/SpecimenServiceImpl.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -54,163 +54,163 @@
@Service
public final class SpecimenServiceImpl implements SpecimenService {
- /** Logger */
- private static final Log LOG = LogTools.getLog();
+ /** Logger */
+ private static final Log LOG = LogTools.getLog();
- /** Accès aux données */
- @Autowired
- private GenericDao dao;
+ /** Accès aux données */
+ @Autowired
+ private GenericDao dao;
- /** {@inheritDoc} */
- @Override
- public long countSpecimens() {
- return dao.count(Specimen.class);
- }
+ /** {@inheritDoc} */
+ @Override
+ public long countSpecimens() {
+ return dao.count(Specimen.class);
+ }
- /** {@inheritDoc} */
- @Override
- public void createSpecimen(Specimen specimen) throws DataConstraintException {
- LOG.info("createSpecimen: " + specimen.getRef());
- dao.create(specimen);
- }
+ /** {@inheritDoc} */
+ @Override
+ public void createSpecimen(Specimen specimen) throws DataConstraintException {
+ LOG.info("createSpecimen: " + specimen.getRef());
+ dao.create(specimen);
+ }
- /** {@inheritDoc} */
- @Override
- public void deleteSpecimen(Specimen specimen) throws DataConstraintException {
- AssertTools.assertNotNull(specimen);
- LOG.info("deleteSpecimen " + specimen.getRef());
- try {
- dao.delete(specimen);
- } catch (DataNotFoundException e) {
- LOG.error(e.getMessage(), e);
- throw new UnexpectedException(e);
- }
- }
+ /** {@inheritDoc} */
+ @Override
+ public void deleteSpecimen(Specimen specimen) throws DataConstraintException {
+ AssertTools.assertNotNull(specimen);
+ LOG.info("deleteSpecimen " + specimen.getRef());
+ try {
+ dao.delete(specimen);
+ } catch (DataNotFoundException e) {
+ LOG.error(e.getMessage(), e);
+ throw new UnexpectedException(e);
+ }
+ }
- /** {@inheritDoc} */
- @Override
- public List<Specimen> listSpecimens(Utilisateur utilisateur) {
- AssertTools.assertNotNull(utilisateur);
- if (utilisateur.getTypeDroit() == TypeDroit.ADMINISTRATEUR) {
- return dao.readList(Specimen.class, "ref");
- }
- SortedSet<Specimen> specimens = listSpecimensForUser(utilisateur);
+ /** {@inheritDoc} */
+ @Override
+ public List<Specimen> listSpecimens(Utilisateur utilisateur) {
+ AssertTools.assertNotNull(utilisateur);
+ if (utilisateur.getTypeDroit() == TypeDroit.ADMINISTRATEUR) {
+ return dao.readList(Specimen.class, "ref");
+ }
+ SortedSet<Specimen> specimens = listSpecimensForUser(utilisateur);
- return new ArrayList<Specimen>(specimens);
- }
+ return new ArrayList<Specimen>(specimens);
+ }
- /** {@inheritDoc} */
- @Override
- public SortedSet<Specimen> listSpecimensForUser(Utilisateur utilisateur) {
- // gestion des droits en plus pour les utilisateurs
- SortedSet<Specimen> specimens = new TreeSet<Specimen>();
+ /** {@inheritDoc} */
+ @Override
+ public SortedSet<Specimen> listSpecimensForUser(Utilisateur utilisateur) {
+ // gestion des droits en plus pour les utilisateurs
+ SortedSet<Specimen> specimens = new TreeSet<Specimen>();
- // droits donnés pour les spécimens créés par l'utilisateur
- specimens.addAll(utilisateur.getSpecimensCrees());
+ // droits donnés pour les spécimens créés par l'utilisateur
+ specimens.addAll(utilisateur.getSpecimensCrees());
- // droits donnés pour l'ensemble des spécimens qui a pour station une station prospectée par les campagnes dont
- // l'utilisateur a les droits
- List<Campagne> campagnes = new ArrayList<Campagne>();
- campagnes.addAll(utilisateur.getCampagnesCreees());
- campagnes.addAll(utilisateur.getCampagnesDroits().keySet());
- for (Campagne c : campagnes) {
- for (Station st : c.getStations()) {
- specimens.addAll(st.getSpecimensRattaches());
- }
- }
- // droits donnés également pour le spécimen de référence de chaque lot dont l'utilisateur a les droits
- List<Lot> lots = new ArrayList<Lot>();
- lots.addAll(utilisateur.getLotsCrees());
- lots.addAll(utilisateur.getLotsDroits().keySet());
- for (Lot l : lots) {
- // droit sur le spécimen de référence du lot
- if (l.getSpecimenRef().getStation() != null) {
- specimens.add(l.getSpecimenRef());
- }
- }
- return specimens;
- }
+ // droits donnés pour l'ensemble des spécimens qui a pour station une station prospectée par les campagnes dont
+ // l'utilisateur a les droits
+ List<Campagne> campagnes = new ArrayList<Campagne>();
+ campagnes.addAll(utilisateur.getCampagnesCreees());
+ campagnes.addAll(utilisateur.getCampagnesDroits().keySet());
+ for (Campagne c : campagnes) {
+ for (Station st : c.getStations()) {
+ specimens.addAll(st.getSpecimensRattaches());
+ }
+ }
+ // droits donnés également pour le spécimen de référence de chaque lot dont l'utilisateur a les droits
+ List<Lot> lots = new ArrayList<Lot>();
+ lots.addAll(utilisateur.getLotsCrees());
+ lots.addAll(utilisateur.getLotsDroits().keySet());
+ for (Lot l : lots) {
+ // droit sur le spécimen de référence du lot
+ if (l.getSpecimenRef().getStation() != null) {
+ specimens.add(l.getSpecimenRef());
+ }
+ }
+ return specimens;
+ }
- /** {@inheritDoc} */
- @SuppressWarnings("unchecked")
- @Override
- public List<String> listSpecimenEmbranchements() {
- return (List<String>) dao.list(SpecimenDao.CRITERIA_DISTINCT_SPECIMEN_EMBRANCHEMENTS);
- }
+ /** {@inheritDoc} */
+ @SuppressWarnings("unchecked")
+ @Override
+ public List<String> listSpecimenEmbranchements() {
+ return (List<String>) dao.list(SpecimenDao.CRITERIA_DISTINCT_SPECIMEN_EMBRANCHEMENTS);
+ }
- /** {@inheritDoc} */
- @SuppressWarnings("unchecked")
- @Override
- public List<String> listSpecimenFamilles() {
- return (List<String>) dao.list(SpecimenDao.CRITERIA_DISTINCT_SPECIMEN_FAMILLES);
- }
+ /** {@inheritDoc} */
+ @SuppressWarnings("unchecked")
+ @Override
+ public List<String> listSpecimenFamilles() {
+ return (List<String>) dao.list(SpecimenDao.CRITERIA_DISTINCT_SPECIMEN_FAMILLES);
+ }
- /** {@inheritDoc} */
- @Override
- @SuppressWarnings("unchecked")
- public List<String> listSpecimenGenres() {
- return (List<String>) dao.list(SpecimenDao.CRITERIA_DISTINCT_SPECIMEN_GENRES);
- }
+ /** {@inheritDoc} */
+ @Override
+ @SuppressWarnings("unchecked")
+ public List<String> listSpecimenGenres() {
+ return (List<String>) dao.list(SpecimenDao.CRITERIA_DISTINCT_SPECIMEN_GENRES);
+ }
- /** {@inheritDoc} */
- @SuppressWarnings("unchecked")
- @Override
- public List<String> listSpecimenEspeces() {
- return (List<String>) dao.list(SpecimenDao.CRITERIA_DISTINCT_SPECIMEN_ESPECES);
- }
+ /** {@inheritDoc} */
+ @SuppressWarnings("unchecked")
+ @Override
+ public List<String> listSpecimenEspeces() {
+ return (List<String>) dao.list(SpecimenDao.CRITERIA_DISTINCT_SPECIMEN_ESPECES);
+ }
- /** {@inheritDoc} */
- @Override
- @SuppressWarnings("unchecked")
- public List<String> listSpecimenSousEspeces() {
- return (List<String>) dao.list(SpecimenDao.CRITERIA_DISTINCT_SPECIMEN_SOUSESPECES);
- }
+ /** {@inheritDoc} */
+ @Override
+ @SuppressWarnings("unchecked")
+ public List<String> listSpecimenSousEspeces() {
+ return (List<String>) dao.list(SpecimenDao.CRITERIA_DISTINCT_SPECIMEN_SOUSESPECES);
+ }
- /** {@inheritDoc} */
- @Override
- @SuppressWarnings("unchecked")
- public List<String> listSpecimenVarietes() {
- return (List<String>) dao.list(SpecimenDao.CRITERIA_DISTINCT_SPECIMEN_VARIETES);
- }
+ /** {@inheritDoc} */
+ @Override
+ @SuppressWarnings("unchecked")
+ public List<String> listSpecimenVarietes() {
+ return (List<String>) dao.list(SpecimenDao.CRITERIA_DISTINCT_SPECIMEN_VARIETES);
+ }
- /** {@inheritDoc} */
- @Override
- @SuppressWarnings("unchecked")
- public List<String> listLieuxDepot() {
- return (List<String>) dao.list(SpecimenDao.CRITERIA_DISTINCT_LIEUX_DEPOT);
- }
+ /** {@inheritDoc} */
+ @Override
+ @SuppressWarnings("unchecked")
+ public List<String> listLieuxDepot() {
+ return (List<String>) dao.list(SpecimenDao.CRITERIA_DISTINCT_LIEUX_DEPOT);
+ }
- /** {@inheritDoc} */
- @Override
- public Specimen loadSpecimen(Integer idSpecimen) throws DataNotFoundException {
- AssertTools.assertNotNull(idSpecimen);
- return dao.read(Specimen.class, idSpecimen);
- }
+ /** {@inheritDoc} */
+ @Override
+ public Specimen loadSpecimen(Integer idSpecimen) throws DataNotFoundException {
+ AssertTools.assertNotNull(idSpecimen);
+ return dao.read(Specimen.class, idSpecimen);
+ }
- /** {@inheritDoc} */
- @Override
- public Specimen loadSpecimen(String ref) throws DataNotFoundException {
- AssertTools.assertNotEmpty(ref);
- return dao.read(Specimen.class, "ref", ref);
- }
+ /** {@inheritDoc} */
+ @Override
+ public Specimen loadSpecimen(String ref) throws DataNotFoundException {
+ AssertTools.assertNotEmpty(ref);
+ return dao.read(Specimen.class, "ref", ref);
+ }
- /** {@inheritDoc} */
- @Override
- public boolean updateOrdeleteSpecimenEnabled(Specimen specimen, Utilisateur utilisateur) {
- return utilisateur.getTypeDroit() == TypeDroit.ADMINISTRATEUR
- || utilisateur.getIdPersonne() == specimen.getCreateur().getIdPersonne();
- }
+ /** {@inheritDoc} */
+ @Override
+ public boolean updateOrdeleteSpecimenEnabled(Specimen specimen, Utilisateur utilisateur) {
+ return utilisateur.getTypeDroit() == TypeDroit.ADMINISTRATEUR
+ || utilisateur.getIdPersonne() == specimen.getCreateur().getIdPersonne();
+ }
- /** {@inheritDoc} */
- @Override
- public void updateSpecimen(Specimen specimen) throws DataConstraintException {
- LOG.info("updateSpecimen " + specimen.getIdSpecimen());
- try {
- dao.update(specimen);
- } catch (DataNotFoundException e) {
- LOG.error(e.getMessage(), e);
- throw new UnexpectedException(e);
- }
- }
+ /** {@inheritDoc} */
+ @Override
+ public void updateSpecimen(Specimen specimen) throws DataConstraintException {
+ LOG.info("updateSpecimen " + specimen.getIdSpecimen());
+ try {
+ dao.update(specimen);
+ } catch (DataNotFoundException e) {
+ LOG.error(e.getMessage(), e);
+ throw new UnexpectedException(e);
+ }
+ }
}
Modified: trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/StationServiceImpl.java
===================================================================
--- trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/StationServiceImpl.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/StationServiceImpl.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -53,119 +53,119 @@
@Service
public final class StationServiceImpl implements StationService {
- /** Logger */
- private static final Log LOG = LogTools.getLog();
+ /** Logger */
+ private static final Log LOG = LogTools.getLog();
- /** DAO */
- @Autowired
- private GenericDao dao;
+ /** DAO */
+ @Autowired
+ private GenericDao dao;
- /** {@inheritDoc} */
- @Override
- public long countStations() {
- return dao.count(Station.class);
- }
+ /** {@inheritDoc} */
+ @Override
+ public long countStations() {
+ return dao.count(Station.class);
+ }
- /** {@inheritDoc} */
- @Override
- public void createStation(Station station) throws DataConstraintException {
- LOG.info("createStation " + station.getNom());
- dao.create(station);
- }
+ /** {@inheritDoc} */
+ @Override
+ public void createStation(Station station) throws DataConstraintException {
+ LOG.info("createStation " + station.getNom());
+ dao.create(station);
+ }
- /** {@inheritDoc} */
- @Override
- public void deleteStation(Station station) throws DataConstraintException {
- LOG.info("deleteStation " + station.getIdStation());
- try {
- dao.delete(station);
- } catch (DataNotFoundException e) {
- LOG.error(e.getMessage(), e);
- throw new UnexpectedException(e);
- }
- }
+ /** {@inheritDoc} */
+ @Override
+ public void deleteStation(Station station) throws DataConstraintException {
+ LOG.info("deleteStation " + station.getIdStation());
+ try {
+ dao.delete(station);
+ } catch (DataNotFoundException e) {
+ LOG.error(e.getMessage(), e);
+ throw new UnexpectedException(e);
+ }
+ }
- /** {@inheritDoc} */
- @SuppressWarnings("unchecked")
- @Override
- public List<String> listStationLocalites() {
- return (List<String>) dao.list(StationDao.CRITERIA_DISTINCT_STATION_LOCALITES);
- }
+ /** {@inheritDoc} */
+ @SuppressWarnings("unchecked")
+ @Override
+ public List<String> listStationLocalites() {
+ return (List<String>) dao.list(StationDao.CRITERIA_DISTINCT_STATION_LOCALITES);
+ }
- /** {@inheritDoc} */
- @Override
- public List<Station> listStations(Utilisateur utilisateur) {
- AssertTools.assertNotNull(utilisateur);
- if (utilisateur.getTypeDroit() == TypeDroit.ADMINISTRATEUR) {
- return dao.readList(Station.class, "nom");
- }
- SortedSet<Station> stations = listStationsForUser(utilisateur);
+ /** {@inheritDoc} */
+ @Override
+ public List<Station> listStations(Utilisateur utilisateur) {
+ AssertTools.assertNotNull(utilisateur);
+ if (utilisateur.getTypeDroit() == TypeDroit.ADMINISTRATEUR) {
+ return dao.readList(Station.class, "nom");
+ }
+ SortedSet<Station> stations = listStationsForUser(utilisateur);
- return new ArrayList<Station>(stations);
- }
+ return new ArrayList<Station>(stations);
+ }
- /** {@inheritDoc} */
- @Override
- public SortedSet<Station> listStationsForUser(Utilisateur utilisateur) {
- // gestion des droits en plus pour les utilisateurs
- SortedSet<Station> stations = new TreeSet<Station>();
+ /** {@inheritDoc} */
+ @Override
+ public SortedSet<Station> listStationsForUser(Utilisateur utilisateur) {
+ // gestion des droits en plus pour les utilisateurs
+ SortedSet<Station> stations = new TreeSet<Station>();
- // droits donnés pour les stations crées par l'utilisateur
- stations.addAll(utilisateur.getStationsCrees());
+ // droits donnés pour les stations crées par l'utilisateur
+ stations.addAll(utilisateur.getStationsCrees());
- // droits donnés pour l'ensemble des stations prospectées des campagnes où l'utilisateur a les droits sur la
- // campagne complète
- List<Campagne> campagnes = new ArrayList<Campagne>();
- campagnes.addAll(utilisateur.getCampagnesCreees());
- campagnes.addAll(utilisateur.getCampagnesDroits().keySet());
- for (Campagne c : campagnes) {
- stations.addAll(c.getStations());
- }
- // droits donnés également pour chaque lot qui a des droits particuliers
- List<Lot> lots = new ArrayList<Lot>();
- lots.addAll(utilisateur.getLotsCrees());
- lots.addAll(utilisateur.getLotsDroits().keySet());
- for (Lot l : lots) {
- // droit sur la station du lot
- stations.add(l.getStation());
- // droit sur la station de provenance du spécimen rattaché
- if (l.getSpecimenRef().getStation() != null) {
- stations.add(l.getSpecimenRef().getStation());
- }
- }
- return stations;
- }
+ // droits donnés pour l'ensemble des stations prospectées des campagnes où l'utilisateur a les droits sur la
+ // campagne complète
+ List<Campagne> campagnes = new ArrayList<Campagne>();
+ campagnes.addAll(utilisateur.getCampagnesCreees());
+ campagnes.addAll(utilisateur.getCampagnesDroits().keySet());
+ for (Campagne c : campagnes) {
+ stations.addAll(c.getStations());
+ }
+ // droits donnés également pour chaque lot qui a des droits particuliers
+ List<Lot> lots = new ArrayList<Lot>();
+ lots.addAll(utilisateur.getLotsCrees());
+ lots.addAll(utilisateur.getLotsDroits().keySet());
+ for (Lot l : lots) {
+ // droit sur la station du lot
+ stations.add(l.getStation());
+ // droit sur la station de provenance du spécimen rattaché
+ if (l.getSpecimenRef().getStation() != null) {
+ stations.add(l.getSpecimenRef().getStation());
+ }
+ }
+ return stations;
+ }
- /** {@inheritDoc} */
- @Override
- public Station loadStation(Integer idStation) throws DataNotFoundException {
- AssertTools.assertNotNull(idStation);
- return dao.read(Station.class, idStation);
- }
+ /** {@inheritDoc} */
+ @Override
+ public Station loadStation(Integer idStation) throws DataNotFoundException {
+ AssertTools.assertNotNull(idStation);
+ return dao.read(Station.class, idStation);
+ }
- /** {@inheritDoc} */
- @Override
- public Station loadStation(String nom) throws DataNotFoundException {
- AssertTools.assertNotEmpty(nom);
- return dao.read(Station.class, "nom", nom);
- }
+ /** {@inheritDoc} */
+ @Override
+ public Station loadStation(String nom) throws DataNotFoundException {
+ AssertTools.assertNotEmpty(nom);
+ return dao.read(Station.class, "nom", nom);
+ }
- /** {@inheritDoc} */
- @Override
- public boolean updateOrdeleteStationEnabled(Station station, Utilisateur utilisateur) {
- return utilisateur.getTypeDroit() == TypeDroit.ADMINISTRATEUR
- || utilisateur.getIdPersonne() == station.getCreateur().getIdPersonne();
- }
+ /** {@inheritDoc} */
+ @Override
+ public boolean updateOrdeleteStationEnabled(Station station, Utilisateur utilisateur) {
+ return utilisateur.getTypeDroit() == TypeDroit.ADMINISTRATEUR
+ || utilisateur.getIdPersonne() == station.getCreateur().getIdPersonne();
+ }
- /** {@inheritDoc} */
- @Override
- public void updateStation(Station station) throws DataConstraintException {
- LOG.info("updateStation " + station.getNom());
- try {
- dao.update(station);
- } catch (DataNotFoundException e) {
- LOG.error(e.getMessage(), e);
- throw new UnexpectedException(e);
- }
- }
+ /** {@inheritDoc} */
+ @Override
+ public void updateStation(Station station) throws DataConstraintException {
+ LOG.info("updateStation " + station.getNom());
+ try {
+ dao.update(station);
+ } catch (DataNotFoundException e) {
+ LOG.error(e.getMessage(), e);
+ throw new UnexpectedException(e);
+ }
+ }
}
Modified: trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/TestBioServiceImpl.java
===================================================================
--- trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/TestBioServiceImpl.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/TestBioServiceImpl.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -55,292 +55,292 @@
@Service
public final class TestBioServiceImpl implements TestBioService {
- /** Logger */
- private static final Log LOG = LogTools.getLog();
+ /** Logger */
+ private static final Log LOG = LogTools.getLog();
- /** Service : lots */
- @Autowired
- private LotService lotService;
+ /** Service : lots */
+ @Autowired
+ private LotService lotService;
- /** DAO */
- @Autowired
- private GenericDao dao;
+ /** DAO */
+ @Autowired
+ private GenericDao dao;
- /** {@inheritDoc} */
- @Override
- public long countResultatsTestsBio() {
- return dao.count(TestBioDao.CRITERIA_COUNT_RESULTATS_TYPE_PRODUIT);
- }
+ /** {@inheritDoc} */
+ @Override
+ public long countResultatsTestsBio() {
+ return dao.count(TestBioDao.CRITERIA_COUNT_RESULTATS_TYPE_PRODUIT);
+ }
- /** {@inheritDoc} */
- @Override
- public void createTestBio(TestBio testBio) throws DataConstraintException {
- LOG.info("createTestBio: " + testBio.getRef());
- dao.create(testBio);
- }
+ /** {@inheritDoc} */
+ @Override
+ public void createTestBio(TestBio testBio) throws DataConstraintException {
+ LOG.info("createTestBio: " + testBio.getRef());
+ dao.create(testBio);
+ }
- /** {@inheritDoc} */
- @Override
- public void deleteTestBio(TestBio testBio) throws DataConstraintException {
- AssertTools.assertNotNull(testBio);
- LOG.info("deleteTestBio: " + testBio.getRef());
- try {
- dao.delete(testBio);
- } catch (DataNotFoundException e) {
- LOG.error(e.getMessage(), e);
- throw new UnexpectedException(e);
- }
+ /** {@inheritDoc} */
+ @Override
+ public void deleteTestBio(TestBio testBio) throws DataConstraintException {
+ AssertTools.assertNotNull(testBio);
+ LOG.info("deleteTestBio: " + testBio.getRef());
+ try {
+ dao.delete(testBio);
+ } catch (DataNotFoundException e) {
+ LOG.error(e.getMessage(), e);
+ throw new UnexpectedException(e);
+ }
- }
+ }
- /** {@inheritDoc} */
- @SuppressWarnings("unchecked")
- @Override
- public List<ResultatTestBio> listResultatsTestBio(Utilisateur utilisateur) {
- AssertTools.assertNotNull(utilisateur);
- if (utilisateur.getTypeDroit() == TypeDroit.ADMINISTRATEUR) {
- // si admin, on ajoute toutes les testBios de la base
- return (List<ResultatTestBio>) dao.list(TestBioDao.CRITERIA_LIST_RESULTATS_TYPE_PRODUIT);
- }
- // gestion des droits en plus pour les utilisateurs
- return new ArrayList<ResultatTestBio>(listResultatsTestBioForUser(utilisateur));
- }
+ /** {@inheritDoc} */
+ @SuppressWarnings("unchecked")
+ @Override
+ public List<ResultatTestBio> listResultatsTestBio(Utilisateur utilisateur) {
+ AssertTools.assertNotNull(utilisateur);
+ if (utilisateur.getTypeDroit() == TypeDroit.ADMINISTRATEUR) {
+ // si admin, on ajoute toutes les testBios de la base
+ return (List<ResultatTestBio>) dao.list(TestBioDao.CRITERIA_LIST_RESULTATS_TYPE_PRODUIT);
+ }
+ // gestion des droits en plus pour les utilisateurs
+ return new ArrayList<ResultatTestBio>(listResultatsTestBioForUser(utilisateur));
+ }
- /** {@inheritDoc} */
- @SuppressWarnings("unchecked")
- @Override
- public SortedSet<ResultatTestBio> listResultatsTestBioForUser(Utilisateur utilisateur) {
- SortedSet<ResultatTestBio> resultats = new TreeSet<ResultatTestBio>();
+ /** {@inheritDoc} */
+ @SuppressWarnings("unchecked")
+ @Override
+ public SortedSet<ResultatTestBio> listResultatsTestBioForUser(Utilisateur utilisateur) {
+ SortedSet<ResultatTestBio> resultats = new TreeSet<ResultatTestBio>();
- // liste triée par produit afin d'optimiser
- List<ResultatTestBio> allResultTests = (List<ResultatTestBio>) dao
- .list(TestBioDao.CRITERIA_LIST_RESULTATS_TYPE_PRODUIT);
- for (ResultatTestBio curRes : allResultTests) {
- if (lotService.isLotAccessibleByUser(curRes.getLotSource(), utilisateur)) {
- resultats.add(curRes);
- }
- }
+ // liste triée par produit afin d'optimiser
+ List<ResultatTestBio> allResultTests = (List<ResultatTestBio>) dao
+ .list(TestBioDao.CRITERIA_LIST_RESULTATS_TYPE_PRODUIT);
+ for (ResultatTestBio curRes : allResultTests) {
+ if (lotService.isLotAccessibleByUser(curRes.getLotSource(), utilisateur)) {
+ resultats.add(curRes);
+ }
+ }
- return resultats;
- }
+ return resultats;
+ }
- /** {@inheritDoc} */
- @SuppressWarnings("unchecked")
- @Override
- public List<String> listProduitsTemoins() {
- return (List<String>) dao.list(TestBioDao.CRITERIA_DISTINCT_PRODUITS_TEMOINS);
- }
+ /** {@inheritDoc} */
+ @SuppressWarnings("unchecked")
+ @Override
+ public List<String> listProduitsTemoins() {
+ return (List<String>) dao.list(TestBioDao.CRITERIA_DISTINCT_PRODUITS_TEMOINS);
+ }
- /** {@inheritDoc} */
- @Override
- public boolean isResultatTestBioAccessibleByUser(ResultatTestBio resultatTestBio, Utilisateur utilisateur) {
- return lotService.isLotAccessibleByUser(resultatTestBio.getLotSource(), utilisateur);
- }
+ /** {@inheritDoc} */
+ @Override
+ public boolean isResultatTestBioAccessibleByUser(ResultatTestBio resultatTestBio, Utilisateur utilisateur) {
+ return lotService.isLotAccessibleByUser(resultatTestBio.getLotSource(), utilisateur);
+ }
- /** {@inheritDoc} */
- @Override
- public boolean isResultatTestBioUniqueInList(final ResultatTestBio resultatTestBio, final List<ResultatTestBio> list) {
- AssertTools.assertNotNull(resultatTestBio.getTypeResultat());
- AssertTools.assertNotNull(resultatTestBio.getRepere());
- // as resultatTestBio is already in list, detect if more of one elements satisfy these conditions
- int count = 0;
- for (ResultatTestBio curRes : list) {
- if (resultatTestBio.getTypeResultat() == TypeResultat.BLANC
- && resultatTestBio.getRepere().equals(curRes.getRepere())) {
- count++;
- } else if (resultatTestBio.getTypeResultat() == TypeResultat.TEMOIN
- && resultatTestBio.getRepere().equals(curRes.getRepere())
- && resultatTestBio.getProduitTemoin().equals(curRes.getProduitTemoin())) {
- count++;
- } else if (resultatTestBio.getTypeResultat() == TypeResultat.PRODUIT
- && resultatTestBio.getRepere().equals(curRes.getRepere())
- && resultatTestBio.getProduit().getRef().equals(curRes.getProduit().getRef())) {
- count++;
- }
- }
- return count <= 1;
- }
+ /** {@inheritDoc} */
+ @Override
+ public boolean isResultatTestBioUniqueInList(final ResultatTestBio resultatTestBio, final List<ResultatTestBio> list) {
+ AssertTools.assertNotNull(resultatTestBio.getTypeResultat());
+ AssertTools.assertNotNull(resultatTestBio.getRepere());
+ // as resultatTestBio is already in list, detect if more of one elements satisfy these conditions
+ int count = 0;
+ for (ResultatTestBio curRes : list) {
+ if (resultatTestBio.getTypeResultat() == TypeResultat.BLANC
+ && resultatTestBio.getRepere().equals(curRes.getRepere())) {
+ count++;
+ } else if (resultatTestBio.getTypeResultat() == TypeResultat.TEMOIN
+ && resultatTestBio.getRepere().equals(curRes.getRepere())
+ && resultatTestBio.getProduitTemoin().equals(curRes.getProduitTemoin())) {
+ count++;
+ } else if (resultatTestBio.getTypeResultat() == TypeResultat.PRODUIT
+ && resultatTestBio.getRepere().equals(curRes.getRepere())
+ && resultatTestBio.getProduit().getRef().equals(curRes.getProduit().getRef())) {
+ count++;
+ }
+ }
+ return count <= 1;
+ }
- /** {@inheritDoc} */
- @Override
- public boolean isTestBioUnique(TestBio testBio) {
- AssertTools.assertNotNull(testBio);
+ /** {@inheritDoc} */
+ @Override
+ public boolean isTestBioUnique(TestBio testBio) {
+ AssertTools.assertNotNull(testBio);
- // unique if it doesn't exist different value or if it exists but with the same id (so same row in the db)
- if (!dao.exists(TestBio.class, "ref", testBio.getRef())) {
- return true;
- }
+ // unique if it doesn't exist different value or if it exists but with the same id (so same row in the db)
+ if (!dao.exists(TestBio.class, "ref", testBio.getRef())) {
+ return true;
+ }
- TestBio puriWithSameVal;
- try {
- puriWithSameVal = dao.read(TestBio.class, "ref", testBio.getRef());
- dao.evict(puriWithSameVal);
- } catch (DataNotFoundException e) {
- return true; // never call, cover by dao.exists...
- }
- // in case of new record, id is null
- return testBio.getIdTestBio() != null && testBio.getIdTestBio().equals(puriWithSameVal.getIdTestBio());
- }
+ TestBio puriWithSameVal;
+ try {
+ puriWithSameVal = dao.read(TestBio.class, "ref", testBio.getRef());
+ dao.evict(puriWithSameVal);
+ } catch (DataNotFoundException e) {
+ return true; // never call, cover by dao.exists...
+ }
+ // in case of new record, id is null
+ return testBio.getIdTestBio() != null && testBio.getIdTestBio().equals(puriWithSameVal.getIdTestBio());
+ }
- /** {@inheritDoc} */
- @Override
- public TestBio loadTestBio(Integer idTestBio) throws DataNotFoundException {
- return dao.read(TestBio.class, idTestBio);
- }
+ /** {@inheritDoc} */
+ @Override
+ public TestBio loadTestBio(Integer idTestBio) throws DataNotFoundException {
+ return dao.read(TestBio.class, idTestBio);
+ }
- /** {@inheritDoc} */
- @Override
- public TestBio loadTestBio(String nom) throws DataNotFoundException {
- return dao.read(TestBio.class, "nom", nom);
- }
+ /** {@inheritDoc} */
+ @Override
+ public TestBio loadTestBio(String nom) throws DataNotFoundException {
+ return dao.read(TestBio.class, "nom", nom);
+ }
- /** {@inheritDoc} */
- @Override
- public void updateTestBio(TestBio testBio) throws DataConstraintException {
- LOG.info("updateTestBio: " + testBio.getRef());
- try {
- dao.update(testBio);
- } catch (DataNotFoundException e) {
- LOG.error(e.getMessage(), e);
- throw new UnexpectedException(e);
- }
- }
+ /** {@inheritDoc} */
+ @Override
+ public void updateTestBio(TestBio testBio) throws DataConstraintException {
+ LOG.info("updateTestBio: " + testBio.getRef());
+ try {
+ dao.update(testBio);
+ } catch (DataNotFoundException e) {
+ LOG.error(e.getMessage(), e);
+ throw new UnexpectedException(e);
+ }
+ }
- /** {@inheritDoc} */
- @Override
- public void refreshTestBio(TestBio testBio) {
- dao.refresh(testBio);
- }
+ /** {@inheritDoc} */
+ @Override
+ public void refreshTestBio(TestBio testBio) {
+ dao.refresh(testBio);
+ }
- /** {@inheritDoc} */
- @Override
- public boolean updateOrdeleteTestBioEnabled(TestBio testBio, Utilisateur utilisateur) {
- return utilisateur.getTypeDroit() == TypeDroit.ADMINISTRATEUR
- || utilisateur.getIdPersonne() == testBio.getCreateur().getIdPersonne();
- }
+ /** {@inheritDoc} */
+ @Override
+ public boolean updateOrdeleteTestBioEnabled(TestBio testBio, Utilisateur utilisateur) {
+ return utilisateur.getTypeDroit() == TypeDroit.ADMINISTRATEUR
+ || utilisateur.getIdPersonne() == testBio.getCreateur().getIdPersonne();
+ }
- /** {@inheritDoc} */
- @Override
- public void createMethodeTestBio(MethodeTestBio methode) throws DataConstraintException {
- LOG.info("createMethodeTest: " + methode.getNom());
- dao.create(methode);
+ /** {@inheritDoc} */
+ @Override
+ public void createMethodeTestBio(MethodeTestBio methode) throws DataConstraintException {
+ LOG.info("createMethodeTest: " + methode.getNom());
+ dao.create(methode);
- }
+ }
- /** {@inheritDoc} */
- @Override
- public void deleteMethodeTestBio(MethodeTestBio methode) throws DataConstraintException {
- AssertTools.assertNotNull(methode);
- LOG.info("deleteMethodeTest: " + methode.getNom());
- try {
- dao.delete(methode);
- } catch (DataNotFoundException e) {
- LOG.error(e.getMessage(), e);
- throw new UnexpectedException(e);
- }
+ /** {@inheritDoc} */
+ @Override
+ public void deleteMethodeTestBio(MethodeTestBio methode) throws DataConstraintException {
+ AssertTools.assertNotNull(methode);
+ LOG.info("deleteMethodeTest: " + methode.getNom());
+ try {
+ dao.delete(methode);
+ } catch (DataNotFoundException e) {
+ LOG.error(e.getMessage(), e);
+ throw new UnexpectedException(e);
+ }
- }
+ }
- /** {@inheritDoc} */
- @Override
- public List<MethodeTestBio> listMethodesTestBio() {
- return dao.readList(MethodeTestBio.class, "nom");
- }
+ /** {@inheritDoc} */
+ @Override
+ public List<MethodeTestBio> listMethodesTestBio() {
+ return dao.readList(MethodeTestBio.class, "nom");
+ }
- /** {@inheritDoc} */
- @SuppressWarnings("unchecked")
- @Override
- public List<String> listDomainesMethodes() {
- return (List<String>) dao.list(TestBioDao.CRITERIA_DISTINCT_DOMAINES_METHODES);
- }
+ /** {@inheritDoc} */
+ @SuppressWarnings("unchecked")
+ @Override
+ public List<String> listDomainesMethodes() {
+ return (List<String>) dao.list(TestBioDao.CRITERIA_DISTINCT_DOMAINES_METHODES);
+ }
- /** {@inheritDoc} */
- @SuppressWarnings("unchecked")
- @Override
- public List<String> listUnitesResultatMethodes() {
- return (List<String>) dao.list(TestBioDao.CRITERIA_DISTINCT_UNITES_RESULTAT_METHODES);
- }
+ /** {@inheritDoc} */
+ @SuppressWarnings("unchecked")
+ @Override
+ public List<String> listUnitesResultatMethodes() {
+ return (List<String>) dao.list(TestBioDao.CRITERIA_DISTINCT_UNITES_RESULTAT_METHODES);
+ }
- /** {@inheritDoc} */
- @Override
- public MethodeTestBio loadMethodeTest(Integer idMethode) throws DataNotFoundException {
- return dao.read(MethodeTestBio.class, idMethode);
- }
+ /** {@inheritDoc} */
+ @Override
+ public MethodeTestBio loadMethodeTest(Integer idMethode) throws DataNotFoundException {
+ return dao.read(MethodeTestBio.class, idMethode);
+ }
- /** {@inheritDoc} */
- @Override
- public MethodeTestBio loadMethodeTest(String nom) throws DataNotFoundException {
- return dao.read(MethodeTestBio.class, "nom", nom);
- }
+ /** {@inheritDoc} */
+ @Override
+ public MethodeTestBio loadMethodeTest(String nom) throws DataNotFoundException {
+ return dao.read(MethodeTestBio.class, "nom", nom);
+ }
- /** {@inheritDoc} */
- @Override
- public void updateMethodeTest(MethodeTestBio methode) throws DataConstraintException {
- LOG.info("updateMethodeTest: " + methode.getNom());
- try {
- dao.update(methode);
- } catch (DataNotFoundException e) {
- LOG.error(e.getMessage(), e);
- throw new UnexpectedException(e);
- }
+ /** {@inheritDoc} */
+ @Override
+ public void updateMethodeTest(MethodeTestBio methode) throws DataConstraintException {
+ LOG.info("updateMethodeTest: " + methode.getNom());
+ try {
+ dao.update(methode);
+ } catch (DataNotFoundException e) {
+ LOG.error(e.getMessage(), e);
+ throw new UnexpectedException(e);
+ }
- }
+ }
- /** {@inheritDoc} */
- @Override
- public void refreshMethodeTestBio(MethodeTestBio methode) {
- AssertTools.assertNotNull(methode);
- dao.refresh(methode);
- }
+ /** {@inheritDoc} */
+ @Override
+ public void refreshMethodeTestBio(MethodeTestBio methode) {
+ AssertTools.assertNotNull(methode);
+ dao.refresh(methode);
+ }
- /** {@inheritDoc} */
- @Override
- public void createErreurTest(ErreurTestBio erreurTest) throws DataConstraintException {
- LOG.info("createErreurTest: " + erreurTest.getNom());
- dao.create(erreurTest);
- }
+ /** {@inheritDoc} */
+ @Override
+ public void createErreurTest(ErreurTestBio erreurTest) throws DataConstraintException {
+ LOG.info("createErreurTest: " + erreurTest.getNom());
+ dao.create(erreurTest);
+ }
- /** {@inheritDoc} */
- @Override
- public void deleteErreurTest(ErreurTestBio erreurTest) throws DataConstraintException {
- AssertTools.assertNotNull(erreurTest);
- LOG.info("deleteErreurTest: " + erreurTest.getNom());
- try {
- dao.delete(erreurTest);
- } catch (DataNotFoundException e) {
- LOG.error(e.getMessage(), e);
- throw new UnexpectedException(e);
- }
- }
+ /** {@inheritDoc} */
+ @Override
+ public void deleteErreurTest(ErreurTestBio erreurTest) throws DataConstraintException {
+ AssertTools.assertNotNull(erreurTest);
+ LOG.info("deleteErreurTest: " + erreurTest.getNom());
+ try {
+ dao.delete(erreurTest);
+ } catch (DataNotFoundException e) {
+ LOG.error(e.getMessage(), e);
+ throw new UnexpectedException(e);
+ }
+ }
- /** {@inheritDoc} */
- @Override
- public List<ErreurTestBio> listErreursTestBio() {
- return dao.readList(ErreurTestBio.class, "nom");
- }
+ /** {@inheritDoc} */
+ @Override
+ public List<ErreurTestBio> listErreursTestBio() {
+ return dao.readList(ErreurTestBio.class, "nom");
+ }
- /** {@inheritDoc} */
- @Override
- public ErreurTestBio loadErreurTestBio(Integer idErreurTest) throws DataNotFoundException {
- return dao.read(ErreurTestBio.class, idErreurTest);
- }
+ /** {@inheritDoc} */
+ @Override
+ public ErreurTestBio loadErreurTestBio(Integer idErreurTest) throws DataNotFoundException {
+ return dao.read(ErreurTestBio.class, idErreurTest);
+ }
- /** {@inheritDoc} */
- @Override
- public ErreurTestBio loadErreurTestBio(String nom) throws DataNotFoundException {
- return dao.read(ErreurTestBio.class, "nom", nom);
- }
+ /** {@inheritDoc} */
+ @Override
+ public ErreurTestBio loadErreurTestBio(String nom) throws DataNotFoundException {
+ return dao.read(ErreurTestBio.class, "nom", nom);
+ }
- /** {@inheritDoc} */
- @Override
- public void updateErreurTestBio(ErreurTestBio erreurTest) throws DataConstraintException {
- LOG.info("updateErreurTest: " + erreurTest.getNom());
- try {
- dao.update(erreurTest);
- } catch (DataNotFoundException e) {
- LOG.error(e.getMessage(), e);
- throw new UnexpectedException(e);
- }
- }
+ /** {@inheritDoc} */
+ @Override
+ public void updateErreurTestBio(ErreurTestBio erreurTest) throws DataConstraintException {
+ LOG.info("updateErreurTest: " + erreurTest.getNom());
+ try {
+ dao.update(erreurTest);
+ } catch (DataNotFoundException e) {
+ LOG.error(e.getMessage(), e);
+ throw new UnexpectedException(e);
+ }
+ }
}
\ No newline at end of file
Modified: trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/utils/normalizers/CampagneNormalizer.java
===================================================================
--- trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/utils/normalizers/CampagneNormalizer.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/utils/normalizers/CampagneNormalizer.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -34,15 +34,15 @@
*/
public final class CampagneNormalizer extends Normalizer<Campagne> {
- /** {@inheritDoc} */
- @Override
- public Campagne normalize(Campagne campagne) {
- AssertTools.assertNotNull(campagne);
- // Unique fields
- campagne.setNom(normalize(UniqueFieldNormalizer.class, campagne.getNom()));
- // Autocompleted fields
- campagne.setProgramme(new StringTransformer(campagne.getProgramme()).replaceConsecutiveWhitespaces()
- .trimToNull().capitalize().toString());
- return campagne;
- }
+ /** {@inheritDoc} */
+ @Override
+ public Campagne normalize(Campagne campagne) {
+ AssertTools.assertNotNull(campagne);
+ // Unique fields
+ campagne.setNom(normalize(UniqueFieldNormalizer.class, campagne.getNom()));
+ // Autocompleted fields
+ campagne.setProgramme(new StringTransformer(campagne.getProgramme()).replaceConsecutiveWhitespaces()
+ .trimToNull().capitalize().toString());
+ return campagne;
+ }
}
Modified: trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/utils/normalizers/ConfigNameNormalizer.java
===================================================================
--- trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/utils/normalizers/ConfigNameNormalizer.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/utils/normalizers/ConfigNameNormalizer.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -31,9 +31,9 @@
*/
public final class ConfigNameNormalizer extends Normalizer<String> {
- /** {@inheritDoc} */
- @Override
- protected String normalize(String uniqueName) {
- return new StringTransformer(uniqueName).replaceConsecutiveWhitespaces().trimToNull().toString();
- }
+ /** {@inheritDoc} */
+ @Override
+ protected String normalize(String uniqueName) {
+ return new StringTransformer(uniqueName).replaceConsecutiveWhitespaces().trimToNull().toString();
+ }
}
Modified: trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/utils/normalizers/EmailNormalizer.java
===================================================================
--- trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/utils/normalizers/EmailNormalizer.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/utils/normalizers/EmailNormalizer.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -32,9 +32,9 @@
*/
public final class EmailNormalizer extends Normalizer<String> {
- /** {@inheritDoc} */
- @Override
- public String normalize(String email) {
- return new StringTransformer(email).trimToNull().toLowerCase().toString();
- }
+ /** {@inheritDoc} */
+ @Override
+ public String normalize(String email) {
+ return new StringTransformer(email).trimToNull().toLowerCase().toString();
+ }
}
Modified: trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/utils/normalizers/ErreurTestNormalizer.java
===================================================================
--- trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/utils/normalizers/ErreurTestNormalizer.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/utils/normalizers/ErreurTestNormalizer.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -32,12 +32,12 @@
*/
public final class ErreurTestNormalizer extends Normalizer<ErreurTestBio> {
- /** {@inheritDoc} */
- @Override
- protected ErreurTestBio normalize(ErreurTestBio erreurTest) {
- AssertTools.assertNotNull(erreurTest);
- // Unique fields
- erreurTest.setNom(Normalizer.normalize(ConfigNameNormalizer.class, erreurTest.getNom()));
- return erreurTest;
- }
+ /** {@inheritDoc} */
+ @Override
+ protected ErreurTestBio normalize(ErreurTestBio erreurTest) {
+ AssertTools.assertNotNull(erreurTest);
+ // Unique fields
+ erreurTest.setNom(Normalizer.normalize(ConfigNameNormalizer.class, erreurTest.getNom()));
+ return erreurTest;
+ }
}
Modified: trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/utils/normalizers/ExtractionNormalizer.java
===================================================================
--- trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/utils/normalizers/ExtractionNormalizer.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/utils/normalizers/ExtractionNormalizer.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -33,16 +33,16 @@
*/
public final class ExtractionNormalizer extends Normalizer<Extraction> {
- /** {@inheritDoc} */
- @Override
- protected Extraction normalize(Extraction extraction) {
- AssertTools.assertNotNull(extraction);
- // Unique fields
- extraction.setRef(Normalizer.normalize(UniqueFieldNormalizer.class, extraction.getRef()));
- for (Extrait curExtrait : extraction.getExtraits()) {
- curExtrait.setRef(Normalizer.normalize(UniqueFieldNormalizer.class, curExtrait.getRef()));
- }
- return extraction;
- }
+ /** {@inheritDoc} */
+ @Override
+ protected Extraction normalize(Extraction extraction) {
+ AssertTools.assertNotNull(extraction);
+ // Unique fields
+ extraction.setRef(Normalizer.normalize(UniqueFieldNormalizer.class, extraction.getRef()));
+ for (Extrait curExtrait : extraction.getExtraits()) {
+ curExtrait.setRef(Normalizer.normalize(UniqueFieldNormalizer.class, curExtrait.getRef()));
+ }
+ return extraction;
+ }
}
Modified: trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/utils/normalizers/LotNormalizer.java
===================================================================
--- trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/utils/normalizers/LotNormalizer.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/utils/normalizers/LotNormalizer.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -33,12 +33,12 @@
*/
public final class LotNormalizer extends Normalizer<Lot> {
- /** {@inheritDoc} */
- @Override
- protected Lot normalize(Lot lot) {
- AssertTools.assertNotNull(lot);
- // Unique fields
- lot.setRef(normalize(UniqueFieldNormalizer.class, lot.getRef()));
- return lot;
- }
+ /** {@inheritDoc} */
+ @Override
+ protected Lot normalize(Lot lot) {
+ AssertTools.assertNotNull(lot);
+ // Unique fields
+ lot.setRef(normalize(UniqueFieldNormalizer.class, lot.getRef()));
+ return lot;
+ }
}
Modified: trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/utils/normalizers/MethodeExtractionNormalizer.java
===================================================================
--- trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/utils/normalizers/MethodeExtractionNormalizer.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/utils/normalizers/MethodeExtractionNormalizer.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -33,15 +33,15 @@
*/
public final class MethodeExtractionNormalizer extends Normalizer<MethodeExtraction> {
- /** {@inheritDoc} */
- @Override
- protected MethodeExtraction normalize(MethodeExtraction methodeExtraction) {
- AssertTools.assertNotNull(methodeExtraction);
- // Unique fields
- methodeExtraction.setNom(Normalizer.normalize(ConfigNameNormalizer.class, methodeExtraction.getNom()));
- for (TypeExtrait curType : methodeExtraction.getTypesEnSortie()) {
- curType.setInitiales(Normalizer.normalize(ConfigNameNormalizer.class, curType.getInitiales()));
- }
- return methodeExtraction;
- }
+ /** {@inheritDoc} */
+ @Override
+ protected MethodeExtraction normalize(MethodeExtraction methodeExtraction) {
+ AssertTools.assertNotNull(methodeExtraction);
+ // Unique fields
+ methodeExtraction.setNom(Normalizer.normalize(ConfigNameNormalizer.class, methodeExtraction.getNom()));
+ for (TypeExtrait curType : methodeExtraction.getTypesEnSortie()) {
+ curType.setInitiales(Normalizer.normalize(ConfigNameNormalizer.class, curType.getInitiales()));
+ }
+ return methodeExtraction;
+ }
}
Modified: trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/utils/normalizers/MethodePurificationNormalizer.java
===================================================================
--- trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/utils/normalizers/MethodePurificationNormalizer.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/utils/normalizers/MethodePurificationNormalizer.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -33,16 +33,16 @@
*/
public final class MethodePurificationNormalizer extends Normalizer<MethodePurification> {
- /** {@inheritDoc} */
- @Override
- protected MethodePurification normalize(MethodePurification methodePurification) {
- AssertTools.assertNotNull(methodePurification);
- // Unique fields
- methodePurification.setNom(Normalizer.normalize(ConfigNameNormalizer.class, methodePurification.getNom()));
- for (ParamMethoPuri curParam : methodePurification.getParametres()) {
- curParam.setNom(Normalizer.normalize(ConfigNameNormalizer.class, curParam.getNom()));
- }
- return methodePurification;
- }
+ /** {@inheritDoc} */
+ @Override
+ protected MethodePurification normalize(MethodePurification methodePurification) {
+ AssertTools.assertNotNull(methodePurification);
+ // Unique fields
+ methodePurification.setNom(Normalizer.normalize(ConfigNameNormalizer.class, methodePurification.getNom()));
+ for (ParamMethoPuri curParam : methodePurification.getParametres()) {
+ curParam.setNom(Normalizer.normalize(ConfigNameNormalizer.class, curParam.getNom()));
+ }
+ return methodePurification;
+ }
}
Modified: trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/utils/normalizers/MethodeTestBioNormalizer.java
===================================================================
--- trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/utils/normalizers/MethodeTestBioNormalizer.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/utils/normalizers/MethodeTestBioNormalizer.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -33,21 +33,21 @@
*/
public final class MethodeTestBioNormalizer extends Normalizer<MethodeTestBio> {
- /** {@inheritDoc} */
- @Override
- protected MethodeTestBio normalize(MethodeTestBio methodeTest) {
- AssertTools.assertNotNull(methodeTest);
- // Unique field
- methodeTest.setNom(Normalizer.normalize(ConfigNameNormalizer.class, methodeTest.getNom()));
- methodeTest.setCible(Normalizer.normalize(ConfigNameNormalizer.class, methodeTest.getCible()));
- methodeTest.setDomaine(new StringTransformer(methodeTest.getDomaine()).trimToNull()
- .replaceConsecutiveWhitespaces().toString());
- methodeTest.setValeurMesuree(new StringTransformer(methodeTest.getValeurMesuree()).trimToNull()
- .replaceConsecutiveWhitespaces().toString());
- methodeTest.setUniteResultat(new StringTransformer(methodeTest.getUniteResultat()).trimToNull()
- .replaceConsecutiveWhitespaces().toString());
- methodeTest.setCritereActivite(new StringTransformer(methodeTest.getCritereActivite()).trimToNull()
- .replaceConsecutiveWhitespaces().toString());
- return methodeTest;
- }
+ /** {@inheritDoc} */
+ @Override
+ protected MethodeTestBio normalize(MethodeTestBio methodeTest) {
+ AssertTools.assertNotNull(methodeTest);
+ // Unique field
+ methodeTest.setNom(Normalizer.normalize(ConfigNameNormalizer.class, methodeTest.getNom()));
+ methodeTest.setCible(Normalizer.normalize(ConfigNameNormalizer.class, methodeTest.getCible()));
+ methodeTest.setDomaine(new StringTransformer(methodeTest.getDomaine()).trimToNull()
+ .replaceConsecutiveWhitespaces().toString());
+ methodeTest.setValeurMesuree(new StringTransformer(methodeTest.getValeurMesuree()).trimToNull()
+ .replaceConsecutiveWhitespaces().toString());
+ methodeTest.setUniteResultat(new StringTransformer(methodeTest.getUniteResultat()).trimToNull()
+ .replaceConsecutiveWhitespaces().toString());
+ methodeTest.setCritereActivite(new StringTransformer(methodeTest.getCritereActivite()).trimToNull()
+ .replaceConsecutiveWhitespaces().toString());
+ return methodeTest;
+ }
}
Modified: trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/utils/normalizers/MoleculeNormalizer.java
===================================================================
--- trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/utils/normalizers/MoleculeNormalizer.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/utils/normalizers/MoleculeNormalizer.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -32,10 +32,10 @@
*/
public final class MoleculeNormalizer extends Normalizer<Molecule> {
- /** {@inheritDoc} */
- @Override
- protected Molecule normalize(Molecule molecule) {
- AssertTools.assertNotNull(molecule);
- return molecule;
- }
+ /** {@inheritDoc} */
+ @Override
+ protected Molecule normalize(Molecule molecule) {
+ AssertTools.assertNotNull(molecule);
+ return molecule;
+ }
}
Modified: trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/utils/normalizers/PartieNormalizer.java
===================================================================
--- trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/utils/normalizers/PartieNormalizer.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/utils/normalizers/PartieNormalizer.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -33,12 +33,12 @@
*/
public final class PartieNormalizer extends Normalizer<Partie> {
- /** {@inheritDoc} */
- @Override
- protected Partie normalize(Partie partie) {
- AssertTools.assertNotNull(partie);
- // Unique fields
- partie.setNom(Normalizer.normalize(ConfigNameNormalizer.class, partie.getNom()));
- return partie;
- }
+ /** {@inheritDoc} */
+ @Override
+ protected Partie normalize(Partie partie) {
+ AssertTools.assertNotNull(partie);
+ // Unique fields
+ partie.setNom(Normalizer.normalize(ConfigNameNormalizer.class, partie.getNom()));
+ return partie;
+ }
}
Modified: trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/utils/normalizers/PersonneNormalizer.java
===================================================================
--- trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/utils/normalizers/PersonneNormalizer.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/utils/normalizers/PersonneNormalizer.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -34,16 +34,16 @@
*/
public final class PersonneNormalizer extends Normalizer<Personne> {
- /** {@inheritDoc} */
- @Override
- public Personne normalize(Personne personne) {
- AssertTools.assertNotNull(personne);
- // Unique fields
- personne.setCourriel(normalize(EmailNormalizer.class, personne.getCourriel()));
- personne.setNom(new StringTransformer(personne.getNom()).replaceAccents().replaceNonAlpha()
- .replaceConsecutiveWhitespaces().trimToNull().toUpperCase().toString());
- personne.setPrenom(new StringTransformer(personne.getPrenom()).replaceAccents().replaceNonAlpha()
- .replaceConsecutiveWhitespaces().trimToNull().capitalizeFully().toString());
- return personne;
- }
+ /** {@inheritDoc} */
+ @Override
+ public Personne normalize(Personne personne) {
+ AssertTools.assertNotNull(personne);
+ // Unique fields
+ personne.setCourriel(normalize(EmailNormalizer.class, personne.getCourriel()));
+ personne.setNom(new StringTransformer(personne.getNom()).replaceAccents().replaceNonAlpha()
+ .replaceConsecutiveWhitespaces().trimToNull().toUpperCase().toString());
+ personne.setPrenom(new StringTransformer(personne.getPrenom()).replaceAccents().replaceNonAlpha()
+ .replaceConsecutiveWhitespaces().trimToNull().capitalizeFully().toString());
+ return personne;
+ }
}
\ No newline at end of file
Modified: trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/utils/normalizers/PurificationNormalizer.java
===================================================================
--- trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/utils/normalizers/PurificationNormalizer.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/utils/normalizers/PurificationNormalizer.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -35,21 +35,21 @@
*/
public final class PurificationNormalizer extends Normalizer<Purification> {
- /** {@inheritDoc} */
- @Override
- protected Purification normalize(Purification purification) {
- AssertTools.assertNotNull(purification);
- // Unique fields
- purification.setRef(Normalizer.normalize(UniqueFieldNormalizer.class, purification.getRef()));
- for (ParamMethoPuriEffectif param : purification.getParamsMetho()) {
- param.setValeur(new StringTransformer(param.getValeur()).trimToNull().replaceConsecutiveWhitespaces()
- .toString());
- }
- for (Fraction curFraction : purification.getFractions()) {
- curFraction.setRef(Normalizer.normalize(UniqueFieldNormalizer.class, curFraction.getRef()));
- }
+ /** {@inheritDoc} */
+ @Override
+ protected Purification normalize(Purification purification) {
+ AssertTools.assertNotNull(purification);
+ // Unique fields
+ purification.setRef(Normalizer.normalize(UniqueFieldNormalizer.class, purification.getRef()));
+ for (ParamMethoPuriEffectif param : purification.getParamsMetho()) {
+ param.setValeur(new StringTransformer(param.getValeur()).trimToNull().replaceConsecutiveWhitespaces()
+ .toString());
+ }
+ for (Fraction curFraction : purification.getFractions()) {
+ curFraction.setRef(Normalizer.normalize(UniqueFieldNormalizer.class, curFraction.getRef()));
+ }
- return purification;
- }
+ return purification;
+ }
}
Modified: trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/utils/normalizers/SpecimenNormalizer.java
===================================================================
--- trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/utils/normalizers/SpecimenNormalizer.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/utils/normalizers/SpecimenNormalizer.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -34,28 +34,28 @@
*/
public final class SpecimenNormalizer extends Normalizer<Specimen> {
- /** {@inheritDoc} */
- @Override
- protected Specimen normalize(Specimen specimen) {
- AssertTools.assertNotNull(specimen);
- // Unique fields
- specimen.setRef(normalize(UniqueFieldNormalizer.class, specimen.getRef()));
+ /** {@inheritDoc} */
+ @Override
+ protected Specimen normalize(Specimen specimen) {
+ AssertTools.assertNotNull(specimen);
+ // Unique fields
+ specimen.setRef(normalize(UniqueFieldNormalizer.class, specimen.getRef()));
- specimen.setEmbranchement(new StringTransformer(specimen.getEmbranchement()).replaceConsecutiveWhitespaces()
- .trimToNull().toLowerCase().capitalize().toString());
- specimen.setFamille(new StringTransformer(specimen.getFamille()).replaceConsecutiveWhitespaces().trimToNull()
- .toLowerCase().capitalize().toString());
- specimen.setGenre(new StringTransformer(specimen.getGenre()).replaceConsecutiveWhitespaces().trimToNull()
- .toLowerCase().capitalize().toString());
- specimen.setEspece(new StringTransformer(specimen.getEspece()).replaceConsecutiveWhitespaces().trimToNull()
- .toLowerCase().toString());
- specimen.setSousEspece(new StringTransformer(specimen.getSousEspece()).replaceConsecutiveWhitespaces()
- .trimToNull().toLowerCase().toString());
- specimen.setVariete(new StringTransformer(specimen.getVariete()).replaceConsecutiveWhitespaces().trimToNull()
- .toLowerCase().toString());
- specimen.setLieuDepot(new StringTransformer(specimen.getLieuDepot()).trimToNull()
- .replaceConsecutiveWhitespaces().toString());
+ specimen.setEmbranchement(new StringTransformer(specimen.getEmbranchement()).replaceConsecutiveWhitespaces()
+ .trimToNull().toLowerCase().capitalize().toString());
+ specimen.setFamille(new StringTransformer(specimen.getFamille()).replaceConsecutiveWhitespaces().trimToNull()
+ .toLowerCase().capitalize().toString());
+ specimen.setGenre(new StringTransformer(specimen.getGenre()).replaceConsecutiveWhitespaces().trimToNull()
+ .toLowerCase().capitalize().toString());
+ specimen.setEspece(new StringTransformer(specimen.getEspece()).replaceConsecutiveWhitespaces().trimToNull()
+ .toLowerCase().toString());
+ specimen.setSousEspece(new StringTransformer(specimen.getSousEspece()).replaceConsecutiveWhitespaces()
+ .trimToNull().toLowerCase().toString());
+ specimen.setVariete(new StringTransformer(specimen.getVariete()).replaceConsecutiveWhitespaces().trimToNull()
+ .toLowerCase().toString());
+ specimen.setLieuDepot(new StringTransformer(specimen.getLieuDepot()).trimToNull()
+ .replaceConsecutiveWhitespaces().toString());
- return specimen;
- }
+ return specimen;
+ }
}
Modified: trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/utils/normalizers/StationNormalizer.java
===================================================================
--- trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/utils/normalizers/StationNormalizer.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/utils/normalizers/StationNormalizer.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -34,15 +34,15 @@
*/
public final class StationNormalizer extends Normalizer<Station> {
- /** {@inheritDoc} */
- @Override
- protected Station normalize(Station station) {
- AssertTools.assertNotNull(station);
- // Unique fields
- station.setNom(normalize(UniqueFieldNormalizer.class, station.getNom()));
- // Autocompleted fields
- station.setLocalite(new StringTransformer(station.getLocalite()).replaceConsecutiveWhitespaces().trimToNull()
- .capitalizeFully().toString());
- return station;
- }
+ /** {@inheritDoc} */
+ @Override
+ protected Station normalize(Station station) {
+ AssertTools.assertNotNull(station);
+ // Unique fields
+ station.setNom(normalize(UniqueFieldNormalizer.class, station.getNom()));
+ // Autocompleted fields
+ station.setLocalite(new StringTransformer(station.getLocalite()).replaceConsecutiveWhitespaces().trimToNull()
+ .capitalizeFully().toString());
+ return station;
+ }
}
Modified: trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/utils/normalizers/TestBioNormalizer.java
===================================================================
--- trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/utils/normalizers/TestBioNormalizer.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/utils/normalizers/TestBioNormalizer.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -34,22 +34,22 @@
*/
public final class TestBioNormalizer extends Normalizer<TestBio> {
- /** {@inheritDoc} */
- @Override
- protected TestBio normalize(TestBio testBio) {
- AssertTools.assertNotNull(testBio);
- // Unique fields
- testBio.setRef(Normalizer.normalize(UniqueFieldNormalizer.class, testBio.getRef()));
- // Autocomplete field
- testBio.setOrganismeTesteur(new StringTransformer(testBio.getOrganismeTesteur())
- .replaceConsecutiveWhitespaces().trimToNull().capitalizeFully().toString());
- for (ResultatTestBio curResult : testBio.getResultats()) {
- curResult.setRepere(Normalizer.normalize(UniqueFieldNormalizer.class, curResult.getRepere()));
- // Autocomplete field
- curResult.setProduitTemoin(new StringTransformer(curResult.getProduitTemoin())
- .replaceConsecutiveWhitespaces().trimToNull().capitalizeFully().toString());
- }
+ /** {@inheritDoc} */
+ @Override
+ protected TestBio normalize(TestBio testBio) {
+ AssertTools.assertNotNull(testBio);
+ // Unique fields
+ testBio.setRef(Normalizer.normalize(UniqueFieldNormalizer.class, testBio.getRef()));
+ // Autocomplete field
+ testBio.setOrganismeTesteur(new StringTransformer(testBio.getOrganismeTesteur())
+ .replaceConsecutiveWhitespaces().trimToNull().capitalizeFully().toString());
+ for (ResultatTestBio curResult : testBio.getResultats()) {
+ curResult.setRepere(Normalizer.normalize(UniqueFieldNormalizer.class, curResult.getRepere()));
+ // Autocomplete field
+ curResult.setProduitTemoin(new StringTransformer(curResult.getProduitTemoin())
+ .replaceConsecutiveWhitespaces().trimToNull().capitalizeFully().toString());
+ }
- return testBio;
- }
+ return testBio;
+ }
}
Modified: trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/utils/normalizers/TypeDocumentNormalizer.java
===================================================================
--- trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/utils/normalizers/TypeDocumentNormalizer.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/utils/normalizers/TypeDocumentNormalizer.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -32,12 +32,12 @@
*/
public final class TypeDocumentNormalizer extends Normalizer<TypeDocument> {
- /** {@inheritDoc} */
- @Override
- protected TypeDocument normalize(TypeDocument typeDocument) {
- AssertTools.assertNotNull(typeDocument);
- // Unique field
- typeDocument.setNom(Normalizer.normalize(ConfigNameNormalizer.class, typeDocument.getNom()));
- return typeDocument;
- }
+ /** {@inheritDoc} */
+ @Override
+ protected TypeDocument normalize(TypeDocument typeDocument) {
+ AssertTools.assertNotNull(typeDocument);
+ // Unique field
+ typeDocument.setNom(Normalizer.normalize(ConfigNameNormalizer.class, typeDocument.getNom()));
+ return typeDocument;
+ }
}
Modified: trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/utils/normalizers/UniqueFieldNormalizer.java
===================================================================
--- trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/utils/normalizers/UniqueFieldNormalizer.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/utils/normalizers/UniqueFieldNormalizer.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -31,10 +31,10 @@
*/
public final class UniqueFieldNormalizer extends Normalizer<String> {
- /** {@inheritDoc} */
- @Override
- protected String normalize(String uniqueName) {
- return new StringTransformer(uniqueName).replaceAccents().replaceConsecutiveWhitespacesByUnderscore()
- .toUpperCase().trimToNull().toString();
- }
+ /** {@inheritDoc} */
+ @Override
+ protected String normalize(String uniqueName) {
+ return new StringTransformer(uniqueName).replaceAccents().replaceConsecutiveWhitespacesByUnderscore()
+ .toUpperCase().trimToNull().toString();
+ }
}
Modified: trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/utils/normalizers/utils/Normalize.java
===================================================================
--- trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/utils/normalizers/utils/Normalize.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/utils/normalizers/utils/Normalize.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -35,8 +35,8 @@
@Target(ElementType.PARAMETER)
@Retention(RetentionPolicy.RUNTIME)
public @interface Normalize {
- /**
- * @return Normalizer to use
- */
- Class<? extends Normalizer<?>> value();
+ /**
+ * @return Normalizer to use
+ */
+ Class<? extends Normalizer<?>> value();
}
Modified: trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/utils/normalizers/utils/Normalizer.java
===================================================================
--- trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/utils/normalizers/utils/Normalizer.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/utils/normalizers/utils/Normalizer.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -39,45 +39,45 @@
*/
public abstract class Normalizer<O> {
- /** Logger */
- private static final Log LOG = LogTools.getLog();
+ /** Logger */
+ private static final Log LOG = LogTools.getLog();
- /** Normalizers cache: normalizerClass + normalizer */
- private static final Map<Class<? extends Normalizer<?>>, Normalizer<?>> NORMALIZERS = Collections
- .synchronizedMap(new HashMap<Class<? extends Normalizer<?>>, Normalizer<?>>());
+ /** Normalizers cache: normalizerClass + normalizer */
+ private static final Map<Class<? extends Normalizer<?>>, Normalizer<?>> NORMALIZERS = Collections
+ .synchronizedMap(new HashMap<Class<? extends Normalizer<?>>, Normalizer<?>>());
- /**
- * Normalize data
- * @param <T> Data type
- * @param normalizerClass Normalizer class
- * @param object Data object
- * @return Normalized data
- */
- @SuppressWarnings("unchecked")
- public static <T> T normalize(Class<? extends Normalizer<T>> normalizerClass, T object) {
- Normalizer<T> normalizer;
- synchronized (NORMALIZERS) {
- normalizer = (Normalizer<T>) NORMALIZERS.get(normalizerClass);
- if (normalizer == null) {
- try {
- normalizer = normalizerClass.newInstance();
- } catch (InstantiationException e) {
- LOG.error(e.getMessage(), e);
- throw new UnexpectedException(e);
- } catch (IllegalAccessException e) {
- LOG.error(e.getMessage(), e);
- throw new UnexpectedException(e);
- }
- NORMALIZERS.put(normalizerClass, normalizer);
- }
- }
- return normalizer.normalize(object);
- }
+ /**
+ * Normalize data
+ * @param <T> Data type
+ * @param normalizerClass Normalizer class
+ * @param object Data object
+ * @return Normalized data
+ */
+ @SuppressWarnings("unchecked")
+ public static <T> T normalize(Class<? extends Normalizer<T>> normalizerClass, T object) {
+ Normalizer<T> normalizer;
+ synchronized (NORMALIZERS) {
+ normalizer = (Normalizer<T>) NORMALIZERS.get(normalizerClass);
+ if (normalizer == null) {
+ try {
+ normalizer = normalizerClass.newInstance();
+ } catch (InstantiationException e) {
+ LOG.error(e.getMessage(), e);
+ throw new UnexpectedException(e);
+ } catch (IllegalAccessException e) {
+ LOG.error(e.getMessage(), e);
+ throw new UnexpectedException(e);
+ }
+ NORMALIZERS.put(normalizerClass, normalizer);
+ }
+ }
+ return normalizer.normalize(object);
+ }
- /**
- * Normalize data
- * @param object Data object
- * @return Normalized data object
- */
- protected abstract O normalize(O object);
+ /**
+ * Normalize data
+ * @param object Data object
+ * @return Normalized data object
+ */
+ protected abstract O normalize(O object);
}
Modified: trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/utils/normalizers/utils/NormalizerAspect.java
===================================================================
--- trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/utils/normalizers/utils/NormalizerAspect.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/utils/normalizers/utils/NormalizerAspect.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -44,33 +44,33 @@
@Component
public final class NormalizerAspect {
- /** Logger */
- private static final Log LOG = LogTools.getLog();
+ /** Logger */
+ private static final Log LOG = LogTools.getLog();
- /**
- * Automatically normalizes data by wrapping methods with Normalize annotation on its parameters
- * @param joinPoint Joint point
- * @return Return of the method
- * @throws Throwable Throwable
- */
- @SuppressWarnings("unchecked")
- @Around("execution(* nc.ird.cantharella.service.services.*Service.*(..,@Normalize (*),..))")
- public Object normalize(ProceedingJoinPoint joinPoint) throws Throwable {
- Method method = ((MethodSignature) joinPoint.getSignature()).getMethod();
- // LOG.debug(method.getDeclaringClass().getSimpleName() + "." + method.getName() + "("
- // + Arrays.asList(method.getParameterTypes()) + ")");
- Object[] args = joinPoint.getArgs();
- Annotation[][] parameterAnnotations = method.getParameterAnnotations();
- for (int i = 0; i < parameterAnnotations.length; ++i) {
- for (Annotation annotation : parameterAnnotations[i]) {
- if (annotation instanceof Normalize) {
- args[i] = Normalizer.normalize((Class<Normalizer<Object>>) ((Normalize) annotation).value(),
- args[i]);
- LOG.debug("normalize : '" + args[i] + "' in " + method.getDeclaringClass().getSimpleName() + "."
- + method.getName() + "(" + Arrays.asList(method.getParameterTypes()) + ")");
- }
- }
- }
- return joinPoint.proceed(args);
- }
+ /**
+ * Automatically normalizes data by wrapping methods with Normalize annotation on its parameters
+ * @param joinPoint Joint point
+ * @return Return of the method
+ * @throws Throwable Throwable
+ */
+ @SuppressWarnings("unchecked")
+ @Around("execution(* nc.ird.cantharella.service.services.*Service.*(..,@Normalize (*),..))")
+ public Object normalize(ProceedingJoinPoint joinPoint) throws Throwable {
+ Method method = ((MethodSignature) joinPoint.getSignature()).getMethod();
+ // LOG.debug(method.getDeclaringClass().getSimpleName() + "." + method.getName() + "("
+ // + Arrays.asList(method.getParameterTypes()) + ")");
+ Object[] args = joinPoint.getArgs();
+ Annotation[][] parameterAnnotations = method.getParameterAnnotations();
+ for (int i = 0; i < parameterAnnotations.length; ++i) {
+ for (Annotation annotation : parameterAnnotations[i]) {
+ if (annotation instanceof Normalize) {
+ args[i] = Normalizer.normalize((Class<Normalizer<Object>>) ((Normalize) annotation).value(),
+ args[i]);
+ LOG.debug("normalize : '" + args[i] + "' in " + method.getDeclaringClass().getSimpleName() + "."
+ + method.getName() + "(" + Arrays.asList(method.getParameterTypes()) + ")");
+ }
+ }
+ }
+ return joinPoint.proceed(args);
+ }
}
Modified: trunk/cantharella.service/src/test/java/nc/ird/cantharella/service/AbstractServiceTest.java
===================================================================
--- trunk/cantharella.service/src/test/java/nc/ird/cantharella/service/AbstractServiceTest.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.service/src/test/java/nc/ird/cantharella/service/AbstractServiceTest.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -45,11 +45,11 @@
@Transactional
public abstract class AbstractServiceTest extends AbstractTransactionalJUnit4SpringContextTests {
- /**
- * Initialization
- */
- @Before
- public void setUp() {
- applicationContext.getAutowireCapableBeanFactory().autowireBean(this);
- }
+ /**
+ * Initialization
+ */
+ @Before
+ public void setUp() {
+ applicationContext.getAutowireCapableBeanFactory().autowireBean(this);
+ }
}
\ No newline at end of file
Modified: trunk/cantharella.service/src/test/java/nc/ird/cantharella/service/ServiceContextTest.java
===================================================================
--- trunk/cantharella.service/src/test/java/nc/ird/cantharella/service/ServiceContextTest.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.service/src/test/java/nc/ird/cantharella/service/ServiceContextTest.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -30,11 +30,11 @@
*/
public final class ServiceContextTest extends AbstractServiceTest {
- /**
- * Test context
- */
- @Test
- public void context() {
- //
- }
+ /**
+ * Test context
+ */
+ @Test
+ public void context() {
+ //
+ }
}
Modified: trunk/cantharella.service/src/test/java/nc/ird/cantharella/service/exceptions/ExcelImportException.java
===================================================================
--- trunk/cantharella.service/src/test/java/nc/ird/cantharella/service/exceptions/ExcelImportException.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.service/src/test/java/nc/ird/cantharella/service/exceptions/ExcelImportException.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -30,21 +30,21 @@
*/
public class ExcelImportException extends AbstractException {
- /**
- * Constructor
- * @param message Message
- */
- public ExcelImportException(String message) {
- super(message);
- }
+ /**
+ * Constructor
+ * @param message Message
+ */
+ public ExcelImportException(String message) {
+ super(message);
+ }
- /**
- * Constructor
- * @param message Message
- * @param cause Cause
- */
- public ExcelImportException(String message, Exception cause) {
- super(message, cause);
- }
+ /**
+ * Constructor
+ * @param message Message
+ * @param cause Cause
+ */
+ public ExcelImportException(String message, Exception cause) {
+ super(message, cause);
+ }
}
Modified: trunk/cantharella.service/src/test/java/nc/ird/cantharella/service/services/PersonneServiceTest.java
===================================================================
--- trunk/cantharella.service/src/test/java/nc/ird/cantharella/service/services/PersonneServiceTest.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.service/src/test/java/nc/ird/cantharella/service/services/PersonneServiceTest.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -38,28 +38,28 @@
*/
public final class PersonneServiceTest extends AbstractServiceTest {
- /** Personne service */
- @Autowired
- private PersonneService personneService;
+ /** Personne service */
+ @Autowired
+ private PersonneService personneService;
- /**
- * Test: checkOrCreateAdmin
- * @throws DataConstraintException -
- */
- @Test
- public void checkOrCreateAdmin() throws DataConstraintException {
- personneService.checkOrCreateAdmin();
- }
+ /**
+ * Test: checkOrCreateAdmin
+ * @throws DataConstraintException -
+ */
+ @Test
+ public void checkOrCreateAdmin() throws DataConstraintException {
+ personneService.checkOrCreateAdmin();
+ }
- /**
- * Test: load
- * @throws DataNotFoundException -
- * @throws DataConstraintException
- */
- @Test
- public void load() throws DataNotFoundException, DataConstraintException {
- personneService.checkOrCreateAdmin();
- List<Personne> personnes = personneService.listPersonnes();
- personneService.loadPersonne(personnes.get(0).getCourriel().toUpperCase());
- }
+ /**
+ * Test: load
+ * @throws DataNotFoundException -
+ * @throws DataConstraintException
+ */
+ @Test
+ public void load() throws DataNotFoundException, DataConstraintException {
+ personneService.checkOrCreateAdmin();
+ List<Personne> personnes = personneService.listPersonnes();
+ personneService.loadPersonne(personnes.get(0).getCourriel().toUpperCase());
+ }
}
Modified: trunk/cantharella.service/src/test/java/nc/ird/cantharella/service/utils/ExcelColumnStructure.java
===================================================================
--- trunk/cantharella.service/src/test/java/nc/ird/cantharella/service/utils/ExcelColumnStructure.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.service/src/test/java/nc/ird/cantharella/service/utils/ExcelColumnStructure.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -28,41 +28,41 @@
*/
public class ExcelColumnStructure {
- /** Name of the column **/
- public String name;
+ /** Name of the column **/
+ public String name;
- /**
- * Different type of value used for the importation
- */
- public enum ExcelColumnType {
- /** string **/
- STRING,
- /** integer **/
- INTEGER,
- /** float number **/
- REEL,
- /** date **/
- DATE,
- /** boolean **/
- BOOLEAN
- }
+ /**
+ * Different type of value used for the importation
+ */
+ public enum ExcelColumnType {
+ /** string **/
+ STRING,
+ /** integer **/
+ INTEGER,
+ /** float number **/
+ REEL,
+ /** date **/
+ DATE,
+ /** boolean **/
+ BOOLEAN
+ }
- /** Type of the column **/
- public ExcelColumnType type;
+ /** Type of the column **/
+ public ExcelColumnType type;
- /** If a value is required for each row of that column */
- public boolean required;
+ /** If a value is required for each row of that column */
+ public boolean required;
- /**
- * Constructor
- * @param name Name of the column
- * @param type Type of the column
- * @param required If a value is required for each row of that column
- */
- public ExcelColumnStructure(String name, ExcelColumnType type, boolean required) {
- this.name = name;
- this.type = type;
- this.required = required;
- }
+ /**
+ * Constructor
+ * @param name Name of the column
+ * @param type Type of the column
+ * @param required If a value is required for each row of that column
+ */
+ public ExcelColumnStructure(String name, ExcelColumnType type, boolean required) {
+ this.name = name;
+ this.type = type;
+ this.required = required;
+ }
}
Modified: trunk/cantharella.service/src/test/java/nc/ird/cantharella/service/utils/ExcelColumnsReader.java
===================================================================
--- trunk/cantharella.service/src/test/java/nc/ird/cantharella/service/utils/ExcelColumnsReader.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.service/src/test/java/nc/ird/cantharella/service/utils/ExcelColumnsReader.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -49,312 +49,312 @@
*/
public final class ExcelColumnsReader {
- /** True value in string **/
- private final static String TRUE_STRING = "true";
+ /** True value in string **/
+ private final static String TRUE_STRING = "true";
- /** False value in string **/
- private final static String FALSE_STRING = "false";
+ /** False value in string **/
+ private final static String FALSE_STRING = "false";
- /** Excel workbook which contain sheets of information **/
- private HSSFWorkbook workbook;
+ /** Excel workbook which contain sheets of information **/
+ private HSSFWorkbook workbook;
- /** current structure sheet browsed */
- private ExcelSheetStructure currentSheetStructure;
+ /** current structure sheet browsed */
+ private ExcelSheetStructure currentSheetStructure;
- /** Index of the current line of the current sheet **/
- private int currentNumLine;
+ /** Index of the current line of the current sheet **/
+ private int currentNumLine;
- /** Structure asked for the Excel file **/
- private List<ExcelSheetStructure> excelStructureAsked;
+ /** Structure asked for the Excel file **/
+ private List<ExcelSheetStructure> excelStructureAsked;
- /**
- * Give indexes of a sheet's columns. Access by the name of the sheet then by the name of the column
- **/
- private Map<String, Map<String, Integer>> columnsIndexes;
+ /**
+ * Give indexes of a sheet's columns. Access by the name of the sheet then by the name of the column
+ **/
+ private Map<String, Map<String, Integer>> columnsIndexes;
- /**
- * Constructor
- * @param inputStream Stream which contain Excel data
- * @param fileStructureAsked Structure asked for the Excel file
- * @throws IOException -
- * @throws ExcelImportException -
- */
- public ExcelColumnsReader(InputStream inputStream, List<ExcelSheetStructure> fileStructureAsked)
- throws IOException, ExcelImportException {
- POIFSFileSystem file = new POIFSFileSystem(inputStream);
- workbook = new HSSFWorkbook(file);
+ /**
+ * Constructor
+ * @param inputStream Stream which contain Excel data
+ * @param fileStructureAsked Structure asked for the Excel file
+ * @throws IOException -
+ * @throws ExcelImportException -
+ */
+ public ExcelColumnsReader(InputStream inputStream, List<ExcelSheetStructure> fileStructureAsked)
+ throws IOException, ExcelImportException {
+ POIFSFileSystem file = new POIFSFileSystem(inputStream);
+ workbook = new HSSFWorkbook(file);
- if (fileStructureAsked.isEmpty()) {
- throw new ExcelImportException("The structure given to the Excel Reader doesn't contain any sheet");
- }
- this.excelStructureAsked = fileStructureAsked;
+ if (fileStructureAsked.isEmpty()) {
+ throw new ExcelImportException("The structure given to the Excel Reader doesn't contain any sheet");
+ }
+ this.excelStructureAsked = fileStructureAsked;
- currentSheetStructure = fileStructureAsked.get(0);
- currentNumLine = workbook.getSheet(currentSheetStructure.name).getFirstRowNum();
+ currentSheetStructure = fileStructureAsked.get(0);
+ currentNumLine = workbook.getSheet(currentSheetStructure.name).getFirstRowNum();
- columnsIndexes = new HashMap<String, Map<String, Integer>>();
+ columnsIndexes = new HashMap<String, Map<String, Integer>>();
- findIndexesColumns();
- }
+ findIndexesColumns();
+ }
- /**
- * Return the names of the autorized sheet (according to the structure given at the reader)
- * @return this names
- */
- public List<String> getSheetNames() {
- List<String> names = new ArrayList<String>();
- for (ExcelSheetStructure curSheetStruct : excelStructureAsked) {
- names.add(curSheetStruct.name);
- }
- return names;
- }
+ /**
+ * Return the names of the autorized sheet (according to the structure given at the reader)
+ * @return this names
+ */
+ public List<String> getSheetNames() {
+ List<String> names = new ArrayList<String>();
+ for (ExcelSheetStructure curSheetStruct : excelStructureAsked) {
+ names.add(curSheetStruct.name);
+ }
+ return names;
+ }
- /**
- * Find the index for each column name (in the first row) of each sheet of the given structure file
- * @throws ExcelImportException if a sheet or a column name is not found
- */
- private void findIndexesColumns() throws ExcelImportException {
+ /**
+ * Find the index for each column name (in the first row) of each sheet of the given structure file
+ * @throws ExcelImportException if a sheet or a column name is not found
+ */
+ private void findIndexesColumns() throws ExcelImportException {
- for (ExcelSheetStructure structAsked : excelStructureAsked) {
- HSSFSheet curSheet = workbook.getSheet(structAsked.name);
- // verify the existance of the sheet
- if (curSheet == null) {
- throw new ExcelImportException("'" + structAsked.name + "' sheet not found in the specified Excel file");
- }
+ for (ExcelSheetStructure structAsked : excelStructureAsked) {
+ HSSFSheet curSheet = workbook.getSheet(structAsked.name);
+ // verify the existance of the sheet
+ if (curSheet == null) {
+ throw new ExcelImportException("'" + structAsked.name + "' sheet not found in the specified Excel file");
+ }
- columnsIndexes.put(structAsked.name, new HashMap<String, Integer>());
- // verify the existance of the sheet columns
- for (ExcelColumnStructure col : structAsked.columns) {
- // get the header line
- HSSFRow header = curSheet.getRow(curSheet.getFirstRowNum());
- AssertTools.assertNotNull(header);
+ columnsIndexes.put(structAsked.name, new HashMap<String, Integer>());
+ // verify the existance of the sheet columns
+ for (ExcelColumnStructure col : structAsked.columns) {
+ // get the header line
+ HSSFRow header = curSheet.getRow(curSheet.getFirstRowNum());
+ AssertTools.assertNotNull(header);
- int i = header.getFirstCellNum();
- HSSFCell curCell = header.getCell(i);
+ int i = header.getFirstCellNum();
+ HSSFCell curCell = header.getCell(i);
- boolean columnFinded = false;
- // look for the colName in the header (blank cell terminate the header)
- while (!columnFinded && curCell != null && curCell.getCellType() != Cell.CELL_TYPE_BLANK) {
- if (curCell.getStringCellValue().trim().toLowerCase().equals(col.name.toLowerCase())) {
- columnFinded = true;
- } else {
- i++;
- curCell = header.getCell(i);
- }
- }
+ boolean columnFinded = false;
+ // look for the colName in the header (blank cell terminate the header)
+ while (!columnFinded && curCell != null && curCell.getCellType() != Cell.CELL_TYPE_BLANK) {
+ if (curCell.getStringCellValue().trim().toLowerCase().equals(col.name.toLowerCase())) {
+ columnFinded = true;
+ } else {
+ i++;
+ curCell = header.getCell(i);
+ }
+ }
- if (!columnFinded) {
- throw new ExcelImportException("'" + col.name + "' not found in the header of the '"
- + structAsked.name + "' sheet");
- }
+ if (!columnFinded) {
+ throw new ExcelImportException("'" + col.name + "' not found in the header of the '"
+ + structAsked.name + "' sheet");
+ }
- // update of the index in the map
- columnsIndexes.get(structAsked.name).put(col.name, i);
- }
- }
- }
+ // update of the index in the map
+ columnsIndexes.get(structAsked.name).put(col.name, i);
+ }
+ }
+ }
- /**
- * Move to the beggining of the given sheet and return the structure of its columns
- * @param sheetName name of the sheet
- * @return the list of the columns of the sheet according to the structure given to the Excel Reader
- * @throws ExcelImportException if the sheet is not autorized according to the structure given to the Excel Reader
- */
- public List<ExcelColumnStructure> selectSheet(String sheetName) throws ExcelImportException {
+ /**
+ * Move to the beggining of the given sheet and return the structure of its columns
+ * @param sheetName name of the sheet
+ * @return the list of the columns of the sheet according to the structure given to the Excel Reader
+ * @throws ExcelImportException if the sheet is not autorized according to the structure given to the Excel Reader
+ */
+ public List<ExcelColumnStructure> selectSheet(String sheetName) throws ExcelImportException {
- Iterator<ExcelSheetStructure> itStructSheet = excelStructureAsked.iterator();
+ Iterator<ExcelSheetStructure> itStructSheet = excelStructureAsked.iterator();
- while (itStructSheet.hasNext()) {
- ExcelSheetStructure structSheet = itStructSheet.next();
- if (sheetName != null && sheetName.equals(structSheet.name)) {
- currentSheetStructure = structSheet;
- // +1 for the second line
- currentNumLine = workbook.getSheet(currentSheetStructure.name).getFirstRowNum() + 1;
- return structSheet.columns;
- }
- }
+ while (itStructSheet.hasNext()) {
+ ExcelSheetStructure structSheet = itStructSheet.next();
+ if (sheetName != null && sheetName.equals(structSheet.name)) {
+ currentSheetStructure = structSheet;
+ // +1 for the second line
+ currentNumLine = workbook.getSheet(currentSheetStructure.name).getFirstRowNum() + 1;
+ return structSheet.columns;
+ }
+ }
- throw new ExcelImportException("'" + sheetName
- + "' is not autorized according to the structure given to the Excel Reader");
- }
+ throw new ExcelImportException("'" + sheetName
+ + "' is not autorized according to the structure given to the Excel Reader");
+ }
- /**
- * Read a line of the Excel file current sheet Read the columns specified to the structure given to Excel Reader
- * @return A map which represent a line with the name of column as key
- * @throws ExcelImportException If error in retrieving a cell value
- */
- public Map<String, Object> readLine() throws ExcelImportException {
- Map<String, Object> line = new HashMap<String, Object>();
+ /**
+ * Read a line of the Excel file current sheet Read the columns specified to the structure given to Excel Reader
+ * @return A map which represent a line with the name of column as key
+ * @throws ExcelImportException If error in retrieving a cell value
+ */
+ public Map<String, Object> readLine() throws ExcelImportException {
+ Map<String, Object> line = new HashMap<String, Object>();
- HSSFRow row = workbook.getSheet(currentSheetStructure.name).getRow(currentNumLine);
- if (row != null) {
- for (ExcelColumnStructure curCol : currentSheetStructure.columns) {
- Integer indCol = columnsIndexes.get(currentSheetStructure.name).get(curCol.name);
- Object cellVal = null;
- try {
- cellVal = checkColumnValue(getCellValue(row.getCell(indCol)), curCol);
- } catch (ExcelImportException e) {
- throw new ExcelImportException("Error in retrieving the cell value : sheet '"
- + currentSheetStructure.name + "', line " + Integer.toString(currentNumLine) + ", column '"
- + curCol.name + "'", e);
- } catch (RuntimeException e) {
- throw new ExcelImportException("Error in retrieving the cell value : sheet '"
- + currentSheetStructure.name + "', line " + Integer.toString(currentNumLine) + ", column '"
- + curCol.name + "'", e);
- }
+ HSSFRow row = workbook.getSheet(currentSheetStructure.name).getRow(currentNumLine);
+ if (row != null) {
+ for (ExcelColumnStructure curCol : currentSheetStructure.columns) {
+ Integer indCol = columnsIndexes.get(currentSheetStructure.name).get(curCol.name);
+ Object cellVal = null;
+ try {
+ cellVal = checkColumnValue(getCellValue(row.getCell(indCol)), curCol);
+ } catch (ExcelImportException e) {
+ throw new ExcelImportException("Error in retrieving the cell value : sheet '"
+ + currentSheetStructure.name + "', line " + Integer.toString(currentNumLine) + ", column '"
+ + curCol.name + "'", e);
+ } catch (RuntimeException e) {
+ throw new ExcelImportException("Error in retrieving the cell value : sheet '"
+ + currentSheetStructure.name + "', line " + Integer.toString(currentNumLine) + ", column '"
+ + curCol.name + "'", e);
+ }
- line.put(curCol.name, cellVal);
- }
- currentNumLine++;
- }
- return line;
- }
+ line.put(curCol.name, cellVal);
+ }
+ currentNumLine++;
+ }
+ return line;
+ }
- /**
- * Check the cell value type according its column definition from the structure given at the Excel Reader If it's
- * possible, convert the cell value in the right type
- * @param cellValue The source value
- * @param curCol The column definition
- * @return The value in the right type
- * @throws ExcelImportException If the cellValue doesn't respect the expected type
- */
- private Object checkColumnValue(Object cellValue, ExcelColumnStructure curCol) throws ExcelImportException {
- // check is it required and no value
- if (cellValue == null && curCol.required) {
- throw new ExcelImportException("Value required for the cell value : sheet '" + currentSheetStructure.name
- + "', line " + Integer.toString(currentNumLine) + ", column '" + curCol.name + "'");
- }
- // check the good type of value
- switch (curCol.type) {
- case STRING:
- if (cellValue instanceof Double) {
- Double doubleVal = (Double) cellValue;
- if (new Double(Math.round(doubleVal)) == doubleVal) {
- // if no float part
- return doubleVal.toString();
- }
- // with float part
- String strVal = doubleVal.toString();
- return strVal.substring(0, strVal.length() - 2);
- }
- // if not a numeric
- if (cellValue == null) {
- return "";
- }
- return cellValue.toString();
- case REEL:
- if (cellValue instanceof Double) {
- return cellValue;
- }
- // if not a numeric, exception
- throw new ExcelImportException("The cell value must be a reel : sheet '" + currentSheetStructure.name
- + "', line " + Integer.toString(currentNumLine) + ", column '" + curCol.name + "'");
- case INTEGER:
- if (cellValue instanceof Double) {
- Double doubleVal = (Double) cellValue;
- if (new Double(Math.round(doubleVal)) == doubleVal) {
- // if it's an integer, ok
- return doubleVal.intValue();
- }
- // if it's a float
- throw new ExcelImportException("The cell value must be a integer : sheet '"
- + currentSheetStructure.name + "', line " + Integer.toString(currentNumLine) + ", column '"
- + curCol.name + "'");
- }
- throw new ExcelImportException("The cell value must be a integer : sheet '"
- + currentSheetStructure.name + "', line " + Integer.toString(currentNumLine) + ", column '"
- + curCol.name + "'");
- case DATE:
- if (cellValue instanceof Date) {
- return cellValue;
- }
- // is it's not a date
- throw new ExcelImportException("The cell value must be a date : sheet '" + currentSheetStructure.name
- + "', line " + Integer.toString(currentNumLine) + ", column '" + curCol.name + "'");
- case BOOLEAN:
- if (cellValue instanceof Boolean) {
- return cellValue;
- } else if (cellValue instanceof String
- && (StringUtils.lowerCase(StringUtils.trim(TRUE_STRING)).equals(
- StringUtils.lowerCase(StringUtils.trim((String) cellValue))) || StringUtils.lowerCase(
- StringUtils.trim(FALSE_STRING)).equals(
- StringUtils.lowerCase(StringUtils.trim((String) cellValue))))) {
- // if "true" or "false" are written in string
- if (StringUtils.lowerCase(StringUtils.trim(TRUE_STRING)).equals(
- StringUtils.lowerCase(StringUtils.trim((String) cellValue)))) {
- return true;
- }
- return false;
- }
- // is it's not boolean or a string
- throw new ExcelImportException("The cell value must be a date : sheet '" + currentSheetStructure.name
- + "', line " + Integer.toString(currentNumLine) + ", column '" + curCol.name + "'");
- }
- // for compiler
- return null;
- }
+ /**
+ * Check the cell value type according its column definition from the structure given at the Excel Reader If it's
+ * possible, convert the cell value in the right type
+ * @param cellValue The source value
+ * @param curCol The column definition
+ * @return The value in the right type
+ * @throws ExcelImportException If the cellValue doesn't respect the expected type
+ */
+ private Object checkColumnValue(Object cellValue, ExcelColumnStructure curCol) throws ExcelImportException {
+ // check is it required and no value
+ if (cellValue == null && curCol.required) {
+ throw new ExcelImportException("Value required for the cell value : sheet '" + currentSheetStructure.name
+ + "', line " + Integer.toString(currentNumLine) + ", column '" + curCol.name + "'");
+ }
+ // check the good type of value
+ switch (curCol.type) {
+ case STRING:
+ if (cellValue instanceof Double) {
+ Double doubleVal = (Double) cellValue;
+ if (new Double(Math.round(doubleVal)) == doubleVal) {
+ // if no float part
+ return doubleVal.toString();
+ }
+ // with float part
+ String strVal = doubleVal.toString();
+ return strVal.substring(0, strVal.length() - 2);
+ }
+ // if not a numeric
+ if (cellValue == null) {
+ return "";
+ }
+ return cellValue.toString();
+ case REEL:
+ if (cellValue instanceof Double) {
+ return cellValue;
+ }
+ // if not a numeric, exception
+ throw new ExcelImportException("The cell value must be a reel : sheet '" + currentSheetStructure.name
+ + "', line " + Integer.toString(currentNumLine) + ", column '" + curCol.name + "'");
+ case INTEGER:
+ if (cellValue instanceof Double) {
+ Double doubleVal = (Double) cellValue;
+ if (new Double(Math.round(doubleVal)) == doubleVal) {
+ // if it's an integer, ok
+ return doubleVal.intValue();
+ }
+ // if it's a float
+ throw new ExcelImportException("The cell value must be a integer : sheet '"
+ + currentSheetStructure.name + "', line " + Integer.toString(currentNumLine) + ", column '"
+ + curCol.name + "'");
+ }
+ throw new ExcelImportException("The cell value must be a integer : sheet '"
+ + currentSheetStructure.name + "', line " + Integer.toString(currentNumLine) + ", column '"
+ + curCol.name + "'");
+ case DATE:
+ if (cellValue instanceof Date) {
+ return cellValue;
+ }
+ // is it's not a date
+ throw new ExcelImportException("The cell value must be a date : sheet '" + currentSheetStructure.name
+ + "', line " + Integer.toString(currentNumLine) + ", column '" + curCol.name + "'");
+ case BOOLEAN:
+ if (cellValue instanceof Boolean) {
+ return cellValue;
+ } else if (cellValue instanceof String
+ && (StringUtils.lowerCase(StringUtils.trim(TRUE_STRING)).equals(
+ StringUtils.lowerCase(StringUtils.trim((String) cellValue))) || StringUtils.lowerCase(
+ StringUtils.trim(FALSE_STRING)).equals(
+ StringUtils.lowerCase(StringUtils.trim((String) cellValue))))) {
+ // if "true" or "false" are written in string
+ if (StringUtils.lowerCase(StringUtils.trim(TRUE_STRING)).equals(
+ StringUtils.lowerCase(StringUtils.trim((String) cellValue)))) {
+ return true;
+ }
+ return false;
+ }
+ // is it's not boolean or a string
+ throw new ExcelImportException("The cell value must be a date : sheet '" + currentSheetStructure.name
+ + "', line " + Integer.toString(currentNumLine) + ", column '" + curCol.name + "'");
+ }
+ // for compiler
+ return null;
+ }
- /**
- * Get the value of the specified cell
- * @param cell the cell
- * @return this value according to the type of the cell<br/>
- * (BLANK -> null, STRING -> String, NUMERIC -> Double, BOOLEAN -> Boolean, FORMULA -> Double, ERROR -> exception)
- * @throws ExcelImportException Exception if error cell or formula don't get a numeric value
- */
- private Object getCellValue(HSSFCell cell) throws ExcelImportException {
- if (cell == null) {
- return null;
- }
+ /**
+ * Get the value of the specified cell
+ * @param cell the cell
+ * @return this value according to the type of the cell<br/>
+ * (BLANK -> null, STRING -> String, NUMERIC -> Double, BOOLEAN -> Boolean, FORMULA -> Double, ERROR -> exception)
+ * @throws ExcelImportException Exception if error cell or formula don't get a numeric value
+ */
+ private Object getCellValue(HSSFCell cell) throws ExcelImportException {
+ if (cell == null) {
+ return null;
+ }
- switch (cell.getCellType()) {
- case Cell.CELL_TYPE_BLANK:
- return null;
- case Cell.CELL_TYPE_STRING:
- return cell.getStringCellValue();
- case Cell.CELL_TYPE_NUMERIC:
- if (DateUtil.isCellDateFormatted(cell)) {
- // if it's a date
- return DateUtil.getJavaDate(cell.getNumericCellValue());
- }
- return cell.getNumericCellValue();
- case Cell.CELL_TYPE_BOOLEAN:
- return cell.getBooleanCellValue();
- case Cell.CELL_TYPE_FORMULA:
- Double numeric = cell.getNumericCellValue();
+ switch (cell.getCellType()) {
+ case Cell.CELL_TYPE_BLANK:
+ return null;
+ case Cell.CELL_TYPE_STRING:
+ return cell.getStringCellValue();
+ case Cell.CELL_TYPE_NUMERIC:
+ if (DateUtil.isCellDateFormatted(cell)) {
+ // if it's a date
+ return DateUtil.getJavaDate(cell.getNumericCellValue());
+ }
+ return cell.getNumericCellValue();
+ case Cell.CELL_TYPE_BOOLEAN:
+ return cell.getBooleanCellValue();
+ case Cell.CELL_TYPE_FORMULA:
+ Double numeric = cell.getNumericCellValue();
- if (numeric.isNaN()) {
- // if it's "Not a Number", exception
- throw new ExcelImportException("Impossible to get a numeric value from the formula");
- }
- return numeric;
- case Cell.CELL_TYPE_ERROR:
- throw new ExcelImportException("Error cell detected");
- }
- // no case for this return
- return null;
- }
+ if (numeric.isNaN()) {
+ // if it's "Not a Number", exception
+ throw new ExcelImportException("Impossible to get a numeric value from the formula");
+ }
+ return numeric;
+ case Cell.CELL_TYPE_ERROR:
+ throw new ExcelImportException("Error cell detected");
+ }
+ // no case for this return
+ return null;
+ }
- /**
- * fileStructureAsked getter
- * @return fileStructureAsked
- */
- public List<ExcelSheetStructure> getFileStructureAsked() {
- return excelStructureAsked;
- }
+ /**
+ * fileStructureAsked getter
+ * @return fileStructureAsked
+ */
+ public List<ExcelSheetStructure> getFileStructureAsked() {
+ return excelStructureAsked;
+ }
- /**
- * fileStructureAsked setter
- * @param fileStructureAsked fileStructureAsked
- */
- public void setFileStructureAsked(List<ExcelSheetStructure> fileStructureAsked) {
- this.excelStructureAsked = fileStructureAsked;
- }
+ /**
+ * fileStructureAsked setter
+ * @param fileStructureAsked fileStructureAsked
+ */
+ public void setFileStructureAsked(List<ExcelSheetStructure> fileStructureAsked) {
+ this.excelStructureAsked = fileStructureAsked;
+ }
- /**
- * currentNumLine getter
- * @return currentNumLine
- */
- public int getCurrentNumLine() {
- return currentNumLine;
- }
+ /**
+ * currentNumLine getter
+ * @return currentNumLine
+ */
+ public int getCurrentNumLine() {
+ return currentNumLine;
+ }
}
Modified: trunk/cantharella.service/src/test/java/nc/ird/cantharella/service/utils/ExcelSheetStructure.java
===================================================================
--- trunk/cantharella.service/src/test/java/nc/ird/cantharella/service/utils/ExcelSheetStructure.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.service/src/test/java/nc/ird/cantharella/service/utils/ExcelSheetStructure.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -30,19 +30,19 @@
*/
public final class ExcelSheetStructure {
- /** Name of the sheet **/
- public String name;
+ /** Name of the sheet **/
+ public String name;
- /** Sheet's columns **/
- public List<ExcelColumnStructure> columns;
+ /** Sheet's columns **/
+ public List<ExcelColumnStructure> columns;
- /**
- * Constructor
- * @param name The name of the sheet
- * @param columns The columns asked to the sheet
- */
- public ExcelSheetStructure(String name, List<ExcelColumnStructure> columns) {
- this.name = name;
- this.columns = columns;
- }
+ /**
+ * Constructor
+ * @param name The name of the sheet
+ * @param columns The columns asked to the sheet
+ */
+ public ExcelSheetStructure(String name, List<ExcelColumnStructure> columns) {
+ this.name = name;
+ this.columns = columns;
+ }
}
Modified: trunk/cantharella.service/src/test/java/nc/ird/cantharella/service/utils/PopulateDB.java
===================================================================
--- trunk/cantharella.service/src/test/java/nc/ird/cantharella/service/utils/PopulateDB.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.service/src/test/java/nc/ird/cantharella/service/utils/PopulateDB.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -77,581 +77,581 @@
*/
public final class PopulateDB {
- /** Logger */
- private static final Log LOG = LogTools.getLog();
+ /** Logger */
+ private static final Log LOG = LogTools.getLog();
- /** Date format */
- private static final DateFormat DATE_FORMAT = new SimpleDateFormat("d/M/y");
+ /** Date format */
+ private static final DateFormat DATE_FORMAT = new SimpleDateFormat("d/M/y");
- /** Excel file structure used to import datas */
- private List<ExcelSheetStructure> excelFileStructure;
+ /** Excel file structure used to import datas */
+ private List<ExcelSheetStructure> excelFileStructure;
- /** Service : campagne */
- @Autowired
- private CampagneService campagneService;
+ /** Service : campagne */
+ @Autowired
+ private CampagneService campagneService;
- /** Service : lot */
- @Autowired
- private LotService lotService;
+ /** Service : lot */
+ @Autowired
+ private LotService lotService;
- /** Service : personne */
- @Autowired
- private PersonneService personneService;
+ /** Service : personne */
+ @Autowired
+ private PersonneService personneService;
- /** Service : spécimen */
- private SpecimenService specimenService;
+ /** Service : spécimen */
+ private SpecimenService specimenService;
- /** Service : station */
- @Autowired
- private StationService stationService;
+ /** Service : station */
+ @Autowired
+ private StationService stationService;
- /**
- * Main
- * @param args Arguments
- * @throws DataConstraintException -
- * @throws IOException -
- * @throws ExcelImportException -
- * @throws DataNotFoundException -
- */
- public static void main(String[] args) throws DataConstraintException, ExcelImportException, IOException,
- DataNotFoundException {
- new PopulateDB();
- }
+ /**
+ * Main
+ * @param args Arguments
+ * @throws DataConstraintException -
+ * @throws IOException -
+ * @throws ExcelImportException -
+ * @throws DataNotFoundException -
+ */
+ public static void main(String[] args) throws DataConstraintException, ExcelImportException, IOException,
+ DataNotFoundException {
+ new PopulateDB();
+ }
- /**
- * Constructor
- * @throws DataConstraintException -
- * @throws IOException -
- * @throws ExcelImportException -
- * @throws DataNotFoundException -
- */
- public PopulateDB() throws DataConstraintException, IOException, ExcelImportException, DataNotFoundException {
- ApplicationContext ctx = new AnnotationConfigApplicationContext(ServiceContext.class);
- ctx.getAutowireCapableBeanFactory().autowireBean(this);
+ /**
+ * Constructor
+ * @throws DataConstraintException -
+ * @throws IOException -
+ * @throws ExcelImportException -
+ * @throws DataNotFoundException -
+ */
+ public PopulateDB() throws DataConstraintException, IOException, ExcelImportException, DataNotFoundException {
+ ApplicationContext ctx = new AnnotationConfigApplicationContext(ServiceContext.class);
+ ctx.getAutowireCapableBeanFactory().autowireBean(this);
- ServiceContext.setMailActivated(false);
+ ServiceContext.setMailActivated(false);
- initExcelFileStructure();
+ initExcelFileStructure();
- InputStream excelStream = FileUtils.openInputStream(new File(
- "/home/adri/workspace/echange_doc/equipe-is/cantharella/jeu_de_donnees.xls"));
+ InputStream excelStream = FileUtils.openInputStream(new File(
+ "/home/adri/workspace/echange_doc/equipe-is/cantharella/jeu_de_donnees.xls"));
- ExcelColumnsReader excelReader = new ExcelColumnsReader(excelStream, excelFileStructure);
- populateAll(excelReader);
+ ExcelColumnsReader excelReader = new ExcelColumnsReader(excelStream, excelFileStructure);
+ populateAll(excelReader);
- excelStream.close();
- }
+ excelStream.close();
+ }
- /**
- * @param excelReader -
- * @throws DataConstraintException -
- * @throws ExcelImportException -
- * @throws DataNotFoundException -
- */
- @Transactional
- public void populateAll(ExcelColumnsReader excelReader) throws ExcelImportException, DataConstraintException,
- DataNotFoundException {
- populatePersonneUtilisateur(excelReader);
- populateCampagne(excelReader);
- populateCampagnePersonneDroits(excelReader);
- // populateCampagnePersonneParticipants(excelReader);
- populateStation(excelReader);
- }
+ /**
+ * @param excelReader -
+ * @throws DataConstraintException -
+ * @throws ExcelImportException -
+ * @throws DataNotFoundException -
+ */
+ @Transactional
+ public void populateAll(ExcelColumnsReader excelReader) throws ExcelImportException, DataConstraintException,
+ DataNotFoundException {
+ populatePersonneUtilisateur(excelReader);
+ populateCampagne(excelReader);
+ populateCampagnePersonneDroits(excelReader);
+ // populateCampagnePersonneParticipants(excelReader);
+ populateStation(excelReader);
+ }
- /**
- * Initialise the structure asked for the Excel file
- */
- private void initExcelFileStructure() {
+ /**
+ * Initialise the structure asked for the Excel file
+ */
+ private void initExcelFileStructure() {
- excelFileStructure = new ArrayList<ExcelSheetStructure>();
+ excelFileStructure = new ArrayList<ExcelSheetStructure>();
- // structure for the entities 'personne'
- ExcelColumnStructure[] personneColsArray = new ExcelColumnStructure[] {
- new ExcelColumnStructure("nom", ExcelColumnType.STRING, true),
- new ExcelColumnStructure("prenom", ExcelColumnType.STRING, true),
- new ExcelColumnStructure("organisme", ExcelColumnType.STRING, true),
- new ExcelColumnStructure("fonction", ExcelColumnType.STRING, false),
- new ExcelColumnStructure("tel", ExcelColumnType.STRING, false),
- new ExcelColumnStructure("fax", ExcelColumnType.STRING, false),
- new ExcelColumnStructure("courriel", ExcelColumnType.STRING, true),
- new ExcelColumnStructure("adressePostale", ExcelColumnType.STRING, true),
- new ExcelColumnStructure("codePostal", ExcelColumnType.STRING, true),
- new ExcelColumnStructure("ville", ExcelColumnType.STRING, true),
- new ExcelColumnStructure("codePays", ExcelColumnType.STRING, true),
- new ExcelColumnStructure("typeDroit", ExcelColumnType.STRING, false) };
- ArrayList<ExcelColumnStructure> personneColsList = new ArrayList<ExcelColumnStructure>(
- Arrays.asList(personneColsArray));
- excelFileStructure.add(new ExcelSheetStructure("personne", personneColsList));
+ // structure for the entities 'personne'
+ ExcelColumnStructure[] personneColsArray = new ExcelColumnStructure[] {
+ new ExcelColumnStructure("nom", ExcelColumnType.STRING, true),
+ new ExcelColumnStructure("prenom", ExcelColumnType.STRING, true),
+ new ExcelColumnStructure("organisme", ExcelColumnType.STRING, true),
+ new ExcelColumnStructure("fonction", ExcelColumnType.STRING, false),
+ new ExcelColumnStructure("tel", ExcelColumnType.STRING, false),
+ new ExcelColumnStructure("fax", ExcelColumnType.STRING, false),
+ new ExcelColumnStructure("courriel", ExcelColumnType.STRING, true),
+ new ExcelColumnStructure("adressePostale", ExcelColumnType.STRING, true),
+ new ExcelColumnStructure("codePostal", ExcelColumnType.STRING, true),
+ new ExcelColumnStructure("ville", ExcelColumnType.STRING, true),
+ new ExcelColumnStructure("codePays", ExcelColumnType.STRING, true),
+ new ExcelColumnStructure("typeDroit", ExcelColumnType.STRING, false) };
+ ArrayList<ExcelColumnStructure> personneColsList = new ArrayList<ExcelColumnStructure>(
+ Arrays.asList(personneColsArray));
+ excelFileStructure.add(new ExcelSheetStructure("personne", personneColsList));
- // structure for the entities 'personne'
- ExcelColumnStructure[] campagneColsArray = new ExcelColumnStructure[] {
- new ExcelColumnStructure("nom", ExcelColumnType.STRING, true),
- new ExcelColumnStructure("codePays", ExcelColumnType.STRING, true),
- new ExcelColumnStructure("programme", ExcelColumnType.STRING, false),
- new ExcelColumnStructure("complement", ExcelColumnType.STRING, false),
- new ExcelColumnStructure("createur", ExcelColumnType.STRING, true),
- new ExcelColumnStructure("dateDeb", ExcelColumnType.DATE, true),
- new ExcelColumnStructure("dateFin", ExcelColumnType.DATE, true) };
- ArrayList<ExcelColumnStructure> campagneColsList = new ArrayList<ExcelColumnStructure>(
- Arrays.asList(campagneColsArray));
- excelFileStructure.add(new ExcelSheetStructure("campagne", campagneColsList));
+ // structure for the entities 'personne'
+ ExcelColumnStructure[] campagneColsArray = new ExcelColumnStructure[] {
+ new ExcelColumnStructure("nom", ExcelColumnType.STRING, true),
+ new ExcelColumnStructure("codePays", ExcelColumnType.STRING, true),
+ new ExcelColumnStructure("programme", ExcelColumnType.STRING, false),
+ new ExcelColumnStructure("complement", ExcelColumnType.STRING, false),
+ new ExcelColumnStructure("createur", ExcelColumnType.STRING, true),
+ new ExcelColumnStructure("dateDeb", ExcelColumnType.DATE, true),
+ new ExcelColumnStructure("dateFin", ExcelColumnType.DATE, true) };
+ ArrayList<ExcelColumnStructure> campagneColsList = new ArrayList<ExcelColumnStructure>(
+ Arrays.asList(campagneColsArray));
+ excelFileStructure.add(new ExcelSheetStructure("campagne", campagneColsList));
- // structure for the entities 'campagnePersonneDroit'
- ExcelColumnStructure[] campagnePersonneDroitColsArray = new ExcelColumnStructure[] {
- new ExcelColumnStructure("campagne", ExcelColumnType.STRING, true),
- new ExcelColumnStructure("personne", ExcelColumnType.STRING, true),
- new ExcelColumnStructure("droitRecolte", ExcelColumnType.BOOLEAN, true),
- new ExcelColumnStructure("droitExtrait", ExcelColumnType.BOOLEAN, true),
- new ExcelColumnStructure("droitPuri", ExcelColumnType.BOOLEAN, true),
- new ExcelColumnStructure("droitTest", ExcelColumnType.BOOLEAN, true) };
- ArrayList<ExcelColumnStructure> campagnePersonneDroitColsList = new ArrayList<ExcelColumnStructure>(
- Arrays.asList(campagnePersonneDroitColsArray));
- excelFileStructure.add(new ExcelSheetStructure("campagnePersonneDroits", campagnePersonneDroitColsList));
+ // structure for the entities 'campagnePersonneDroit'
+ ExcelColumnStructure[] campagnePersonneDroitColsArray = new ExcelColumnStructure[] {
+ new ExcelColumnStructure("campagne", ExcelColumnType.STRING, true),
+ new ExcelColumnStructure("personne", ExcelColumnType.STRING, true),
+ new ExcelColumnStructure("droitRecolte", ExcelColumnType.BOOLEAN, true),
+ new ExcelColumnStructure("droitExtrait", ExcelColumnType.BOOLEAN, true),
+ new ExcelColumnStructure("droitPuri", ExcelColumnType.BOOLEAN, true),
+ new ExcelColumnStructure("droitTest", ExcelColumnType.BOOLEAN, true) };
+ ArrayList<ExcelColumnStructure> campagnePersonneDroitColsList = new ArrayList<ExcelColumnStructure>(
+ Arrays.asList(campagnePersonneDroitColsArray));
+ excelFileStructure.add(new ExcelSheetStructure("campagnePersonneDroits", campagnePersonneDroitColsList));
- // structure for the entities 'campagnePersonneParticipants'
- ExcelColumnStructure[] campagnePersonneParticipantsColsArray = new ExcelColumnStructure[] {
- new ExcelColumnStructure("campagne", ExcelColumnType.STRING, true),
- new ExcelColumnStructure("personne", ExcelColumnType.STRING, true),
- new ExcelColumnStructure("complement", ExcelColumnType.STRING, false) };
- ArrayList<ExcelColumnStructure> campagnePersonneParticipantsColsList = new ArrayList<ExcelColumnStructure>(
- Arrays.asList(campagnePersonneParticipantsColsArray));
- excelFileStructure.add(new ExcelSheetStructure("campagnePersonneParticipants",
- campagnePersonneParticipantsColsList));
+ // structure for the entities 'campagnePersonneParticipants'
+ ExcelColumnStructure[] campagnePersonneParticipantsColsArray = new ExcelColumnStructure[] {
+ new ExcelColumnStructure("campagne", ExcelColumnType.STRING, true),
+ new ExcelColumnStructure("personne", ExcelColumnType.STRING, true),
+ new ExcelColumnStructure("complement", ExcelColumnType.STRING, false) };
+ ArrayList<ExcelColumnStructure> campagnePersonneParticipantsColsList = new ArrayList<ExcelColumnStructure>(
+ Arrays.asList(campagnePersonneParticipantsColsArray));
+ excelFileStructure.add(new ExcelSheetStructure("campagnePersonneParticipants",
+ campagnePersonneParticipantsColsList));
- // structure for the entities 'station'
- ExcelColumnStructure[] stationColsArray = new ExcelColumnStructure[] {
- new ExcelColumnStructure("nom", ExcelColumnType.STRING, true),
- new ExcelColumnStructure("codePays", ExcelColumnType.STRING, true),
- new ExcelColumnStructure("localite", ExcelColumnType.STRING, true),
- new ExcelColumnStructure("latitude", ExcelColumnType.STRING, false),
- new ExcelColumnStructure("longitude", ExcelColumnType.STRING, false),
- new ExcelColumnStructure("referentiel", ExcelColumnType.STRING, false),
- new ExcelColumnStructure("complement", ExcelColumnType.STRING, false),
- new ExcelColumnStructure("createur", ExcelColumnType.STRING, true) };
- ArrayList<ExcelColumnStructure> stationColsList = new ArrayList<ExcelColumnStructure>(
- Arrays.asList(stationColsArray));
- excelFileStructure.add(new ExcelSheetStructure("station", stationColsList));
+ // structure for the entities 'station'
+ ExcelColumnStructure[] stationColsArray = new ExcelColumnStructure[] {
+ new ExcelColumnStructure("nom", ExcelColumnType.STRING, true),
+ new ExcelColumnStructure("codePays", ExcelColumnType.STRING, true),
+ new ExcelColumnStructure("localite", ExcelColumnType.STRING, true),
+ new ExcelColumnStructure("latitude", ExcelColumnType.STRING, false),
+ new ExcelColumnStructure("longitude", ExcelColumnType.STRING, false),
+ new ExcelColumnStructure("referentiel", ExcelColumnType.STRING, false),
+ new ExcelColumnStructure("complement", ExcelColumnType.STRING, false),
+ new ExcelColumnStructure("createur", ExcelColumnType.STRING, true) };
+ ArrayList<ExcelColumnStructure> stationColsList = new ArrayList<ExcelColumnStructure>(
+ Arrays.asList(stationColsArray));
+ excelFileStructure.add(new ExcelSheetStructure("station", stationColsList));
- }
+ }
- /**
- * Populate the personne and utilisateur entities
- * @param excelReader The Excel reader
- * @throws ExcelImportException -
- * @throws DataConstraintException -
- */
- private void populatePersonneUtilisateur(ExcelColumnsReader excelReader) throws ExcelImportException,
- DataConstraintException {
- excelReader.selectSheet("personne");
+ /**
+ * Populate the personne and utilisateur entities
+ * @param excelReader The Excel reader
+ * @throws ExcelImportException -
+ * @throws DataConstraintException -
+ */
+ private void populatePersonneUtilisateur(ExcelColumnsReader excelReader) throws ExcelImportException,
+ DataConstraintException {
+ excelReader.selectSheet("personne");
- Map<String, Object> line = excelReader.readLine();
- while (!line.isEmpty()) {
- String nom = (String) line.get("nom");
- String prenom = (String) line.get("prenom");
- String organisme = (String) line.get("organisme");
- String fonction = (String) line.get("fonction");
- String tel = (String) line.get("tel");
- String fax = (String) line.get("fax");
- String courriel = (String) line.get("courriel");
- String adressePostale = (String) line.get("adressePostale");
- String codePostal = (String) line.get("codePostal");
- String ville = (String) line.get("ville");
- String codePays = (String) line.get("codePays");
- String typeDroit = (String) line.get("typeDroit");
- String password = "password";
- Boolean estValide = true;
- LOG.info("adding personne (xls line " + excelReader.getCurrentNumLine() + ") with values :");
- LOG.info("[nom : '" + nom + "', prenom : '" + prenom + "', organisme : '" + organisme + "', fonction : '"
- + fonction + "', tel : '" + tel + "', fax : '" + fax + "', courriel : '" + courriel
- + "', adressePostale : '" + adressePostale + "', codePays : '" + codePays + "', typeDroit : '"
- + typeDroit + "', password : '" + password + "', estValide : '" + estValide + "']");
- addUtilisateurOrPersonne(nom, prenom, organisme, fonction, tel, fax, courriel, adressePostale, codePostal,
- ville, codePays, typeDroit, password, estValide);
- line = excelReader.readLine();
- }
- }
+ Map<String, Object> line = excelReader.readLine();
+ while (!line.isEmpty()) {
+ String nom = (String) line.get("nom");
+ String prenom = (String) line.get("prenom");
+ String organisme = (String) line.get("organisme");
+ String fonction = (String) line.get("fonction");
+ String tel = (String) line.get("tel");
+ String fax = (String) line.get("fax");
+ String courriel = (String) line.get("courriel");
+ String adressePostale = (String) line.get("adressePostale");
+ String codePostal = (String) line.get("codePostal");
+ String ville = (String) line.get("ville");
+ String codePays = (String) line.get("codePays");
+ String typeDroit = (String) line.get("typeDroit");
+ String password = "password";
+ Boolean estValide = true;
+ LOG.info("adding personne (xls line " + excelReader.getCurrentNumLine() + ") with values :");
+ LOG.info("[nom : '" + nom + "', prenom : '" + prenom + "', organisme : '" + organisme + "', fonction : '"
+ + fonction + "', tel : '" + tel + "', fax : '" + fax + "', courriel : '" + courriel
+ + "', adressePostale : '" + adressePostale + "', codePays : '" + codePays + "', typeDroit : '"
+ + typeDroit + "', password : '" + password + "', estValide : '" + estValide + "']");
+ addUtilisateurOrPersonne(nom, prenom, organisme, fonction, tel, fax, courriel, adressePostale, codePostal,
+ ville, codePays, typeDroit, password, estValide);
+ line = excelReader.readLine();
+ }
+ }
- /**
- * Populate the campagne entities
- * @param excelReader The Excel reader
- * @throws ExcelImportException -
- * @throws DataConstraintException -
- * @throws DataNotFoundException -
- */
- private void populateCampagne(ExcelColumnsReader excelReader) throws ExcelImportException, DataConstraintException,
- DataNotFoundException {
- excelReader.selectSheet("campagne");
+ /**
+ * Populate the campagne entities
+ * @param excelReader The Excel reader
+ * @throws ExcelImportException -
+ * @throws DataConstraintException -
+ * @throws DataNotFoundException -
+ */
+ private void populateCampagne(ExcelColumnsReader excelReader) throws ExcelImportException, DataConstraintException,
+ DataNotFoundException {
+ excelReader.selectSheet("campagne");
- Map<String, Object> line = excelReader.readLine();
- while (!line.isEmpty()) {
- String nom = (String) line.get("nom");
- String codePays = (String) line.get("codePays");
- String programme = (String) line.get("programme");
- String complement = (String) line.get("complement");
- String createur = (String) line.get("createur");
- Date dateDeb = (Date) line.get("dateDeb");
- Date dateFin = (Date) line.get("dateFin");
+ Map<String, Object> line = excelReader.readLine();
+ while (!line.isEmpty()) {
+ String nom = (String) line.get("nom");
+ String codePays = (String) line.get("codePays");
+ String programme = (String) line.get("programme");
+ String complement = (String) line.get("complement");
+ String createur = (String) line.get("createur");
+ Date dateDeb = (Date) line.get("dateDeb");
+ Date dateFin = (Date) line.get("dateFin");
- LOG.debug("adding campagne (xls line " + excelReader.getCurrentNumLine() + ") with values :");
- LOG.debug("[nom : '" + nom + "', codePays : '" + codePays + "', programme : '" + programme
- + "', complement : '" + complement + "', createur : '" + createur + "', dateDeb : '" + dateDeb
- + "', dateFin : '" + dateFin + "']");
- addCampagne(nom, codePays, programme, complement, createur, dateDeb, dateFin);
+ LOG.debug("adding campagne (xls line " + excelReader.getCurrentNumLine() + ") with values :");
+ LOG.debug("[nom : '" + nom + "', codePays : '" + codePays + "', programme : '" + programme
+ + "', complement : '" + complement + "', createur : '" + createur + "', dateDeb : '" + dateDeb
+ + "', dateFin : '" + dateFin + "']");
+ addCampagne(nom, codePays, programme, complement, createur, dateDeb, dateFin);
- line = excelReader.readLine();
- }
- }
+ line = excelReader.readLine();
+ }
+ }
- /**
- * Populate the campagnePersonneDroits entities
- * @param excelReader The Excel reader
- * @throws ExcelImportException -
- * @throws DataConstraintException -
- * @throws DataNotFoundException -
- */
- private void populateCampagnePersonneDroits(ExcelColumnsReader excelReader) throws ExcelImportException,
- DataConstraintException, DataNotFoundException {
- excelReader.selectSheet("campagnePersonneDroits");
+ /**
+ * Populate the campagnePersonneDroits entities
+ * @param excelReader The Excel reader
+ * @throws ExcelImportException -
+ * @throws DataConstraintException -
+ * @throws DataNotFoundException -
+ */
+ private void populateCampagnePersonneDroits(ExcelColumnsReader excelReader) throws ExcelImportException,
+ DataConstraintException, DataNotFoundException {
+ excelReader.selectSheet("campagnePersonneDroits");
- Map<String, Object> line = excelReader.readLine();
- while (!line.isEmpty()) {
- String campagne = (String) line.get("campagne");
- String personne = (String) line.get("personne");
- Boolean droitRecolte = (Boolean) line.get("droitRecolte");
- Boolean droitExtrait = (Boolean) line.get("droitExtrait");
- Boolean droitPuri = (Boolean) line.get("droitPuri");
- Boolean droitTest = (Boolean) line.get("droitTest");
+ Map<String, Object> line = excelReader.readLine();
+ while (!line.isEmpty()) {
+ String campagne = (String) line.get("campagne");
+ String personne = (String) line.get("personne");
+ Boolean droitRecolte = (Boolean) line.get("droitRecolte");
+ Boolean droitExtrait = (Boolean) line.get("droitExtrait");
+ Boolean droitPuri = (Boolean) line.get("droitPuri");
+ Boolean droitTest = (Boolean) line.get("droitTest");
- LOG.debug("adding campagnePersonneDroits (xls line " + excelReader.getCurrentNumLine() + ") with values :");
- LOG.debug("[campagne : '" + campagne + "', personne : '" + personne + "', droitRecolte : '" + droitRecolte
- + "', droitExtrait : '" + droitExtrait + "', droitPuri : '" + droitPuri + "', droitTest : '"
- + droitTest + "']");
- addCampagnePersonneDroits(campagne, personne, droitExtrait, droitPuri, droitRecolte, droitTest);
+ LOG.debug("adding campagnePersonneDroits (xls line " + excelReader.getCurrentNumLine() + ") with values :");
+ LOG.debug("[campagne : '" + campagne + "', personne : '" + personne + "', droitRecolte : '" + droitRecolte
+ + "', droitExtrait : '" + droitExtrait + "', droitPuri : '" + droitPuri + "', droitTest : '"
+ + droitTest + "']");
+ addCampagnePersonneDroits(campagne, personne, droitExtrait, droitPuri, droitRecolte, droitTest);
- line = excelReader.readLine();
- }
- }
+ line = excelReader.readLine();
+ }
+ }
- /**
- * Populate the campagnePersonneParticipants entities
- * @param excelReader The Excel reader
- * @throws ExcelImportException -
- * @throws DataConstraintException -
- * @throws DataNotFoundException -
- */
- @SuppressWarnings("unused")
- private void populateCampagnePersonneParticipants(ExcelColumnsReader excelReader) throws ExcelImportException,
- DataConstraintException, DataNotFoundException {
- excelReader.selectSheet("campagnePersonneParticipants");
+ /**
+ * Populate the campagnePersonneParticipants entities
+ * @param excelReader The Excel reader
+ * @throws ExcelImportException -
+ * @throws DataConstraintException -
+ * @throws DataNotFoundException -
+ */
+ @SuppressWarnings("unused")
+ private void populateCampagnePersonneParticipants(ExcelColumnsReader excelReader) throws ExcelImportException,
+ DataConstraintException, DataNotFoundException {
+ excelReader.selectSheet("campagnePersonneParticipants");
- Map<String, Object> line = excelReader.readLine();
- while (!line.isEmpty()) {
- String campagne = (String) line.get("campagne");
- String personne = (String) line.get("personne");
- String complement = (String) line.get("complement");
+ Map<String, Object> line = excelReader.readLine();
+ while (!line.isEmpty()) {
+ String campagne = (String) line.get("campagne");
+ String personne = (String) line.get("personne");
+ String complement = (String) line.get("complement");
- LOG.debug("adding campagnePersonneParticipants (xls line " + excelReader.getCurrentNumLine()
- + ") with values :");
- LOG.debug("[campagne : '" + campagne + "', personne : '" + personne + "', complement : '" + complement
- + "']");
- addCampagnePersonneParticipants(campagne, personne, complement);
+ LOG.debug("adding campagnePersonneParticipants (xls line " + excelReader.getCurrentNumLine()
+ + ") with values :");
+ LOG.debug("[campagne : '" + campagne + "', personne : '" + personne + "', complement : '" + complement
+ + "']");
+ addCampagnePersonneParticipants(campagne, personne, complement);
- line = excelReader.readLine();
- }
- }
+ line = excelReader.readLine();
+ }
+ }
- /**
- * Populate the station entities
- * @param excelReader The Excel reader
- * @throws ExcelImportException -
- * @throws DataConstraintException -
- * @throws DataNotFoundException -
- */
- private void populateStation(ExcelColumnsReader excelReader) throws ExcelImportException, DataConstraintException,
- DataNotFoundException {
- excelReader.selectSheet("station");
+ /**
+ * Populate the station entities
+ * @param excelReader The Excel reader
+ * @throws ExcelImportException -
+ * @throws DataConstraintException -
+ * @throws DataNotFoundException -
+ */
+ private void populateStation(ExcelColumnsReader excelReader) throws ExcelImportException, DataConstraintException,
+ DataNotFoundException {
+ excelReader.selectSheet("station");
- Map<String, Object> line = excelReader.readLine();
- while (!line.isEmpty()) {
- String nom = (String) line.get("nom");
- String codePays = (String) line.get("codePays");
- String localite = (String) line.get("localite");
- String latitude = (String) line.get("latitude");
- String longitude = (String) line.get("longitude");
- String referentiel = (String) line.get("referentiel");
- String complement = (String) line.get("complement");
- String createur = (String) line.get("createur");
+ Map<String, Object> line = excelReader.readLine();
+ while (!line.isEmpty()) {
+ String nom = (String) line.get("nom");
+ String codePays = (String) line.get("codePays");
+ String localite = (String) line.get("localite");
+ String latitude = (String) line.get("latitude");
+ String longitude = (String) line.get("longitude");
+ String referentiel = (String) line.get("referentiel");
+ String complement = (String) line.get("complement");
+ String createur = (String) line.get("createur");
- LOG.debug("adding campagnePersonneParticipants (xls line " + excelReader.getCurrentNumLine()
- + ") with values :");
- LOG.debug("[nom :'" + nom + "', codePays : '" + codePays + "', localite : '" + localite + "', latitude : '"
- + latitude + "', longitude : '" + longitude + "', referentiel : '" + referentiel
- + "', complement : '" + complement + "', createur : '" + createur + "']");
- addStation(nom, codePays, localite, latitude, longitude, complement, createur, referentiel);
+ LOG.debug("adding campagnePersonneParticipants (xls line " + excelReader.getCurrentNumLine()
+ + ") with values :");
+ LOG.debug("[nom :'" + nom + "', codePays : '" + codePays + "', localite : '" + localite + "', latitude : '"
+ + latitude + "', longitude : '" + longitude + "', referentiel : '" + referentiel
+ + "', complement : '" + complement + "', createur : '" + createur + "']");
+ addStation(nom, codePays, localite, latitude, longitude, complement, createur, referentiel);
- line = excelReader.readLine();
- }
- }
+ line = excelReader.readLine();
+ }
+ }
- /**
- * Ajouter une campagne
- * @param nom -
- * @param codePays -
- * @param programme -
- * @param complement -
- * @param createur -
- * @param dateDeb -
- * @param dateFin -
- * @throws DataConstraintException -
- * @throws DataNotFoundException -
- */
- private void addCampagne(String nom, String codePays, String programme, String complement, String createur,
- Date dateDeb, Date dateFin) throws DataConstraintException, DataNotFoundException {
- Campagne c = new Campagne();
- c.setNom(nom);
- c.setCodePays(codePays);
- c.setProgramme(programme);
- c.setComplement(complement);
- c.setCreateur(personneService.loadPersonne(createur));
- c.setDateDeb(dateDeb);
- c.setDateFin(dateFin);
- campagneService.createCampagne(c);
- }
+ /**
+ * Ajouter une campagne
+ * @param nom -
+ * @param codePays -
+ * @param programme -
+ * @param complement -
+ * @param createur -
+ * @param dateDeb -
+ * @param dateFin -
+ * @throws DataConstraintException -
+ * @throws DataNotFoundException -
+ */
+ private void addCampagne(String nom, String codePays, String programme, String complement, String createur,
+ Date dateDeb, Date dateFin) throws DataConstraintException, DataNotFoundException {
+ Campagne c = new Campagne();
+ c.setNom(nom);
+ c.setCodePays(codePays);
+ c.setProgramme(programme);
+ c.setComplement(complement);
+ c.setCreateur(personneService.loadPersonne(createur));
+ c.setDateDeb(dateDeb);
+ c.setDateFin(dateFin);
+ campagneService.createCampagne(c);
+ }
- /**
- * Ajouter des droits pour une personne sur une campagne
- * @param campagne -
- * @param personne -
- * @param droitExtrait -
- * @param droitPuri -
- * @param droitRecolte -
- * @param droitTest -
- * @throws DataNotFoundException -
- * @throws DataConstraintException -
- */
- private void addCampagnePersonneDroits(String campagne, String personne, Boolean droitExtrait, Boolean droitPuri,
- Boolean droitRecolte, Boolean droitTest) throws DataNotFoundException, DataConstraintException {
- CampagnePersonneDroits d = new CampagnePersonneDroits();
- d.getId().setPk1(campagneService.loadCampagne(campagne));
- d.getId().setPk2(personneService.loadPersonne(personne));
- d.getDroits().setDroitExtrait(droitExtrait);
- d.getDroits().setDroitPuri(droitPuri);
- d.getDroits().setDroitRecolte(droitRecolte);
- d.getDroits().setDroitTestBio(droitTest);
- // d.id.pk1.personnesDroits.add(d);
- // d.id.pk2.campagnesDroits.put(d.id.pk1, d);
- personneService.updatePersonne(d.getId().getPk2());
- }
+ /**
+ * Ajouter des droits pour une personne sur une campagne
+ * @param campagne -
+ * @param personne -
+ * @param droitExtrait -
+ * @param droitPuri -
+ * @param droitRecolte -
+ * @param droitTest -
+ * @throws DataNotFoundException -
+ * @throws DataConstraintException -
+ */
+ private void addCampagnePersonneDroits(String campagne, String personne, Boolean droitExtrait, Boolean droitPuri,
+ Boolean droitRecolte, Boolean droitTest) throws DataNotFoundException, DataConstraintException {
+ CampagnePersonneDroits d = new CampagnePersonneDroits();
+ d.getId().setPk1(campagneService.loadCampagne(campagne));
+ d.getId().setPk2(personneService.loadPersonne(personne));
+ d.getDroits().setDroitExtrait(droitExtrait);
+ d.getDroits().setDroitPuri(droitPuri);
+ d.getDroits().setDroitRecolte(droitRecolte);
+ d.getDroits().setDroitTestBio(droitTest);
+ // d.id.pk1.personnesDroits.add(d);
+ // d.id.pk2.campagnesDroits.put(d.id.pk1, d);
+ personneService.updatePersonne(d.getId().getPk2());
+ }
- /**
- * Ajouter un participant à une campagne
- * @param campagne -
- * @param personne -
- * @param complement -
- * @throws DataNotFoundException -
- * @throws DataConstraintException -
- */
- private void addCampagnePersonneParticipants(String campagne, String personne, String complement)
- throws DataNotFoundException, DataConstraintException {
- CampagnePersonneParticipant p = new CampagnePersonneParticipant();
- p.getId().setPk1(campagneService.loadCampagne(campagne));
- p.getId().setPk2(personneService.loadPersonne(personne));
- p.setComplement(complement);
- p.getId().getPk1().getParticipants().add(p);
- p.getId().getPk2().getCampagnesParticipees().add(p);
- campagneService.updateCampagne(p.getId().getPk1());
- }
+ /**
+ * Ajouter un participant à une campagne
+ * @param campagne -
+ * @param personne -
+ * @param complement -
+ * @throws DataNotFoundException -
+ * @throws DataConstraintException -
+ */
+ private void addCampagnePersonneParticipants(String campagne, String personne, String complement)
+ throws DataNotFoundException, DataConstraintException {
+ CampagnePersonneParticipant p = new CampagnePersonneParticipant();
+ p.getId().setPk1(campagneService.loadCampagne(campagne));
+ p.getId().setPk2(personneService.loadPersonne(personne));
+ p.setComplement(complement);
+ p.getId().getPk1().getParticipants().add(p);
+ p.getId().getPk2().getCampagnesParticipees().add(p);
+ campagneService.updateCampagne(p.getId().getPk1());
+ }
- /**
- * Ajouter un lot
- * @param campagne -
- * @param complement -
- * @param createur -
- * @param date -
- * @param echantillonColl -
- * @param echantillonIdent -
- * @param echantillonPhylo -
- * @param masseFraiche -
- * @param masseSeche -
- * @param partie -
- * @param ref -
- * @param specimenRef -
- * @param station -
- * @throws DataNotFoundException -
- * @throws ParseException -
- */
- @SuppressWarnings("unused")
- private void addLot(String campagne, String complement, String createur, String date, String echantillonColl,
- String echantillonIdent, String echantillonPhylo, String masseFraiche, String masseSeche, String partie,
- String ref, String specimenRef, String station) throws DataNotFoundException, ParseException {
- Lot l = new Lot();
- l.setCampagne(campagneService.loadCampagne(campagne));
- l.setComplement(complement);
- l.setCreateur(personneService.loadPersonne(createur));
- l.setDateRecolte(DATE_FORMAT.parse(date));
- l.setEchantillonColl(Boolean.valueOf(echantillonColl));
- l.setEchantillonIdent(Boolean.valueOf(echantillonIdent));
- l.setEchantillonPhylo(Boolean.valueOf(echantillonPhylo));
- DecimalFormat fmt = (DecimalFormat) NumberFormat.getNumberInstance(Locale.FRENCH);
- fmt.setMaximumFractionDigits(DataContext.DECIMAL_SCALE);
- fmt.setMaximumIntegerDigits(DataContext.DECIMAL_PRECISION - DataContext.DECIMAL_SCALE);
- fmt.setParseBigDecimal(true);
- l.setMasseFraiche((BigDecimal) fmt.parse(masseFraiche));
- l.setMasseSeche((BigDecimal) fmt.parse(masseSeche));
- l.setPartie(lotService.loadPartie(partie));
- l.setRef(ref);
- l.setSpecimenRef(specimenService.loadSpecimen(specimenRef));
- l.setStation(stationService.loadStation(station));
- }
+ /**
+ * Ajouter un lot
+ * @param campagne -
+ * @param complement -
+ * @param createur -
+ * @param date -
+ * @param echantillonColl -
+ * @param echantillonIdent -
+ * @param echantillonPhylo -
+ * @param masseFraiche -
+ * @param masseSeche -
+ * @param partie -
+ * @param ref -
+ * @param specimenRef -
+ * @param station -
+ * @throws DataNotFoundException -
+ * @throws ParseException -
+ */
+ @SuppressWarnings("unused")
+ private void addLot(String campagne, String complement, String createur, String date, String echantillonColl,
+ String echantillonIdent, String echantillonPhylo, String masseFraiche, String masseSeche, String partie,
+ String ref, String specimenRef, String station) throws DataNotFoundException, ParseException {
+ Lot l = new Lot();
+ l.setCampagne(campagneService.loadCampagne(campagne));
+ l.setComplement(complement);
+ l.setCreateur(personneService.loadPersonne(createur));
+ l.setDateRecolte(DATE_FORMAT.parse(date));
+ l.setEchantillonColl(Boolean.valueOf(echantillonColl));
+ l.setEchantillonIdent(Boolean.valueOf(echantillonIdent));
+ l.setEchantillonPhylo(Boolean.valueOf(echantillonPhylo));
+ DecimalFormat fmt = (DecimalFormat) NumberFormat.getNumberInstance(Locale.FRENCH);
+ fmt.setMaximumFractionDigits(DataContext.DECIMAL_SCALE);
+ fmt.setMaximumIntegerDigits(DataContext.DECIMAL_PRECISION - DataContext.DECIMAL_SCALE);
+ fmt.setParseBigDecimal(true);
+ l.setMasseFraiche((BigDecimal) fmt.parse(masseFraiche));
+ l.setMasseSeche((BigDecimal) fmt.parse(masseSeche));
+ l.setPartie(lotService.loadPartie(partie));
+ l.setRef(ref);
+ l.setSpecimenRef(specimenService.loadSpecimen(specimenRef));
+ l.setStation(stationService.loadStation(station));
+ }
- /**
- * Ajouter des droits pour une personne sur un lot
- * @param lot -
- * @param personne -
- * @param droitExtrait -
- * @param droitPuri -
- * @param droitRécolte -
- * @param droitTest -
- * @throws DataNotFoundException -
- * @throws DataConstraintException -
- */
- @SuppressWarnings("unused")
- private void addLotPersonneDroits(String lot, String personne, String droitExtrait, String droitPuri,
- String droitRécolte, String droitTest) throws DataNotFoundException, DataConstraintException {
- LotPersonneDroits d = new LotPersonneDroits();
- d.getId().setPk1(lotService.loadLot(lot));
- d.getId().setPk2(personneService.loadPersonne(personne));
- d.getDroits().setDroitExtrait(Boolean.valueOf(droitExtrait));
- d.getDroits().setDroitPuri(Boolean.valueOf(droitPuri));
- d.getDroits().setDroitRecolte(Boolean.valueOf(droitRécolte));
- d.getDroits().setDroitTestBio(Boolean.valueOf(droitTest));
- d.getId().getPk1().getPersonnesDroits().add(d);
- d.getId().getPk2().getLotsDroits().put(d.getId().getPk1(), d);
- personneService.updatePersonne(d.getId().getPk2());
- }
+ /**
+ * Ajouter des droits pour une personne sur un lot
+ * @param lot -
+ * @param personne -
+ * @param droitExtrait -
+ * @param droitPuri -
+ * @param droitRécolte -
+ * @param droitTest -
+ * @throws DataNotFoundException -
+ * @throws DataConstraintException -
+ */
+ @SuppressWarnings("unused")
+ private void addLotPersonneDroits(String lot, String personne, String droitExtrait, String droitPuri,
+ String droitRécolte, String droitTest) throws DataNotFoundException, DataConstraintException {
+ LotPersonneDroits d = new LotPersonneDroits();
+ d.getId().setPk1(lotService.loadLot(lot));
+ d.getId().setPk2(personneService.loadPersonne(personne));
+ d.getDroits().setDroitExtrait(Boolean.valueOf(droitExtrait));
+ d.getDroits().setDroitPuri(Boolean.valueOf(droitPuri));
+ d.getDroits().setDroitRecolte(Boolean.valueOf(droitRécolte));
+ d.getDroits().setDroitTestBio(Boolean.valueOf(droitTest));
+ d.getId().getPk1().getPersonnesDroits().add(d);
+ d.getId().getPk2().getLotsDroits().put(d.getId().getPk1(), d);
+ personneService.updatePersonne(d.getId().getPk2());
+ }
- /**
- * Ajouter une partie
- * @param nom -
- * @throws DataConstraintException -
- */
- @SuppressWarnings("unused")
- private void addPartie(String nom) throws DataConstraintException {
- Partie p = new Partie();
- p.setNom(nom);
- lotService.createPartie(p);
- }
+ /**
+ * Ajouter une partie
+ * @param nom -
+ * @throws DataConstraintException -
+ */
+ @SuppressWarnings("unused")
+ private void addPartie(String nom) throws DataConstraintException {
+ Partie p = new Partie();
+ p.setNom(nom);
+ lotService.createPartie(p);
+ }
- /**
- * Ajouter un spécimen
- * @param ref -
- * @param embranchement -
- * @throws DataConstraintException -
- */
- @SuppressWarnings("unused")
- private void addSpecimen(String ref, String embranchement) throws DataConstraintException {
- Specimen s = new Specimen();
- s.setRef(ref);
- s.setEmbranchement(embranchement);
- specimenService.createSpecimen(s);
- }
+ /**
+ * Ajouter un spécimen
+ * @param ref -
+ * @param embranchement -
+ * @throws DataConstraintException -
+ */
+ @SuppressWarnings("unused")
+ private void addSpecimen(String ref, String embranchement) throws DataConstraintException {
+ Specimen s = new Specimen();
+ s.setRef(ref);
+ s.setEmbranchement(embranchement);
+ specimenService.createSpecimen(s);
+ }
- /**
- * Ajouter une campagne
- * @param nom -
- * @param codePays -
- * @param localite -
- * @param latitude -
- * @param longitude -
- * @param complement -
- * @param createur -
- * @param referentiel -
- * @throws DataNotFoundException -
- * @throws DataConstraintException -
- * @throws ExcelImportException -
- */
- private void addStation(String nom, String codePays, String localite, String latitude, String longitude,
- String complement, String createur, String referentiel) throws DataNotFoundException,
- DataConstraintException, ExcelImportException {
- Station s = new Station();
- s.setNom(nom);
- s.setCodePays(codePays);
- s.setComplement(complement);
- s.setCreateur(personneService.loadPersonne(createur));
- s.setLatitude(StringUtils.leftPad(StringUtils.deleteWhitespace(latitude), CoordTools.LATITUDE_LENGTH));
- s.setLongitude(StringUtils.leftPad(StringUtils.deleteWhitespace(longitude), CoordTools.LONGITUDE_LENGTH));
- s.setReferentiel(getReferentialNumber(referentiel));
- s.setLocalite(localite);
- stationService.createStation(s);
- }
+ /**
+ * Ajouter une campagne
+ * @param nom -
+ * @param codePays -
+ * @param localite -
+ * @param latitude -
+ * @param longitude -
+ * @param complement -
+ * @param createur -
+ * @param referentiel -
+ * @throws DataNotFoundException -
+ * @throws DataConstraintException -
+ * @throws ExcelImportException -
+ */
+ private void addStation(String nom, String codePays, String localite, String latitude, String longitude,
+ String complement, String createur, String referentiel) throws DataNotFoundException,
+ DataConstraintException, ExcelImportException {
+ Station s = new Station();
+ s.setNom(nom);
+ s.setCodePays(codePays);
+ s.setComplement(complement);
+ s.setCreateur(personneService.loadPersonne(createur));
+ s.setLatitude(StringUtils.leftPad(StringUtils.deleteWhitespace(latitude), CoordTools.LATITUDE_LENGTH));
+ s.setLongitude(StringUtils.leftPad(StringUtils.deleteWhitespace(longitude), CoordTools.LONGITUDE_LENGTH));
+ s.setReferentiel(getReferentialNumber(referentiel));
+ s.setLocalite(localite);
+ stationService.createStation(s);
+ }
- /**
- * Get the referentiel number associated to the given referential
- * @param referentialString referential name
- * @return the corresponding number
- * @throws ExcelImportException -
- */
- private Integer getReferentialNumber(String referentialString) throws ExcelImportException {
- for (Map.Entry<Integer, String> curEntry : DataContext.REFERENTIELS.entrySet()) {
- if (curEntry.getValue().equals(referentialString)) {
- return curEntry.getKey();
- }
- }
- throw new ExcelImportException("'" + referentialString + "' is not a allowed referential");
- }
+ /**
+ * Get the referentiel number associated to the given referential
+ * @param referentialString referential name
+ * @return the corresponding number
+ * @throws ExcelImportException -
+ */
+ private Integer getReferentialNumber(String referentialString) throws ExcelImportException {
+ for (Map.Entry<Integer, String> curEntry : DataContext.REFERENTIELS.entrySet()) {
+ if (curEntry.getValue().equals(referentialString)) {
+ return curEntry.getKey();
+ }
+ }
+ throw new ExcelImportException("'" + referentialString + "' is not a allowed referential");
+ }
- /**
- * Ajoute une personne ou un utilisateur
- * @param nom -
- * @param prenom -
- * @param organisme -
- * @param fonction -
- * @param tel -
- * @param fax -
- * @param courriel -
- * @param adressePostale -
- * @param codePostal -
- * @param ville -
- * @param codePays -
- * @param typeDroit -
- * @param password -
- * @param estValide -
- * @throws DataConstraintException -
- */
- private void addUtilisateurOrPersonne(String nom, String prenom, String organisme, String fonction, String tel,
- String fax, String courriel, String adressePostale, String codePostal, String ville, String codePays,
- String typeDroit, String password, Boolean estValide) throws DataConstraintException {
- if (StringUtils.isEmpty(typeDroit)) {
- Personne p = new Personne();
- p.setNom(nom);
- p.setPrenom(prenom);
- p.setOrganisme(organisme);
- p.setFonction(fonction);
- p.setTel(tel);
- p.setFax(fax);
- p.setCourriel(courriel);
- p.setAdressePostale(adressePostale);
- p.setCodePostal(codePostal);
- p.setVille(ville);
- p.setCodePays(codePays);
- personneService.createPersonne(p);
- } else {
- Utilisateur u = new Utilisateur();
- u.setNom(nom);
- u.setPrenom(prenom);
- u.setOrganisme(organisme);
- u.setFonction(fonction);
- u.setTel(tel);
- u.setFax(fax);
- u.setCourriel(courriel);
- u.setAdressePostale(adressePostale);
- u.setCodePostal(codePostal);
- u.setVille(ville);
- u.setCodePays(codePays);
- u.setTypeDroit(TypeDroit.valueOf(typeDroit));
- u.setPasswordHash(personneService.hashPassword(password));
- u.setValide(estValide);
- personneService.createUtilisateur(u);
- }
- }
+ /**
+ * Ajoute une personne ou un utilisateur
+ * @param nom -
+ * @param prenom -
+ * @param organisme -
+ * @param fonction -
+ * @param tel -
+ * @param fax -
+ * @param courriel -
+ * @param adressePostale -
+ * @param codePostal -
+ * @param ville -
+ * @param codePays -
+ * @param typeDroit -
+ * @param password -
+ * @param estValide -
+ * @throws DataConstraintException -
+ */
+ private void addUtilisateurOrPersonne(String nom, String prenom, String organisme, String fonction, String tel,
+ String fax, String courriel, String adressePostale, String codePostal, String ville, String codePays,
+ String typeDroit, String password, Boolean estValide) throws DataConstraintException {
+ if (StringUtils.isEmpty(typeDroit)) {
+ Personne p = new Personne();
+ p.setNom(nom);
+ p.setPrenom(prenom);
+ p.setOrganisme(organisme);
+ p.setFonction(fonction);
+ p.setTel(tel);
+ p.setFax(fax);
+ p.setCourriel(courriel);
+ p.setAdressePostale(adressePostale);
+ p.setCodePostal(codePostal);
+ p.setVille(ville);
+ p.setCodePays(codePays);
+ personneService.createPersonne(p);
+ } else {
+ Utilisateur u = new Utilisateur();
+ u.setNom(nom);
+ u.setPrenom(prenom);
+ u.setOrganisme(organisme);
+ u.setFonction(fonction);
+ u.setTel(tel);
+ u.setFax(fax);
+ u.setCourriel(courriel);
+ u.setAdressePostale(adressePostale);
+ u.setCodePostal(codePostal);
+ u.setVille(ville);
+ u.setCodePays(codePays);
+ u.setTypeDroit(TypeDroit.valueOf(typeDroit));
+ u.setPasswordHash(personneService.hashPassword(password));
+ u.setValide(estValide);
+ personneService.createUtilisateur(u);
+ }
+ }
}
\ No newline at end of file
Modified: trunk/cantharella.utils/pom.xml
===================================================================
--- trunk/cantharella.utils/pom.xml 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.utils/pom.xml 2013-01-29 09:48:04 UTC (rev 65)
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
Modified: trunk/cantharella.utils/src/main/java/nc/ird/module/utils/AssertTools.java
===================================================================
--- trunk/cantharella.utils/src/main/java/nc/ird/module/utils/AssertTools.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.utils/src/main/java/nc/ird/module/utils/AssertTools.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -32,220 +32,220 @@
*/
public final class AssertTools {
- /** Error message for wrong class argument */
- private static final String CLASS = "Argument must be of type %s";
+ /** Error message for wrong class argument */
+ private static final String CLASS = "Argument must be of type %s";
- /** Error message for not equals argument */
- private static final String EQUALS = "Argument must be equals to %s";
+ /** Error message for not equals argument */
+ private static final String EQUALS = "Argument must be equals to %s";
- /** Error message for not greater argument */
- private static final String GREATER = "Argument must be greater than %s";
+ /** Error message for not greater argument */
+ private static final String GREATER = "Argument must be greater than %s";
- /** Error message for not greater or equals argument */
- private static final String GREATER_OR_EQUALS = "Argument must be greater than or equals to %s";
+ /** Error message for not greater or equals argument */
+ private static final String GREATER_OR_EQUALS = "Argument must be greater than or equals to %s";
- /** Error message for "not in" argument */
- private static final String IN = "Argument must be in %s";
+ /** Error message for "not in" argument */
+ private static final String IN = "Argument must be in %s";
- /** Error message for not lower argument */
- private static final String LOWER = "Argument must be lower than %s";
+ /** Error message for not lower argument */
+ private static final String LOWER = "Argument must be lower than %s";
- /** Error message for not lower or equals argument */
- private static final String LOWER_OR_EQUALS = "Argument must be lower than or equals to %s";
+ /** Error message for not lower or equals argument */
+ private static final String LOWER_OR_EQUALS = "Argument must be lower than or equals to %s";
- /** Error message for empty argument */
- private static final String NOT_EMPTY = "Argument must not be empty";
+ /** Error message for empty argument */
+ private static final String NOT_EMPTY = "Argument must not be empty";
- /** Error message for equals argument */
- private static final String NOT_EQUALS = "Argument must not be equals to %s";
+ /** Error message for equals argument */
+ private static final String NOT_EQUALS = "Argument must not be equals to %s";
- /** Error message for null argument */
- private static final String NOT_NULL = "Argument must not be null";
+ /** Error message for null argument */
+ private static final String NOT_NULL = "Argument must not be null";
- /**
- * Assert that none of the string in an array is empty
- * @param strings Strings array
- */
- public static void assertArrayNotEmpty(String[] strings) {
- assertNotNull(strings);
- for (String string : strings) {
- assertNotEmpty(string);
- }
- }
+ /**
+ * Assert that none of the string in an array is empty
+ * @param strings Strings array
+ */
+ public static void assertArrayNotEmpty(String[] strings) {
+ assertNotNull(strings);
+ for (String string : strings) {
+ assertNotEmpty(string);
+ }
+ }
- /**
- * Assert that none of the objects in an array is null
- * @param objects Objects array
- */
- public static void assertArrayNotNull(Object[] objects) {
- assertNotNull(objects);
- for (Object object : objects) {
- assertNotNull(object);
- }
- }
+ /**
+ * Assert that none of the objects in an array is null
+ * @param objects Objects array
+ */
+ public static void assertArrayNotNull(Object[] objects) {
+ assertNotNull(objects);
+ for (Object object : objects) {
+ assertNotNull(object);
+ }
+ }
- /**
- * Assert that an object class/superclass/interface/superinterface
- * @param object Object
- * @param clazz Expected class/superclass/interface/superinterface
- */
- public static void assertClassOrInterface(Object object, Class<?> clazz) {
- assertNotNull(object);
- assertNotNull(clazz);
- assert clazz.isAssignableFrom(object.getClass()) : String.format(CLASS, clazz.getName());
- }
+ /**
+ * Assert that an object class/superclass/interface/superinterface
+ * @param object Object
+ * @param clazz Expected class/superclass/interface/superinterface
+ */
+ public static void assertClassOrInterface(Object object, Class<?> clazz) {
+ assertNotNull(object);
+ assertNotNull(clazz);
+ assert clazz.isAssignableFrom(object.getClass()) : String.format(CLASS, clazz.getName());
+ }
- /**
- * Assert that none of the objects in a Collection is null
- * @param objects Objects collection
- */
- public static void assertCollectionNotNull(Collection<?> objects) {
- assertNotNull(objects);
- for (Object object : objects) {
- assertNotNull(object);
- }
- }
+ /**
+ * Assert that none of the objects in a Collection is null
+ * @param objects Objects collection
+ */
+ public static void assertCollectionNotNull(Collection<?> objects) {
+ assertNotNull(objects);
+ for (Object object : objects) {
+ assertNotNull(object);
+ }
+ }
- /**
- * Assert that a value is equals to an expected value
- * @param <N> Number type
- * @param value Value
- * @param expectedValue Expected value
- */
- public static <N extends Number> void assertEquals(N value, N expectedValue) {
- assert value.doubleValue() == expectedValue.doubleValue() : String.format(EQUALS, expectedValue);
- }
+ /**
+ * Assert that a value is equals to an expected value
+ * @param <N> Number type
+ * @param value Value
+ * @param expectedValue Expected value
+ */
+ public static <N extends Number> void assertEquals(N value, N expectedValue) {
+ assert value.doubleValue() == expectedValue.doubleValue() : String.format(EQUALS, expectedValue);
+ }
- /**
- * Assert that a value is greater than to a bound
- * @param <N> Number type
- * @param value Value
- * @param bound Bound
- */
- public static <N extends Number> void assertGreater(N value, N bound) {
- assert value.doubleValue() > bound.doubleValue() : String.format(GREATER, bound);
- }
+ /**
+ * Assert that a value is greater than to a bound
+ * @param <N> Number type
+ * @param value Value
+ * @param bound Bound
+ */
+ public static <N extends Number> void assertGreater(N value, N bound) {
+ assert value.doubleValue() > bound.doubleValue() : String.format(GREATER, bound);
+ }
- /**
- * Assert that a value is greater than or equals to a bound
- * @param <N> Number type
- * @param value Value
- * @param bound Bound
- */
- public static <N extends Number> void assertGreaterOrEquals(N value, N bound) {
- assert value.doubleValue() >= bound.doubleValue() : String.format(GREATER_OR_EQUALS, bound);
- }
+ /**
+ * Assert that a value is greater than or equals to a bound
+ * @param <N> Number type
+ * @param value Value
+ * @param bound Bound
+ */
+ public static <N extends Number> void assertGreaterOrEquals(N value, N bound) {
+ assert value.doubleValue() >= bound.doubleValue() : String.format(GREATER_OR_EQUALS, bound);
+ }
- /**
- * Assert that an object is contains in a values array
- * @param <O> Object type
- * @param object Object
- * @param values Values collection
- */
- public static <O> void assertIn(O object, Collection<O> values) {
- assertNotNull(object);
- assertNotEmpty(values);
- assert values.contains(object) : String.format(IN, object);
- }
+ /**
+ * Assert that an object is contains in a values array
+ * @param <O> Object type
+ * @param object Object
+ * @param values Values collection
+ */
+ public static <O> void assertIn(O object, Collection<O> values) {
+ assertNotNull(object);
+ assertNotEmpty(values);
+ assert values.contains(object) : String.format(IN, object);
+ }
- /**
- * Assert that an object is contains in a values array
- * @param <O> Object type
- * @param object Object
- * @param values Values array
- */
- public static <O> void assertIn(O object, O... values) {
- assertNotEmpty(values);
- assertIn(object, Arrays.asList(values));
- }
+ /**
+ * Assert that an object is contains in a values array
+ * @param <O> Object type
+ * @param object Object
+ * @param values Values array
+ */
+ public static <O> void assertIn(O object, O... values) {
+ assertNotEmpty(values);
+ assertIn(object, Arrays.asList(values));
+ }
- /**
- * Assert that a value is lower than to a bound
- * @param <N> Number type
- * @param value Value
- * @param bound Bound
- */
- public static <N extends Number> void assertLower(N value, N bound) {
- assert value.doubleValue() < bound.doubleValue() : String.format(LOWER, bound);
- }
+ /**
+ * Assert that a value is lower than to a bound
+ * @param <N> Number type
+ * @param value Value
+ * @param bound Bound
+ */
+ public static <N extends Number> void assertLower(N value, N bound) {
+ assert value.doubleValue() < bound.doubleValue() : String.format(LOWER, bound);
+ }
- /**
- * Assert that a value is lower than or equals to a bound
- * @param <N> Number type
- * @param value Value
- * @param bound Bound
- */
- public static <N extends Number> void assertLowerOrEquals(N value, N bound) {
- assert value.doubleValue() <= bound.doubleValue() : String.format(LOWER_OR_EQUALS, bound);
- }
+ /**
+ * Assert that a value is lower than or equals to a bound
+ * @param <N> Number type
+ * @param value Value
+ * @param bound Bound
+ */
+ public static <N extends Number> void assertLowerOrEquals(N value, N bound) {
+ assert value.doubleValue() <= bound.doubleValue() : String.format(LOWER_OR_EQUALS, bound);
+ }
- /**
- * Assert that an array is not null or empty
- * @param collection Collection
- */
- public static void assertNotEmpty(Collection<?> collection) {
- assertNotNull(collection);
- assert !collection.isEmpty() : NOT_EMPTY;
- }
+ /**
+ * Assert that an array is not null or empty
+ * @param collection Collection
+ */
+ public static void assertNotEmpty(Collection<?> collection) {
+ assertNotNull(collection);
+ assert !collection.isEmpty() : NOT_EMPTY;
+ }
- /**
- * Assert that a collection is not null or empty
- * @param array Array
- */
- public static void assertNotEmpty(Object[] array) {
- assertNotNull(array);
- assert array.length > 0 : NOT_EMPTY;
- }
+ /**
+ * Assert that a collection is not null or empty
+ * @param array Array
+ */
+ public static void assertNotEmpty(Object[] array) {
+ assertNotNull(array);
+ assert array.length > 0 : NOT_EMPTY;
+ }
- /**
- * Assert that a string is not null or empty
- * @param string String
- */
- public static void assertNotEmpty(String string) {
- assertNotNull(string);
- assert !string.isEmpty() : NOT_EMPTY;
- }
+ /**
+ * Assert that a string is not null or empty
+ * @param string String
+ */
+ public static void assertNotEmpty(String string) {
+ assertNotNull(string);
+ assert !string.isEmpty() : NOT_EMPTY;
+ }
- /**
- * Assert that a value is not equals to an unexpected value
- * @param <N> Number type
- * @param value Value
- * @param unexpectedValue Unxpected value
- */
- public static <N extends Number> void assertNotEquals(N value, N unexpectedValue) {
- assert value.doubleValue() != unexpectedValue.doubleValue() : String.format(NOT_EQUALS, unexpectedValue);
- }
+ /**
+ * Assert that a value is not equals to an unexpected value
+ * @param <N> Number type
+ * @param value Value
+ * @param unexpectedValue Unxpected value
+ */
+ public static <N extends Number> void assertNotEquals(N value, N unexpectedValue) {
+ assert value.doubleValue() != unexpectedValue.doubleValue() : String.format(NOT_EQUALS, unexpectedValue);
+ }
- /**
- * Assert that a value is not negative
- * @param <N> Number type
- * @param value Value
- */
- public static <N extends Number> void assertNotNegative(N value) {
- assertGreaterOrEquals(value, 0);
- }
+ /**
+ * Assert that a value is not negative
+ * @param <N> Number type
+ * @param value Value
+ */
+ public static <N extends Number> void assertNotNegative(N value) {
+ assertGreaterOrEquals(value, 0);
+ }
- /**
- * Assert that an object is not null
- * @param object Object
- */
- public static void assertNotNull(Object object) {
- assert object != null : NOT_NULL;
- }
+ /**
+ * Assert that an object is not null
+ * @param object Object
+ */
+ public static void assertNotNull(Object object) {
+ assert object != null : NOT_NULL;
+ }
- /**
- * Assert that a value is positive
- * @param <N> Number type
- * @param value Value
- */
- public static <N extends Number> void assertPositive(N value) {
- assertGreater(value, 0);
- }
+ /**
+ * Assert that a value is positive
+ * @param <N> Number type
+ * @param value Value
+ */
+ public static <N extends Number> void assertPositive(N value) {
+ assertGreater(value, 0);
+ }
- /**
- * Constructor (prevents instantiation)
- */
- private AssertTools() {
- //
- }
+ /**
+ * Constructor (prevents instantiation)
+ */
+ private AssertTools() {
+ //
+ }
}
Modified: trunk/cantharella.utils/src/main/java/nc/ird/module/utils/BeanLookup.java
===================================================================
--- trunk/cantharella.utils/src/main/java/nc/ird/module/utils/BeanLookup.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.utils/src/main/java/nc/ird/module/utils/BeanLookup.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -33,35 +33,35 @@
*/
public final class BeanLookup extends StrLookup {
- /** Access type */
- private final AccessType accessType;
+ /** Access type */
+ private final AccessType accessType;
- /** Bean */
- private final Object bean;
+ /** Bean */
+ private final Object bean;
- /**
- * Constructor
- * @param bean Bean
- * @param accessType Access type
- */
- public BeanLookup(Object bean, AccessType accessType) {
- super();
- AssertTools.assertNotNull(bean);
- AssertTools.assertNotNull(accessType);
- this.bean = bean;
- this.accessType = accessType;
- }
+ /**
+ * Constructor
+ * @param bean Bean
+ * @param accessType Access type
+ */
+ public BeanLookup(Object bean, AccessType accessType) {
+ super();
+ AssertTools.assertNotNull(bean);
+ AssertTools.assertNotNull(accessType);
+ this.bean = bean;
+ this.accessType = accessType;
+ }
- /** {@inheritDoc} */
- @Override
- public String lookup(String key) {
- AssertTools.assertNotNull(key);
- Object value;
- try {
- value = BeanTools.getValue(bean, accessType, key);
- } catch (IllegalArgumentException e) {
- value = null;
- }
- return value != null ? value.toString() : null;
- }
+ /** {@inheritDoc} */
+ @Override
+ public String lookup(String key) {
+ AssertTools.assertNotNull(key);
+ Object value;
+ try {
+ value = BeanTools.getValue(bean, accessType, key);
+ } catch (IllegalArgumentException e) {
+ value = null;
+ }
+ return value != null ? value.toString() : null;
+ }
}
\ No newline at end of file
Modified: trunk/cantharella.utils/src/main/java/nc/ird/module/utils/BeanTools.java
===================================================================
--- trunk/cantharella.utils/src/main/java/nc/ird/module/utils/BeanTools.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.utils/src/main/java/nc/ird/module/utils/BeanTools.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -45,496 +45,496 @@
*/
public final class BeanTools {
- /** Logger */
- // private static final Log LOG = LogTools.getLog();
- /**
- * Access type
- */
- public enum AccessType {
- /** Access by (public) field */
- FIELD,
- /** Access by (public) getter */
- GETTER;
- }
+ /** Logger */
+ // private static final Log LOG = LogTools.getLog();
+ /**
+ * Access type
+ */
+ public enum AccessType {
+ /** Access by (public) field */
+ FIELD,
+ /** Access by (public) getter */
+ GETTER;
+ }
- /** Error message for annotation not found in a class */
- private static final String ANNOTATION = "Argument of type %s must have a field annotated with %s";
+ /** Error message for annotation not found in a class */
+ private static final String ANNOTATION = "Argument of type %s must have a field annotated with %s";
- /** Error message for field not found in a class */
- private static final String FIELD = "Argument of type %s must have an accessible %s property";
+ /** Error message for field not found in a class */
+ private static final String FIELD = "Argument of type %s must have an accessible %s property";
- /** Parameters */
- private static final Object[] PARAMETERS = new Object[0];
+ /** Parameters */
+ private static final Object[] PARAMETERS = new Object[0];
- /**
- * Equals method
- * @param thiz First object ("this", not null)
- * @param obj Second object
- * @param accessType Access type
- * @param properties Properties (names) to check
- * @return Equality
- */
- public static boolean equals(Object thiz, Object obj, AccessType accessType, String... properties) {
- AssertTools.assertNotNull(thiz);
- AssertTools.assertNotEmpty(properties);
- AssertTools.assertArrayNotNull(properties);
- if (thiz == obj) {
- return true;
- }
- if (obj != null
- && thiz != null
- && (thiz.getClass().isAssignableFrom(obj.getClass()) || obj.getClass()
- .isAssignableFrom(thiz.getClass()))) {
- EqualsBuilder builder = new EqualsBuilder();
- for (String property : properties) {
- try {
- Object val1 = getValue(thiz, accessType, property);
- Object val2 = getValue(obj, accessType, property);
+ /**
+ * Equals method
+ * @param thiz First object ("this", not null)
+ * @param obj Second object
+ * @param accessType Access type
+ * @param properties Properties (names) to check
+ * @return Equality
+ */
+ public static boolean equals(Object thiz, Object obj, AccessType accessType, String... properties) {
+ AssertTools.assertNotNull(thiz);
+ AssertTools.assertNotEmpty(properties);
+ AssertTools.assertArrayNotNull(properties);
+ if (thiz == obj) {
+ return true;
+ }
+ if (obj != null
+ && thiz != null
+ && (thiz.getClass().isAssignableFrom(obj.getClass()) || obj.getClass()
+ .isAssignableFrom(thiz.getClass()))) {
+ EqualsBuilder builder = new EqualsBuilder();
+ for (String property : properties) {
+ try {
+ Object val1 = getValue(thiz, accessType, property);
+ Object val2 = getValue(obj, accessType, property);
- // Test hashCodes first
- if (val1 != null && val2 != null && !builder.append(val1.hashCode(), val2.hashCode()).isEquals()) {
- return false;
- }
+ // Test hashCodes first
+ if (val1 != null && val2 != null && !builder.append(val1.hashCode(), val2.hashCode()).isEquals()) {
+ return false;
+ }
- if (!builder.append(val1, val2).isEquals()) {
- return false;
- }
- } catch (RuntimeException e) {
- throw e;
- } catch (Exception e) {
- throw new IllegalArgumentException(String.format(FIELD, thiz.getClass(), property), e);
- }
+ if (!builder.append(val1, val2).isEquals()) {
+ return false;
+ }
+ } catch (RuntimeException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new IllegalArgumentException(String.format(FIELD, thiz.getClass(), property), e);
+ }
- }
- return builder.isEquals();
- }
- return false;
- }
+ }
+ return builder.isEquals();
+ }
+ return false;
+ }
- /**
- * Equals method
- * @param thiz First object ("this", not null)
- * @param obj Second object
- * @param fields Public fields to check
- * @return Equality
- */
- public static boolean equals(Object thiz, Object obj, Field... fields) {
- AssertTools.assertNotNull(thiz);
- AssertTools.assertNotEmpty(fields);
- AssertTools.assertArrayNotNull(fields);
- if (thiz == obj) {
- return true;
- }
- if (obj != null
- && thiz != null
- && (thiz.getClass().isAssignableFrom(obj.getClass()) || obj.getClass()
- .isAssignableFrom(thiz.getClass()))) {
- EqualsBuilder builder = new EqualsBuilder();
- for (Field field : fields) {
- try {
- Object val1 = field.get(thiz);
- Object val2 = field.get(obj);
+ /**
+ * Equals method
+ * @param thiz First object ("this", not null)
+ * @param obj Second object
+ * @param fields Public fields to check
+ * @return Equality
+ */
+ public static boolean equals(Object thiz, Object obj, Field... fields) {
+ AssertTools.assertNotNull(thiz);
+ AssertTools.assertNotEmpty(fields);
+ AssertTools.assertArrayNotNull(fields);
+ if (thiz == obj) {
+ return true;
+ }
+ if (obj != null
+ && thiz != null
+ && (thiz.getClass().isAssignableFrom(obj.getClass()) || obj.getClass()
+ .isAssignableFrom(thiz.getClass()))) {
+ EqualsBuilder builder = new EqualsBuilder();
+ for (Field field : fields) {
+ try {
+ Object val1 = field.get(thiz);
+ Object val2 = field.get(obj);
- // Test hashCodes first
- if (val1 != null && val2 != null && !builder.append(val1.hashCode(), val2.hashCode()).isEquals()) {
- return false;
- }
+ // Test hashCodes first
+ if (val1 != null && val2 != null && !builder.append(val1.hashCode(), val2.hashCode()).isEquals()) {
+ return false;
+ }
- if (!builder.append(val1, val2).isEquals()) {
- return false;
- }
- } catch (RuntimeException e) {
- throw e;
- } catch (Exception e) {
- throw new IllegalArgumentException(String.format(FIELD, thiz.getClass(), field.getName()), e);
- }
- }
- return builder.isEquals();
- }
- return false;
- }
+ if (!builder.append(val1, val2).isEquals()) {
+ return false;
+ }
+ } catch (RuntimeException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new IllegalArgumentException(String.format(FIELD, thiz.getClass(), field.getName()), e);
+ }
+ }
+ return builder.isEquals();
+ }
+ return false;
+ }
- /**
- * Retrieve an annotated public field or from inherited public field too
- * @param thiz Object
- * @param annotations Annotations to retrieve on a public field
- * @return First annotated public field
- * @throws NoSuchFieldException If an annotation cannot be found
- */
- public static Field getAnnotatedPublicField(Object thiz, Class<? extends Annotation>... annotations)
- throws NoSuchFieldException {
- AssertTools.assertNotNull(thiz);
- return getAnnotatedPublicField(thiz.getClass(), annotations);
- }
+ /**
+ * Retrieve an annotated public field or from inherited public field too
+ * @param thiz Object
+ * @param annotations Annotations to retrieve on a public field
+ * @return First annotated public field
+ * @throws NoSuchFieldException If an annotation cannot be found
+ */
+ public static Field getAnnotatedPublicField(Object thiz, Class<? extends Annotation>... annotations)
+ throws NoSuchFieldException {
+ AssertTools.assertNotNull(thiz);
+ return getAnnotatedPublicField(thiz.getClass(), annotations);
+ }
- /**
- * Retrieve an annotated from private field or from inherited private, protected or public field
- * @param clazz The class which contains annotations (or inherited class)
- * @param annotations Annotations to retrieve
- * @return First annotated field finded
- * @throws NoSuchFieldException If an annotation cannot be found
- */
- public static Field getAnnotatedPrivateField(Class<?> clazz, Class<? extends Annotation>... annotations)
- throws NoSuchFieldException {
- AssertTools.assertNotNull(clazz);
- AssertTools.assertNotEmpty(annotations);
- AssertTools.assertArrayNotNull(annotations);
- Field[] fields = clazz.getDeclaredFields();
- Field field = null;
- int i = 0;
- while (field == null && i < fields.length) {
- int j = 0;
- while (field == null && j < annotations.length) {
- if (fields[i].isAnnotationPresent(annotations[j])) {
- field = fields[i];
- }
- ++j;
- }
- ++i;
- }
- if (field == null) {
- // if not found
- if (clazz.getSuperclass() == null) {
- throw new NoSuchFieldException(String.format(ANNOTATION, clazz.getName(), Arrays.toString(annotations)));
- }
- // recursive search in the superclass
- return getAnnotatedInheritedField(clazz, clazz.getSuperclass(), annotations);
- }
- return field;
- }
+ /**
+ * Retrieve an annotated from private field or from inherited private, protected or public field
+ * @param clazz The class which contains annotations (or inherited class)
+ * @param annotations Annotations to retrieve
+ * @return First annotated field finded
+ * @throws NoSuchFieldException If an annotation cannot be found
+ */
+ public static Field getAnnotatedPrivateField(Class<?> clazz, Class<? extends Annotation>... annotations)
+ throws NoSuchFieldException {
+ AssertTools.assertNotNull(clazz);
+ AssertTools.assertNotEmpty(annotations);
+ AssertTools.assertArrayNotNull(annotations);
+ Field[] fields = clazz.getDeclaredFields();
+ Field field = null;
+ int i = 0;
+ while (field == null && i < fields.length) {
+ int j = 0;
+ while (field == null && j < annotations.length) {
+ if (fields[i].isAnnotationPresent(annotations[j])) {
+ field = fields[i];
+ }
+ ++j;
+ }
+ ++i;
+ }
+ if (field == null) {
+ // if not found
+ if (clazz.getSuperclass() == null) {
+ throw new NoSuchFieldException(String.format(ANNOTATION, clazz.getName(), Arrays.toString(annotations)));
+ }
+ // recursive search in the superclass
+ return getAnnotatedInheritedField(clazz, clazz.getSuperclass(), annotations);
+ }
+ return field;
+ }
- /**
- * Retrieve an annotated from inherited private, protected or public field
- * @param baseClazz The base clazz where the search began
- * @param browsedClazz The
- * @param annotations Annotations to retrieve
- * @return First annotated field finded
- * @throws NoSuchFieldException If an annotation cannot be found
- */
- private static Field getAnnotatedInheritedField(Class<?> baseClazz, Class<?> browsedClazz,
- Class<? extends Annotation>... annotations) throws NoSuchFieldException {
- AssertTools.assertNotNull(baseClazz);
- AssertTools.assertNotEmpty(annotations);
- AssertTools.assertArrayNotNull(annotations);
+ /**
+ * Retrieve an annotated from inherited private, protected or public field
+ * @param baseClazz The base clazz where the search began
+ * @param browsedClazz The
+ * @param annotations Annotations to retrieve
+ * @return First annotated field finded
+ * @throws NoSuchFieldException If an annotation cannot be found
+ */
+ private static Field getAnnotatedInheritedField(Class<?> baseClazz, Class<?> browsedClazz,
+ Class<? extends Annotation>... annotations) throws NoSuchFieldException {
+ AssertTools.assertNotNull(baseClazz);
+ AssertTools.assertNotEmpty(annotations);
+ AssertTools.assertArrayNotNull(annotations);
- Field[] fields = browsedClazz.getDeclaredFields();
- Field field = null;
- int i = 0;
- while (field == null && i < fields.length) {
- int j = 0;
- while (field == null && j < annotations.length) {
- if (fields[i].isAnnotationPresent(annotations[j])
- && (Modifier.isProtected(fields[i].getModifiers())
- || Modifier.isPublic(fields[i].getModifiers()) || Modifier.isPrivate(fields[i]
- .getModifiers()))) {
- field = fields[i];
- }
- ++j;
- }
- ++i;
- }
- if (field == null) {
- // if not found
- if (browsedClazz.getSuperclass() == null) {
- throw new NoSuchFieldException(String.format(ANNOTATION, baseClazz.getName(), Arrays
- .toString(annotations)));
- }
- // recursive search in the superclass
- getAnnotatedInheritedField(baseClazz, browsedClazz.getSuperclass(), annotations);
- }
- return field;
- }
+ Field[] fields = browsedClazz.getDeclaredFields();
+ Field field = null;
+ int i = 0;
+ while (field == null && i < fields.length) {
+ int j = 0;
+ while (field == null && j < annotations.length) {
+ if (fields[i].isAnnotationPresent(annotations[j])
+ && (Modifier.isProtected(fields[i].getModifiers())
+ || Modifier.isPublic(fields[i].getModifiers()) || Modifier.isPrivate(fields[i]
+ .getModifiers()))) {
+ field = fields[i];
+ }
+ ++j;
+ }
+ ++i;
+ }
+ if (field == null) {
+ // if not found
+ if (browsedClazz.getSuperclass() == null) {
+ throw new NoSuchFieldException(String.format(ANNOTATION, baseClazz.getName(), Arrays
+ .toString(annotations)));
+ }
+ // recursive search in the superclass
+ getAnnotatedInheritedField(baseClazz, browsedClazz.getSuperclass(), annotations);
+ }
+ return field;
+ }
- /**
- * Retrieve an annotated public field
- * @param clazz The class which contains annotations
- * @param annotations Annotations to retrieve on a public field
- * @return First annotated public field
- * @throws NoSuchFieldException If an annotation cannot be found
- */
- public static Field getAnnotatedPublicField(Class<?> clazz, Class<? extends Annotation>... annotations)
- throws NoSuchFieldException {
- AssertTools.assertNotNull(clazz);
- AssertTools.assertNotEmpty(annotations);
- AssertTools.assertArrayNotNull(annotations);
- Field[] fields = clazz.getFields();
- Field field = null;
- int i = 0;
- while (field == null && i < fields.length) {
- int j = 0;
- while (field == null && j < annotations.length) {
- if (fields[i].isAnnotationPresent(annotations[j])) {
- field = fields[i];
- }
- ++j;
- }
- ++i;
- }
- if (field == null) {
- throw new NoSuchFieldException(String.format(ANNOTATION, clazz.getName(), Arrays.toString(annotations)));
- }
- return field;
- }
+ /**
+ * Retrieve an annotated public field
+ * @param clazz The class which contains annotations
+ * @param annotations Annotations to retrieve on a public field
+ * @return First annotated public field
+ * @throws NoSuchFieldException If an annotation cannot be found
+ */
+ public static Field getAnnotatedPublicField(Class<?> clazz, Class<? extends Annotation>... annotations)
+ throws NoSuchFieldException {
+ AssertTools.assertNotNull(clazz);
+ AssertTools.assertNotEmpty(annotations);
+ AssertTools.assertArrayNotNull(annotations);
+ Field[] fields = clazz.getFields();
+ Field field = null;
+ int i = 0;
+ while (field == null && i < fields.length) {
+ int j = 0;
+ while (field == null && j < annotations.length) {
+ if (fields[i].isAnnotationPresent(annotations[j])) {
+ field = fields[i];
+ }
+ ++j;
+ }
+ ++i;
+ }
+ if (field == null) {
+ throw new NoSuchFieldException(String.format(ANNOTATION, clazz.getName(), Arrays.toString(annotations)));
+ }
+ return field;
+ }
- /**
- * Get an annotation on a bean property
- * @param <A> Annotation class
- * @param beanClass Bean class
- * @param annotation Annotation
- * @param property Property name
- * @return The annotation
- * @throws NoSuchFieldException If the property does not exist
- */
- public static <A extends Annotation> A getAnnotationOnProperty(Class<?> beanClass, Class<A> annotation,
- String property) throws NoSuchFieldException {
- AssertTools.assertNotNull(beanClass);
- AssertTools.assertNotNull(annotation);
- return beanClass.getField(property).getAnnotation(annotation);
- }
+ /**
+ * Get an annotation on a bean property
+ * @param <A> Annotation class
+ * @param beanClass Bean class
+ * @param annotation Annotation
+ * @param property Property name
+ * @return The annotation
+ * @throws NoSuchFieldException If the property does not exist
+ */
+ public static <A extends Annotation> A getAnnotationOnProperty(Class<?> beanClass, Class<A> annotation,
+ String property) throws NoSuchFieldException {
+ AssertTools.assertNotNull(beanClass);
+ AssertTools.assertNotNull(annotation);
+ return beanClass.getField(property).getAnnotation(annotation);
+ }
- /**
- * Get a property value for a specified bean
- * @param bean Bean
- * @param accessType Access type
- * @param property Property name
- * @return Property value
- */
- public static Object getValue(Object bean, AccessType accessType, String property) {
- AssertTools.assertNotNull(bean);
- AssertTools.assertNotNull(accessType);
- AssertTools.assertNotEmpty(property);
- Object value;
- switch (accessType) {
- case GETTER:
- try {
- value = new PropertyDescriptor(property, bean.getClass(), "is" + StringUtils.capitalize(property),
- null).getReadMethod().invoke(bean, PARAMETERS);
- } catch (RuntimeException e) {
- throw e;
- } catch (Exception e) {
- throw new IllegalArgumentException(e);
- }
- break;
- case FIELD:
- try {
- value = bean.getClass().getField(property).get(bean);
- } catch (RuntimeException e) {
- throw e;
- } catch (Exception e) {
- throw new IllegalArgumentException(e);
- }
- break;
- default:
- throw new IllegalArgumentException();
- }
- return value;
- }
+ /**
+ * Get a property value for a specified bean
+ * @param bean Bean
+ * @param accessType Access type
+ * @param property Property name
+ * @return Property value
+ */
+ public static Object getValue(Object bean, AccessType accessType, String property) {
+ AssertTools.assertNotNull(bean);
+ AssertTools.assertNotNull(accessType);
+ AssertTools.assertNotEmpty(property);
+ Object value;
+ switch (accessType) {
+ case GETTER:
+ try {
+ value = new PropertyDescriptor(property, bean.getClass(), "is" + StringUtils.capitalize(property),
+ null).getReadMethod().invoke(bean, PARAMETERS);
+ } catch (RuntimeException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new IllegalArgumentException(e);
+ }
+ break;
+ case FIELD:
+ try {
+ value = bean.getClass().getField(property).get(bean);
+ } catch (RuntimeException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new IllegalArgumentException(e);
+ }
+ break;
+ default:
+ throw new IllegalArgumentException();
+ }
+ return value;
+ }
- /**
- * Get a property value for a specified bean
- * @param bean Bean
- * @param accessType Access type
- * @param pathToProperty properties path to access the property, example : beanX.beanY.propZ
- * @return Property value
- */
- public static Object getValueFromPath(Object bean, AccessType accessType, String pathToProperty) {
- AssertTools.assertNotNull(bean);
- AssertTools.assertNotNull(accessType);
- AssertTools.assertNotEmpty(pathToProperty);
- List<String> beanNames = createAccessBeanList(pathToProperty);
- Object curBean = bean;
- for (String beanName : beanNames) {
- curBean = BeanTools.getValue(curBean, AccessType.GETTER, beanName);
- }
- return curBean;
- }
+ /**
+ * Get a property value for a specified bean
+ * @param bean Bean
+ * @param accessType Access type
+ * @param pathToProperty properties path to access the property, example : beanX.beanY.propZ
+ * @return Property value
+ */
+ public static Object getValueFromPath(Object bean, AccessType accessType, String pathToProperty) {
+ AssertTools.assertNotNull(bean);
+ AssertTools.assertNotNull(accessType);
+ AssertTools.assertNotEmpty(pathToProperty);
+ List<String> beanNames = createAccessBeanList(pathToProperty);
+ Object curBean = bean;
+ for (String beanName : beanNames) {
+ curBean = BeanTools.getValue(curBean, AccessType.GETTER, beanName);
+ }
+ return curBean;
+ }
- /**
- * Extract from the given path, the differents beans name to access example : "X.Y.Z.F" will give the the array
- * {"X", "Y", "Z", "F"}
- * @param propertiesPath the properties path to browse
- * @return an array of all the different bean names to access
- */
- private static List<String> createAccessBeanList(final String propertiesPath) {
- final Matcher matcher = Pattern.compile("\\w+").matcher(propertiesPath);
- List<String> paramList = new ArrayList<String>();
- while (matcher.find()) {
- paramList.add(propertiesPath.substring(matcher.start(), matcher.end()));
- }
- return paramList;
- }
+ /**
+ * Extract from the given path, the differents beans name to access example : "X.Y.Z.F" will give the the array
+ * {"X", "Y", "Z", "F"}
+ * @param propertiesPath the properties path to browse
+ * @return an array of all the different bean names to access
+ */
+ private static List<String> createAccessBeanList(final String propertiesPath) {
+ final Matcher matcher = Pattern.compile("\\w+").matcher(propertiesPath);
+ List<String> paramList = new ArrayList<String>();
+ while (matcher.find()) {
+ paramList.add(propertiesPath.substring(matcher.start(), matcher.end()));
+ }
+ return paramList;
+ }
- /**
- * HashCode method
- * @param thiz Bean (not null)
- * @param fields Public fields to considere
- * @return HashCode
- */
- public static int hashCode(Object thiz, Field... fields) {
- AssertTools.assertNotNull(thiz);
- AssertTools.assertNotEmpty(fields);
- AssertTools.assertArrayNotNull(fields);
- int seed = thiz.getClass().hashCode();
- int hashCode = seed;
- for (Field field : fields) {
- Object value;
- try {
- value = field.get(thiz);
- } catch (RuntimeException e) {
- throw e;
- } catch (Exception e) {
- throw new IllegalArgumentException(String.format(FIELD, thiz.getClass(), field.getName()), e);
- }
- hashCode += value != null ? seed ^ value.hashCode() : 0;
- }
- return hashCode;
- }
+ /**
+ * HashCode method
+ * @param thiz Bean (not null)
+ * @param fields Public fields to considere
+ * @return HashCode
+ */
+ public static int hashCode(Object thiz, Field... fields) {
+ AssertTools.assertNotNull(thiz);
+ AssertTools.assertNotEmpty(fields);
+ AssertTools.assertArrayNotNull(fields);
+ int seed = thiz.getClass().hashCode();
+ int hashCode = seed;
+ for (Field field : fields) {
+ Object value;
+ try {
+ value = field.get(thiz);
+ } catch (RuntimeException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new IllegalArgumentException(String.format(FIELD, thiz.getClass(), field.getName()), e);
+ }
+ hashCode += value != null ? seed ^ value.hashCode() : 0;
+ }
+ return hashCode;
+ }
- /**
- * HashCode method
- * @param thiz Bean (not null)
- * @param ids Bean IDs
- * @return HashCode
- */
- public static int hashCode(Object thiz, Object... ids) {
- AssertTools.assertNotNull(thiz);
- AssertTools.assertNotEmpty(ids);
- AssertTools.assertNotNull(ids);
- int seed = thiz.getClass().hashCode();
- int hashCode = seed;
- for (Object id : ids) {
- hashCode += id != null ? seed ^ id.hashCode() : 0;
- }
- return hashCode;
- }
+ /**
+ * HashCode method
+ * @param thiz Bean (not null)
+ * @param ids Bean IDs
+ * @return HashCode
+ */
+ public static int hashCode(Object thiz, Object... ids) {
+ AssertTools.assertNotNull(thiz);
+ AssertTools.assertNotEmpty(ids);
+ AssertTools.assertNotNull(ids);
+ int seed = thiz.getClass().hashCode();
+ int hashCode = seed;
+ for (Object id : ids) {
+ hashCode += id != null ? seed ^ id.hashCode() : 0;
+ }
+ return hashCode;
+ }
- /**
- * Is there an annotation on a bean property
- * @param <A> Annotation class
- * @param beanClass Bean class
- * @param annotation Annotation
- * @param property Property name
- * @return TRUE if the annotation is on the bean property
- * @throws NoSuchFieldException If the property does not exist
- */
- public static <A extends Annotation> boolean isAnnotationOnProperty(Class<?> beanClass, Class<A> annotation,
- String property) throws NoSuchFieldException {
- return getAnnotationOnProperty(beanClass, annotation, property) != null;
- }
+ /**
+ * Is there an annotation on a bean property
+ * @param <A> Annotation class
+ * @param beanClass Bean class
+ * @param annotation Annotation
+ * @param property Property name
+ * @return TRUE if the annotation is on the bean property
+ * @throws NoSuchFieldException If the property does not exist
+ */
+ public static <A extends Annotation> boolean isAnnotationOnProperty(Class<?> beanClass, Class<A> annotation,
+ String property) throws NoSuchFieldException {
+ return getAnnotationOnProperty(beanClass, annotation, property) != null;
+ }
- /**
- * Display a bean by listing the specified properties
- * @param bean Bean
- * @param delimiter Delimiter between properties in the resulting string
- * @param accessType Access type
- * @param pathsToProperties Path of properties to display
- * @return Bean display
- */
- public static String toString(Object bean, String delimiter, AccessType accessType, String... pathsToProperties) {
- AssertTools.assertNotNull(bean);
- AssertTools.assertNotEmpty(delimiter);
- AssertTools.assertArrayNotNull(pathsToProperties);
- Class<?> clazz = bean.getClass();
- StringBuilder builder = new StringBuilder(clazz.getName());
- for (String pathToProperty : pathsToProperties) {
- try {
- Object value = getValueFromPath(bean, accessType, pathToProperty);
- builder.append(delimiter + pathToProperty + ": " + (value != null ? value.toString() : "<null>"));
- } catch (RuntimeException e) {
- throw e;
- } catch (Exception e) {
- throw new IllegalArgumentException(String.format(FIELD, clazz, pathToProperty), e);
- }
- }
- return builder.toString();
- }
+ /**
+ * Display a bean by listing the specified properties
+ * @param bean Bean
+ * @param delimiter Delimiter between properties in the resulting string
+ * @param accessType Access type
+ * @param pathsToProperties Path of properties to display
+ * @return Bean display
+ */
+ public static String toString(Object bean, String delimiter, AccessType accessType, String... pathsToProperties) {
+ AssertTools.assertNotNull(bean);
+ AssertTools.assertNotEmpty(delimiter);
+ AssertTools.assertArrayNotNull(pathsToProperties);
+ Class<?> clazz = bean.getClass();
+ StringBuilder builder = new StringBuilder(clazz.getName());
+ for (String pathToProperty : pathsToProperties) {
+ try {
+ Object value = getValueFromPath(bean, accessType, pathToProperty);
+ builder.append(delimiter + pathToProperty + ": " + (value != null ? value.toString() : "<null>"));
+ } catch (RuntimeException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new IllegalArgumentException(String.format(FIELD, clazz, pathToProperty), e);
+ }
+ }
+ return builder.toString();
+ }
- /**
- * Display a bean by listing the specified properties (separated by "\n")
- * @param bean Bean
- * @param accessType Access type
- * @param properties Properties to display
- * @return Bean display
- */
- public static String toString(Object bean, AccessType accessType, String... properties) {
- return toString(bean, "\n- ", accessType, properties);
- }
+ /**
+ * Display a bean by listing the specified properties (separated by "\n")
+ * @param bean Bean
+ * @param accessType Access type
+ * @param properties Properties to display
+ * @return Bean display
+ */
+ public static String toString(Object bean, AccessType accessType, String... properties) {
+ return toString(bean, "\n- ", accessType, properties);
+ }
- /**
- * Constructor (prevents instantiation)
- */
- private BeanTools() {
- //
- }
+ /**
+ * Constructor (prevents instantiation)
+ */
+ private BeanTools() {
+ //
+ }
- /**
- * Display a list of beans by listing the specified properties (bean separated by "\n", properties by ", ")
- * @param beansList The beans list to browsed
- * @param accessType Access type
- * @param pathsToProperties Paths to properties to display
- * @return Bean display
- */
- public static String beanListToString(List<? extends Object> beansList, AccessType accessType,
- String... pathsToProperties) {
- return BeanTools.beanListToString(beansList, "\n", ", ", accessType, pathsToProperties);
- }
+ /**
+ * Display a list of beans by listing the specified properties (bean separated by "\n", properties by ", ")
+ * @param beansList The beans list to browsed
+ * @param accessType Access type
+ * @param pathsToProperties Paths to properties to display
+ * @return Bean display
+ */
+ public static String beanListToString(List<? extends Object> beansList, AccessType accessType,
+ String... pathsToProperties) {
+ return BeanTools.beanListToString(beansList, "\n", ", ", accessType, pathsToProperties);
+ }
- /**
- * Display a list of beans by listing the specified properties
- * @param beansList The beans list to browsed
- * @param delimiterBeans Delimiter between beans in the resulting string
- * @param delimiterProperties Delimiter between properties in the resulting string
- * @param accessType Access type
- * @param pathsToProperties Paths to properties to display
- * @return Bean display
- */
- public static String beanListToString(List<? extends Object> beansList, String delimiterBeans,
- String delimiterProperties, AccessType accessType, String... pathsToProperties) {
- AssertTools.assertNotNull(beansList);
- AssertTools.assertNotEmpty(delimiterProperties);
- AssertTools.assertNotEmpty(delimiterBeans);
- AssertTools.assertNotNull(accessType);
- StringBuilder builder = new StringBuilder();
- Iterator<? extends Object> itBeans = beansList.iterator();
- while (itBeans.hasNext()) {
- Object bean = itBeans.next();
- builder.append(toString(bean, delimiterProperties, accessType, pathsToProperties));
- if (itBeans.hasNext()) {
- builder.append(delimiterBeans);
- }
- }
- return builder.toString();
- }
+ /**
+ * Display a list of beans by listing the specified properties
+ * @param beansList The beans list to browsed
+ * @param delimiterBeans Delimiter between beans in the resulting string
+ * @param delimiterProperties Delimiter between properties in the resulting string
+ * @param accessType Access type
+ * @param pathsToProperties Paths to properties to display
+ * @return Bean display
+ */
+ public static String beanListToString(List<? extends Object> beansList, String delimiterBeans,
+ String delimiterProperties, AccessType accessType, String... pathsToProperties) {
+ AssertTools.assertNotNull(beansList);
+ AssertTools.assertNotEmpty(delimiterProperties);
+ AssertTools.assertNotEmpty(delimiterBeans);
+ AssertTools.assertNotNull(accessType);
+ StringBuilder builder = new StringBuilder();
+ Iterator<? extends Object> itBeans = beansList.iterator();
+ while (itBeans.hasNext()) {
+ Object bean = itBeans.next();
+ builder.append(toString(bean, delimiterProperties, accessType, pathsToProperties));
+ if (itBeans.hasNext()) {
+ builder.append(delimiterBeans);
+ }
+ }
+ return builder.toString();
+ }
- /**
- * Wrapping of Apache communs BeanComparator. Create a comparator which compares two beans by the specified bean
- * property. Property expression can use Apache's nested, indexed, combinated, mapped syntax. @see <a
- * href="http://commons.apache.org/beanutils/api/org/apache/commons/beanutils/BeanCo…">Apache's Bean
- * Comparator</a> for more details.
- * @param <T> generic type
- * @param propertyExpression propertyExpression
- * @return the comparator
- */
- @SuppressWarnings("unchecked")
- public static <T> Comparator<T> createPropertyComparator(final String propertyExpression) {
- return new BeanComparator(propertyExpression);
- }
+ /**
+ * Wrapping of Apache communs BeanComparator. Create a comparator which compares two beans by the specified bean
+ * property. Property expression can use Apache's nested, indexed, combinated, mapped syntax. @see <a
+ * href="http://commons.apache.org/beanutils/api/org/apache/commons/beanutils/BeanCo…">Apache's Bean
+ * Comparator</a> for more details.
+ * @param <T> generic type
+ * @param propertyExpression propertyExpression
+ * @return the comparator
+ */
+ @SuppressWarnings("unchecked")
+ public static <T> Comparator<T> createPropertyComparator(final String propertyExpression) {
+ return new BeanComparator(propertyExpression);
+ }
- /**
- * Wrapping of Apache communs BeanComparator to avoid "unchecked" tag in code. Create a comparator which compares
- * two beans by the specified bean property. Property expression can use Apache's nested, indexed, combinated,
- * mapped syntax. @see <a
- * href="http://commons.apache.org/beanutils/api/org/apache/commons/beanutils/BeanCo…">Apache's Bean
- * Comparator</a> for more details.
- * @param <T> generic type
- * @param propertyExpression PropertyExpression
- * @param comparator BeanComparator will pass the values of the specified bean property to this Comparator. If your
- * bean property is not a comparable or contains null values, a suitable comparator may be supplied in this
- * constructor
- * @return the Comparator being used to compare beans
- */
- @SuppressWarnings("unchecked")
- public static <T> Comparator<T> createPropertyComparator(final String propertyExpression, Comparator<T> comparator) {
- return new BeanComparator(propertyExpression, comparator);
- }
+ /**
+ * Wrapping of Apache communs BeanComparator to avoid "unchecked" tag in code. Create a comparator which compares
+ * two beans by the specified bean property. Property expression can use Apache's nested, indexed, combinated,
+ * mapped syntax. @see <a
+ * href="http://commons.apache.org/beanutils/api/org/apache/commons/beanutils/BeanCo…">Apache's Bean
+ * Comparator</a> for more details.
+ * @param <T> generic type
+ * @param propertyExpression PropertyExpression
+ * @param comparator BeanComparator will pass the values of the specified bean property to this Comparator. If your
+ * bean property is not a comparable or contains null values, a suitable comparator may be supplied in this
+ * constructor
+ * @return the Comparator being used to compare beans
+ */
+ @SuppressWarnings("unchecked")
+ public static <T> Comparator<T> createPropertyComparator(final String propertyExpression, Comparator<T> comparator) {
+ return new BeanComparator(propertyExpression, comparator);
+ }
}
Modified: trunk/cantharella.utils/src/main/java/nc/ird/module/utils/CaptchaTools.java
===================================================================
--- trunk/cantharella.utils/src/main/java/nc/ird/module/utils/CaptchaTools.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.utils/src/main/java/nc/ird/module/utils/CaptchaTools.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -30,25 +30,25 @@
*/
public final class CaptchaTools {
- /** Captcha max length */
- public static final int CAPTCHA_LENGTH_MAX = 6;
+ /** Captcha max length */
+ public static final int CAPTCHA_LENGTH_MAX = 6;
- /** Captcha min length */
- public static final int CAPTCHA_LENGTH_MIN = 3;
+ /** Captcha min length */
+ public static final int CAPTCHA_LENGTH_MIN = 3;
- /**
- * Generate a random numeric catpcha
- * @return Captcha
- */
- public static String random() {
- return RandomStringUtils
- .randomNumeric((int) (Math.random() * (CAPTCHA_LENGTH_MAX - CAPTCHA_LENGTH_MIN) + CAPTCHA_LENGTH_MIN));
- }
+ /**
+ * Generate a random numeric catpcha
+ * @return Captcha
+ */
+ public static String random() {
+ return RandomStringUtils
+ .randomNumeric((int) (Math.random() * (CAPTCHA_LENGTH_MAX - CAPTCHA_LENGTH_MIN) + CAPTCHA_LENGTH_MIN));
+ }
- /**
- * Constructor (prevents from instantiation)
- */
- private CaptchaTools() {
- //
- }
+ /**
+ * Constructor (prevents from instantiation)
+ */
+ private CaptchaTools() {
+ //
+ }
}
Modified: trunk/cantharella.utils/src/main/java/nc/ird/module/utils/CollectionTools.java
===================================================================
--- trunk/cantharella.utils/src/main/java/nc/ird/module/utils/CollectionTools.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.utils/src/main/java/nc/ird/module/utils/CollectionTools.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -40,205 +40,205 @@
*/
public final class CollectionTools {
- /**
- * Test if all collection's values contain always the same value
- * @param <T> Collection type
- * @param collection Collection to parse
- * @param value Value which is tested for the identity (may be null)
- * @return The answer
- */
- public static <T> boolean containsOnlySameValue(Collection<T> collection, T value) {
- AssertTools.assertNotNull(collection);
+ /**
+ * Test if all collection's values contain always the same value
+ * @param <T> Collection type
+ * @param collection Collection to parse
+ * @param value Value which is tested for the identity (may be null)
+ * @return The answer
+ */
+ public static <T> boolean containsOnlySameValue(Collection<T> collection, T value) {
+ AssertTools.assertNotNull(collection);
- if (collection.isEmpty()) {
- return false;
- }
+ if (collection.isEmpty()) {
+ return false;
+ }
- boolean hasSame = true;
- Iterator<T> itCol = collection.iterator();
- while (hasSame && itCol.hasNext()) {
- T curVal = itCol.next();
- if (!ObjectUtils.equals(curVal, value)) {
- hasSame = false;
- }
- }
- return hasSame;
- }
+ boolean hasSame = true;
+ Iterator<T> itCol = collection.iterator();
+ while (hasSame && itCol.hasNext()) {
+ T curVal = itCol.next();
+ if (!ObjectUtils.equals(curVal, value)) {
+ hasSame = false;
+ }
+ }
+ return hasSame;
+ }
- /**
- * Intersection of two sets
- * @param <T> Set type
- * @param s1 Set 1
- * @param s2 Set 2
- * @return Intersection
- */
- public static <T> Set<T> intersect(Set<T> s1, Set<T> s2) {
- Set<T> intersect = s1 == null ? new HashSet<T>() : new HashSet<T>(s1);
- intersect.retainAll(s2);
- return intersect;
- }
+ /**
+ * Intersection of two sets
+ * @param <T> Set type
+ * @param s1 Set 1
+ * @param s2 Set 2
+ * @return Intersection
+ */
+ public static <T> Set<T> intersect(Set<T> s1, Set<T> s2) {
+ Set<T> intersect = s1 == null ? new HashSet<T>() : new HashSet<T>(s1);
+ intersect.retainAll(s2);
+ return intersect;
+ }
- /**
- * Setter for collections, preserving the instance
- * @param <T> Collection type
- * @param collectionToWrite Collection to write
- * @param collectionToRead Collection to read
- */
- public static <T> void setter(Collection<T> collectionToWrite, Collection<T> collectionToRead) {
- AssertTools.assertNotNull(collectionToWrite);
- collectionToWrite.clear();
- if (collectionToRead != null) {
- collectionToWrite.addAll(collectionToRead);
- }
- }
+ /**
+ * Setter for collections, preserving the instance
+ * @param <T> Collection type
+ * @param collectionToWrite Collection to write
+ * @param collectionToRead Collection to read
+ */
+ public static <T> void setter(Collection<T> collectionToWrite, Collection<T> collectionToRead) {
+ AssertTools.assertNotNull(collectionToWrite);
+ collectionToWrite.clear();
+ if (collectionToRead != null) {
+ collectionToWrite.addAll(collectionToRead);
+ }
+ }
- /**
- * Check in a collection of beans if a property has a specific value
- * @param collection The collection to parse
- * @param pathToProperty The path to the tested bean property (for each bean in the collection), example :
- * beanX.beanY.propZ
- * @param accessType The access type to reach each property value
- * @param value The value to find
- * @return true if the value is found, otherwise false
- */
- public static boolean containsWithValue(Collection<? extends Object> collection, String pathToProperty,
- AccessType accessType, Object value) {
- AssertTools.assertNotNull(collection);
- AssertTools.assertNotEmpty(pathToProperty);
- for (Object curBean : collection) {
- Object curVal = BeanTools.getValueFromPath(curBean, accessType, pathToProperty);
- if (curVal.equals(value)) {
- return true;
- }
- }
- return false;
- }
+ /**
+ * Check in a collection of beans if a property has a specific value
+ * @param collection The collection to parse
+ * @param pathToProperty The path to the tested bean property (for each bean in the collection), example :
+ * beanX.beanY.propZ
+ * @param accessType The access type to reach each property value
+ * @param value The value to find
+ * @return true if the value is found, otherwise false
+ */
+ public static boolean containsWithValue(Collection<? extends Object> collection, String pathToProperty,
+ AccessType accessType, Object value) {
+ AssertTools.assertNotNull(collection);
+ AssertTools.assertNotEmpty(pathToProperty);
+ for (Object curBean : collection) {
+ Object curVal = BeanTools.getValueFromPath(curBean, accessType, pathToProperty);
+ if (curVal.equals(value)) {
+ return true;
+ }
+ }
+ return false;
+ }
- /**
- * Count in a collection of beans the number of beans which have a specific value
- * @param collection The collection to parse
- * @param pathToProperty The path to the tested bean property, example : beanX.beanY.propZ
- * @param accessType The access type to reach each property value
- * @param value The value to find
- * @return The count result
- */
- public static int countWithValue(Collection<? extends Object> collection, String pathToProperty,
- AccessType accessType, Object value) {
- AssertTools.assertNotNull(collection);
- AssertTools.assertNotEmpty(pathToProperty);
- int count = 0;
- for (Object curBean : collection) {
- Object curVal = BeanTools.getValueFromPath(curBean, accessType, pathToProperty);
- if (value.equals(curVal)) {
- count++;
- }
- }
- return count;
- }
+ /**
+ * Count in a collection of beans the number of beans which have a specific value
+ * @param collection The collection to parse
+ * @param pathToProperty The path to the tested bean property, example : beanX.beanY.propZ
+ * @param accessType The access type to reach each property value
+ * @param value The value to find
+ * @return The count result
+ */
+ public static int countWithValue(Collection<? extends Object> collection, String pathToProperty,
+ AccessType accessType, Object value) {
+ AssertTools.assertNotNull(collection);
+ AssertTools.assertNotEmpty(pathToProperty);
+ int count = 0;
+ for (Object curBean : collection) {
+ Object curVal = BeanTools.getValueFromPath(curBean, accessType, pathToProperty);
+ if (value.equals(curVal)) {
+ count++;
+ }
+ }
+ return count;
+ }
- /**
- * Get from a beans collection the first bean which have a property with a specific value. If the value is not
- * found, return null
- * @param <T> The beans class in the collection
- * @param collection The collection to parse
- * @param pathToProperty The path to the tested bean property, example : beanX.beanY.propZ
- * @param accessType The access type to reach each property value
- * @param value The value to find
- * @return The bean with the specific value, null if not found
- */
- public static <T extends Object> T findWithValue(List<T> collection, String pathToProperty, AccessType accessType,
- Object value) {
- AssertTools.assertNotNull(collection);
- AssertTools.assertNotEmpty(pathToProperty);
- for (T curBean : collection) {
- Object curVal = BeanTools.getValueFromPath(curBean, accessType, pathToProperty);
- if (value.equals(curVal)) {
- return curBean;
- }
- }
- return null;
- }
+ /**
+ * Get from a beans collection the first bean which have a property with a specific value. If the value is not
+ * found, return null
+ * @param <T> The beans class in the collection
+ * @param collection The collection to parse
+ * @param pathToProperty The path to the tested bean property, example : beanX.beanY.propZ
+ * @param accessType The access type to reach each property value
+ * @param value The value to find
+ * @return The bean with the specific value, null if not found
+ */
+ public static <T extends Object> T findWithValue(List<T> collection, String pathToProperty, AccessType accessType,
+ Object value) {
+ AssertTools.assertNotNull(collection);
+ AssertTools.assertNotEmpty(pathToProperty);
+ for (T curBean : collection) {
+ Object curVal = BeanTools.getValueFromPath(curBean, accessType, pathToProperty);
+ if (value.equals(curVal)) {
+ return curBean;
+ }
+ }
+ return null;
+ }
- /**
- * Remove in a collection of beans the beans which have a specific value. If the value is found, remove it and
- * return true.
- * @param collection The collection to parse
- * @param pathToProperty The path to the tested bean property, example : beanX.beanY.propZ
- * @param accessType The access type to reach each property value
- * @param value The value to find
- * @return true if found, false otherwise
- */
- public static boolean removeWithValue(Collection<? extends Object> collection, String pathToProperty,
- AccessType accessType, Object value) {
- AssertTools.assertNotNull(collection);
- AssertTools.assertNotEmpty(pathToProperty);
- boolean hasDeleted = false;
+ /**
+ * Remove in a collection of beans the beans which have a specific value. If the value is found, remove it and
+ * return true.
+ * @param collection The collection to parse
+ * @param pathToProperty The path to the tested bean property, example : beanX.beanY.propZ
+ * @param accessType The access type to reach each property value
+ * @param value The value to find
+ * @return true if found, false otherwise
+ */
+ public static boolean removeWithValue(Collection<? extends Object> collection, String pathToProperty,
+ AccessType accessType, Object value) {
+ AssertTools.assertNotNull(collection);
+ AssertTools.assertNotEmpty(pathToProperty);
+ boolean hasDeleted = false;
- Iterator<? extends Object> itList = collection.iterator();
- while (itList.hasNext()) {
- Object curBean = itList.next();
- Object curVal = BeanTools.getValueFromPath(curBean, accessType, pathToProperty);
- if (value.equals(curVal)) {
- itList.remove();
- hasDeleted = true;
- }
- }
- return hasDeleted;
- }
+ Iterator<? extends Object> itList = collection.iterator();
+ while (itList.hasNext()) {
+ Object curBean = itList.next();
+ Object curVal = BeanTools.getValueFromPath(curBean, accessType, pathToProperty);
+ if (value.equals(curVal)) {
+ itList.remove();
+ hasDeleted = true;
+ }
+ }
+ return hasDeleted;
+ }
- /**
- * Remove in a collection of beans the beans which have a specifics values. If on these values are found, remove
- * them and return true.
- * @param collection The collection to parse
- * @param pathToProperty The path to the tested bean property, example : beanX.beanY.propZ
- * @param accessType The access type to reach each property value
- * @param values The values to find
- * @return true if at least one value is found, false otherwise
- */
- public static boolean removeAllWithValue(Collection<? extends Object> collection, String pathToProperty,
- AccessType accessType, Collection<? extends Object> values) {
- AssertTools.assertNotNull(collection);
- AssertTools.assertNotEmpty(pathToProperty);
- boolean hasDeleted = false;
+ /**
+ * Remove in a collection of beans the beans which have a specifics values. If on these values are found, remove
+ * them and return true.
+ * @param collection The collection to parse
+ * @param pathToProperty The path to the tested bean property, example : beanX.beanY.propZ
+ * @param accessType The access type to reach each property value
+ * @param values The values to find
+ * @return true if at least one value is found, false otherwise
+ */
+ public static boolean removeAllWithValue(Collection<? extends Object> collection, String pathToProperty,
+ AccessType accessType, Collection<? extends Object> values) {
+ AssertTools.assertNotNull(collection);
+ AssertTools.assertNotEmpty(pathToProperty);
+ boolean hasDeleted = false;
- Iterator<? extends Object> itList = collection.iterator();
- while (itList.hasNext()) {
- Object curBean = itList.next();
- Object curVal = BeanTools.getValueFromPath(curBean, accessType, pathToProperty);
- if (curVal != null && values.contains(curVal)) {
- itList.remove();
- hasDeleted = true;
- }
- }
- return hasDeleted;
- }
+ Iterator<? extends Object> itList = collection.iterator();
+ while (itList.hasNext()) {
+ Object curBean = itList.next();
+ Object curVal = BeanTools.getValueFromPath(curBean, accessType, pathToProperty);
+ if (curVal != null && values.contains(curVal)) {
+ itList.remove();
+ hasDeleted = true;
+ }
+ }
+ return hasDeleted;
+ }
- /**
- * Build a list from values properties of a bean list. Ex : From a beans list which contains the property "name",
- * you can build the list of these names.
- * @param collection The beans list to parse
- * @param pathToProperty The path to the bean property, example : beanX.beanY.propZ
- * @param accessType The access type to reach each property value
- * @return These values
- */
- public static List<Object> valuesFromList(Collection<? extends Object> collection, String pathToProperty,
- AccessType accessType) {
- AssertTools.assertNotNull(collection);
- AssertTools.assertNotEmpty(pathToProperty);
+ /**
+ * Build a list from values properties of a bean list. Ex : From a beans list which contains the property "name",
+ * you can build the list of these names.
+ * @param collection The beans list to parse
+ * @param pathToProperty The path to the bean property, example : beanX.beanY.propZ
+ * @param accessType The access type to reach each property value
+ * @return These values
+ */
+ public static List<Object> valuesFromList(Collection<? extends Object> collection, String pathToProperty,
+ AccessType accessType) {
+ AssertTools.assertNotNull(collection);
+ AssertTools.assertNotEmpty(pathToProperty);
- List<Object> values = new ArrayList<Object>();
- for (Object curBean : collection) {
- Object curVal = BeanTools.getValueFromPath(curBean, accessType, pathToProperty);
- values.add(curVal);
- }
- return values;
- }
+ List<Object> values = new ArrayList<Object>();
+ for (Object curBean : collection) {
+ Object curVal = BeanTools.getValueFromPath(curBean, accessType, pathToProperty);
+ values.add(curVal);
+ }
+ return values;
+ }
- /**
- * Constructor (prevents instantiation)
- */
- private CollectionTools() {
- //
- }
+ /**
+ * Constructor (prevents instantiation)
+ */
+ private CollectionTools() {
+ //
+ }
}
Modified: trunk/cantharella.utils/src/main/java/nc/ird/module/utils/CoordTools.java
===================================================================
--- trunk/cantharella.utils/src/main/java/nc/ird/module/utils/CoordTools.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.utils/src/main/java/nc/ird/module/utils/CoordTools.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -36,323 +36,323 @@
*/
public final class CoordTools {
- /** Logger */
- // private static final Log LOG = LogTools.getLog();
- /** Degrees character */
- public static final char DEGREES = '°';
+ /** Logger */
+ // private static final Log LOG = LogTools.getLog();
+ /** Degrees character */
+ public static final char DEGREES = '°';
- /** Latitude length */
- public static final int LATITUDE_LENGTH = 11;
+ /** Latitude length */
+ public static final int LATITUDE_LENGTH = 11;
- /** Latitude max degrees */
- public static final int LATITUDE_MAX_DEGREES = 90;
+ /** Latitude max degrees */
+ public static final int LATITUDE_MAX_DEGREES = 90;
- /** Latitude max minutes */
- public static final String LATITUDE_MAX_MINUTES_STRING = "59.999";
+ /** Latitude max minutes */
+ public static final String LATITUDE_MAX_MINUTES_STRING = "59.999";
- /** Latitude max minutes */
- public static final BigDecimal LATITUDE_MAX_MINUTES = new BigDecimal(LATITUDE_MAX_MINUTES_STRING);
+ /** Latitude max minutes */
+ public static final BigDecimal LATITUDE_MAX_MINUTES = new BigDecimal(LATITUDE_MAX_MINUTES_STRING);
- /** Latitude min degrees */
- public static final int LATITUDE_MIN_DEGREES = 0;
+ /** Latitude min degrees */
+ public static final int LATITUDE_MIN_DEGREES = 0;
- /** Latitude min minutes */
- public static final String LATITUDE_MIN_MINUTES_STRING = "00.000";
+ /** Latitude min minutes */
+ public static final String LATITUDE_MIN_MINUTES_STRING = "00.000";
- /** Latitude min minutes */
- public static final BigDecimal LATITUDE_MIN_MINUTES = new BigDecimal(LATITUDE_MIN_MINUTES_STRING);
+ /** Latitude min minutes */
+ public static final BigDecimal LATITUDE_MIN_MINUTES = new BigDecimal(LATITUDE_MIN_MINUTES_STRING);
- /** Latitude orientations */
- public static final Character[] LATITUDE_ORIENTATIONS = { 'N', 'S' };
+ /** Latitude orientations */
+ public static final Character[] LATITUDE_ORIENTATIONS = { 'N', 'S' };
- /** Latitude pattern */
- private static final Pattern LATITUDE_PATTERN;
+ /** Latitude pattern */
+ private static final Pattern LATITUDE_PATTERN;
- /** Longitude length */
- public static final int LONGITUDE_LENGTH = 12;
+ /** Longitude length */
+ public static final int LONGITUDE_LENGTH = 12;
- /** Longitude max degrees */
- public static final int LONGITUDE_MAX_DEGREES = 180;
+ /** Longitude max degrees */
+ public static final int LONGITUDE_MAX_DEGREES = 180;
- /** Longitude max minutes */
- public static final String LONGITUDE_MAX_MINUTES_STRING = "59.999";
+ /** Longitude max minutes */
+ public static final String LONGITUDE_MAX_MINUTES_STRING = "59.999";
- /** Longitude max minutes */
- public static final BigDecimal LONGITUDE_MAX_MINUTES = new BigDecimal(LONGITUDE_MAX_MINUTES_STRING);
+ /** Longitude max minutes */
+ public static final BigDecimal LONGITUDE_MAX_MINUTES = new BigDecimal(LONGITUDE_MAX_MINUTES_STRING);
- /** Longitude min degrees */
- public static final int LONGITUDE_MIN_DEGREES = 0;
+ /** Longitude min degrees */
+ public static final int LONGITUDE_MIN_DEGREES = 0;
- /** Longitude min minutes */
- public static final String LONGITUDE_MIN_MINUTES_STRING = "00.000";
+ /** Longitude min minutes */
+ public static final String LONGITUDE_MIN_MINUTES_STRING = "00.000";
- /** Longitude min minutes */
- public static final BigDecimal LONGITUDE_MIN_MINUTES = new BigDecimal(LONGITUDE_MIN_MINUTES_STRING);
+ /** Longitude min minutes */
+ public static final BigDecimal LONGITUDE_MIN_MINUTES = new BigDecimal(LONGITUDE_MIN_MINUTES_STRING);
- /** Longitude orientations */
- public static final Character[] LONGITUDE_ORIENTATIONS = { 'E', 'W' };
+ /** Longitude orientations */
+ public static final Character[] LONGITUDE_ORIENTATIONS = { 'E', 'W' };
- /** Longitude pattern */
- private static final Pattern LONGITUDE_PATTERN;
+ /** Longitude pattern */
+ private static final Pattern LONGITUDE_PATTERN;
- /** Minutes character */
- public static final char MINUTES = '\'';
+ /** Minutes character */
+ public static final char MINUTES = '\'';
- /** Minutes blank */
- private static final char MINUTES_BLANK = '0';
+ /** Minutes blank */
+ private static final char MINUTES_BLANK = '0';
- /** Minutes decimal length */
- private static final int MINUTES_DECIMAL_LENGTH;
+ /** Minutes decimal length */
+ private static final int MINUTES_DECIMAL_LENGTH;
- /** Minutes integer length */
- private static final int MINUTES_INTEGER_LENGTH;
+ /** Minutes integer length */
+ private static final int MINUTES_INTEGER_LENGTH;
- /** Minutes separator */
- public static final char MINUTES_SEPARATOR = '.';
+ /** Minutes separator */
+ public static final char MINUTES_SEPARATOR = '.';
- /** Minutes separator */
- private static final String MINUTES_SEPARATOR_PATTERN = "\\.";
+ /** Minutes separator */
+ private static final String MINUTES_SEPARATOR_PATTERN = "\\.";
- static {
- String[] md = LONGITUDE_MAX_MINUTES_STRING.split(MINUTES_SEPARATOR_PATTERN);
+ static {
+ String[] md = LONGITUDE_MAX_MINUTES_STRING.split(MINUTES_SEPARATOR_PATTERN);
- MINUTES_INTEGER_LENGTH = md[0].length();
- MINUTES_DECIMAL_LENGTH = md[1].length();
+ MINUTES_INTEGER_LENGTH = md[0].length();
+ MINUTES_DECIMAL_LENGTH = md[1].length();
- String patternMinutes = "[0-9]";
- String patternDegrees = "[ 0-9]";
+ String patternMinutes = "[0-9]";
+ String patternDegrees = "[ 0-9]";
- StringBuilder pattern = new StringBuilder("^(");
- for (int i = 0; i < String.valueOf(LATITUDE_MAX_DEGREES).length(); ++i) {
- pattern.append(patternDegrees);
- }
- pattern.append(')');
- pattern.append(DEGREES);
- pattern.append('(');
- for (int i = 0; i < MINUTES_INTEGER_LENGTH; ++i) {
- pattern.append(patternMinutes);
- }
- pattern.append(")");
- pattern.append(MINUTES_SEPARATOR_PATTERN);
- pattern.append('(');
- for (int i = 0; i < MINUTES_DECIMAL_LENGTH; ++i) {
- pattern.append(patternMinutes);
- }
- pattern.append(')');
- pattern.append(MINUTES);
- pattern.append("([");
- for (char o : LATITUDE_ORIENTATIONS) {
- pattern.append(o);
- }
- pattern.append("])$");
- LATITUDE_PATTERN = Pattern.compile(pattern.toString());
+ StringBuilder pattern = new StringBuilder("^(");
+ for (int i = 0; i < String.valueOf(LATITUDE_MAX_DEGREES).length(); ++i) {
+ pattern.append(patternDegrees);
+ }
+ pattern.append(')');
+ pattern.append(DEGREES);
+ pattern.append('(');
+ for (int i = 0; i < MINUTES_INTEGER_LENGTH; ++i) {
+ pattern.append(patternMinutes);
+ }
+ pattern.append(")");
+ pattern.append(MINUTES_SEPARATOR_PATTERN);
+ pattern.append('(');
+ for (int i = 0; i < MINUTES_DECIMAL_LENGTH; ++i) {
+ pattern.append(patternMinutes);
+ }
+ pattern.append(')');
+ pattern.append(MINUTES);
+ pattern.append("([");
+ for (char o : LATITUDE_ORIENTATIONS) {
+ pattern.append(o);
+ }
+ pattern.append("])$");
+ LATITUDE_PATTERN = Pattern.compile(pattern.toString());
- pattern = new StringBuilder("^(");
- for (int i = 0; i < String.valueOf(LONGITUDE_MAX_DEGREES).length(); ++i) {
- pattern.append(patternDegrees);
- }
- pattern.append(')');
- pattern.append(DEGREES);
- pattern.append('(');
- for (int i = 0; i < MINUTES_INTEGER_LENGTH; ++i) {
- pattern.append(patternMinutes);
- }
- pattern.append(")");
- pattern.append(MINUTES_SEPARATOR_PATTERN);
- pattern.append('(');
- for (int i = 0; i < MINUTES_DECIMAL_LENGTH; ++i) {
- pattern.append(patternMinutes);
- }
- pattern.append(')');
- pattern.append(MINUTES);
- pattern.append("([");
- for (char o : LONGITUDE_ORIENTATIONS) {
- pattern.append(o);
- }
- pattern.append("])$");
+ pattern = new StringBuilder("^(");
+ for (int i = 0; i < String.valueOf(LONGITUDE_MAX_DEGREES).length(); ++i) {
+ pattern.append(patternDegrees);
+ }
+ pattern.append(')');
+ pattern.append(DEGREES);
+ pattern.append('(');
+ for (int i = 0; i < MINUTES_INTEGER_LENGTH; ++i) {
+ pattern.append(patternMinutes);
+ }
+ pattern.append(")");
+ pattern.append(MINUTES_SEPARATOR_PATTERN);
+ pattern.append('(');
+ for (int i = 0; i < MINUTES_DECIMAL_LENGTH; ++i) {
+ pattern.append(patternMinutes);
+ }
+ pattern.append(')');
+ pattern.append(MINUTES);
+ pattern.append("([");
+ for (char o : LONGITUDE_ORIENTATIONS) {
+ pattern.append(o);
+ }
+ pattern.append("])$");
- LONGITUDE_PATTERN = Pattern.compile(pattern.toString());
- }
+ LONGITUDE_PATTERN = Pattern.compile(pattern.toString());
+ }
- /**
- * Format a latitude (dd.mm.sss"o)
- * @param d Degrees (0-90)
- * @param m Minutes (00.000-59.999)
- * @param o Orientation (N-S)
- * @return Latitude
- */
- public static String latitude(Integer d, BigDecimal m, Character o) {
- // Check values
- AssertTools.assertGreaterOrEquals(d, LATITUDE_MIN_DEGREES);
- AssertTools.assertLowerOrEquals(d, LATITUDE_MAX_DEGREES);
- AssertTools.assertGreaterOrEquals(m, LATITUDE_MIN_MINUTES);
- AssertTools.assertLowerOrEquals(m, LATITUDE_MAX_MINUTES);
- AssertTools.assertIn(Character.toUpperCase(o), LATITUDE_ORIENTATIONS);
- // Format values
- // LOG.debug(m);
- // LOG.debug(NumberTools.doubleToString(m, Locale.ENGLISH, MINUTES_DECIMAL_LENGTH, MINUTES_DECIMAL_LENGTH));
- String[] md = NumberTools.bigDecimalToString(m, Locale.ENGLISH, MINUTES_DECIMAL_LENGTH, MINUTES_DECIMAL_LENGTH,
- 2).split(MINUTES_SEPARATOR_PATTERN);
- // LOG.debug(md);
- return StringUtils.leftPad(String.valueOf(d), String.valueOf(LATITUDE_MAX_DEGREES).length()) + DEGREES
- + StringUtils.leftPad(String.valueOf(md[0]), MINUTES_INTEGER_LENGTH, MINUTES_BLANK) + MINUTES_SEPARATOR
- + StringUtils.rightPad(md[1], MINUTES_DECIMAL_LENGTH, MINUTES_BLANK) + MINUTES
- + Character.toUpperCase(o);
- }
+ /**
+ * Format a latitude (dd.mm.sss"o)
+ * @param d Degrees (0-90)
+ * @param m Minutes (00.000-59.999)
+ * @param o Orientation (N-S)
+ * @return Latitude
+ */
+ public static String latitude(Integer d, BigDecimal m, Character o) {
+ // Check values
+ AssertTools.assertGreaterOrEquals(d, LATITUDE_MIN_DEGREES);
+ AssertTools.assertLowerOrEquals(d, LATITUDE_MAX_DEGREES);
+ AssertTools.assertGreaterOrEquals(m, LATITUDE_MIN_MINUTES);
+ AssertTools.assertLowerOrEquals(m, LATITUDE_MAX_MINUTES);
+ AssertTools.assertIn(Character.toUpperCase(o), LATITUDE_ORIENTATIONS);
+ // Format values
+ // LOG.debug(m);
+ // LOG.debug(NumberTools.doubleToString(m, Locale.ENGLISH, MINUTES_DECIMAL_LENGTH, MINUTES_DECIMAL_LENGTH));
+ String[] md = NumberTools.bigDecimalToString(m, Locale.ENGLISH, MINUTES_DECIMAL_LENGTH, MINUTES_DECIMAL_LENGTH,
+ 2).split(MINUTES_SEPARATOR_PATTERN);
+ // LOG.debug(md);
+ return StringUtils.leftPad(String.valueOf(d), String.valueOf(LATITUDE_MAX_DEGREES).length()) + DEGREES
+ + StringUtils.leftPad(String.valueOf(md[0]), MINUTES_INTEGER_LENGTH, MINUTES_BLANK) + MINUTES_SEPARATOR
+ + StringUtils.rightPad(md[1], MINUTES_DECIMAL_LENGTH, MINUTES_BLANK) + MINUTES
+ + Character.toUpperCase(o);
+ }
- /**
- * Retrieve the degrees from a complete latitude
- * @param latitude Latitude
- * @return Degrees
- */
- public static Integer latitudeDegrees(String latitude) {
- if (StringUtils.isEmpty(latitude)) {
- return null;
- }
- Matcher matcher = LATITUDE_PATTERN.matcher(latitude);
- matcher.lookingAt();
- return Integer.valueOf(matcher.group(1).trim());
- }
+ /**
+ * Retrieve the degrees from a complete latitude
+ * @param latitude Latitude
+ * @return Degrees
+ */
+ public static Integer latitudeDegrees(String latitude) {
+ if (StringUtils.isEmpty(latitude)) {
+ return null;
+ }
+ Matcher matcher = LATITUDE_PATTERN.matcher(latitude);
+ matcher.lookingAt();
+ return Integer.valueOf(matcher.group(1).trim());
+ }
- /**
- * Retrieve the minutes from a complete latitude
- * @param latitude Latitude
- * @return Minutes
- */
- public static BigDecimal latitudeMinutes(String latitude) {
- if (StringUtils.isEmpty(latitude)) {
- return null;
- }
- Matcher matcher = LATITUDE_PATTERN.matcher(latitude);
- matcher.lookingAt();
- return NumberTools.parseBigDecimal(matcher.group(2) + MINUTES_SEPARATOR + matcher.group(3), Locale.ENGLISH,
- MINUTES_DECIMAL_LENGTH, 2);
- }
+ /**
+ * Retrieve the minutes from a complete latitude
+ * @param latitude Latitude
+ * @return Minutes
+ */
+ public static BigDecimal latitudeMinutes(String latitude) {
+ if (StringUtils.isEmpty(latitude)) {
+ return null;
+ }
+ Matcher matcher = LATITUDE_PATTERN.matcher(latitude);
+ matcher.lookingAt();
+ return NumberTools.parseBigDecimal(matcher.group(2) + MINUTES_SEPARATOR + matcher.group(3), Locale.ENGLISH,
+ MINUTES_DECIMAL_LENGTH, 2);
+ }
- /**
- * Retrieve the orientation from a complete latitude
- * @param latitude Latitude
- * @return Orientation
- */
- public static Character latitudeOrientation(String latitude) {
- if (StringUtils.isEmpty(latitude)) {
- return null;
- }
- Matcher matcher = LATITUDE_PATTERN.matcher(latitude);
- matcher.lookingAt();
- return Character.valueOf(matcher.group(4).charAt(0));
- }
+ /**
+ * Retrieve the orientation from a complete latitude
+ * @param latitude Latitude
+ * @return Orientation
+ */
+ public static Character latitudeOrientation(String latitude) {
+ if (StringUtils.isEmpty(latitude)) {
+ return null;
+ }
+ Matcher matcher = LATITUDE_PATTERN.matcher(latitude);
+ matcher.lookingAt();
+ return Character.valueOf(matcher.group(4).charAt(0));
+ }
- /**
- * Format a longitude (ddd.mm'ss"o)
- * @param d Degrees (0-180)
- * @param m Minutes (00.000-59.999)
- * @param o Orientation (E-W)
- * @return Longitude
- */
- public static String longitude(Integer d, BigDecimal m, Character o) {
- // Check values
- AssertTools.assertGreaterOrEquals(d, LONGITUDE_MIN_DEGREES);
- AssertTools.assertLowerOrEquals(d, LONGITUDE_MAX_DEGREES);
- AssertTools.assertGreaterOrEquals(m, LONGITUDE_MIN_MINUTES);
- AssertTools.assertLowerOrEquals(m, LONGITUDE_MAX_MINUTES);
- AssertTools.assertIn(Character.toUpperCase(o), LONGITUDE_ORIENTATIONS);
- // Format values
- String[] md = NumberTools.bigDecimalToString(m, Locale.ENGLISH, MINUTES_DECIMAL_LENGTH, MINUTES_DECIMAL_LENGTH,
- 3).split(MINUTES_SEPARATOR_PATTERN);
- return StringUtils.leftPad(String.valueOf(d), String.valueOf(LONGITUDE_MAX_DEGREES).length()) + DEGREES
- + StringUtils.leftPad(String.valueOf(md[0]), MINUTES_INTEGER_LENGTH, MINUTES_BLANK) + MINUTES_SEPARATOR
- + StringUtils.rightPad(md[1], MINUTES_DECIMAL_LENGTH, MINUTES_BLANK) + MINUTES
- + Character.toUpperCase(o);
- }
+ /**
+ * Format a longitude (ddd.mm'ss"o)
+ * @param d Degrees (0-180)
+ * @param m Minutes (00.000-59.999)
+ * @param o Orientation (E-W)
+ * @return Longitude
+ */
+ public static String longitude(Integer d, BigDecimal m, Character o) {
+ // Check values
+ AssertTools.assertGreaterOrEquals(d, LONGITUDE_MIN_DEGREES);
+ AssertTools.assertLowerOrEquals(d, LONGITUDE_MAX_DEGREES);
+ AssertTools.assertGreaterOrEquals(m, LONGITUDE_MIN_MINUTES);
+ AssertTools.assertLowerOrEquals(m, LONGITUDE_MAX_MINUTES);
+ AssertTools.assertIn(Character.toUpperCase(o), LONGITUDE_ORIENTATIONS);
+ // Format values
+ String[] md = NumberTools.bigDecimalToString(m, Locale.ENGLISH, MINUTES_DECIMAL_LENGTH, MINUTES_DECIMAL_LENGTH,
+ 3).split(MINUTES_SEPARATOR_PATTERN);
+ return StringUtils.leftPad(String.valueOf(d), String.valueOf(LONGITUDE_MAX_DEGREES).length()) + DEGREES
+ + StringUtils.leftPad(String.valueOf(md[0]), MINUTES_INTEGER_LENGTH, MINUTES_BLANK) + MINUTES_SEPARATOR
+ + StringUtils.rightPad(md[1], MINUTES_DECIMAL_LENGTH, MINUTES_BLANK) + MINUTES
+ + Character.toUpperCase(o);
+ }
- /**
- * Retrieve the degrees from a complete longitude
- * @param longitude Longitude
- * @return Degrees
- */
- public static Integer longitudeDegrees(String longitude) {
- if (StringUtils.isEmpty(longitude)) {
- return null;
- }
- Matcher matcher = LONGITUDE_PATTERN.matcher(longitude);
- matcher.lookingAt();
- return Integer.valueOf(matcher.group(1).trim());
- }
+ /**
+ * Retrieve the degrees from a complete longitude
+ * @param longitude Longitude
+ * @return Degrees
+ */
+ public static Integer longitudeDegrees(String longitude) {
+ if (StringUtils.isEmpty(longitude)) {
+ return null;
+ }
+ Matcher matcher = LONGITUDE_PATTERN.matcher(longitude);
+ matcher.lookingAt();
+ return Integer.valueOf(matcher.group(1).trim());
+ }
- /**
- * Retrieve the minutes from a complete longitude
- * @param longitude Longitude
- * @return Minutes
- */
- public static BigDecimal longitudeMinutes(String longitude) {
- if (StringUtils.isEmpty(longitude)) {
- return null;
- }
- Matcher matcher = LONGITUDE_PATTERN.matcher(longitude);
- matcher.lookingAt();
- return NumberTools.parseBigDecimal(matcher.group(2) + MINUTES_SEPARATOR + matcher.group(3), Locale.ENGLISH,
- MINUTES_DECIMAL_LENGTH, 3);
- }
+ /**
+ * Retrieve the minutes from a complete longitude
+ * @param longitude Longitude
+ * @return Minutes
+ */
+ public static BigDecimal longitudeMinutes(String longitude) {
+ if (StringUtils.isEmpty(longitude)) {
+ return null;
+ }
+ Matcher matcher = LONGITUDE_PATTERN.matcher(longitude);
+ matcher.lookingAt();
+ return NumberTools.parseBigDecimal(matcher.group(2) + MINUTES_SEPARATOR + matcher.group(3), Locale.ENGLISH,
+ MINUTES_DECIMAL_LENGTH, 3);
+ }
- /**
- * Retrieve the orientation from a complete longitude
- * @param longitude Longitude
- * @return Orientation
- */
- public static Character longitudeOrientation(String longitude) {
- if (StringUtils.isEmpty(longitude)) {
- return null;
- }
- Matcher matcher = LONGITUDE_PATTERN.matcher(longitude);
- matcher.lookingAt();
- return Character.valueOf(matcher.group(4).charAt(0));
- }
+ /**
+ * Retrieve the orientation from a complete longitude
+ * @param longitude Longitude
+ * @return Orientation
+ */
+ public static Character longitudeOrientation(String longitude) {
+ if (StringUtils.isEmpty(longitude)) {
+ return null;
+ }
+ Matcher matcher = LONGITUDE_PATTERN.matcher(longitude);
+ matcher.lookingAt();
+ return Character.valueOf(matcher.group(4).charAt(0));
+ }
- /**
- * Validate a latitude (ddd.mm.sss"o)
- * @param latitude Latitude
- * @return TRUE if the latitude is valid
- */
- public static boolean validateLatitude(String latitude) {
- AssertTools.assertNotEmpty(latitude);
+ /**
+ * Validate a latitude (ddd.mm.sss"o)
+ * @param latitude Latitude
+ * @return TRUE if the latitude is valid
+ */
+ public static boolean validateLatitude(String latitude) {
+ AssertTools.assertNotEmpty(latitude);
- Matcher matcher = LATITUDE_PATTERN.matcher(latitude);
- if (matcher.lookingAt()) {
- int d = Integer.valueOf(matcher.group(1).trim());
- BigDecimal m = NumberTools.parseBigDecimal(matcher.group(2) + MINUTES_SEPARATOR + matcher.group(3),
- Locale.ENGLISH, MINUTES_DECIMAL_LENGTH, 2);
- // if the latitude is 90 with others minutes, return false
- return d >= LATITUDE_MIN_DEGREES && d <= LATITUDE_MAX_DEGREES && LATITUDE_MIN_MINUTES.compareTo(m) <= 0
- && LATITUDE_MAX_MINUTES.compareTo(m) >= 0 && (d != 90 || new BigDecimal("0.000").compareTo(m) == 0);
- }
- return false;
- }
+ Matcher matcher = LATITUDE_PATTERN.matcher(latitude);
+ if (matcher.lookingAt()) {
+ int d = Integer.valueOf(matcher.group(1).trim());
+ BigDecimal m = NumberTools.parseBigDecimal(matcher.group(2) + MINUTES_SEPARATOR + matcher.group(3),
+ Locale.ENGLISH, MINUTES_DECIMAL_LENGTH, 2);
+ // if the latitude is 90 with others minutes, return false
+ return d >= LATITUDE_MIN_DEGREES && d <= LATITUDE_MAX_DEGREES && LATITUDE_MIN_MINUTES.compareTo(m) <= 0
+ && LATITUDE_MAX_MINUTES.compareTo(m) >= 0 && (d != 90 || new BigDecimal("0.000").compareTo(m) == 0);
+ }
+ return false;
+ }
- /**
- * Validate a longitude (dd.mm.sss"o)
- * @param longitude Longitude
- * @return TRUE if the longitude is valid
- */
- public static boolean validateLongitude(String longitude) {
- AssertTools.assertNotEmpty(longitude);
- Matcher matcher = LONGITUDE_PATTERN.matcher(longitude);
- if (matcher.lookingAt()) {
- int d = Integer.valueOf(matcher.group(1).trim());
- BigDecimal m = NumberTools.parseBigDecimal(matcher.group(2) + MINUTES_SEPARATOR + matcher.group(3),
- Locale.ENGLISH, MINUTES_DECIMAL_LENGTH, 3);
- // if the longitude is 180 with others minutes, return false
- return d >= LONGITUDE_MIN_DEGREES && d <= LONGITUDE_MAX_DEGREES && LONGITUDE_MIN_MINUTES.compareTo(m) <= 0
- && LATITUDE_MAX_MINUTES.compareTo(m) >= 0
- && (d != 180 || new BigDecimal("0.000").compareTo(m) == 0);
- }
- return false;
- }
+ /**
+ * Validate a longitude (dd.mm.sss"o)
+ * @param longitude Longitude
+ * @return TRUE if the longitude is valid
+ */
+ public static boolean validateLongitude(String longitude) {
+ AssertTools.assertNotEmpty(longitude);
+ Matcher matcher = LONGITUDE_PATTERN.matcher(longitude);
+ if (matcher.lookingAt()) {
+ int d = Integer.valueOf(matcher.group(1).trim());
+ BigDecimal m = NumberTools.parseBigDecimal(matcher.group(2) + MINUTES_SEPARATOR + matcher.group(3),
+ Locale.ENGLISH, MINUTES_DECIMAL_LENGTH, 3);
+ // if the longitude is 180 with others minutes, return false
+ return d >= LONGITUDE_MIN_DEGREES && d <= LONGITUDE_MAX_DEGREES && LONGITUDE_MIN_MINUTES.compareTo(m) <= 0
+ && LATITUDE_MAX_MINUTES.compareTo(m) >= 0
+ && (d != 180 || new BigDecimal("0.000").compareTo(m) == 0);
+ }
+ return false;
+ }
- /**
- * Constructor
- */
- private CoordTools() {
- //
- }
+ /**
+ * Constructor
+ */
+ private CoordTools() {
+ //
+ }
}
Modified: trunk/cantharella.utils/src/main/java/nc/ird/module/utils/GenerateCsv.java
===================================================================
--- trunk/cantharella.utils/src/main/java/nc/ird/module/utils/GenerateCsv.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.utils/src/main/java/nc/ird/module/utils/GenerateCsv.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -35,121 +35,121 @@
*/
public class GenerateCsv {
- /** delimiter de colonne */
- private char columnsSeparator;
- /** Copyright, pour Ird par défaut */
- private String copyright;
- /** Encoding utilisé pour le CSV */
- private String encoding;
-
- /** Copyright utilisé par défaut, pour l'IRD en français */
- private final static String DEFAULT_COPYRIGHT = "©IRD tous droits réservés";
-
- /** static varable for UTF-8 encoding */
- public static final String CHARSET_UTF_8 ="UTF-8";
+ /** delimiter de colonne */
+ private char columnsSeparator;
+ /** Copyright, pour Ird par défaut */
+ private String copyright;
+ /** Encoding utilisé pour le CSV */
+ private String encoding;
+
+ /** Copyright utilisé par défaut, pour l'IRD en français */
+ private final static String DEFAULT_COPYRIGHT = "©IRD tous droits réservés";
+
+ /** static varable for UTF-8 encoding */
+ public static final String CHARSET_UTF_8 ="UTF-8";
- /** static varable for ISO_8859_1 encoding */
- public static final String CHARSET_ISO_8859_1 ="ISO-8859-1";
-
- /**
- * Constructeur par défaut
- */
- public GenerateCsv(){
- this(';',CHARSET_UTF_8);
- }
-
- /**
- * Constructeur
- * @param encoding utilisé pour le CSV
- */
- public GenerateCsv(String encoding){
- this(';',encoding);
- }
-
- /**
- * Constructeur
- *
- * @param columnsSeparator caractère utilisé comme délimiteur de colonne
- * @param encoding utilisé pour le CSV
- */
- public GenerateCsv(char columnsSeparator, String encoding){
- setColumnsSeparator(columnsSeparator);
- setEncoding(encoding);
- setCopyright(DEFAULT_COPYRIGHT);
- }
-
- /**
- * Rend un flux qui décrit un ensemble de données en respectant le format CSV
- *
- * @param data données à écrire
- * @param withCopyright si vrai, un copyright est ajouté à la dernière ligne
- * @return le flux de donnée en sortie
- * @throws IOException exception parvenue dans les traitements entrée/sortie du fichier
- */
- public ByteArrayOutputStream writeCSV(List<String[]> data, boolean withCopyright) throws IOException{
-
- ByteArrayOutputStream csvStream = new ByteArrayOutputStream();
- OutputStreamWriter outWriter = new OutputStreamWriter(csvStream, encoding);
-
- CSVWriter csvWriter = new CSVWriter(outWriter, this.getColumnsSeparator());
- // paramétrage de l'écriture du CSV
-
- //écriture des données
- csvWriter.writeAll(data);
- if (withCopyright){
- //écriture du copyright
- csvWriter.writeNext(new String[]{getCopyright()});
- }
- csvWriter.close();
- return csvStream;
- }
-
- /**
- * copyright getter
- * @return copyright
- */
- public String getCopyright() {
- return copyright;
- }
+ /** static varable for ISO_8859_1 encoding */
+ public static final String CHARSET_ISO_8859_1 ="ISO-8859-1";
+
+ /**
+ * Constructeur par défaut
+ */
+ public GenerateCsv(){
+ this(';',CHARSET_UTF_8);
+ }
+
+ /**
+ * Constructeur
+ * @param encoding utilisé pour le CSV
+ */
+ public GenerateCsv(String encoding){
+ this(';',encoding);
+ }
+
+ /**
+ * Constructeur
+ *
+ * @param columnsSeparator caractère utilisé comme délimiteur de colonne
+ * @param encoding utilisé pour le CSV
+ */
+ public GenerateCsv(char columnsSeparator, String encoding){
+ setColumnsSeparator(columnsSeparator);
+ setEncoding(encoding);
+ setCopyright(DEFAULT_COPYRIGHT);
+ }
+
+ /**
+ * Rend un flux qui décrit un ensemble de données en respectant le format CSV
+ *
+ * @param data données à écrire
+ * @param withCopyright si vrai, un copyright est ajouté à la dernière ligne
+ * @return le flux de donnée en sortie
+ * @throws IOException exception parvenue dans les traitements entrée/sortie du fichier
+ */
+ public ByteArrayOutputStream writeCSV(List<String[]> data, boolean withCopyright) throws IOException{
+
+ ByteArrayOutputStream csvStream = new ByteArrayOutputStream();
+ OutputStreamWriter outWriter = new OutputStreamWriter(csvStream, encoding);
+
+ CSVWriter csvWriter = new CSVWriter(outWriter, this.getColumnsSeparator());
+ // paramétrage de l'écriture du CSV
+
+ //écriture des données
+ csvWriter.writeAll(data);
+ if (withCopyright){
+ //écriture du copyright
+ csvWriter.writeNext(new String[]{getCopyright()});
+ }
+ csvWriter.close();
+ return csvStream;
+ }
+
+ /**
+ * copyright getter
+ * @return copyright
+ */
+ public String getCopyright() {
+ return copyright;
+ }
- /**
- * copyright setter
- * @param copyright copyright
- */
- public void setCopyright(String copyright) {
- this.copyright = copyright;
- }
+ /**
+ * copyright setter
+ * @param copyright copyright
+ */
+ public void setCopyright(String copyright) {
+ this.copyright = copyright;
+ }
- /**
- * columnsSeparator getter
- * @return columnsSeparator
- */
- public char getColumnsSeparator() {
- return columnsSeparator;
- }
+ /**
+ * columnsSeparator getter
+ * @return columnsSeparator
+ */
+ public char getColumnsSeparator() {
+ return columnsSeparator;
+ }
- /**
- * columnsSeparator setter
- * @param columnsSeparator columnsSeparator
- */
- public void setColumnsSeparator(char columnsSeparator) {
- this.columnsSeparator = columnsSeparator;
- }
+ /**
+ * columnsSeparator setter
+ * @param columnsSeparator columnsSeparator
+ */
+ public void setColumnsSeparator(char columnsSeparator) {
+ this.columnsSeparator = columnsSeparator;
+ }
- /**
- * encoding getter
- * @return encoding
- */
- public String getEncoding() {
- return encoding;
- }
+ /**
+ * encoding getter
+ * @return encoding
+ */
+ public String getEncoding() {
+ return encoding;
+ }
- /**
- * encoding setter
- * @param encoding encoding
- */
- public void setEncoding(String encoding) {
- this.encoding = encoding;
- }
+ /**
+ * encoding setter
+ * @param encoding encoding
+ */
+ public void setEncoding(String encoding) {
+ this.encoding = encoding;
+ }
}
Modified: trunk/cantharella.utils/src/main/java/nc/ird/module/utils/GenericsTools.java
===================================================================
--- trunk/cantharella.utils/src/main/java/nc/ird/module/utils/GenericsTools.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.utils/src/main/java/nc/ird/module/utils/GenericsTools.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -32,33 +32,33 @@
@SuppressWarnings("restriction")
public final class GenericsTools {
- /**
- * Object cast
- * @param <I> Input type
- * @param <O> Output type
- * @param i Input object
- * @return Output object
- */
- @SuppressWarnings("unchecked")
- public static <I, O extends I> O cast(I i) {
- return (O) i;
- }
+ /**
+ * Object cast
+ * @param <I> Input type
+ * @param <O> Output type
+ * @param i Input object
+ * @return Output object
+ */
+ @SuppressWarnings("unchecked")
+ public static <I, O extends I> O cast(I i) {
+ return (O) i;
+ }
- /**
- * Constructor (prevents instantiation)
- */
- private GenericsTools() {
- //
- }
-
- /**
- * Return the class where this method is called
- * @return this class
- */
- public static Class<?> getCallerClass(){
- // Warning, access type of this method is forbidden (you must configure your IDE tu use it)
- // work only with SUN JVM
- return Reflection.getCallerClass(1);
- }
-
+ /**
+ * Constructor (prevents instantiation)
+ */
+ private GenericsTools() {
+ //
+ }
+
+ /**
+ * Return the class where this method is called
+ * @return this class
+ */
+ public static Class<?> getCallerClass(){
+ // Warning, access type of this method is forbidden (you must configure your IDE tu use it)
+ // work only with SUN JVM
+ return Reflection.getCallerClass(1);
+ }
+
}
Modified: trunk/cantharella.utils/src/main/java/nc/ird/module/utils/IntuitiveStringComparator.java
===================================================================
--- trunk/cantharella.utils/src/main/java/nc/ird/module/utils/IntuitiveStringComparator.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.utils/src/main/java/nc/ird/module/utils/IntuitiveStringComparator.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -49,122 +49,122 @@
*/
public class IntuitiveStringComparator<T extends CharSequence> implements Comparator<T> {
- /** string 1 */
- private T str1;
+ /** string 1 */
+ private T str1;
- /** string 2 */
- private T str2;
+ /** string 2 */
+ private T str2;
- /** posistion 1 */
- private int pos1;
+ /** posistion 1 */
+ private int pos1;
- /** position 2 */
- private int pos2;
+ /** position 2 */
+ private int pos2;
- /** lenght 1 */
- private int len1;
+ /** lenght 1 */
+ private int len1;
- /** length 2 */
- private int len2;
+ /** length 2 */
+ private int len2;
- /** {@inheritDoc} */
- @Override
- public int compare(T s1, T s2) {
- str1 = s1;
- str2 = s2;
- len1 = str1.length();
- len2 = str2.length();
- pos1 = pos2 = 0;
+ /** {@inheritDoc} */
+ @Override
+ public int compare(T s1, T s2) {
+ str1 = s1;
+ str2 = s2;
+ len1 = str1.length();
+ len2 = str2.length();
+ pos1 = pos2 = 0;
- if (len1 == 0) {
- return len2 == 0 ? 0 : -1;
- } else if (len2 == 0) {
- return 1;
- }
+ if (len1 == 0) {
+ return len2 == 0 ? 0 : -1;
+ } else if (len2 == 0) {
+ return 1;
+ }
- while (pos1 < len1 && pos2 < len2) {
- char ch1 = str1.charAt(pos1);
- char ch2 = str2.charAt(pos2);
- int result = 0;
+ while (pos1 < len1 && pos2 < len2) {
+ char ch1 = str1.charAt(pos1);
+ char ch2 = str2.charAt(pos2);
+ int result = 0;
- if (Character.isDigit(ch1)) {
- result = Character.isDigit(ch2) ? compareNumbers() : -1;
- } else if (Character.isLetter(ch1)) {
- result = Character.isLetter(ch2) ? compareOther(true) : 1;
- } else {
- result = Character.isDigit(ch2) ? 1 : Character.isLetter(ch2) ? -1 : compareOther(false);
- }
+ if (Character.isDigit(ch1)) {
+ result = Character.isDigit(ch2) ? compareNumbers() : -1;
+ } else if (Character.isLetter(ch1)) {
+ result = Character.isLetter(ch2) ? compareOther(true) : 1;
+ } else {
+ result = Character.isDigit(ch2) ? 1 : Character.isLetter(ch2) ? -1 : compareOther(false);
+ }
- if (result != 0) {
- return result;
- }
- }
+ if (result != 0) {
+ return result;
+ }
+ }
- return len1 - len2;
- }
+ return len1 - len2;
+ }
- /**
- * Compare numbers
- * @return the integer response
- */
- private int compareNumbers() {
- int delta = 0;
- int zeroes1 = 0, zeroes2 = 0;
- char ch1 = (char) 0, ch2 = (char) 0;
+ /**
+ * Compare numbers
+ * @return the integer response
+ */
+ private int compareNumbers() {
+ int delta = 0;
+ int zeroes1 = 0, zeroes2 = 0;
+ char ch1 = (char) 0, ch2 = (char) 0;
- // Skip leading zeroes, but keep a count of them.
- while (pos1 < len1 && (ch1 = str1.charAt(pos1++)) == '0') {
- zeroes1++;
- }
- while (pos2 < len2 && (ch2 = str2.charAt(pos2++)) == '0') {
- zeroes2++;
- }
+ // Skip leading zeroes, but keep a count of them.
+ while (pos1 < len1 && (ch1 = str1.charAt(pos1++)) == '0') {
+ zeroes1++;
+ }
+ while (pos2 < len2 && (ch2 = str2.charAt(pos2++)) == '0') {
+ zeroes2++;
+ }
- // If one sequence contains more significant digits than the
- // other, it's a larger number. In case they turn out to have
- // equal lengths, we compare digits at each position; the first
- // unequal pair determines which is the bigger number.
- while (true) {
- boolean noMoreDigits1 = (ch1 == 0) || !Character.isDigit(ch1);
- boolean noMoreDigits2 = (ch2 == 0) || !Character.isDigit(ch2);
+ // If one sequence contains more significant digits than the
+ // other, it's a larger number. In case they turn out to have
+ // equal lengths, we compare digits at each position; the first
+ // unequal pair determines which is the bigger number.
+ while (true) {
+ boolean noMoreDigits1 = (ch1 == 0) || !Character.isDigit(ch1);
+ boolean noMoreDigits2 = (ch2 == 0) || !Character.isDigit(ch2);
- if (noMoreDigits1 && noMoreDigits2) {
- return delta != 0 ? delta : zeroes1 - zeroes2;
- } else if (noMoreDigits1) {
- return -1;
- } else if (noMoreDigits2) {
- return 1;
- } else if (delta == 0 && ch1 != ch2) {
- delta = ch1 - ch2;
- }
+ if (noMoreDigits1 && noMoreDigits2) {
+ return delta != 0 ? delta : zeroes1 - zeroes2;
+ } else if (noMoreDigits1) {
+ return -1;
+ } else if (noMoreDigits2) {
+ return 1;
+ } else if (delta == 0 && ch1 != ch2) {
+ delta = ch1 - ch2;
+ }
- ch1 = pos1 < len1 ? str1.charAt(pos1++) : (char) 0;
- ch2 = pos2 < len2 ? str2.charAt(pos2++) : (char) 0;
- }
- }
+ ch1 = pos1 < len1 ? str1.charAt(pos1++) : (char) 0;
+ ch2 = pos2 < len2 ? str2.charAt(pos2++) : (char) 0;
+ }
+ }
- /**
- * Compare other characters
- * @param isLetters true if characters are letters
- * @return the integer response
- */
- private int compareOther(boolean isLetters) {
- char ch1 = str1.charAt(pos1++);
- char ch2 = str2.charAt(pos2++);
+ /**
+ * Compare other characters
+ * @param isLetters true if characters are letters
+ * @return the integer response
+ */
+ private int compareOther(boolean isLetters) {
+ char ch1 = str1.charAt(pos1++);
+ char ch2 = str2.charAt(pos2++);
- if (ch1 == ch2) {
- return 0;
- }
+ if (ch1 == ch2) {
+ return 0;
+ }
- if (isLetters) {
- ch1 = Character.toUpperCase(ch1);
- ch2 = Character.toUpperCase(ch2);
- if (ch1 != ch2) {
- ch1 = Character.toLowerCase(ch1);
- ch2 = Character.toLowerCase(ch2);
- }
- }
+ if (isLetters) {
+ ch1 = Character.toUpperCase(ch1);
+ ch2 = Character.toUpperCase(ch2);
+ if (ch1 != ch2) {
+ ch1 = Character.toLowerCase(ch1);
+ ch2 = Character.toLowerCase(ch2);
+ }
+ }
- return ch1 - ch2;
- }
+ return ch1 - ch2;
+ }
}
\ No newline at end of file
Modified: trunk/cantharella.utils/src/main/java/nc/ird/module/utils/LogTools.java
===================================================================
--- trunk/cantharella.utils/src/main/java/nc/ird/module/utils/LogTools.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.utils/src/main/java/nc/ird/module/utils/LogTools.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -32,21 +32,21 @@
*/
public final class LogTools {
- /**
- * Create a logger by retrieving the caller class. This method is expensive, so you may use it only once in each
- * class.
- * @return Logger
- */
- public static Log getLog() {
- //old methode to get the class in a static methode
- //new LogConfigurationException().fillInStackTrace().getStackTrace()[1].getClassName()
- return LogFactory.getLog(GenericsTools.getCallerClass());
- }
+ /**
+ * Create a logger by retrieving the caller class. This method is expensive, so you may use it only once in each
+ * class.
+ * @return Logger
+ */
+ public static Log getLog() {
+ //old methode to get the class in a static methode
+ //new LogConfigurationException().fillInStackTrace().getStackTrace()[1].getClassName()
+ return LogFactory.getLog(GenericsTools.getCallerClass());
+ }
- /**
- * Constructor (prevents from instantiation)
- */
- private LogTools() {
- //
- }
+ /**
+ * Constructor (prevents from instantiation)
+ */
+ private LogTools() {
+ //
+ }
}
Modified: trunk/cantharella.utils/src/main/java/nc/ird/module/utils/NumberTools.java
===================================================================
--- trunk/cantharella.utils/src/main/java/nc/ird/module/utils/NumberTools.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.utils/src/main/java/nc/ird/module/utils/NumberTools.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -37,152 +37,152 @@
*/
public final class NumberTools {
- /**
- * Constructor (prevents instantiation)
- */
- private NumberTools() {
- //
- }
+ /**
+ * Constructor (prevents instantiation)
+ */
+ private NumberTools() {
+ //
+ }
- /**
- * Returns null if the value if zero
- * @param <N> Number type
- * @param n Number value
- * @return The value or null if zero
- */
- public static <N extends Number> N nullIfZero(N n) {
- return n == null || n.doubleValue() == 0D ? null : n;
- }
+ /**
+ * Returns null if the value if zero
+ * @param <N> Number type
+ * @param n Number value
+ * @return The value or null if zero
+ */
+ public static <N extends Number> N nullIfZero(N n) {
+ return n == null || n.doubleValue() == 0D ? null : n;
+ }
- /**
- * Parse a double from a String. If the number is not recognize with locale separator, try with '.' decimal
- * separator.
- * @param value String value to parse
- * @param locale The locale which define the decimal separator
- * @param maxFractionDigit The maximum number of digits allowed in the fraction portion
- * @return The double rounded according to maxFractionDigit (HALF_UP rounding mode)
- */
- public static Double parseDouble(final String value, final Locale locale, final int maxFractionDigit) {
- AssertTools.assertNotEmpty(value);
- AssertTools.assertNotNull(locale);
+ /**
+ * Parse a double from a String. If the number is not recognize with locale separator, try with '.' decimal
+ * separator.
+ * @param value String value to parse
+ * @param locale The locale which define the decimal separator
+ * @param maxFractionDigit The maximum number of digits allowed in the fraction portion
+ * @return The double rounded according to maxFractionDigit (HALF_UP rounding mode)
+ */
+ public static Double parseDouble(final String value, final Locale locale, final int maxFractionDigit) {
+ AssertTools.assertNotEmpty(value);
+ AssertTools.assertNotNull(locale);
- DecimalFormat fmt = (DecimalFormat) DecimalFormat.getNumberInstance(locale);
- fmt.setMaximumFractionDigits(maxFractionDigit);
- fmt.setRoundingMode(RoundingMode.HALF_UP);
+ DecimalFormat fmt = (DecimalFormat) DecimalFormat.getNumberInstance(locale);
+ fmt.setMaximumFractionDigits(maxFractionDigit);
+ fmt.setRoundingMode(RoundingMode.HALF_UP);
- ParsePosition position = new ParsePosition(0);
- Number nb = (Number) fmt.parseObject(value, position);
+ ParsePosition position = new ParsePosition(0);
+ Number nb = (Number) fmt.parseObject(value, position);
- if (position.getIndex() != value.length()) {
- // second try with '.' for decimal separator
- if (value.charAt(position.getIndex()) == '.') {
- DecimalFormatSymbols symbols = new DecimalFormatSymbols(locale);
- symbols.setDecimalSeparator('.');
- fmt.setDecimalFormatSymbols(symbols);
+ if (position.getIndex() != value.length()) {
+ // second try with '.' for decimal separator
+ if (value.charAt(position.getIndex()) == '.') {
+ DecimalFormatSymbols symbols = new DecimalFormatSymbols(locale);
+ symbols.setDecimalSeparator('.');
+ fmt.setDecimalFormatSymbols(symbols);
- position = new ParsePosition(0);
- nb = (Number) fmt.parseObject(value, position);
- if (position.getIndex() != value.length()) {
- throw new NumberFormatException("Cannot convert '" + value
- + "' to Double. Parse failed at position " + position.getIndex() + ".");
- }
- } else {
- throw new NumberFormatException("Cannot convert '" + value + "' to Double. Parse failed at position "
- + position.getIndex() + ".");
- }
- }
- return nb.doubleValue();
- }
+ position = new ParsePosition(0);
+ nb = (Number) fmt.parseObject(value, position);
+ if (position.getIndex() != value.length()) {
+ throw new NumberFormatException("Cannot convert '" + value
+ + "' to Double. Parse failed at position " + position.getIndex() + ".");
+ }
+ } else {
+ throw new NumberFormatException("Cannot convert '" + value + "' to Double. Parse failed at position "
+ + position.getIndex() + ".");
+ }
+ }
+ return nb.doubleValue();
+ }
- /**
- * Parse a big decimal from a String. If the number is not recognize with locale separator, try with '.' decimal
- * separator
- * @param value String value to parse
- * @param locale The locale which define the decimal separator
- * @param maxFractionDigit The maximum number of digits allowed in the fraction portion
- * @param maxIntegerDigit The maximum number of digits allowed in the integer portion
- * @return The big decimal with a specified precision
- */
- public static BigDecimal parseBigDecimal(final String value, final Locale locale, final int maxFractionDigit,
- final int maxIntegerDigit) {
- AssertTools.assertNotEmpty(value);
- AssertTools.assertNotNull(locale);
+ /**
+ * Parse a big decimal from a String. If the number is not recognize with locale separator, try with '.' decimal
+ * separator
+ * @param value String value to parse
+ * @param locale The locale which define the decimal separator
+ * @param maxFractionDigit The maximum number of digits allowed in the fraction portion
+ * @param maxIntegerDigit The maximum number of digits allowed in the integer portion
+ * @return The big decimal with a specified precision
+ */
+ public static BigDecimal parseBigDecimal(final String value, final Locale locale, final int maxFractionDigit,
+ final int maxIntegerDigit) {
+ AssertTools.assertNotEmpty(value);
+ AssertTools.assertNotNull(locale);
- DecimalFormat fmt = (DecimalFormat) NumberFormat.getNumberInstance(locale);
- fmt.setMaximumFractionDigits(maxFractionDigit);
- fmt.setMaximumIntegerDigits(maxIntegerDigit);
- fmt.setParseBigDecimal(true);
+ DecimalFormat fmt = (DecimalFormat) NumberFormat.getNumberInstance(locale);
+ fmt.setMaximumFractionDigits(maxFractionDigit);
+ fmt.setMaximumIntegerDigits(maxIntegerDigit);
+ fmt.setParseBigDecimal(true);
- ParsePosition position = new ParsePosition(0);
- BigDecimal bd = (BigDecimal) fmt.parseObject(value, position);
+ ParsePosition position = new ParsePosition(0);
+ BigDecimal bd = (BigDecimal) fmt.parseObject(value, position);
- if (position.getIndex() != value.length()) {
- // second try with '.' for decimal separator
- if (value.charAt(position.getIndex()) == '.') {
- DecimalFormatSymbols symbols = new DecimalFormatSymbols(locale);
- symbols.setDecimalSeparator('.');
- fmt.setDecimalFormatSymbols(symbols);
+ if (position.getIndex() != value.length()) {
+ // second try with '.' for decimal separator
+ if (value.charAt(position.getIndex()) == '.') {
+ DecimalFormatSymbols symbols = new DecimalFormatSymbols(locale);
+ symbols.setDecimalSeparator('.');
+ fmt.setDecimalFormatSymbols(symbols);
- position = new ParsePosition(0);
- bd = (BigDecimal) fmt.parseObject(value, position);
- if (position.getIndex() != value.length()) {
- throw new NumberFormatException("Cannot convert '" + value
- + "' to BigDecimal. Parse failed at position " + position.getIndex() + ".");
- }
- } else {
- throw new NumberFormatException("Cannot convert '" + value
- + "' to BigDecimal. Parse failed at position " + position.getIndex() + ".");
- }
- }
+ position = new ParsePosition(0);
+ bd = (BigDecimal) fmt.parseObject(value, position);
+ if (position.getIndex() != value.length()) {
+ throw new NumberFormatException("Cannot convert '" + value
+ + "' to BigDecimal. Parse failed at position " + position.getIndex() + ".");
+ }
+ } else {
+ throw new NumberFormatException("Cannot convert '" + value
+ + "' to BigDecimal. Parse failed at position " + position.getIndex() + ".");
+ }
+ }
- return bd;
- }
+ return bd;
+ }
- /**
- * Give the string representation of a double
- * @param value The double
- * @param locale The locale which define the decimal separator
- * @param minFractionDigit the minimum number of digits allowed in the fraction portion
- * @param maxFractionDigit The maximum number of digits allowed in the fraction portion
- * @return The double rounded according to maxFractionDigit (HALF_UP rounding mode)
- */
- public static String doubleToString(final Double value, final Locale locale, final int minFractionDigit,
- final int maxFractionDigit) {
- AssertTools.assertNotNull(value);
- AssertTools.assertNotNull(locale);
+ /**
+ * Give the string representation of a double
+ * @param value The double
+ * @param locale The locale which define the decimal separator
+ * @param minFractionDigit the minimum number of digits allowed in the fraction portion
+ * @param maxFractionDigit The maximum number of digits allowed in the fraction portion
+ * @return The double rounded according to maxFractionDigit (HALF_UP rounding mode)
+ */
+ public static String doubleToString(final Double value, final Locale locale, final int minFractionDigit,
+ final int maxFractionDigit) {
+ AssertTools.assertNotNull(value);
+ AssertTools.assertNotNull(locale);
- NumberFormat fmt = NumberFormat.getInstance(locale);
- if (fmt != null) {
- fmt.setMinimumFractionDigits(minFractionDigit);
- fmt.setMaximumFractionDigits(maxFractionDigit);
- fmt.setRoundingMode(RoundingMode.HALF_UP);
- return fmt.format(value);
- }
- return value.toString();
- }
+ NumberFormat fmt = NumberFormat.getInstance(locale);
+ if (fmt != null) {
+ fmt.setMinimumFractionDigits(minFractionDigit);
+ fmt.setMaximumFractionDigits(maxFractionDigit);
+ fmt.setRoundingMode(RoundingMode.HALF_UP);
+ return fmt.format(value);
+ }
+ return value.toString();
+ }
- /**
- * Give the string representation of a big decimal
- * @param value The big decimal
- * @param locale The locale which define the decimal separator
- * @param minFractionDigit the minimum number of digits allowed in the fraction portion
- * @param maxFractionDigit The maximum number of digits allowed in the fraction portion
- * @param maxIntegerDigit The maximum number of digits allowed in the integer portion
- * @return The big decimal with a specified precision
- */
- public static String bigDecimalToString(final BigDecimal value, final Locale locale, final int minFractionDigit,
- final int maxFractionDigit, final int maxIntegerDigit) {
- AssertTools.assertNotNull(value);
- AssertTools.assertNotNull(locale);
+ /**
+ * Give the string representation of a big decimal
+ * @param value The big decimal
+ * @param locale The locale which define the decimal separator
+ * @param minFractionDigit the minimum number of digits allowed in the fraction portion
+ * @param maxFractionDigit The maximum number of digits allowed in the fraction portion
+ * @param maxIntegerDigit The maximum number of digits allowed in the integer portion
+ * @return The big decimal with a specified precision
+ */
+ public static String bigDecimalToString(final BigDecimal value, final Locale locale, final int minFractionDigit,
+ final int maxFractionDigit, final int maxIntegerDigit) {
+ AssertTools.assertNotNull(value);
+ AssertTools.assertNotNull(locale);
- NumberFormat fmt = NumberFormat.getInstance(locale);
- if (fmt != null) {
- fmt.setMinimumFractionDigits(minFractionDigit);
- fmt.setMaximumFractionDigits(maxFractionDigit);
- fmt.setMaximumIntegerDigits(maxIntegerDigit);
- fmt.setRoundingMode(RoundingMode.HALF_UP);
- return fmt.format(value);
- }
- return value.toString();
- }
+ NumberFormat fmt = NumberFormat.getInstance(locale);
+ if (fmt != null) {
+ fmt.setMinimumFractionDigits(minFractionDigit);
+ fmt.setMaximumFractionDigits(maxFractionDigit);
+ fmt.setMaximumIntegerDigits(maxIntegerDigit);
+ fmt.setRoundingMode(RoundingMode.HALF_UP);
+ return fmt.format(value);
+ }
+ return value.toString();
+ }
}
Modified: trunk/cantharella.utils/src/main/java/nc/ird/module/utils/Pair.java
===================================================================
--- trunk/cantharella.utils/src/main/java/nc/ird/module/utils/Pair.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.utils/src/main/java/nc/ird/module/utils/Pair.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -35,67 +35,67 @@
*/
public final class Pair<K, V> implements Entry<K, V>, Serializable {
- /** First element */
- private K key;
+ /** First element */
+ private K key;
- /** Second element */
- private V value;
+ /** Second element */
+ private V value;
- /**
- * Constructor
- */
- public Pair() {
- //
- }
+ /**
+ * Constructor
+ */
+ public Pair() {
+ //
+ }
- /**
- * Constructor
- * @param key First element
- * @param value Second element
- */
- public Pair(K key, V value) {
- this();
- this.key = key;
- this.value = value;
- }
+ /**
+ * Constructor
+ * @param key First element
+ * @param value Second element
+ */
+ public Pair(K key, V value) {
+ this();
+ this.key = key;
+ this.value = value;
+ }
- /** @see java.lang.Object#equals(java.lang.Object) */
- @Override
- public boolean equals(Object obj) {
- return BeanTools.equals(this, obj, AccessType.GETTER, "key", "value");
- }
+ /** @see java.lang.Object#equals(java.lang.Object) */
+ @Override
+ public boolean equals(Object obj) {
+ return BeanTools.equals(this, obj, AccessType.GETTER, "key", "value");
+ }
- /** {@inheritDoc} */
- @Override
- public K getKey() {
- return key;
- }
+ /** {@inheritDoc} */
+ @Override
+ public K getKey() {
+ return key;
+ }
- /** {@inheritDoc} */
- @Override
- public V getValue() {
- return value;
- }
+ /** {@inheritDoc} */
+ @Override
+ public V getValue() {
+ return value;
+ }
- /** @see java.lang.Object#hashCode() **/
- @Override
- public int hashCode() {
- return BeanTools.hashCode(this, getKey(), getValue());
- }
+ /** @see java.lang.Object#hashCode() **/
+ @Override
+ public int hashCode() {
+ return BeanTools.hashCode(this, getKey(), getValue());
+ }
- /**
- * key setter
- * @param key key
- */
- public void setKey(K key) {
- this.key = key;
- }
+ /**
+ * key setter
+ * @param key key
+ */
+ public void setKey(K key) {
+ this.key = key;
+ }
- /** {@inheritDoc} */
- @Override
- public V setValue(V value) {
- V oldValue = this.value;
- this.value = value;
- return oldValue;
- }
+ /** {@inheritDoc} */
+ @Override
+ public V setValue(V value) {
+ V oldValue = this.value;
+ this.value = value;
+ return oldValue;
+ }
}
\ No newline at end of file
Modified: trunk/cantharella.utils/src/main/java/nc/ird/module/utils/PasswordTools.java
===================================================================
--- trunk/cantharella.utils/src/main/java/nc/ird/module/utils/PasswordTools.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.utils/src/main/java/nc/ird/module/utils/PasswordTools.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -31,51 +31,51 @@
*/
public final class PasswordTools {
- /** Password MD5 length */
- public static final int MD5_LENGTH = 32;
+ /** Password MD5 length */
+ public static final int MD5_LENGTH = 32;
- /** Password max length */
- public static final int PASSWORD_LENGTH_MAX = 12;
+ /** Password max length */
+ public static final int PASSWORD_LENGTH_MAX = 12;
- /** Password min length */
- public static final int PASSWORD_LENGTH_MIN = 5;
+ /** Password min length */
+ public static final int PASSWORD_LENGTH_MIN = 5;
- /** Password SHA1 length */
- public static final int SHA1_LENGTH = 40;
+ /** Password SHA1 length */
+ public static final int SHA1_LENGTH = 40;
- /**
- * Hash a password with the MD5 algorithm
- * @param password Password
- * @return Hashed password
- */
- public static String md5(String password) {
- AssertTools.assertNotNull(password);
- return DigestUtils.md5Hex(password);
- }
+ /**
+ * Hash a password with the MD5 algorithm
+ * @param password Password
+ * @return Hashed password
+ */
+ public static String md5(String password) {
+ AssertTools.assertNotNull(password);
+ return DigestUtils.md5Hex(password);
+ }
- /**
- * Generate a random password
- * @return Password
- */
- public static String random() {
- return RandomStringUtils
- .randomAlphanumeric((int) (Math.random() * (PASSWORD_LENGTH_MAX - PASSWORD_LENGTH_MIN) + PASSWORD_LENGTH_MIN));
- }
+ /**
+ * Generate a random password
+ * @return Password
+ */
+ public static String random() {
+ return RandomStringUtils
+ .randomAlphanumeric((int) (Math.random() * (PASSWORD_LENGTH_MAX - PASSWORD_LENGTH_MIN) + PASSWORD_LENGTH_MIN));
+ }
- /**
- * Hash a password with the SHA-1 algorithm
- * @param password Password
- * @return Hashed password
- */
- public static String sha1(String password) {
- AssertTools.assertNotNull(password);
- return DigestUtils.shaHex(password);
- }
+ /**
+ * Hash a password with the SHA-1 algorithm
+ * @param password Password
+ * @return Hashed password
+ */
+ public static String sha1(String password) {
+ AssertTools.assertNotNull(password);
+ return DigestUtils.shaHex(password);
+ }
- /**
- * Constructor (prevents from instantiation)
- */
- private PasswordTools() {
- //
- }
+ /**
+ * Constructor (prevents from instantiation)
+ */
+ private PasswordTools() {
+ //
+ }
}
Modified: trunk/cantharella.utils/src/main/java/nc/ird/module/utils/StringTools.java
===================================================================
--- trunk/cantharella.utils/src/main/java/nc/ird/module/utils/StringTools.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.utils/src/main/java/nc/ird/module/utils/StringTools.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -40,169 +40,169 @@
*/
public final class StringTools {
- /**
- * Create a string representing a list of couples (key + value)
- * @param <O1> Keys type
- * @param <O2> Values type
- * @param couples Couples (key + value)
- * @param separatorKeysValues Separator between keys and values
- * @param separatorCouples Separator between couples
- * @return String representing the list of couples, or null if empty
- */
- public static <O1, O2> String couplesToString(Map<O1, O2> couples, String separatorKeysValues,
- String separatorCouples) {
- AssertTools.assertNotNull(couples);
- AssertTools.assertNotNull(separatorKeysValues);
- AssertTools.assertNotNull(separatorCouples);
- StringBuilder builder = new StringBuilder();
- for (Entry<O1, O2> entry : couples.entrySet()) {
- builder.append(entry.getKey() + separatorKeysValues + entry.getValue() + separatorCouples);
- }
- return StringUtils.stripToNull(truncate(builder, separatorCouples));
- }
+ /**
+ * Create a string representing a list of couples (key + value)
+ * @param <O1> Keys type
+ * @param <O2> Values type
+ * @param couples Couples (key + value)
+ * @param separatorKeysValues Separator between keys and values
+ * @param separatorCouples Separator between couples
+ * @return String representing the list of couples, or null if empty
+ */
+ public static <O1, O2> String couplesToString(Map<O1, O2> couples, String separatorKeysValues,
+ String separatorCouples) {
+ AssertTools.assertNotNull(couples);
+ AssertTools.assertNotNull(separatorKeysValues);
+ AssertTools.assertNotNull(separatorCouples);
+ StringBuilder builder = new StringBuilder();
+ for (Entry<O1, O2> entry : couples.entrySet()) {
+ builder.append(entry.getKey() + separatorKeysValues + entry.getValue() + separatorCouples);
+ }
+ return StringUtils.stripToNull(truncate(builder, separatorCouples));
+ }
- /**
- * Display a list of objects
- * @param list The list to browsed
- * @param delimiter The delimiter between each object
- * @return List display
- */
- public static String listToString(List<? extends Object> list, String delimiter) {
- AssertTools.assertNotNull(list);
- AssertTools.assertNotEmpty(delimiter);
- StringBuilder builder = new StringBuilder();
- Iterator<? extends Object> itBeans = list.iterator();
- while (itBeans.hasNext()) {
- Object bean = itBeans.next();
- builder.append(bean.toString());
- if (itBeans.hasNext()) {
- builder.append(delimiter);
- }
- }
- return builder.toString();
- }
+ /**
+ * Display a list of objects
+ * @param list The list to browsed
+ * @param delimiter The delimiter between each object
+ * @return List display
+ */
+ public static String listToString(List<? extends Object> list, String delimiter) {
+ AssertTools.assertNotNull(list);
+ AssertTools.assertNotEmpty(delimiter);
+ StringBuilder builder = new StringBuilder();
+ Iterator<? extends Object> itBeans = list.iterator();
+ while (itBeans.hasNext()) {
+ Object bean = itBeans.next();
+ builder.append(bean.toString());
+ if (itBeans.hasNext()) {
+ builder.append(delimiter);
+ }
+ }
+ return builder.toString();
+ }
- /**
- * Null-safe string length
- * @param string String
- * @return String length or -1 if null
- */
- public static int length(String string) {
- return string == null ? -1 : string.length();
- }
+ /**
+ * Null-safe string length
+ * @param string String
+ * @return String length or -1 if null
+ */
+ public static int length(String string) {
+ return string == null ? -1 : string.length();
+ }
- /**
- * Create a line iterator, without null or empty lines
- * @param string String
- * @return Iterator
- */
- public static Iterator<String> lineIterator(String string) {
- AssertTools.assertNotNull(string);
- List<String> lines = new ArrayList<String>();
- for (LineIterator i = new LineIterator(new StringReader(string)); i.hasNext();) {
- String line = StringUtils.trimToNull(i.nextLine());
- if (line != null) {
- lines.add(line);
- }
- }
- return lines.iterator();
- }
+ /**
+ * Create a line iterator, without null or empty lines
+ * @param string String
+ * @return Iterator
+ */
+ public static Iterator<String> lineIterator(String string) {
+ AssertTools.assertNotNull(string);
+ List<String> lines = new ArrayList<String>();
+ for (LineIterator i = new LineIterator(new StringReader(string)); i.hasNext();) {
+ String line = StringUtils.trimToNull(i.nextLine());
+ if (line != null) {
+ lines.add(line);
+ }
+ }
+ return lines.iterator();
+ }
- /**
- * Create a line iterator, without null or empty lines
- * @param stringBuilder String
- * @return Iterator
- */
- public static Iterator<String> lineIterator(StringBuilder stringBuilder) {
- AssertTools.assertNotNull(stringBuilder);
- return lineIterator(stringBuilder.toString());
- }
+ /**
+ * Create a line iterator, without null or empty lines
+ * @param stringBuilder String
+ * @return Iterator
+ */
+ public static Iterator<String> lineIterator(StringBuilder stringBuilder) {
+ AssertTools.assertNotNull(stringBuilder);
+ return lineIterator(stringBuilder.toString());
+ }
- /**
- * Replace accented characters by their corresponding non-accented characters
- * @param string Accented string
- * @return Non-accented string
- */
- public static String replaceAccents(String string) {
- return StringUtils.stripAccents(string);
- }
+ /**
+ * Replace accented characters by their corresponding non-accented characters
+ * @param string Accented string
+ * @return Non-accented string
+ */
+ public static String replaceAccents(String string) {
+ return StringUtils.stripAccents(string);
+ }
- /**
- * Replace consecutive whitespaces by a single whitespace
- * @param string String to transform
- * @return String transformed
- */
- public static String replaceConsecutiveWhitespaces(String string) {
- return StringUtils.isEmpty(string) ? string : string.replaceAll("\\p{Space}+", " ");
- }
+ /**
+ * Replace consecutive whitespaces by a single whitespace
+ * @param string String to transform
+ * @return String transformed
+ */
+ public static String replaceConsecutiveWhitespaces(String string) {
+ return StringUtils.isEmpty(string) ? string : string.replaceAll("\\p{Space}+", " ");
+ }
- /**
- * Replace consecutive whitespaces by an underscore
- * @param string String to transform
- * @return String transformed
- */
- public static String replaceConsecutiveWhitespacesByUnderscore(String string) {
- return StringUtils.isEmpty(string) ? string : string.replaceAll("\\p{Space}+", "_");
- }
+ /**
+ * Replace consecutive whitespaces by an underscore
+ * @param string String to transform
+ * @return String transformed
+ */
+ public static String replaceConsecutiveWhitespacesByUnderscore(String string) {
+ return StringUtils.isEmpty(string) ? string : string.replaceAll("\\p{Space}+", "_");
+ }
- /**
- * Replace non alpha characters by a whitespace (accentuated characters are considered as non alpha characters)
- * @param string String to transform
- * @return String transformed
- */
- public static String replaceNonAlpha(String string) {
- return StringUtils.isEmpty(string) ? string : string.replaceAll("[^\\p{Alpha}]", " ");
- }
+ /**
+ * Replace non alpha characters by a whitespace (accentuated characters are considered as non alpha characters)
+ * @param string String to transform
+ * @return String transformed
+ */
+ public static String replaceNonAlpha(String string) {
+ return StringUtils.isEmpty(string) ? string : string.replaceAll("[^\\p{Alpha}]", " ");
+ }
- /**
- * Truncate a string by the end
- * @param toTruncate String to truncate
- * @param truncation String to delete
- * @return Truncated string (empty if empty, null if null)
- */
- public static String truncate(String toTruncate, String truncation) {
- AssertTools.assertNotNull(truncation);
- String result = toTruncate;
- if (!StringUtils.isEmpty(toTruncate)
- && toTruncate.length() >= truncation.length()
- && truncation.equals(toTruncate.substring(toTruncate.length() - truncation.length(), toTruncate
- .length()))) {
- result = toTruncate.substring(0, toTruncate.length() - truncation.length());
- }
- return result;
- }
+ /**
+ * Truncate a string by the end
+ * @param toTruncate String to truncate
+ * @param truncation String to delete
+ * @return Truncated string (empty if empty, null if null)
+ */
+ public static String truncate(String toTruncate, String truncation) {
+ AssertTools.assertNotNull(truncation);
+ String result = toTruncate;
+ if (!StringUtils.isEmpty(toTruncate)
+ && toTruncate.length() >= truncation.length()
+ && truncation.equals(toTruncate.substring(toTruncate.length() - truncation.length(), toTruncate
+ .length()))) {
+ result = toTruncate.substring(0, toTruncate.length() - truncation.length());
+ }
+ return result;
+ }
- /**
- * Truncate a string by the end
- * @param toTruncate String to truncate
- * @param truncation String to delete
- * @return Truncated string (empty if empty, null if null)
- */
- public static String truncate(StringBuilder toTruncate, String truncation) {
- return toTruncate != null ? truncate(toTruncate.toString(), truncation) : null;
- }
+ /**
+ * Truncate a string by the end
+ * @param toTruncate String to truncate
+ * @param truncation String to delete
+ * @return Truncated string (empty if empty, null if null)
+ */
+ public static String truncate(StringBuilder toTruncate, String truncation) {
+ return toTruncate != null ? truncate(toTruncate.toString(), truncation) : null;
+ }
- /**
- * Constructor (prevents from instantiation)
- */
- private StringTools() {
- //
- }
+ /**
+ * Constructor (prevents from instantiation)
+ */
+ private StringTools() {
+ //
+ }
- /**
- * Create a comparator according to the toString method
- * @param <T> Type
- * @return Comparator
- */
- public static <T> Comparator<T> createStringComparator() {
- return new Comparator<T>() {
- @Override
- public int compare(T t1, T t2) {
- String t1String = t1 == null ? "" : t1.toString();
- String t2String = t2 == null ? "" : t2.toString();
-
- return t1String.compareTo(t2String);
- }
- };
- }
+ /**
+ * Create a comparator according to the toString method
+ * @param <T> Type
+ * @return Comparator
+ */
+ public static <T> Comparator<T> createStringComparator() {
+ return new Comparator<T>() {
+ @Override
+ public int compare(T t1, T t2) {
+ String t1String = t1 == null ? "" : t1.toString();
+ String t2String = t2 == null ? "" : t2.toString();
+
+ return t1String.compareTo(t2String);
+ }
+ };
+ }
}
Modified: trunk/cantharella.utils/src/main/java/nc/ird/module/utils/StringTransformer.java
===================================================================
--- trunk/cantharella.utils/src/main/java/nc/ird/module/utils/StringTransformer.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.utils/src/main/java/nc/ird/module/utils/StringTransformer.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -31,120 +31,120 @@
*/
public final class StringTransformer {
- /** String to transform */
- private String string;
+ /** String to transform */
+ private String string;
- /**
- * Constructor
- * @param string String to transform
- */
- public StringTransformer(String string) {
- this.string = string;
- }
+ /**
+ * Constructor
+ * @param string String to transform
+ */
+ public StringTransformer(String string) {
+ this.string = string;
+ }
- /**
- * Capitalize
- * @return this
- * @see WordUtils
- */
- public StringTransformer capitalize() {
- string = StringUtils.isEmpty(string) ? string : WordUtils.capitalize(string);
- return this;
- }
+ /**
+ * Capitalize
+ * @return this
+ * @see WordUtils
+ */
+ public StringTransformer capitalize() {
+ string = StringUtils.isEmpty(string) ? string : WordUtils.capitalize(string);
+ return this;
+ }
- /**
- * Capitalize fully
- * @return this
- * @see WordUtils
- */
- public StringTransformer capitalizeFully() {
- string = StringUtils.isEmpty(string) ? string : WordUtils.capitalizeFully(string);
- return this;
- }
+ /**
+ * Capitalize fully
+ * @return this
+ * @see WordUtils
+ */
+ public StringTransformer capitalizeFully() {
+ string = StringUtils.isEmpty(string) ? string : WordUtils.capitalizeFully(string);
+ return this;
+ }
- /**
- * Replace accents
- * @return this
- * @see StringTools
- */
- public StringTransformer replaceAccents() {
- string = StringUtils.isEmpty(string) ? string : StringTools.replaceAccents(string);
- return this;
- }
+ /**
+ * Replace accents
+ * @return this
+ * @see StringTools
+ */
+ public StringTransformer replaceAccents() {
+ string = StringUtils.isEmpty(string) ? string : StringTools.replaceAccents(string);
+ return this;
+ }
- /**
- * Replace consecutive whitespaces
- * @return this
- * @see StringTools
- */
- public StringTransformer replaceConsecutiveWhitespaces() {
- string = StringUtils.isEmpty(string) ? string : StringTools.replaceConsecutiveWhitespaces(string);
- return this;
- }
+ /**
+ * Replace consecutive whitespaces
+ * @return this
+ * @see StringTools
+ */
+ public StringTransformer replaceConsecutiveWhitespaces() {
+ string = StringUtils.isEmpty(string) ? string : StringTools.replaceConsecutiveWhitespaces(string);
+ return this;
+ }
- /**
- * Replace consecutive whitespaces by an underscore
- * @return this
- * @see StringTools
- */
- public StringTransformer replaceConsecutiveWhitespacesByUnderscore() {
- string = StringUtils.isEmpty(string) ? string : StringTools.replaceConsecutiveWhitespacesByUnderscore(string);
- return this;
- }
+ /**
+ * Replace consecutive whitespaces by an underscore
+ * @return this
+ * @see StringTools
+ */
+ public StringTransformer replaceConsecutiveWhitespacesByUnderscore() {
+ string = StringUtils.isEmpty(string) ? string : StringTools.replaceConsecutiveWhitespacesByUnderscore(string);
+ return this;
+ }
- /**
- * Replace non alpha
- * @return this
- * @see StringTools
- */
- public StringTransformer replaceNonAlpha() {
- string = StringUtils.isEmpty(string) ? string : StringTools.replaceNonAlpha(string);
- return this;
- }
+ /**
+ * Replace non alpha
+ * @return this
+ * @see StringTools
+ */
+ public StringTransformer replaceNonAlpha() {
+ string = StringUtils.isEmpty(string) ? string : StringTools.replaceNonAlpha(string);
+ return this;
+ }
- /**
- * To lower case
- * @return this
- * @see String
- */
- public StringTransformer toLowerCase() {
- string = StringUtils.isEmpty(string) ? string : string.toLowerCase();
- return this;
- }
+ /**
+ * To lower case
+ * @return this
+ * @see String
+ */
+ public StringTransformer toLowerCase() {
+ string = StringUtils.isEmpty(string) ? string : string.toLowerCase();
+ return this;
+ }
- /** {@inheritDoc} */
- @Override
- public String toString() {
- return string;
- }
+ /** {@inheritDoc} */
+ @Override
+ public String toString() {
+ return string;
+ }
- /**
- * To upper case
- * @return this
- * @see String
- */
- public StringTransformer toUpperCase() {
- string = StringUtils.isEmpty(string) ? string : string.toUpperCase();
- return this;
- }
+ /**
+ * To upper case
+ * @return this
+ * @see String
+ */
+ public StringTransformer toUpperCase() {
+ string = StringUtils.isEmpty(string) ? string : string.toUpperCase();
+ return this;
+ }
- /**
- * Trim
- * @return this
- * @see String
- */
- public StringTransformer trim() {
- string = StringUtils.isEmpty(string) ? string : string.trim();
- return this;
- }
+ /**
+ * Trim
+ * @return this
+ * @see String
+ */
+ public StringTransformer trim() {
+ string = StringUtils.isEmpty(string) ? string : string.trim();
+ return this;
+ }
- /**
- * Trim to null
- * @return this
- * @see StringUtils
- */
- public StringTransformer trimToNull() {
- string = string == null ? null : StringUtils.trimToNull(string);
- return this;
- }
+ /**
+ * Trim to null
+ * @return this
+ * @see StringUtils
+ */
+ public StringTransformer trimToNull() {
+ string = string == null ? null : StringUtils.trimToNull(string);
+ return this;
+ }
}
Modified: trunk/cantharella.utils/src/test/java/nc/ird/module/utils/AssertToolsTest.java
===================================================================
--- trunk/cantharella.utils/src/test/java/nc/ird/module/utils/AssertToolsTest.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.utils/src/test/java/nc/ird/module/utils/AssertToolsTest.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -35,366 +35,366 @@
*/
public final class AssertToolsTest {
- /**
- * assert array not empty : false (empty value)
- */
- @Test(expected = AssertionError.class)
- public void assertArrayNotEmptyFalse1() {
- AssertTools.assertArrayNotEmpty(new String[] { "toto", "" });
- }
+ /**
+ * assert array not empty : false (empty value)
+ */
+ @Test(expected = AssertionError.class)
+ public void assertArrayNotEmptyFalse1() {
+ AssertTools.assertArrayNotEmpty(new String[] { "toto", "" });
+ }
- /**
- * assert array not empty : false (null value)
- */
- @Test(expected = AssertionError.class)
- public void assertArrayNotEmptyFalse2() {
- AssertTools.assertArrayNotEmpty(new String[] { null, "toto" });
- }
+ /**
+ * assert array not empty : false (null value)
+ */
+ @Test(expected = AssertionError.class)
+ public void assertArrayNotEmptyFalse2() {
+ AssertTools.assertArrayNotEmpty(new String[] { null, "toto" });
+ }
- /**
- * assert array not empty : true
- */
- public void assertArrayNotEmptyTrue() {
- AssertTools.assertArrayNotEmpty(new String[] {});
- AssertTools.assertArrayNotEmpty(new String[] { "toto", "titi" });
- }
+ /**
+ * assert array not empty : true
+ */
+ public void assertArrayNotEmptyTrue() {
+ AssertTools.assertArrayNotEmpty(new String[] {});
+ AssertTools.assertArrayNotEmpty(new String[] { "toto", "titi" });
+ }
- /**
- * assert array not null : false
- */
- @Test(expected = AssertionError.class)
- public void assertArrayNotNullFalse() {
- AssertTools.assertArrayNotNull(new Integer[] { Integer.valueOf(0), null, Integer.valueOf(2) });
- }
+ /**
+ * assert array not null : false
+ */
+ @Test(expected = AssertionError.class)
+ public void assertArrayNotNullFalse() {
+ AssertTools.assertArrayNotNull(new Integer[] { Integer.valueOf(0), null, Integer.valueOf(2) });
+ }
- /**
- * assert array not null : true
- */
- public void assertArrayNotNullTrue() {
- AssertTools.assertArrayNotNull(new Integer[] { Integer.valueOf(0), Integer.valueOf(1), Integer.valueOf(2) });
- }
+ /**
+ * assert array not null : true
+ */
+ public void assertArrayNotNullTrue() {
+ AssertTools.assertArrayNotNull(new Integer[] { Integer.valueOf(0), Integer.valueOf(1), Integer.valueOf(2) });
+ }
- /**
- * assertClassOrInterface test: error
- */
- @Test(expected = AssertionError.class)
- public void assertClassOrInterfaceFalse() {
- AssertTools.assertClassOrInterface("", AssertToolsTest.class);
- }
+ /**
+ * assertClassOrInterface test: error
+ */
+ @Test(expected = AssertionError.class)
+ public void assertClassOrInterfaceFalse() {
+ AssertTools.assertClassOrInterface("", AssertToolsTest.class);
+ }
- /**
- * assert class or interface: false class
- */
- @Test(expected = AssertionError.class)
- public void assertClassOrInterfaceFalseClass() {
- AssertTools.assertClassOrInterface("", AssertToolsTest.class);
- }
+ /**
+ * assert class or interface: false class
+ */
+ @Test(expected = AssertionError.class)
+ public void assertClassOrInterfaceFalseClass() {
+ AssertTools.assertClassOrInterface("", AssertToolsTest.class);
+ }
- /**
- * assert class or interface: false interface
- */
- @Test(expected = AssertionError.class)
- public void assertClassOrInterfaceFalseInterface() {
- AssertTools.assertClassOrInterface("", Iterable.class);
- }
+ /**
+ * assert class or interface: false interface
+ */
+ @Test(expected = AssertionError.class)
+ public void assertClassOrInterfaceFalseInterface() {
+ AssertTools.assertClassOrInterface("", Iterable.class);
+ }
- /**
- * assertClassOrInterface test: null class
- */
- @Test(expected = AssertionError.class)
- public void assertClassOrInterfaceNullClass() {
- AssertTools.assertClassOrInterface(this, null);
- }
+ /**
+ * assertClassOrInterface test: null class
+ */
+ @Test(expected = AssertionError.class)
+ public void assertClassOrInterfaceNullClass() {
+ AssertTools.assertClassOrInterface(this, null);
+ }
- /**
- * assertClassOrInterface test: null object
- */
- @Test(expected = AssertionError.class)
- public void assertClassOrInterfaceNullObject() {
- AssertTools.assertClassOrInterface(null, AssertToolsTest.class);
- }
+ /**
+ * assertClassOrInterface test: null object
+ */
+ @Test(expected = AssertionError.class)
+ public void assertClassOrInterfaceNullObject() {
+ AssertTools.assertClassOrInterface(null, AssertToolsTest.class);
+ }
- /**
- * assertClassOrInterface test: success
- */
- @Test
- public void assertClassOrInterfaceTrue() {
- AssertTools.assertClassOrInterface(this, AssertToolsTest.class);
- AssertTools.assertClassOrInterface(this, Object.class);
- AssertTools.assertClassOrInterface(Integer.valueOf(0), Number.class);
- AssertTools.assertClassOrInterface("", Serializable.class);
- }
+ /**
+ * assertClassOrInterface test: success
+ */
+ @Test
+ public void assertClassOrInterfaceTrue() {
+ AssertTools.assertClassOrInterface(this, AssertToolsTest.class);
+ AssertTools.assertClassOrInterface(this, Object.class);
+ AssertTools.assertClassOrInterface(Integer.valueOf(0), Number.class);
+ AssertTools.assertClassOrInterface("", Serializable.class);
+ }
- /**
- * assert collection not null : not null
- */
- @Test
- public void assertCollectionNotNullNotNull() {
- AssertTools.assertCollectionNotNull(Arrays.asList(new String[] {}));
- AssertTools.assertCollectionNotNull(Arrays.asList(new String[] { "" }));
- }
+ /**
+ * assert collection not null : not null
+ */
+ @Test
+ public void assertCollectionNotNullNotNull() {
+ AssertTools.assertCollectionNotNull(Arrays.asList(new String[] {}));
+ AssertTools.assertCollectionNotNull(Arrays.asList(new String[] { "" }));
+ }
- /**
- * assert collection not null : null
- */
- @Test(expected = AssertionError.class)
- public void assertCollectionNotNullNull() {
- AssertTools.assertCollectionNotNull(Arrays.asList(new String[] { null }));
- }
+ /**
+ * assert collection not null : null
+ */
+ @Test(expected = AssertionError.class)
+ public void assertCollectionNotNullNull() {
+ AssertTools.assertCollectionNotNull(Arrays.asList(new String[] { null }));
+ }
- /**
- * assertEquals test: equals
- */
- @Test
- public void assertEqualsEquals() {
- AssertTools.assertEquals(-1, -1);
- AssertTools.assertEquals(0, 0);
- AssertTools.assertEquals(1, 1);
- }
+ /**
+ * assertEquals test: equals
+ */
+ @Test
+ public void assertEqualsEquals() {
+ AssertTools.assertEquals(-1, -1);
+ AssertTools.assertEquals(0, 0);
+ AssertTools.assertEquals(1, 1);
+ }
- /**
- * assertEquals test: equals
- */
- @Test(expected = AssertionError.class)
- public void assertEqualsNotEquals() {
- AssertTools.assertEquals(-1, 0);
- }
+ /**
+ * assertEquals test: equals
+ */
+ @Test(expected = AssertionError.class)
+ public void assertEqualsNotEquals() {
+ AssertTools.assertEquals(-1, 0);
+ }
- /**
- * assertGreaterOrEquals test: equals
- */
- @Test
- public void assertGreateOrEqualsEquals() {
- AssertTools.assertGreaterOrEquals(0, 0);
- }
+ /**
+ * assertGreaterOrEquals test: equals
+ */
+ @Test
+ public void assertGreateOrEqualsEquals() {
+ AssertTools.assertGreaterOrEquals(0, 0);
+ }
- /**
- * assertGreaterOrEquals test: greater
- */
- @Test
- public void assertGreateOrEqualsGreater() {
- AssertTools.assertGreaterOrEquals(1, 0);
- }
+ /**
+ * assertGreaterOrEquals test: greater
+ */
+ @Test
+ public void assertGreateOrEqualsGreater() {
+ AssertTools.assertGreaterOrEquals(1, 0);
+ }
- /**
- * assertGreaterOrEquals test: equals
- */
- @Test(expected = AssertionError.class)
- public void assertGreateOrEqualsLower() {
- AssertTools.assertGreaterOrEquals(-1, 0);
- }
+ /**
+ * assertGreaterOrEquals test: equals
+ */
+ @Test(expected = AssertionError.class)
+ public void assertGreateOrEqualsLower() {
+ AssertTools.assertGreaterOrEquals(-1, 0);
+ }
- /**
- * AssertIn test: false
- */
- @Test(expected = AssertionError.class)
- public void assertInArrayFalse() {
- AssertTools.assertIn("b", "a", "c");
- }
+ /**
+ * AssertIn test: false
+ */
+ @Test(expected = AssertionError.class)
+ public void assertInArrayFalse() {
+ AssertTools.assertIn("b", "a", "c");
+ }
- /**
- * AssertIn test: false
- */
- @Test(expected = AssertionError.class)
- public void assertInCollectionFalse() {
- AssertTools.assertIn("b", Arrays.asList(new String[] { "a", "c" }));
- }
+ /**
+ * AssertIn test: false
+ */
+ @Test(expected = AssertionError.class)
+ public void assertInCollectionFalse() {
+ AssertTools.assertIn("b", Arrays.asList(new String[] { "a", "c" }));
+ }
- /**
- * AssertIn test: true
- */
- @Test
- public void assertInTrue() {
- AssertTools.assertIn("b", "b");
- AssertTools.assertIn("b", "a", "b");
- AssertTools.assertIn("b", Arrays.asList(new String[] { "b" }));
- AssertTools.assertIn("b", Arrays.asList(new String[] { "a", "b" }));
- }
+ /**
+ * AssertIn test: true
+ */
+ @Test
+ public void assertInTrue() {
+ AssertTools.assertIn("b", "b");
+ AssertTools.assertIn("b", "a", "b");
+ AssertTools.assertIn("b", Arrays.asList(new String[] { "b" }));
+ AssertTools.assertIn("b", Arrays.asList(new String[] { "a", "b" }));
+ }
- /**
- * Assert lower test: equals
- */
- @Test(expected = AssertionError.class)
- public void assertLowerEquals() {
- AssertTools.assertLower(0, 0);
- }
+ /**
+ * Assert lower test: equals
+ */
+ @Test(expected = AssertionError.class)
+ public void assertLowerEquals() {
+ AssertTools.assertLower(0, 0);
+ }
- /**
- * Assert lower test: lower
- */
- @Test
- public void assertLowerLower() {
- AssertTools.assertLower(-1, 0);
- }
+ /**
+ * Assert lower test: lower
+ */
+ @Test
+ public void assertLowerLower() {
+ AssertTools.assertLower(-1, 0);
+ }
- /**
- * Assert lower or equals: lower or equals
- */
- @Test
- public void assertLowerOrEqualsLowerOrEquals() {
- AssertTools.assertLowerOrEquals(-1, 0);
- AssertTools.assertLowerOrEquals(0, 0);
- }
+ /**
+ * Assert lower or equals: lower or equals
+ */
+ @Test
+ public void assertLowerOrEqualsLowerOrEquals() {
+ AssertTools.assertLowerOrEquals(-1, 0);
+ AssertTools.assertLowerOrEquals(0, 0);
+ }
- /**
- * Assert lower or equals: upper
- */
- @Test(expected = AssertionError.class)
- public void assertLowerOrEqualsUpper() {
- AssertTools.assertLower(1, 0);
- }
+ /**
+ * Assert lower or equals: upper
+ */
+ @Test(expected = AssertionError.class)
+ public void assertLowerOrEqualsUpper() {
+ AssertTools.assertLower(1, 0);
+ }
- /**
- * Assert lower: upper
- */
- @Test(expected = AssertionError.class)
- public void assertLowerUpper() {
- AssertTools.assertLower(1, 0);
- }
+ /**
+ * Assert lower: upper
+ */
+ @Test(expected = AssertionError.class)
+ public void assertLowerUpper() {
+ AssertTools.assertLower(1, 0);
+ }
- /**
- * assertNotEmpty test: array empty
- */
- @Test(expected = AssertionError.class)
- public void assertNotEmptyArrayEmpty() {
- AssertTools.assertNotEmpty(new Integer[] {});
- }
+ /**
+ * assertNotEmpty test: array empty
+ */
+ @Test(expected = AssertionError.class)
+ public void assertNotEmptyArrayEmpty() {
+ AssertTools.assertNotEmpty(new Integer[] {});
+ }
- /**
- * assertNotEmpty test: array not empty
- */
- @Test
- public void assertNotEmptyArrayNotEmpty() {
- AssertTools.assertNotEmpty(new String[] { "toto" });
- }
+ /**
+ * assertNotEmpty test: array not empty
+ */
+ @Test
+ public void assertNotEmptyArrayNotEmpty() {
+ AssertTools.assertNotEmpty(new String[] { "toto" });
+ }
- /**
- * assertNotEmpty : Null test
- */
- @Test(expected = AssertionError.class)
- public void assertNotEmptyArrayNull() {
- AssertTools.assertNotEmpty((Integer[]) null);
- }
+ /**
+ * assertNotEmpty : Null test
+ */
+ @Test(expected = AssertionError.class)
+ public void assertNotEmptyArrayNull() {
+ AssertTools.assertNotEmpty((Integer[]) null);
+ }
- /**
- * assertNotEmpty test: collection empty
- */
- @Test(expected = AssertionError.class)
- public void assertNotEmptyCollectionEmpty() {
- AssertTools.assertNotEmpty(new ArrayList<String>());
- }
+ /**
+ * assertNotEmpty test: collection empty
+ */
+ @Test(expected = AssertionError.class)
+ public void assertNotEmptyCollectionEmpty() {
+ AssertTools.assertNotEmpty(new ArrayList<String>());
+ }
- /**
- * assertNotEmpty test: collection not empty
- */
- @Test
- public void assertNotEmptyCollectionNotEmpty() {
- AssertTools.assertNotEmpty(Arrays.asList("toto"));
- }
+ /**
+ * assertNotEmpty test: collection not empty
+ */
+ @Test
+ public void assertNotEmptyCollectionNotEmpty() {
+ AssertTools.assertNotEmpty(Arrays.asList("toto"));
+ }
- /**
- * assertNotEmptyCollection : Null test
- */
- @Test(expected = AssertionError.class)
- public void assertNotEmptyCollectionNull() {
- AssertTools.assertNotEmpty((Collection<?>) null);
- }
+ /**
+ * assertNotEmptyCollection : Null test
+ */
+ @Test(expected = AssertionError.class)
+ public void assertNotEmptyCollectionNull() {
+ AssertTools.assertNotEmpty((Collection<?>) null);
+ }
- /**
- * assertEmpty test: string empty
- */
- @Test(expected = AssertionError.class)
- public void assertNotEmptyStringEmpty() {
- AssertTools.assertNotEmpty("");
- }
+ /**
+ * assertEmpty test: string empty
+ */
+ @Test(expected = AssertionError.class)
+ public void assertNotEmptyStringEmpty() {
+ AssertTools.assertNotEmpty("");
+ }
- /**
- * assertEmpty test: string not empty
- */
- @Test
- public void assertNotEmptyStringNotEmpty() {
- AssertTools.assertNotEmpty("toto");
- }
+ /**
+ * assertEmpty test: string not empty
+ */
+ @Test
+ public void assertNotEmptyStringNotEmpty() {
+ AssertTools.assertNotEmpty("toto");
+ }
- /**
- * assertNotEmpty test: string null
- */
- @Test(expected = AssertionError.class)
- public void assertNotEmptyStringNull() {
- AssertTools.assertNotEmpty((String) null);
- }
+ /**
+ * assertNotEmpty test: string null
+ */
+ @Test(expected = AssertionError.class)
+ public void assertNotEmptyStringNull() {
+ AssertTools.assertNotEmpty((String) null);
+ }
- /**
- * Assert not equals test: equals
- */
- @Test(expected = AssertionError.class)
- public void assertNotEqualsEquals() {
- AssertTools.assertNotEquals(0, 0);
- }
+ /**
+ * Assert not equals test: equals
+ */
+ @Test(expected = AssertionError.class)
+ public void assertNotEqualsEquals() {
+ AssertTools.assertNotEquals(0, 0);
+ }
- /**
- * Assert not equals: upper
- */
- @Test
- public void assertNotEqualsNotEquals() {
- AssertTools.assertNotEquals(1, 0);
- AssertTools.assertNotEquals(-1, 0);
- }
+ /**
+ * Assert not equals: upper
+ */
+ @Test
+ public void assertNotEqualsNotEquals() {
+ AssertTools.assertNotEquals(1, 0);
+ AssertTools.assertNotEquals(-1, 0);
+ }
- /**
- * Assert not negative: negative
- */
- @Test(expected = AssertionError.class)
- public void assertNotNegativeNegative() {
- AssertTools.assertNotNegative(-1);
- }
+ /**
+ * Assert not negative: negative
+ */
+ @Test(expected = AssertionError.class)
+ public void assertNotNegativeNegative() {
+ AssertTools.assertNotNegative(-1);
+ }
- /**
- * Assert not negative: not negative
- */
- @Test
- public void assertNotNegativeNotNegative() {
- AssertTools.assertNotNegative(1);
- AssertTools.assertNotNegative(0);
- }
+ /**
+ * Assert not negative: not negative
+ */
+ @Test
+ public void assertNotNegativeNotNegative() {
+ AssertTools.assertNotNegative(1);
+ AssertTools.assertNotNegative(0);
+ }
- /**
- * assertNotNull test: not null
- */
- @Test
- public void assertNotNullNotNull() {
- AssertTools.assertNotNull("");
- }
+ /**
+ * assertNotNull test: not null
+ */
+ @Test
+ public void assertNotNullNotNull() {
+ AssertTools.assertNotNull("");
+ }
- /**
- * assert not null: null
- */
- @Test(expected = AssertionError.class)
- public void assertNotNullNull() {
- AssertTools.assertNotNull(null);
- }
+ /**
+ * assert not null: null
+ */
+ @Test(expected = AssertionError.class)
+ public void assertNotNullNull() {
+ AssertTools.assertNotNull(null);
+ }
- /**
- * assert positive: negative
- */
- @Test(expected = AssertionError.class)
- public void assertPositiveNegative() {
- AssertTools.assertPositive(-1);
- }
+ /**
+ * assert positive: negative
+ */
+ @Test(expected = AssertionError.class)
+ public void assertPositiveNegative() {
+ AssertTools.assertPositive(-1);
+ }
- /**
- * assert positive: positive
- */
- @Test
- public void assertPositivePositive() {
- AssertTools.assertPositive(1);
- }
+ /**
+ * assert positive: positive
+ */
+ @Test
+ public void assertPositivePositive() {
+ AssertTools.assertPositive(1);
+ }
- /**
- * assert positive: zero
- */
- @Test(expected = AssertionError.class)
- public void assertPositiveZero() {
- AssertTools.assertPositive(0);
- }
+ /**
+ * assert positive: zero
+ */
+ @Test(expected = AssertionError.class)
+ public void assertPositiveZero() {
+ AssertTools.assertPositive(0);
+ }
}
Modified: trunk/cantharella.utils/src/test/java/nc/ird/module/utils/BeanLookupTest.java
===================================================================
--- trunk/cantharella.utils/src/test/java/nc/ird/module/utils/BeanLookupTest.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.utils/src/test/java/nc/ird/module/utils/BeanLookupTest.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -33,98 +33,98 @@
*/
public final class BeanLookupTest {
- /**
- * Bean for the test
- * @author acheype
- */
- public final class Bean {
+ /**
+ * Bean for the test
+ * @author acheype
+ */
+ public final class Bean {
- /** boolean */
- public boolean bool;
+ /** boolean */
+ public boolean bool;
- /** integer */
- public Integer integer;
+ /** integer */
+ public Integer integer;
- /** string */
- public String string;
+ /** string */
+ public String string;
- /**
- * integer getter
- * @return integer
- */
- public Integer getInteger() {
- return integer;
- }
+ /**
+ * integer getter
+ * @return integer
+ */
+ public Integer getInteger() {
+ return integer;
+ }
- /**
- * string getter
- * @return string
- */
- public String getString() {
- return string;
- }
+ /**
+ * string getter
+ * @return string
+ */
+ public String getString() {
+ return string;
+ }
- /**
- * bool getter
- * @return bool
- */
- public boolean isBool() {
- return bool;
- }
+ /**
+ * bool getter
+ * @return bool
+ */
+ public boolean isBool() {
+ return bool;
+ }
- /**
- * bool setter
- * @param bool bool
- */
- public void setBool(boolean bool) {
- this.bool = bool;
- }
+ /**
+ * bool setter
+ * @param bool bool
+ */
+ public void setBool(boolean bool) {
+ this.bool = bool;
+ }
- /**
- * integer setter
- * @param integer integer
- */
- public void setInteger(Integer integer) {
- this.integer = integer;
- }
+ /**
+ * integer setter
+ * @param integer integer
+ */
+ public void setInteger(Integer integer) {
+ this.integer = integer;
+ }
- /**
- * string setter
- * @param string string
- */
- public void setString(String string) {
- this.string = string;
- }
+ /**
+ * string setter
+ * @param string string
+ */
+ public void setString(String string) {
+ this.string = string;
+ }
- }
+ }
- /**
- * lookup test
- */
- @Test
- public void lookup() {
- Bean bean = new Bean();
- BeanLookup lookupGetter = new BeanLookup(bean, AccessType.GETTER);
- BeanLookup lookupField = new BeanLookup(bean, AccessType.FIELD);
- Assert.assertNull(lookupGetter.lookup("Toto"));
- Assert.assertNull(lookupField.lookup("Toto"));
- Assert.assertNull(lookupGetter.lookup("integer"));
- Assert.assertNull(lookupField.lookup("integer"));
- Assert.assertNull(lookupGetter.lookup("string"));
- Assert.assertNull(lookupField.lookup("string"));
- bean.setInteger(0);
- bean.setString("");
- bean.setBool(true);
- Assert.assertNull(lookupGetter.lookup("Toto"));
- Assert.assertNull(lookupField.lookup("Toto"));
- Assert.assertEquals(bean.getInteger().toString(), lookupGetter.lookup("integer"));
- Assert.assertEquals(bean.integer.toString(), lookupField.lookup("integer"));
- Assert.assertEquals(bean.getString(), lookupGetter.lookup("string"));
- Assert.assertEquals(bean.string, lookupField.lookup("string"));
- Assert.assertEquals(String.valueOf(bean.isBool()), lookupGetter.lookup("bool"));
- Assert.assertEquals(String.valueOf(bean.bool), lookupField.lookup("bool"));
- bean.setBool(false);
- Assert.assertEquals(String.valueOf(bean.isBool()), lookupGetter.lookup("bool"));
- Assert.assertEquals(String.valueOf(bean.bool), lookupField.lookup("bool"));
- }
+ /**
+ * lookup test
+ */
+ @Test
+ public void lookup() {
+ Bean bean = new Bean();
+ BeanLookup lookupGetter = new BeanLookup(bean, AccessType.GETTER);
+ BeanLookup lookupField = new BeanLookup(bean, AccessType.FIELD);
+ Assert.assertNull(lookupGetter.lookup("Toto"));
+ Assert.assertNull(lookupField.lookup("Toto"));
+ Assert.assertNull(lookupGetter.lookup("integer"));
+ Assert.assertNull(lookupField.lookup("integer"));
+ Assert.assertNull(lookupGetter.lookup("string"));
+ Assert.assertNull(lookupField.lookup("string"));
+ bean.setInteger(0);
+ bean.setString("");
+ bean.setBool(true);
+ Assert.assertNull(lookupGetter.lookup("Toto"));
+ Assert.assertNull(lookupField.lookup("Toto"));
+ Assert.assertEquals(bean.getInteger().toString(), lookupGetter.lookup("integer"));
+ Assert.assertEquals(bean.integer.toString(), lookupField.lookup("integer"));
+ Assert.assertEquals(bean.getString(), lookupGetter.lookup("string"));
+ Assert.assertEquals(bean.string, lookupField.lookup("string"));
+ Assert.assertEquals(String.valueOf(bean.isBool()), lookupGetter.lookup("bool"));
+ Assert.assertEquals(String.valueOf(bean.bool), lookupField.lookup("bool"));
+ bean.setBool(false);
+ Assert.assertEquals(String.valueOf(bean.isBool()), lookupGetter.lookup("bool"));
+ Assert.assertEquals(String.valueOf(bean.bool), lookupField.lookup("bool"));
+ }
}
Modified: trunk/cantharella.utils/src/test/java/nc/ird/module/utils/BeanToolsTest.java
===================================================================
--- trunk/cantharella.utils/src/test/java/nc/ird/module/utils/BeanToolsTest.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.utils/src/test/java/nc/ird/module/utils/BeanToolsTest.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -38,446 +38,446 @@
*/
public final class BeanToolsTest {
- /**
- * Bean for the test
- * @author acheype
- */
- public class Bean {
+ /**
+ * Bean for the test
+ * @author acheype
+ */
+ public class Bean {
- /** integer */
- @Resource
- public Integer integer;
+ /** integer */
+ @Resource
+ public Integer integer;
- /** string */
- public String string;
+ /** string */
+ public String string;
- /**
- * integer getter
- * @return integer
- */
- public Integer getInteger() {
- return integer;
- }
+ /**
+ * integer getter
+ * @return integer
+ */
+ public Integer getInteger() {
+ return integer;
+ }
- /**
- * string getter
- * @return string
- */
- public String getString() {
- return string;
- }
+ /**
+ * string getter
+ * @return string
+ */
+ public String getString() {
+ return string;
+ }
- /** {@inheritDoc} */
- @Override
- public int hashCode() {
- return BeanTools.hashCode(this, integer, string);
- }
+ /** {@inheritDoc} */
+ @Override
+ public int hashCode() {
+ return BeanTools.hashCode(this, integer, string);
+ }
- /**
- * integer setter
- * @param integer integer
- */
- public void setInteger(Integer integer) {
- this.integer = integer;
- }
+ /**
+ * integer setter
+ * @param integer integer
+ */
+ public void setInteger(Integer integer) {
+ this.integer = integer;
+ }
- /**
- * string setter
- * @param string string
- */
- public void setString(String string) {
- this.string = string;
- }
- }
+ /**
+ * string setter
+ * @param string string
+ */
+ public void setString(String string) {
+ this.string = string;
+ }
+ }
- /**
- * Sub-bean for the test
- * @author acheype
- */
- public final class SubBean extends Bean {
- /** integer */
- @Resource
- public Integer subInteger;
+ /**
+ * Sub-bean for the test
+ * @author acheype
+ */
+ public final class SubBean extends Bean {
+ /** integer */
+ @Resource
+ public Integer subInteger;
- /**
- * subInteger getter
- * @return subInteger
- */
- public Integer getSubInteger() {
- return subInteger;
- }
+ /**
+ * subInteger getter
+ * @return subInteger
+ */
+ public Integer getSubInteger() {
+ return subInteger;
+ }
- /**
- * subInteger setter
- * @param subInteger subInteger
- */
- public void setSubInteger(Integer subInteger) {
- this.subInteger = subInteger;
- }
- }
+ /**
+ * subInteger setter
+ * @param subInteger subInteger
+ */
+ public void setSubInteger(Integer subInteger) {
+ this.subInteger = subInteger;
+ }
+ }
- /**
- * Bean for the test
- * @author acheype
- */
- public final class SubBean2 extends Bean {
+ /**
+ * Bean for the test
+ * @author acheype
+ */
+ public final class SubBean2 extends Bean {
- /** {@inheritDoc} */
- @Override
- public int hashCode() {
- return 1;
- }
- }
+ /** {@inheritDoc} */
+ @Override
+ public int hashCode() {
+ return 1;
+ }
+ }
- /** Bean test class 1 */
- public class Bean1 {
+ /** Bean test class 1 */
+ public class Bean1 {
- /** name test 1 */
- private String name1;
+ /** name test 1 */
+ private String name1;
- /** bean test class 2 **/
- private Bean2 bean2;
+ /** bean test class 2 **/
+ private Bean2 bean2;
- /** id */
- public int id;
+ /** id */
+ public int id;
- /**
- * name1 getter
- * @return name1
- */
- public String getName1() {
- return name1;
- }
+ /**
+ * name1 getter
+ * @return name1
+ */
+ public String getName1() {
+ return name1;
+ }
- /**
- * name1 setter
- * @param name1 name1
- */
- public void setName1(String name1) {
- this.name1 = name1;
- }
+ /**
+ * name1 setter
+ * @param name1 name1
+ */
+ public void setName1(String name1) {
+ this.name1 = name1;
+ }
- /**
- * bean2 getter
- * @return bean2
- */
- public Bean2 getBean2() {
- return bean2;
- }
+ /**
+ * bean2 getter
+ * @return bean2
+ */
+ public Bean2 getBean2() {
+ return bean2;
+ }
- /**
- * bean2 setter
- * @param bean2 bean2
- */
- public void setBean2(Bean2 bean2) {
- this.bean2 = bean2;
- }
+ /**
+ * bean2 setter
+ * @param bean2 bean2
+ */
+ public void setBean2(Bean2 bean2) {
+ this.bean2 = bean2;
+ }
- /**
- * id getter
- * @return id
- */
- public int getId() {
- return id;
- }
+ /**
+ * id getter
+ * @return id
+ */
+ public int getId() {
+ return id;
+ }
- /**
- * id setter
- * @param id id
- */
- public void setId(int id) {
- this.id = id;
- }
- }
+ /**
+ * id setter
+ * @param id id
+ */
+ public void setId(int id) {
+ this.id = id;
+ }
+ }
- /** Bean test class 2 **/
- public class Bean2 {
+ /** Bean test class 2 **/
+ public class Bean2 {
- /** name test2 */
- public String name2;
+ /** name test2 */
+ public String name2;
- /**
- * name2 getter
- * @return name2
- */
- public String getName2() {
- return name2;
- }
+ /**
+ * name2 getter
+ * @return name2
+ */
+ public String getName2() {
+ return name2;
+ }
- /**
- * name2 setter
- * @param name2 name2
- */
- public void setName2(String name2) {
- this.name2 = name2;
- }
+ /**
+ * name2 setter
+ * @param name2 name2
+ */
+ public void setName2(String name2) {
+ this.name2 = name2;
+ }
- }
+ }
- /** Bean test class 2 **/
- public class Bean3 extends Bean1 {
+ /** Bean test class 2 **/
+ public class Bean3 extends Bean1 {
- /** name test2 */
- public String name2;
+ /** name test2 */
+ public String name2;
- /** id **/
- public int id;
+ /** id **/
+ public int id;
- /**
- * id getter
- * @return id
- */
- @Override
- public int getId() {
- return this.id;
- }
+ /**
+ * id getter
+ * @return id
+ */
+ @Override
+ public int getId() {
+ return this.id;
+ }
- /**
- * id setter
- * @param id id
- */
- @Override
- public void setId(int id) {
- this.id = id;
- }
+ /**
+ * id setter
+ * @param id id
+ */
+ @Override
+ public void setId(int id) {
+ this.id = id;
+ }
- /**
- * name2 getter
- * @return name2
- */
- public String getName2() {
- return name2;
- }
+ /**
+ * name2 getter
+ * @return name2
+ */
+ public String getName2() {
+ return name2;
+ }
- /**
- * name2 setter
- * @param name2 name2
- */
- public void setName2(String name2) {
- this.name2 = name2;
- }
- }
+ /**
+ * name2 setter
+ * @param name2 name2
+ */
+ public void setName2(String name2) {
+ this.name2 = name2;
+ }
+ }
- /**
- * equals test
- * @throws NoSuchFieldException -
- * @throws SecurityException -
- */
- @Test
- public void beanEquals() throws SecurityException, NoSuchFieldException {
+ /**
+ * equals test
+ * @throws NoSuchFieldException -
+ * @throws SecurityException -
+ */
+ @Test
+ public void beanEquals() throws SecurityException, NoSuchFieldException {
- Field fi = Bean.class.getField("integer");
- Field fs = Bean.class.getField("string");
+ Field fi = Bean.class.getField("integer");
+ Field fs = Bean.class.getField("string");
- Bean bean = new Bean();
- Bean1 bean1 = new Bean1();
- bean1.setId(455);
- Bean3 bean3 = new Bean3();
- bean3.setId(455);
- // Field fx = Bean1.class.getField("id");
- // Field fz = Bean3.class.getField("id");
+ Bean bean = new Bean();
+ Bean1 bean1 = new Bean1();
+ bean1.setId(455);
+ Bean3 bean3 = new Bean3();
+ bean3.setId(455);
+ // Field fx = Bean1.class.getField("id");
+ // Field fz = Bean3.class.getField("id");
- Assert.assertTrue(BeanTools.equals(bean, bean, AccessType.GETTER, "integer", "string"));
- Assert.assertTrue(BeanTools.equals(bean, bean, AccessType.FIELD, "integer", "string"));
- Assert.assertTrue(BeanTools.equals(bean, bean, fi, fs));
+ Assert.assertTrue(BeanTools.equals(bean, bean, AccessType.GETTER, "integer", "string"));
+ Assert.assertTrue(BeanTools.equals(bean, bean, AccessType.FIELD, "integer", "string"));
+ Assert.assertTrue(BeanTools.equals(bean, bean, fi, fs));
- Assert.assertFalse(BeanTools.equals(bean, null, AccessType.GETTER, "integer", "string"));
- Assert.assertFalse(BeanTools.equals(bean, null, AccessType.FIELD, "integer", "string"));
- Assert.assertFalse(BeanTools.equals(bean, null, fi, fs));
+ Assert.assertFalse(BeanTools.equals(bean, null, AccessType.GETTER, "integer", "string"));
+ Assert.assertFalse(BeanTools.equals(bean, null, AccessType.FIELD, "integer", "string"));
+ Assert.assertFalse(BeanTools.equals(bean, null, fi, fs));
- Assert.assertTrue(BeanTools.equals(bean, bean, AccessType.GETTER, "integer", "string"));
- Assert.assertTrue(BeanTools.equals(bean, bean, AccessType.FIELD, "integer", "string"));
- Assert.assertTrue(BeanTools.equals(bean, bean, fi, fs));
+ Assert.assertTrue(BeanTools.equals(bean, bean, AccessType.GETTER, "integer", "string"));
+ Assert.assertTrue(BeanTools.equals(bean, bean, AccessType.FIELD, "integer", "string"));
+ Assert.assertTrue(BeanTools.equals(bean, bean, fi, fs));
- Bean bean12 = new Bean();
+ Bean bean12 = new Bean();
- Assert.assertTrue(BeanTools.equals(bean, bean12, AccessType.GETTER, "integer", "string"));
- Assert.assertTrue(BeanTools.equals(bean, bean12, AccessType.FIELD, "integer", "string"));
- Assert.assertTrue(BeanTools.equals(bean, bean12, fi, fs));
+ Assert.assertTrue(BeanTools.equals(bean, bean12, AccessType.GETTER, "integer", "string"));
+ Assert.assertTrue(BeanTools.equals(bean, bean12, AccessType.FIELD, "integer", "string"));
+ Assert.assertTrue(BeanTools.equals(bean, bean12, fi, fs));
- Assert.assertTrue(BeanTools.equals(bean12, bean, AccessType.GETTER, "integer", "string"));
- Assert.assertTrue(BeanTools.equals(bean12, bean, AccessType.FIELD, "integer", "string"));
- Assert.assertTrue(BeanTools.equals(bean12, bean, fi, fs));
+ Assert.assertTrue(BeanTools.equals(bean12, bean, AccessType.GETTER, "integer", "string"));
+ Assert.assertTrue(BeanTools.equals(bean12, bean, AccessType.FIELD, "integer", "string"));
+ Assert.assertTrue(BeanTools.equals(bean12, bean, fi, fs));
- bean.setInteger(0);
- bean.setString("");
+ bean.setInteger(0);
+ bean.setString("");
- Assert.assertFalse(BeanTools.equals(bean, bean12, AccessType.GETTER, "integer", "string"));
- Assert.assertFalse(BeanTools.equals(bean, bean12, AccessType.FIELD, "integer", "string"));
- Assert.assertFalse(BeanTools.equals(bean, bean12, fi, fs));
+ Assert.assertFalse(BeanTools.equals(bean, bean12, AccessType.GETTER, "integer", "string"));
+ Assert.assertFalse(BeanTools.equals(bean, bean12, AccessType.FIELD, "integer", "string"));
+ Assert.assertFalse(BeanTools.equals(bean, bean12, fi, fs));
- Assert.assertFalse(BeanTools.equals(bean12, bean, AccessType.GETTER, "integer", "string"));
- Assert.assertFalse(BeanTools.equals(bean12, bean, AccessType.FIELD, "integer", "string"));
- Assert.assertFalse(BeanTools.equals(bean12, bean, fi, fs));
+ Assert.assertFalse(BeanTools.equals(bean12, bean, AccessType.GETTER, "integer", "string"));
+ Assert.assertFalse(BeanTools.equals(bean12, bean, AccessType.FIELD, "integer", "string"));
+ Assert.assertFalse(BeanTools.equals(bean12, bean, fi, fs));
- bean12.setInteger(0);
- bean12.setString("");
+ bean12.setInteger(0);
+ bean12.setString("");
- Assert.assertTrue(BeanTools.equals(bean, bean12, AccessType.GETTER, "integer", "string"));
- Assert.assertTrue(BeanTools.equals(bean, bean12, AccessType.FIELD, "integer", "string"));
- Assert.assertTrue(BeanTools.equals(bean, bean12, fi, fs));
+ Assert.assertTrue(BeanTools.equals(bean, bean12, AccessType.GETTER, "integer", "string"));
+ Assert.assertTrue(BeanTools.equals(bean, bean12, AccessType.FIELD, "integer", "string"));
+ Assert.assertTrue(BeanTools.equals(bean, bean12, fi, fs));
- Assert.assertTrue(BeanTools.equals(bean12, bean, AccessType.GETTER, "integer", "string"));
- Assert.assertTrue(BeanTools.equals(bean12, bean, AccessType.FIELD, "integer", "string"));
- Assert.assertTrue(BeanTools.equals(bean12, bean, fi, fs));
+ Assert.assertTrue(BeanTools.equals(bean12, bean, AccessType.GETTER, "integer", "string"));
+ Assert.assertTrue(BeanTools.equals(bean12, bean, AccessType.FIELD, "integer", "string"));
+ Assert.assertTrue(BeanTools.equals(bean12, bean, fi, fs));
- bean12.setInteger(1);
+ bean12.setInteger(1);
- Assert.assertFalse(BeanTools.equals(bean, bean12, AccessType.GETTER, "integer", "string"));
- Assert.assertFalse(BeanTools.equals(bean, bean12, AccessType.FIELD, "integer", "string"));
- Assert.assertFalse(BeanTools.equals(bean, bean12, fi, fs));
+ Assert.assertFalse(BeanTools.equals(bean, bean12, AccessType.GETTER, "integer", "string"));
+ Assert.assertFalse(BeanTools.equals(bean, bean12, AccessType.FIELD, "integer", "string"));
+ Assert.assertFalse(BeanTools.equals(bean, bean12, fi, fs));
- Assert.assertFalse(BeanTools.equals(bean12, bean, AccessType.GETTER, "integer", "string"));
- Assert.assertFalse(BeanTools.equals(bean12, bean, AccessType.FIELD, "integer", "string"));
- Assert.assertFalse(BeanTools.equals(bean12, bean, fi, fs));
+ Assert.assertFalse(BeanTools.equals(bean12, bean, AccessType.GETTER, "integer", "string"));
+ Assert.assertFalse(BeanTools.equals(bean12, bean, AccessType.FIELD, "integer", "string"));
+ Assert.assertFalse(BeanTools.equals(bean12, bean, fi, fs));
- bean12.setString("Toto");
+ bean12.setString("Toto");
- Assert.assertFalse(BeanTools.equals(bean, bean12, AccessType.GETTER, "integer", "string"));
- Assert.assertFalse(BeanTools.equals(bean, bean12, AccessType.FIELD, "integer", "string"));
- Assert.assertFalse(BeanTools.equals(bean, bean12, fi, fs));
+ Assert.assertFalse(BeanTools.equals(bean, bean12, AccessType.GETTER, "integer", "string"));
+ Assert.assertFalse(BeanTools.equals(bean, bean12, AccessType.FIELD, "integer", "string"));
+ Assert.assertFalse(BeanTools.equals(bean, bean12, fi, fs));
- Assert.assertFalse(BeanTools.equals(bean12, bean, AccessType.GETTER, "integer", "string"));
- Assert.assertFalse(BeanTools.equals(bean12, bean, AccessType.FIELD, "integer", "string"));
- Assert.assertFalse(BeanTools.equals(bean12, bean, fi, fs));
+ Assert.assertFalse(BeanTools.equals(bean12, bean, AccessType.GETTER, "integer", "string"));
+ Assert.assertFalse(BeanTools.equals(bean12, bean, AccessType.FIELD, "integer", "string"));
+ Assert.assertFalse(BeanTools.equals(bean12, bean, fi, fs));
- bean12.setInteger(0);
+ bean12.setInteger(0);
- Assert.assertFalse(BeanTools.equals(bean, bean12, AccessType.GETTER, "integer", "string"));
- Assert.assertFalse(BeanTools.equals(bean, bean12, AccessType.FIELD, "integer", "string"));
- Assert.assertFalse(BeanTools.equals(bean, bean12, fi, fs));
+ Assert.assertFalse(BeanTools.equals(bean, bean12, AccessType.GETTER, "integer", "string"));
+ Assert.assertFalse(BeanTools.equals(bean, bean12, AccessType.FIELD, "integer", "string"));
+ Assert.assertFalse(BeanTools.equals(bean, bean12, fi, fs));
- Assert.assertFalse(BeanTools.equals(bean12, bean, AccessType.GETTER, "integer", "string"));
- Assert.assertFalse(BeanTools.equals(bean12, bean, AccessType.FIELD, "integer", "string"));
- Assert.assertFalse(BeanTools.equals(bean12, bean, fi, fs));
+ Assert.assertFalse(BeanTools.equals(bean12, bean, AccessType.GETTER, "integer", "string"));
+ Assert.assertFalse(BeanTools.equals(bean12, bean, AccessType.FIELD, "integer", "string"));
+ Assert.assertFalse(BeanTools.equals(bean12, bean, fi, fs));
- Assert.assertTrue(BeanTools.equals(bean1, bean3, AccessType.GETTER, "id"));
- Assert.assertTrue(BeanTools.equals(bean1, bean3, AccessType.FIELD, "id"));
- }
+ Assert.assertTrue(BeanTools.equals(bean1, bean3, AccessType.GETTER, "id"));
+ Assert.assertTrue(BeanTools.equals(bean1, bean3, AccessType.FIELD, "id"));
+ }
- /**
- * hashCode test
- * @throws NoSuchFieldException -
- * @throws SecurityException -
- */
- @Test
- public void beanHashCode() throws SecurityException, NoSuchFieldException {
- Field fi = Bean.class.getField("integer");
- Field fs = Bean.class.getField("string");
- Bean bean1 = new Bean();
- Bean bean2 = new Bean();
- Assert.assertTrue(bean1.hashCode() == bean2.hashCode());
- Assert.assertTrue(BeanTools.hashCode(bean1, fi, fs) == BeanTools.hashCode(bean2, fi, fs));
- bean1.setInteger(0);
- bean1.setString("");
- Assert.assertFalse(bean1.hashCode() == bean2.hashCode());
- Assert.assertFalse(BeanTools.hashCode(bean1, fi, fs) == BeanTools.hashCode(bean2, fi, fs));
- bean2.setInteger(0);
- bean2.setString("");
- Assert.assertTrue(bean1.hashCode() == bean2.hashCode());
- Assert.assertTrue(BeanTools.hashCode(bean1, fi, fs) == BeanTools.hashCode(bean2, fi, fs));
- bean2.setInteger(1);
- Assert.assertFalse(bean1.hashCode() == bean2.hashCode());
- Assert.assertFalse(BeanTools.hashCode(bean1, fi, fs) == BeanTools.hashCode(bean2, fi, fs));
- bean2.setString("Toto");
- Assert.assertFalse(bean1.hashCode() == bean2.hashCode());
- Assert.assertFalse(BeanTools.hashCode(bean1, fi, fs) == BeanTools.hashCode(bean2, fi, fs));
- bean2.setInteger(0);
- Assert.assertFalse(bean1.hashCode() == bean2.hashCode());
- Assert.assertFalse(BeanTools.hashCode(bean1, fi, fs) == BeanTools.hashCode(bean2, fi, fs));
- }
+ /**
+ * hashCode test
+ * @throws NoSuchFieldException -
+ * @throws SecurityException -
+ */
+ @Test
+ public void beanHashCode() throws SecurityException, NoSuchFieldException {
+ Field fi = Bean.class.getField("integer");
+ Field fs = Bean.class.getField("string");
+ Bean bean1 = new Bean();
+ Bean bean2 = new Bean();
+ Assert.assertTrue(bean1.hashCode() == bean2.hashCode());
+ Assert.assertTrue(BeanTools.hashCode(bean1, fi, fs) == BeanTools.hashCode(bean2, fi, fs));
+ bean1.setInteger(0);
+ bean1.setString("");
+ Assert.assertFalse(bean1.hashCode() == bean2.hashCode());
+ Assert.assertFalse(BeanTools.hashCode(bean1, fi, fs) == BeanTools.hashCode(bean2, fi, fs));
+ bean2.setInteger(0);
+ bean2.setString("");
+ Assert.assertTrue(bean1.hashCode() == bean2.hashCode());
+ Assert.assertTrue(BeanTools.hashCode(bean1, fi, fs) == BeanTools.hashCode(bean2, fi, fs));
+ bean2.setInteger(1);
+ Assert.assertFalse(bean1.hashCode() == bean2.hashCode());
+ Assert.assertFalse(BeanTools.hashCode(bean1, fi, fs) == BeanTools.hashCode(bean2, fi, fs));
+ bean2.setString("Toto");
+ Assert.assertFalse(bean1.hashCode() == bean2.hashCode());
+ Assert.assertFalse(BeanTools.hashCode(bean1, fi, fs) == BeanTools.hashCode(bean2, fi, fs));
+ bean2.setInteger(0);
+ Assert.assertFalse(bean1.hashCode() == bean2.hashCode());
+ Assert.assertFalse(BeanTools.hashCode(bean1, fi, fs) == BeanTools.hashCode(bean2, fi, fs));
+ }
- /**
- * toString test
- */
- @Test
- public void beanToString() {
- SubBean bean = new SubBean();
- Assert.assertEquals(SubBean.class.getName() + "\n- integer: <null>\n- string: <null>\n- subInteger: <null>",
- BeanTools.toString(bean, AccessType.GETTER, "integer", "string", "subInteger"));
- Assert.assertEquals(SubBean.class.getName() + "\n- integer: <null>\n- string: <null>\n- subInteger: <null>",
- BeanTools.toString(bean, AccessType.FIELD, "integer", "string", "subInteger"));
- bean.setInteger(0);
- Assert.assertEquals(SubBean.class.getName() + "\n- integer: 0\n- string: <null>\n- subInteger: <null>",
- BeanTools.toString(bean, AccessType.GETTER, "integer", "string", "subInteger"));
- Assert.assertEquals(SubBean.class.getName() + "\n- integer: 0\n- string: <null>\n- subInteger: <null>",
- BeanTools.toString(bean, AccessType.FIELD, "integer", "string", "subInteger"));
- bean.setString("");
- Assert.assertEquals(SubBean.class.getName() + "\n- integer: 0\n- string: \n- subInteger: <null>", BeanTools
- .toString(bean, AccessType.GETTER, "integer", "string", "subInteger"));
- Assert.assertEquals(SubBean.class.getName() + "\n- integer: 0\n- string: \n- subInteger: <null>", BeanTools
- .toString(bean, AccessType.FIELD, "integer", "string", "subInteger"));
- bean.setString("Toto");
- Assert.assertEquals(SubBean.class.getName() + "\n- integer: 0\n- string: Toto\n- subInteger: <null>", BeanTools
- .toString(bean, AccessType.GETTER, "integer", "string", "subInteger"));
- Assert.assertEquals(SubBean.class.getName() + "\n- integer: 0\n- string: Toto\n- subInteger: <null>", BeanTools
- .toString(bean, AccessType.FIELD, "integer", "string", "subInteger"));
- }
+ /**
+ * toString test
+ */
+ @Test
+ public void beanToString() {
+ SubBean bean = new SubBean();
+ Assert.assertEquals(SubBean.class.getName() + "\n- integer: <null>\n- string: <null>\n- subInteger: <null>",
+ BeanTools.toString(bean, AccessType.GETTER, "integer", "string", "subInteger"));
+ Assert.assertEquals(SubBean.class.getName() + "\n- integer: <null>\n- string: <null>\n- subInteger: <null>",
+ BeanTools.toString(bean, AccessType.FIELD, "integer", "string", "subInteger"));
+ bean.setInteger(0);
+ Assert.assertEquals(SubBean.class.getName() + "\n- integer: 0\n- string: <null>\n- subInteger: <null>",
+ BeanTools.toString(bean, AccessType.GETTER, "integer", "string", "subInteger"));
+ Assert.assertEquals(SubBean.class.getName() + "\n- integer: 0\n- string: <null>\n- subInteger: <null>",
+ BeanTools.toString(bean, AccessType.FIELD, "integer", "string", "subInteger"));
+ bean.setString("");
+ Assert.assertEquals(SubBean.class.getName() + "\n- integer: 0\n- string: \n- subInteger: <null>", BeanTools
+ .toString(bean, AccessType.GETTER, "integer", "string", "subInteger"));
+ Assert.assertEquals(SubBean.class.getName() + "\n- integer: 0\n- string: \n- subInteger: <null>", BeanTools
+ .toString(bean, AccessType.FIELD, "integer", "string", "subInteger"));
+ bean.setString("Toto");
+ Assert.assertEquals(SubBean.class.getName() + "\n- integer: 0\n- string: Toto\n- subInteger: <null>", BeanTools
+ .toString(bean, AccessType.GETTER, "integer", "string", "subInteger"));
+ Assert.assertEquals(SubBean.class.getName() + "\n- integer: 0\n- string: Toto\n- subInteger: <null>", BeanTools
+ .toString(bean, AccessType.FIELD, "integer", "string", "subInteger"));
+ }
- /**
- * getAnnotatedField test KO
- * @throws SecurityException -
- * @throws NullPointerException -
- * @throws NoSuchFieldException -
- */
- @SuppressWarnings("unchecked")
- @Test(expected = NoSuchFieldException.class)
- public void getAnnotatedPublicFieldKO() throws SecurityException, NullPointerException, NoSuchFieldException {
- BeanTools.getAnnotatedPublicField(new Bean(), Deprecated.class);
- }
+ /**
+ * getAnnotatedField test KO
+ * @throws SecurityException -
+ * @throws NullPointerException -
+ * @throws NoSuchFieldException -
+ */
+ @SuppressWarnings("unchecked")
+ @Test(expected = NoSuchFieldException.class)
+ public void getAnnotatedPublicFieldKO() throws SecurityException, NullPointerException, NoSuchFieldException {
+ BeanTools.getAnnotatedPublicField(new Bean(), Deprecated.class);
+ }
- /**
- * getAnnotatedField test OK
- * @throws SecurityException -
- * @throws NullPointerException -
- * @throws NoSuchFieldException -
- */
- @SuppressWarnings("unchecked")
- @Test
- public void getAnnotatedPublicFieldOK() throws SecurityException, NullPointerException, NoSuchFieldException {
- Field f = Bean.class.getField("integer");
- Assert.assertEquals(f, BeanTools.getAnnotatedPublicField(new Bean(), Resource.class));
- }
+ /**
+ * getAnnotatedField test OK
+ * @throws SecurityException -
+ * @throws NullPointerException -
+ * @throws NoSuchFieldException -
+ */
+ @SuppressWarnings("unchecked")
+ @Test
+ public void getAnnotatedPublicFieldOK() throws SecurityException, NullPointerException, NoSuchFieldException {
+ Field f = Bean.class.getField("integer");
+ Assert.assertEquals(f, BeanTools.getAnnotatedPublicField(new Bean(), Resource.class));
+ }
- /**
- * isAnnotationOnProperty test
- * @throws SecurityException -
- * @throws NullPointerException -
- * @throws NoSuchFieldException -
- */
- @Test
- public void isAnnotationOnProperty() throws SecurityException, NullPointerException, NoSuchFieldException {
- Assert.assertTrue(BeanTools.isAnnotationOnProperty(SubBean.class, Resource.class, "subInteger"));
- Assert.assertTrue(BeanTools.isAnnotationOnProperty(SubBean.class, Resource.class, "integer"));
- Assert.assertFalse(BeanTools.isAnnotationOnProperty(SubBean.class, Resource.class, "string"));
- }
+ /**
+ * isAnnotationOnProperty test
+ * @throws SecurityException -
+ * @throws NullPointerException -
+ * @throws NoSuchFieldException -
+ */
+ @Test
+ public void isAnnotationOnProperty() throws SecurityException, NullPointerException, NoSuchFieldException {
+ Assert.assertTrue(BeanTools.isAnnotationOnProperty(SubBean.class, Resource.class, "subInteger"));
+ Assert.assertTrue(BeanTools.isAnnotationOnProperty(SubBean.class, Resource.class, "integer"));
+ Assert.assertFalse(BeanTools.isAnnotationOnProperty(SubBean.class, Resource.class, "string"));
+ }
- /**
- * isAnnotationOnProperty fail test
- * @throws SecurityException -
- * @throws NullPointerException -
- * @throws NoSuchFieldException -
- */
- @Test(expected = NoSuchFieldException.class)
- public void isAnnotationOnPropertyError() throws SecurityException, NullPointerException, NoSuchFieldException {
- BeanTools.isAnnotationOnProperty(SubBean.class, Resource.class, "toto");
- }
+ /**
+ * isAnnotationOnProperty fail test
+ * @throws SecurityException -
+ * @throws NullPointerException -
+ * @throws NoSuchFieldException -
+ */
+ @Test(expected = NoSuchFieldException.class)
+ public void isAnnotationOnPropertyError() throws SecurityException, NullPointerException, NoSuchFieldException {
+ BeanTools.isAnnotationOnProperty(SubBean.class, Resource.class, "toto");
+ }
- /**
- * getValueFromPath Test
- */
- @Test(expected = IllegalArgumentException.class)
- public void getValueFromPath() {
- Bean1 b1 = new Bean1();
- Bean2 b2 = new Bean2();
+ /**
+ * getValueFromPath Test
+ */
+ @Test(expected = IllegalArgumentException.class)
+ public void getValueFromPath() {
+ Bean1 b1 = new Bean1();
+ Bean2 b2 = new Bean2();
- b1.setName1("name1");
- b2.setName2("name2");
- b1.setBean2(b2);
+ b1.setName1("name1");
+ b2.setName2("name2");
+ b1.setBean2(b2);
- Assert.assertSame(b1.getName1(), BeanTools.getValueFromPath(b1, AccessType.GETTER, "name1"));
- Assert.assertSame(b1.getBean2().getName2(), BeanTools.getValueFromPath(b1, AccessType.GETTER, "bean2.name2"));
- BeanTools.getValueFromPath(b1, AccessType.FIELD, "bean2.nameX");
- }
+ Assert.assertSame(b1.getName1(), BeanTools.getValueFromPath(b1, AccessType.GETTER, "name1"));
+ Assert.assertSame(b1.getBean2().getName2(), BeanTools.getValueFromPath(b1, AccessType.GETTER, "bean2.name2"));
+ BeanTools.getValueFromPath(b1, AccessType.FIELD, "bean2.nameX");
+ }
}
Modified: trunk/cantharella.utils/src/test/java/nc/ird/module/utils/CaptchaToolsTest.java
===================================================================
--- trunk/cantharella.utils/src/test/java/nc/ird/module/utils/CaptchaToolsTest.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.utils/src/test/java/nc/ird/module/utils/CaptchaToolsTest.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -32,19 +32,19 @@
*/
public final class CaptchaToolsTest {
- /**
- * random test
- */
- @Test
- public void random() {
- String captcha1 = CaptchaTools.random();
- Assert.assertNotNull(captcha1);
- Assert.assertTrue(captcha1.length() >= CaptchaTools.CAPTCHA_LENGTH_MIN);
- Assert.assertTrue(captcha1.length() <= CaptchaTools.CAPTCHA_LENGTH_MAX);
- String captcha2 = CaptchaTools.random();
- Assert.assertNotNull(captcha2);
- Assert.assertTrue(captcha2.length() >= CaptchaTools.CAPTCHA_LENGTH_MIN);
- Assert.assertTrue(captcha2.length() <= CaptchaTools.CAPTCHA_LENGTH_MAX);
- Assert.assertTrue(!captcha1.equals(captcha2));
- }
+ /**
+ * random test
+ */
+ @Test
+ public void random() {
+ String captcha1 = CaptchaTools.random();
+ Assert.assertNotNull(captcha1);
+ Assert.assertTrue(captcha1.length() >= CaptchaTools.CAPTCHA_LENGTH_MIN);
+ Assert.assertTrue(captcha1.length() <= CaptchaTools.CAPTCHA_LENGTH_MAX);
+ String captcha2 = CaptchaTools.random();
+ Assert.assertNotNull(captcha2);
+ Assert.assertTrue(captcha2.length() >= CaptchaTools.CAPTCHA_LENGTH_MIN);
+ Assert.assertTrue(captcha2.length() <= CaptchaTools.CAPTCHA_LENGTH_MAX);
+ Assert.assertTrue(!captcha1.equals(captcha2));
+ }
}
\ No newline at end of file
Modified: trunk/cantharella.utils/src/test/java/nc/ird/module/utils/CollectionToolsTest.java
===================================================================
--- trunk/cantharella.utils/src/test/java/nc/ird/module/utils/CollectionToolsTest.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.utils/src/test/java/nc/ird/module/utils/CollectionToolsTest.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -45,204 +45,204 @@
*/
public final class CollectionToolsTest {
- /** beans collection for tests */
- public AbstractList<Bean1> beansCol = new ArrayList<Bean1>();
+ /** beans collection for tests */
+ public AbstractList<Bean1> beansCol = new ArrayList<Bean1>();
- /**
- * Constructor
- */
- public CollectionToolsTest() {
- init();
- }
+ /**
+ * Constructor
+ */
+ public CollectionToolsTest() {
+ init();
+ }
- /**
- * initialisation of tests
- */
- private void init() {
- BeanToolsTest beanTest = new BeanToolsTest();
+ /**
+ * initialisation of tests
+ */
+ private void init() {
+ BeanToolsTest beanTest = new BeanToolsTest();
- Bean1 b1 = beanTest.new Bean1();
- Bean2 b12 = beanTest.new Bean2();
- b12.setName2("name12");
- b1.setName1("name");
- b1.setBean2(b12);
+ Bean1 b1 = beanTest.new Bean1();
+ Bean2 b12 = beanTest.new Bean2();
+ b12.setName2("name12");
+ b1.setName1("name");
+ b1.setBean2(b12);
- Bean1 b2 = beanTest.new Bean1();
- Bean2 b22 = beanTest.new Bean2();
- b22.setName2("name22");
- b2.setName1("name");
- b2.setBean2(b22);
+ Bean1 b2 = beanTest.new Bean1();
+ Bean2 b22 = beanTest.new Bean2();
+ b22.setName2("name22");
+ b2.setName1("name");
+ b2.setBean2(b22);
- Bean1 b3 = beanTest.new Bean1();
- Bean2 b32 = beanTest.new Bean2();
- b32.setName2(null);
- b3.setName1("name");
- b3.setBean2(b32);
+ Bean1 b3 = beanTest.new Bean1();
+ Bean2 b32 = beanTest.new Bean2();
+ b32.setName2(null);
+ b3.setName1("name");
+ b3.setBean2(b32);
- beansCol.add(b1);
- beansCol.add(b2);
- beansCol.add(b3);
- }
+ beansCol.add(b1);
+ beansCol.add(b2);
+ beansCol.add(b3);
+ }
- /**
- * containsOnlyValue test
- */
- @Test
- public void containsOnlyValue() {
- Collection<String> col1 = new ArrayList<String>(Arrays.asList(new String[] { "fff", "fff" }));
- Collection<String> col2 = new ArrayList<String>();
- Collection<String> col3 = new ArrayList<String>(Arrays.asList(new String[] { "ab", "fff" }));
- Collection<String> col4 = new ArrayList<String>(Arrays.asList(new String[] { null, null }));
- Collection<String> col5 = new ArrayList<String>(Arrays.asList(new String[] { null, "fff" }));
- Collection<String> col6 = new ArrayList<String>(Arrays.asList(new String[] { "fff" }));
- Collection<Integer> col7 = new ArrayList<Integer>(Arrays.asList(new Integer[] { 5, 5, 5, 5, 5 }));
+ /**
+ * containsOnlyValue test
+ */
+ @Test
+ public void containsOnlyValue() {
+ Collection<String> col1 = new ArrayList<String>(Arrays.asList(new String[] { "fff", "fff" }));
+ Collection<String> col2 = new ArrayList<String>();
+ Collection<String> col3 = new ArrayList<String>(Arrays.asList(new String[] { "ab", "fff" }));
+ Collection<String> col4 = new ArrayList<String>(Arrays.asList(new String[] { null, null }));
+ Collection<String> col5 = new ArrayList<String>(Arrays.asList(new String[] { null, "fff" }));
+ Collection<String> col6 = new ArrayList<String>(Arrays.asList(new String[] { "fff" }));
+ Collection<Integer> col7 = new ArrayList<Integer>(Arrays.asList(new Integer[] { 5, 5, 5, 5, 5 }));
- Assert.assertTrue(CollectionTools.containsOnlySameValue(col1, "fff"));
- Assert.assertFalse(CollectionTools.containsOnlySameValue(col2, ""));
- Assert.assertFalse(CollectionTools.containsOnlySameValue(col3, "fff"));
- Assert.assertTrue(CollectionTools.containsOnlySameValue(col4, null));
- Assert.assertFalse(CollectionTools.containsOnlySameValue(col5, null));
- Assert.assertTrue(CollectionTools.containsOnlySameValue(col6, "fff"));
- Assert.assertTrue(CollectionTools.containsOnlySameValue(col7, 5));
- }
+ Assert.assertTrue(CollectionTools.containsOnlySameValue(col1, "fff"));
+ Assert.assertFalse(CollectionTools.containsOnlySameValue(col2, ""));
+ Assert.assertFalse(CollectionTools.containsOnlySameValue(col3, "fff"));
+ Assert.assertTrue(CollectionTools.containsOnlySameValue(col4, null));
+ Assert.assertFalse(CollectionTools.containsOnlySameValue(col5, null));
+ Assert.assertTrue(CollectionTools.containsOnlySameValue(col6, "fff"));
+ Assert.assertTrue(CollectionTools.containsOnlySameValue(col7, 5));
+ }
- /**
- * Intersect test
- */
- @Test
- public void intersect() {
- Set<Integer> s1 = new HashSet<Integer>();
- Set<Integer> s2 = new HashSet<Integer>();
- Assert.assertTrue(CollectionTools.intersect(null, null).isEmpty());
- Assert.assertTrue(CollectionTools.intersect(s1, null).isEmpty());
- Assert.assertTrue(CollectionTools.intersect(null, s2).isEmpty());
- Assert.assertTrue(CollectionTools.intersect(s1, s2).isEmpty());
- s1.add(Integer.valueOf(0));
- Assert.assertTrue(CollectionTools.intersect(s1, s2).isEmpty());
- s2.add(Integer.valueOf(1));
- Assert.assertTrue(CollectionTools.intersect(s1, s2).isEmpty());
- s1.add(Integer.valueOf(2));
- s2.add(Integer.valueOf(2));
- Set<Integer> intersect = CollectionTools.intersect(s1, s2);
- Assert.assertEquals(1, intersect.size());
- Assert.assertTrue(intersect.contains(Integer.valueOf(2)));
- s1.add(Integer.valueOf(3));
- s2.add(Integer.valueOf(3));
- intersect = CollectionTools.intersect(s1, s2);
- Assert.assertEquals(2, intersect.size());
- Assert.assertTrue(intersect.contains(Integer.valueOf(2)));
- Assert.assertTrue(intersect.contains(Integer.valueOf(3)));
- intersect = CollectionTools.intersect(s2, s1);
- Assert.assertEquals(2, intersect.size());
- Assert.assertTrue(intersect.contains(Integer.valueOf(2)));
- Assert.assertTrue(intersect.contains(Integer.valueOf(3)));
- }
+ /**
+ * Intersect test
+ */
+ @Test
+ public void intersect() {
+ Set<Integer> s1 = new HashSet<Integer>();
+ Set<Integer> s2 = new HashSet<Integer>();
+ Assert.assertTrue(CollectionTools.intersect(null, null).isEmpty());
+ Assert.assertTrue(CollectionTools.intersect(s1, null).isEmpty());
+ Assert.assertTrue(CollectionTools.intersect(null, s2).isEmpty());
+ Assert.assertTrue(CollectionTools.intersect(s1, s2).isEmpty());
+ s1.add(Integer.valueOf(0));
+ Assert.assertTrue(CollectionTools.intersect(s1, s2).isEmpty());
+ s2.add(Integer.valueOf(1));
+ Assert.assertTrue(CollectionTools.intersect(s1, s2).isEmpty());
+ s1.add(Integer.valueOf(2));
+ s2.add(Integer.valueOf(2));
+ Set<Integer> intersect = CollectionTools.intersect(s1, s2);
+ Assert.assertEquals(1, intersect.size());
+ Assert.assertTrue(intersect.contains(Integer.valueOf(2)));
+ s1.add(Integer.valueOf(3));
+ s2.add(Integer.valueOf(3));
+ intersect = CollectionTools.intersect(s1, s2);
+ Assert.assertEquals(2, intersect.size());
+ Assert.assertTrue(intersect.contains(Integer.valueOf(2)));
+ Assert.assertTrue(intersect.contains(Integer.valueOf(3)));
+ intersect = CollectionTools.intersect(s2, s1);
+ Assert.assertEquals(2, intersect.size());
+ Assert.assertTrue(intersect.contains(Integer.valueOf(2)));
+ Assert.assertTrue(intersect.contains(Integer.valueOf(3)));
+ }
- /**
- * setter test
- */
- @Test
- public void setter() {
- Collection<Integer> toWrite = new ArrayList<Integer>();
- Collection<Integer> toRead = null;
- toWrite.add(0);
- CollectionTools.setter(toWrite, toRead);
- Assert.assertTrue(toWrite.isEmpty());
- toWrite.add(0);
- toRead = new ArrayList<Integer>();
- CollectionTools.setter(toWrite, toRead);
- Assert.assertTrue(toWrite.isEmpty());
- toWrite.add(0);
- toRead.add(1);
- CollectionTools.setter(toWrite, toRead);
- Assert.assertArrayEquals(toRead.toArray(), toWrite.toArray());
- }
+ /**
+ * setter test
+ */
+ @Test
+ public void setter() {
+ Collection<Integer> toWrite = new ArrayList<Integer>();
+ Collection<Integer> toRead = null;
+ toWrite.add(0);
+ CollectionTools.setter(toWrite, toRead);
+ Assert.assertTrue(toWrite.isEmpty());
+ toWrite.add(0);
+ toRead = new ArrayList<Integer>();
+ CollectionTools.setter(toWrite, toRead);
+ Assert.assertTrue(toWrite.isEmpty());
+ toWrite.add(0);
+ toRead.add(1);
+ CollectionTools.setter(toWrite, toRead);
+ Assert.assertArrayEquals(toRead.toArray(), toWrite.toArray());
+ }
- /**
- * toStringComparatorTest
- */
- @Test
- public void toStringComparator() {
- List<String> list = new ArrayList<String>();
- list.add("t");
- list.add(null);
- list.add("");
- list.add("z");
- list.add("b");
- list.add(" ");
- Collections.sort(list, StringTools.createStringComparator());
- Assert.assertArrayEquals(list.toArray(new String[0]), new String[] { null, "", " ", "b", "t", "z" });
- }
+ /**
+ * toStringComparatorTest
+ */
+ @Test
+ public void toStringComparator() {
+ List<String> list = new ArrayList<String>();
+ list.add("t");
+ list.add(null);
+ list.add("");
+ list.add("z");
+ list.add("b");
+ list.add(" ");
+ Collections.sort(list, StringTools.createStringComparator());
+ Assert.assertArrayEquals(list.toArray(new String[0]), new String[] { null, "", " ", "b", "t", "z" });
+ }
- /**
- * containsFieldWithValue tests
- */
- @Test
- public void containsFieldWithValue() {
- Assert.assertTrue(CollectionTools.containsWithValue(beansCol, "name1", AccessType.GETTER, "name"));
- Assert.assertTrue(CollectionTools.containsWithValue(beansCol, "bean2.name2", AccessType.GETTER, "name12"));
- Assert.assertTrue(CollectionTools.containsWithValue(beansCol, "bean2.name2", AccessType.GETTER, "name22"));
- Assert.assertFalse(CollectionTools.containsWithValue(beansCol, "name1", AccessType.GETTER, "XXX"));
- }
+ /**
+ * containsFieldWithValue tests
+ */
+ @Test
+ public void containsFieldWithValue() {
+ Assert.assertTrue(CollectionTools.containsWithValue(beansCol, "name1", AccessType.GETTER, "name"));
+ Assert.assertTrue(CollectionTools.containsWithValue(beansCol, "bean2.name2", AccessType.GETTER, "name12"));
+ Assert.assertTrue(CollectionTools.containsWithValue(beansCol, "bean2.name2", AccessType.GETTER, "name22"));
+ Assert.assertFalse(CollectionTools.containsWithValue(beansCol, "name1", AccessType.GETTER, "XXX"));
+ }
- /**
- * containsFieldWithValue tests
- */
- @Test
- public void countFieldWithValue() {
- Assert.assertSame(CollectionTools.countWithValue(beansCol, "name1", AccessType.GETTER, "name"), 3);
- Assert.assertSame(CollectionTools.countWithValue(beansCol, "bean2.name2", AccessType.GETTER, "name12"), 1);
- Assert.assertSame(CollectionTools.countWithValue(beansCol, "bean2.name2", AccessType.GETTER, "name22"), 1);
- Assert.assertSame(CollectionTools.countWithValue(beansCol, "name1", AccessType.GETTER, "XXX"), 0);
- }
+ /**
+ * containsFieldWithValue tests
+ */
+ @Test
+ public void countFieldWithValue() {
+ Assert.assertSame(CollectionTools.countWithValue(beansCol, "name1", AccessType.GETTER, "name"), 3);
+ Assert.assertSame(CollectionTools.countWithValue(beansCol, "bean2.name2", AccessType.GETTER, "name12"), 1);
+ Assert.assertSame(CollectionTools.countWithValue(beansCol, "bean2.name2", AccessType.GETTER, "name22"), 1);
+ Assert.assertSame(CollectionTools.countWithValue(beansCol, "name1", AccessType.GETTER, "XXX"), 0);
+ }
- /**
- * removeWithValue tests
- */
- @Test
- public void removeWithValue() {
- Assert.assertTrue(CollectionTools.removeWithValue(beansCol, "name1", AccessType.GETTER, "name"));
- Assert.assertSame(beansCol.size(), 0);
- beansCol.clear();
- init();
+ /**
+ * removeWithValue tests
+ */
+ @Test
+ public void removeWithValue() {
+ Assert.assertTrue(CollectionTools.removeWithValue(beansCol, "name1", AccessType.GETTER, "name"));
+ Assert.assertSame(beansCol.size(), 0);
+ beansCol.clear();
+ init();
- Assert.assertTrue(CollectionTools.removeWithValue(beansCol, "bean2.name2", AccessType.GETTER, "name12"));
- Assert.assertSame(beansCol.size(), 2);
- beansCol.clear();
- init();
+ Assert.assertTrue(CollectionTools.removeWithValue(beansCol, "bean2.name2", AccessType.GETTER, "name12"));
+ Assert.assertSame(beansCol.size(), 2);
+ beansCol.clear();
+ init();
- Assert.assertFalse(CollectionTools.removeWithValue(beansCol, "name1", AccessType.GETTER, "XXX"));
- }
+ Assert.assertFalse(CollectionTools.removeWithValue(beansCol, "name1", AccessType.GETTER, "XXX"));
+ }
- /**
- * removeWithValue tests
- */
- @Test
- public void removeAllWithValue() {
- Assert.assertTrue(CollectionTools.removeAllWithValue(beansCol, "name1", AccessType.GETTER, Arrays
- .asList(new String[] { "name" })));
- Assert.assertSame(beansCol.size(), 0);
- beansCol.clear();
- init();
+ /**
+ * removeWithValue tests
+ */
+ @Test
+ public void removeAllWithValue() {
+ Assert.assertTrue(CollectionTools.removeAllWithValue(beansCol, "name1", AccessType.GETTER, Arrays
+ .asList(new String[] { "name" })));
+ Assert.assertSame(beansCol.size(), 0);
+ beansCol.clear();
+ init();
- Assert.assertTrue(CollectionTools.removeAllWithValue(beansCol, "bean2.name2", AccessType.GETTER, Arrays
- .asList(new String[] { "name12", "name22" })));
- Assert.assertSame(beansCol.size(), 1);
- beansCol.clear();
- init();
+ Assert.assertTrue(CollectionTools.removeAllWithValue(beansCol, "bean2.name2", AccessType.GETTER, Arrays
+ .asList(new String[] { "name12", "name22" })));
+ Assert.assertSame(beansCol.size(), 1);
+ beansCol.clear();
+ init();
- Assert.assertFalse(CollectionTools.removeAllWithValue(beansCol, "name1", AccessType.GETTER, Arrays
- .asList(new String[] { "XXX", "YYY", "ZZZ" })));
- }
+ Assert.assertFalse(CollectionTools.removeAllWithValue(beansCol, "name1", AccessType.GETTER, Arrays
+ .asList(new String[] { "XXX", "YYY", "ZZZ" })));
+ }
- /**
- * valuesFromList tests
- */
- @Test
- public void valuesFromList() {
- Assert.assertEquals(CollectionTools.valuesFromList(beansCol, "name1", AccessType.GETTER), Arrays
- .asList(new String[] { "name", "name", "name" }));
- Assert.assertEquals(CollectionTools.valuesFromList(beansCol, "bean2.name2", AccessType.GETTER), Arrays
- .asList(new String[] { "name12", "name22", null }));
- }
+ /**
+ * valuesFromList tests
+ */
+ @Test
+ public void valuesFromList() {
+ Assert.assertEquals(CollectionTools.valuesFromList(beansCol, "name1", AccessType.GETTER), Arrays
+ .asList(new String[] { "name", "name", "name" }));
+ Assert.assertEquals(CollectionTools.valuesFromList(beansCol, "bean2.name2", AccessType.GETTER), Arrays
+ .asList(new String[] { "name12", "name22", null }));
+ }
}
Modified: trunk/cantharella.utils/src/test/java/nc/ird/module/utils/CoordToolsTest.java
===================================================================
--- trunk/cantharella.utils/src/test/java/nc/ird/module/utils/CoordToolsTest.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.utils/src/test/java/nc/ird/module/utils/CoordToolsTest.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -35,41 +35,41 @@
*/
public class CoordToolsTest {
- /**
- * Latitude test
- */
- @Test
- public void latitude() {
- Integer degrees = 1;
- BigDecimal minutes = new BigDecimal("2.300");
- Character orientation = 'N';
- String latitude = CoordTools.latitude(degrees, minutes, orientation);
+ /**
+ * Latitude test
+ */
+ @Test
+ public void latitude() {
+ Integer degrees = 1;
+ BigDecimal minutes = new BigDecimal("2.300");
+ Character orientation = 'N';
+ String latitude = CoordTools.latitude(degrees, minutes, orientation);
- Assert.assertTrue(CoordTools.validateLatitude(latitude));
- Assert.assertFalse(CoordTools.validateLatitude(latitude
- .replace(orientation, Character.toLowerCase(orientation))));
+ Assert.assertTrue(CoordTools.validateLatitude(latitude));
+ Assert.assertFalse(CoordTools.validateLatitude(latitude
+ .replace(orientation, Character.toLowerCase(orientation))));
- Assert.assertEquals(degrees, CoordTools.latitudeDegrees(latitude));
- Assert.assertEquals(minutes, CoordTools.latitudeMinutes(latitude));
- Assert.assertEquals(orientation, CoordTools.latitudeOrientation(latitude));
- }
+ Assert.assertEquals(degrees, CoordTools.latitudeDegrees(latitude));
+ Assert.assertEquals(minutes, CoordTools.latitudeMinutes(latitude));
+ Assert.assertEquals(orientation, CoordTools.latitudeOrientation(latitude));
+ }
- /**
- * Longitude test
- */
- @Test
- public void longitude() {
- Integer degrees = 1;
- BigDecimal minutes = new BigDecimal("52.999");
- Character orientation = 'E';
- String longitude = CoordTools.longitude(degrees, minutes, orientation);
+ /**
+ * Longitude test
+ */
+ @Test
+ public void longitude() {
+ Integer degrees = 1;
+ BigDecimal minutes = new BigDecimal("52.999");
+ Character orientation = 'E';
+ String longitude = CoordTools.longitude(degrees, minutes, orientation);
- Assert.assertTrue(CoordTools.validateLongitude(longitude));
- Assert.assertFalse(CoordTools.validateLongitude(longitude.replace(orientation, Character
- .toLowerCase(orientation))));
+ Assert.assertTrue(CoordTools.validateLongitude(longitude));
+ Assert.assertFalse(CoordTools.validateLongitude(longitude.replace(orientation, Character
+ .toLowerCase(orientation))));
- Assert.assertEquals(degrees, CoordTools.longitudeDegrees(longitude));
- Assert.assertEquals(minutes, CoordTools.longitudeMinutes(longitude));
- Assert.assertEquals(orientation, CoordTools.longitudeOrientation(longitude));
- }
+ Assert.assertEquals(degrees, CoordTools.longitudeDegrees(longitude));
+ Assert.assertEquals(minutes, CoordTools.longitudeMinutes(longitude));
+ Assert.assertEquals(orientation, CoordTools.longitudeOrientation(longitude));
+ }
}
Modified: trunk/cantharella.utils/src/test/java/nc/ird/module/utils/GenericsToolsTest.java
===================================================================
--- trunk/cantharella.utils/src/test/java/nc/ird/module/utils/GenericsToolsTest.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.utils/src/test/java/nc/ird/module/utils/GenericsToolsTest.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -31,13 +31,13 @@
*/
public final class GenericsToolsTest {
- /**
- * cast test
- */
- @Test
- public void cast() {
- Number n = 1;
- Integer i = GenericsTools.cast(n);
- Assert.assertEquals((Integer) 1, i);
- }
+ /**
+ * cast test
+ */
+ @Test
+ public void cast() {
+ Number n = 1;
+ Integer i = GenericsTools.cast(n);
+ Assert.assertEquals((Integer) 1, i);
+ }
}
Modified: trunk/cantharella.utils/src/test/java/nc/ird/module/utils/LogToolsTest.java
===================================================================
--- trunk/cantharella.utils/src/test/java/nc/ird/module/utils/LogToolsTest.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.utils/src/test/java/nc/ird/module/utils/LogToolsTest.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -32,13 +32,13 @@
*/
public final class LogToolsTest {
- /**
- * getLog test
- */
- @Test
- public void getLog() {
- Log log = LogTools.getLog();
- Assert.assertNotNull(log);
- log.debug(null);
- }
+ /**
+ * getLog test
+ */
+ @Test
+ public void getLog() {
+ Log log = LogTools.getLog();
+ Assert.assertNotNull(log);
+ log.debug(null);
+ }
}
Modified: trunk/cantharella.utils/src/test/java/nc/ird/module/utils/NumberToolsTest.java
===================================================================
--- trunk/cantharella.utils/src/test/java/nc/ird/module/utils/NumberToolsTest.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.utils/src/test/java/nc/ird/module/utils/NumberToolsTest.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -36,109 +36,109 @@
*/
public final class NumberToolsTest {
- /**
- * nullIfZero test
- */
- @Test
- public void nullIfZero() {
- // AtomicInteger
- AtomicInteger ai = null;
- Assert.assertNull(NumberTools.nullIfZero(ai));
- ai = new AtomicInteger(-1);
- Assert.assertEquals(ai, NumberTools.nullIfZero(ai));
- ai.set(0);
- Assert.assertNull(NumberTools.nullIfZero(ai));
- ai.set(1);
- Assert.assertEquals(ai, NumberTools.nullIfZero(ai));
- // AtomicLong
- AtomicLong al = null;
- Assert.assertNull(NumberTools.nullIfZero(al));
- al = new AtomicLong(-1L);
- Assert.assertEquals(al, NumberTools.nullIfZero(al));
- al.set(0L);
- Assert.assertNull(NumberTools.nullIfZero(al));
- al.set(1L);
- Assert.assertEquals(al, NumberTools.nullIfZero(al));
- // BigDecimal
- BigDecimal bd = null;
- Assert.assertNull(NumberTools.nullIfZero(bd));
- bd = new BigDecimal(-1.0D);
- Assert.assertEquals(bd, NumberTools.nullIfZero(bd));
- bd = new BigDecimal(-.5D);
- Assert.assertEquals(bd, NumberTools.nullIfZero(bd));
- bd = new BigDecimal(0.0D);
- Assert.assertNull(NumberTools.nullIfZero(bd));
- bd = new BigDecimal(.5D);
- Assert.assertEquals(bd, NumberTools.nullIfZero(bd));
- bd = new BigDecimal(1.0D);
- Assert.assertEquals(bd, NumberTools.nullIfZero(bd));
- // BigInteger
- BigInteger bi = null;
- Assert.assertNull(NumberTools.nullIfZero(bi));
- bi = new BigInteger("-1");
- Assert.assertEquals(bi, NumberTools.nullIfZero(bi));
- bi = new BigInteger("0");
- Assert.assertNull(NumberTools.nullIfZero(bi));
- bi = new BigInteger("1");
- Assert.assertEquals(bi, NumberTools.nullIfZero(bi));
- // Byte
- Byte b = null;
- Assert.assertNull(NumberTools.nullIfZero(b));
- b = 0;
- Assert.assertNull(NumberTools.nullIfZero(b));
- b = 1;
- Assert.assertEquals(b, NumberTools.nullIfZero(b));
- // Double
- Double d = null;
- Assert.assertNull(NumberTools.nullIfZero(d));
- d = -1.0D;
- Assert.assertEquals(d, NumberTools.nullIfZero(d));
- d = -.5D;
- Assert.assertEquals(d, NumberTools.nullIfZero(d));
- d = 0.0D;
- Assert.assertNull(NumberTools.nullIfZero(d));
- d = .5D;
- Assert.assertEquals(d, NumberTools.nullIfZero(d));
- d = 1.0D;
- Assert.assertEquals(d, NumberTools.nullIfZero(d));
- // Float
- Float f = null;
- Assert.assertNull(NumberTools.nullIfZero(f));
- f = -1.0F;
- Assert.assertEquals(f, NumberTools.nullIfZero(f));
- f = -.5F;
- Assert.assertEquals(f, NumberTools.nullIfZero(f));
- f = 0.0F;
- Assert.assertNull(NumberTools.nullIfZero(f));
- f = .5F;
- Assert.assertEquals(f, NumberTools.nullIfZero(f));
- f = 1.0F;
- Assert.assertEquals(f, NumberTools.nullIfZero(f));
- // Integer
- Integer i = null;
- Assert.assertNull(NumberTools.nullIfZero(i));
- i = -1;
- Assert.assertEquals(i, NumberTools.nullIfZero(i));
- i = 0;
- Assert.assertNull(NumberTools.nullIfZero(i));
- i = 1;
- Assert.assertEquals(i, NumberTools.nullIfZero(i));
- // Long
- Long l = null;
- Assert.assertNull(NumberTools.nullIfZero(l));
- l = -1L;
- Assert.assertEquals(l, NumberTools.nullIfZero(l));
- l = 0L;
- Assert.assertNull(NumberTools.nullIfZero(l));
- l = 1L;
- Assert.assertEquals(l, NumberTools.nullIfZero(l));
- // Short
- Short s = null;
- Assert.assertNull(NumberTools.nullIfZero(s));
- s = -1;
- Assert.assertEquals(s, NumberTools.nullIfZero(s));
- s = 0;
- Assert.assertNull(NumberTools.nullIfZero(s));
- s = 1;
- }
+ /**
+ * nullIfZero test
+ */
+ @Test
+ public void nullIfZero() {
+ // AtomicInteger
+ AtomicInteger ai = null;
+ Assert.assertNull(NumberTools.nullIfZero(ai));
+ ai = new AtomicInteger(-1);
+ Assert.assertEquals(ai, NumberTools.nullIfZero(ai));
+ ai.set(0);
+ Assert.assertNull(NumberTools.nullIfZero(ai));
+ ai.set(1);
+ Assert.assertEquals(ai, NumberTools.nullIfZero(ai));
+ // AtomicLong
+ AtomicLong al = null;
+ Assert.assertNull(NumberTools.nullIfZero(al));
+ al = new AtomicLong(-1L);
+ Assert.assertEquals(al, NumberTools.nullIfZero(al));
+ al.set(0L);
+ Assert.assertNull(NumberTools.nullIfZero(al));
+ al.set(1L);
+ Assert.assertEquals(al, NumberTools.nullIfZero(al));
+ // BigDecimal
+ BigDecimal bd = null;
+ Assert.assertNull(NumberTools.nullIfZero(bd));
+ bd = new BigDecimal(-1.0D);
+ Assert.assertEquals(bd, NumberTools.nullIfZero(bd));
+ bd = new BigDecimal(-.5D);
+ Assert.assertEquals(bd, NumberTools.nullIfZero(bd));
+ bd = new BigDecimal(0.0D);
+ Assert.assertNull(NumberTools.nullIfZero(bd));
+ bd = new BigDecimal(.5D);
+ Assert.assertEquals(bd, NumberTools.nullIfZero(bd));
+ bd = new BigDecimal(1.0D);
+ Assert.assertEquals(bd, NumberTools.nullIfZero(bd));
+ // BigInteger
+ BigInteger bi = null;
+ Assert.assertNull(NumberTools.nullIfZero(bi));
+ bi = new BigInteger("-1");
+ Assert.assertEquals(bi, NumberTools.nullIfZero(bi));
+ bi = new BigInteger("0");
+ Assert.assertNull(NumberTools.nullIfZero(bi));
+ bi = new BigInteger("1");
+ Assert.assertEquals(bi, NumberTools.nullIfZero(bi));
+ // Byte
+ Byte b = null;
+ Assert.assertNull(NumberTools.nullIfZero(b));
+ b = 0;
+ Assert.assertNull(NumberTools.nullIfZero(b));
+ b = 1;
+ Assert.assertEquals(b, NumberTools.nullIfZero(b));
+ // Double
+ Double d = null;
+ Assert.assertNull(NumberTools.nullIfZero(d));
+ d = -1.0D;
+ Assert.assertEquals(d, NumberTools.nullIfZero(d));
+ d = -.5D;
+ Assert.assertEquals(d, NumberTools.nullIfZero(d));
+ d = 0.0D;
+ Assert.assertNull(NumberTools.nullIfZero(d));
+ d = .5D;
+ Assert.assertEquals(d, NumberTools.nullIfZero(d));
+ d = 1.0D;
+ Assert.assertEquals(d, NumberTools.nullIfZero(d));
+ // Float
+ Float f = null;
+ Assert.assertNull(NumberTools.nullIfZero(f));
+ f = -1.0F;
+ Assert.assertEquals(f, NumberTools.nullIfZero(f));
+ f = -.5F;
+ Assert.assertEquals(f, NumberTools.nullIfZero(f));
+ f = 0.0F;
+ Assert.assertNull(NumberTools.nullIfZero(f));
+ f = .5F;
+ Assert.assertEquals(f, NumberTools.nullIfZero(f));
+ f = 1.0F;
+ Assert.assertEquals(f, NumberTools.nullIfZero(f));
+ // Integer
+ Integer i = null;
+ Assert.assertNull(NumberTools.nullIfZero(i));
+ i = -1;
+ Assert.assertEquals(i, NumberTools.nullIfZero(i));
+ i = 0;
+ Assert.assertNull(NumberTools.nullIfZero(i));
+ i = 1;
+ Assert.assertEquals(i, NumberTools.nullIfZero(i));
+ // Long
+ Long l = null;
+ Assert.assertNull(NumberTools.nullIfZero(l));
+ l = -1L;
+ Assert.assertEquals(l, NumberTools.nullIfZero(l));
+ l = 0L;
+ Assert.assertNull(NumberTools.nullIfZero(l));
+ l = 1L;
+ Assert.assertEquals(l, NumberTools.nullIfZero(l));
+ // Short
+ Short s = null;
+ Assert.assertNull(NumberTools.nullIfZero(s));
+ s = -1;
+ Assert.assertEquals(s, NumberTools.nullIfZero(s));
+ s = 0;
+ Assert.assertNull(NumberTools.nullIfZero(s));
+ s = 1;
+ }
}
Modified: trunk/cantharella.utils/src/test/java/nc/ird/module/utils/PairTest.java
===================================================================
--- trunk/cantharella.utils/src/test/java/nc/ird/module/utils/PairTest.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.utils/src/test/java/nc/ird/module/utils/PairTest.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -31,21 +31,21 @@
*/
public final class PairTest {
- /**
- * pair test
- */
- @Test
- public void pair() {
- Pair<Integer, String> pair = new Pair<Integer, String>(1, "Toto");
- Assert.assertEquals((Integer) 1, pair.getKey());
- Assert.assertEquals("Toto", pair.getValue());
- pair.setKey(2);
- Assert.assertEquals((Integer) 2, pair.getKey());
- Assert.assertEquals("Toto", pair.setValue("Titi"));
- Assert.assertEquals("Titi", pair.getValue());
- Pair<Integer, String> pair2 = new Pair<Integer, String>(1, "Titi");
- Assert.assertNotSame(pair, pair2);
- Pair<Integer, String> pair3 = new Pair<Integer, String>(2, "Titi");
- Assert.assertEquals(pair, pair3);
- }
+ /**
+ * pair test
+ */
+ @Test
+ public void pair() {
+ Pair<Integer, String> pair = new Pair<Integer, String>(1, "Toto");
+ Assert.assertEquals((Integer) 1, pair.getKey());
+ Assert.assertEquals("Toto", pair.getValue());
+ pair.setKey(2);
+ Assert.assertEquals((Integer) 2, pair.getKey());
+ Assert.assertEquals("Toto", pair.setValue("Titi"));
+ Assert.assertEquals("Titi", pair.getValue());
+ Pair<Integer, String> pair2 = new Pair<Integer, String>(1, "Titi");
+ Assert.assertNotSame(pair, pair2);
+ Pair<Integer, String> pair3 = new Pair<Integer, String>(2, "Titi");
+ Assert.assertEquals(pair, pair3);
+ }
}
Modified: trunk/cantharella.utils/src/test/java/nc/ird/module/utils/PasswordToolsTest.java
===================================================================
--- trunk/cantharella.utils/src/test/java/nc/ird/module/utils/PasswordToolsTest.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.utils/src/test/java/nc/ird/module/utils/PasswordToolsTest.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -32,52 +32,52 @@
*/
public final class PasswordToolsTest {
- /**
- * md5 test
- */
- @Test
- public void md5() {
- String hash1 = PasswordTools.md5("toto");
- Assert.assertNotNull(hash1);
- Assert.assertEquals(PasswordTools.MD5_LENGTH, hash1.length());
- Assert.assertEquals(PasswordTools.md5("toto"), hash1);
- String hash2 = PasswordTools.md5("titi");
- Assert.assertNotNull(hash2);
- Assert.assertEquals(PasswordTools.MD5_LENGTH, hash2.length());
- Assert.assertEquals(PasswordTools.md5("titi"), hash2);
- Assert.assertNotNull(hash1);
- Assert.assertTrue(!hash1.equals(hash2));
- }
+ /**
+ * md5 test
+ */
+ @Test
+ public void md5() {
+ String hash1 = PasswordTools.md5("toto");
+ Assert.assertNotNull(hash1);
+ Assert.assertEquals(PasswordTools.MD5_LENGTH, hash1.length());
+ Assert.assertEquals(PasswordTools.md5("toto"), hash1);
+ String hash2 = PasswordTools.md5("titi");
+ Assert.assertNotNull(hash2);
+ Assert.assertEquals(PasswordTools.MD5_LENGTH, hash2.length());
+ Assert.assertEquals(PasswordTools.md5("titi"), hash2);
+ Assert.assertNotNull(hash1);
+ Assert.assertTrue(!hash1.equals(hash2));
+ }
- /**
- * random test
- */
- @Test
- public void random() {
- String password1 = PasswordTools.random();
- Assert.assertNotNull(password1);
- Assert.assertTrue(password1.length() >= PasswordTools.PASSWORD_LENGTH_MIN);
- Assert.assertTrue(password1.length() <= PasswordTools.PASSWORD_LENGTH_MAX);
- String password2 = PasswordTools.random();
- Assert.assertNotNull(password2);
- Assert.assertTrue(password2.length() >= PasswordTools.PASSWORD_LENGTH_MIN);
- Assert.assertTrue(password2.length() <= PasswordTools.PASSWORD_LENGTH_MAX);
- Assert.assertTrue(!password1.equals(password2));
- }
+ /**
+ * random test
+ */
+ @Test
+ public void random() {
+ String password1 = PasswordTools.random();
+ Assert.assertNotNull(password1);
+ Assert.assertTrue(password1.length() >= PasswordTools.PASSWORD_LENGTH_MIN);
+ Assert.assertTrue(password1.length() <= PasswordTools.PASSWORD_LENGTH_MAX);
+ String password2 = PasswordTools.random();
+ Assert.assertNotNull(password2);
+ Assert.assertTrue(password2.length() >= PasswordTools.PASSWORD_LENGTH_MIN);
+ Assert.assertTrue(password2.length() <= PasswordTools.PASSWORD_LENGTH_MAX);
+ Assert.assertTrue(!password1.equals(password2));
+ }
- /**
- * sha1 test
- */
- @Test
- public void sha1() {
- String hash1 = PasswordTools.sha1("toto");
- Assert.assertNotNull(hash1);
- Assert.assertEquals(PasswordTools.sha1("toto"), hash1);
- Assert.assertEquals(PasswordTools.SHA1_LENGTH, hash1.length());
- String hash2 = PasswordTools.sha1("titi");
- Assert.assertNotNull(hash2);
- Assert.assertEquals(PasswordTools.SHA1_LENGTH, hash2.length());
- Assert.assertNotNull(hash1);
- Assert.assertTrue(!hash1.equals(hash2));
- }
+ /**
+ * sha1 test
+ */
+ @Test
+ public void sha1() {
+ String hash1 = PasswordTools.sha1("toto");
+ Assert.assertNotNull(hash1);
+ Assert.assertEquals(PasswordTools.sha1("toto"), hash1);
+ Assert.assertEquals(PasswordTools.SHA1_LENGTH, hash1.length());
+ String hash2 = PasswordTools.sha1("titi");
+ Assert.assertNotNull(hash2);
+ Assert.assertEquals(PasswordTools.SHA1_LENGTH, hash2.length());
+ Assert.assertNotNull(hash1);
+ Assert.assertTrue(!hash1.equals(hash2));
+ }
}
Modified: trunk/cantharella.utils/src/test/java/nc/ird/module/utils/StringToolsTest.java
===================================================================
--- trunk/cantharella.utils/src/test/java/nc/ird/module/utils/StringToolsTest.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.utils/src/test/java/nc/ird/module/utils/StringToolsTest.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -36,136 +36,136 @@
*/
public final class StringToolsTest {
- /**
- * coupleToString test
- */
- @Test
- public void couplesToString() {
- // Empty
- Map<String, Integer> couples = new HashMap<String, Integer>();
- String toString = StringTools.couplesToString(couples, " ", " / ");
- // One couple
- couples.put("Toto", 1);
- toString = StringTools.couplesToString(couples, " ", " / ");
- Assert.assertEquals("Toto 1", toString);
- // Two couples
- couples.put("Titi", 2);
- toString = StringTools.couplesToString(couples, " ", " / ");
- Assert.assertEquals("Toto 1 / Titi 2", toString);
- }
+ /**
+ * coupleToString test
+ */
+ @Test
+ public void couplesToString() {
+ // Empty
+ Map<String, Integer> couples = new HashMap<String, Integer>();
+ String toString = StringTools.couplesToString(couples, " ", " / ");
+ // One couple
+ couples.put("Toto", 1);
+ toString = StringTools.couplesToString(couples, " ", " / ");
+ Assert.assertEquals("Toto 1", toString);
+ // Two couples
+ couples.put("Titi", 2);
+ toString = StringTools.couplesToString(couples, " ", " / ");
+ Assert.assertEquals("Toto 1 / Titi 2", toString);
+ }
- /**
- * length test
- */
- @Test
- public void length() {
- Assert.assertEquals(-1, StringTools.length(null));
- Assert.assertEquals(0, StringTools.length(""));
- Assert.assertEquals(1, StringTools.length("a"));
- }
+ /**
+ * length test
+ */
+ @Test
+ public void length() {
+ Assert.assertEquals(-1, StringTools.length(null));
+ Assert.assertEquals(0, StringTools.length(""));
+ Assert.assertEquals(1, StringTools.length("a"));
+ }
- /**
- * lineIterator test
- */
- @Test
- public void lineIterator() {
- // Empty
- StringBuilder lines = new StringBuilder();
- Iterator<String> i = StringTools.lineIterator(lines);
- Assert.assertFalse(i.hasNext());
- // One line
- lines.append("Toto");
- i = StringTools.lineIterator(lines);
- Assert.assertTrue(i.hasNext());
- Assert.assertEquals("Toto", i.next());
- Assert.assertFalse(i.hasNext());
- // Two lines with a blank one
- lines.append("\n ");
- i = StringTools.lineIterator(lines);
- Assert.assertTrue(i.hasNext());
- Assert.assertEquals("Toto", i.next());
- Assert.assertFalse(i.hasNext());
- // Three lines with a blank one
- lines.append("\nTiti");
- i = StringTools.lineIterator(lines);
- Assert.assertTrue(i.hasNext());
- Assert.assertEquals("Toto", i.next());
- Assert.assertTrue(i.hasNext());
- Assert.assertEquals("Titi", i.next());
- Assert.assertFalse(i.hasNext());
- }
+ /**
+ * lineIterator test
+ */
+ @Test
+ public void lineIterator() {
+ // Empty
+ StringBuilder lines = new StringBuilder();
+ Iterator<String> i = StringTools.lineIterator(lines);
+ Assert.assertFalse(i.hasNext());
+ // One line
+ lines.append("Toto");
+ i = StringTools.lineIterator(lines);
+ Assert.assertTrue(i.hasNext());
+ Assert.assertEquals("Toto", i.next());
+ Assert.assertFalse(i.hasNext());
+ // Two lines with a blank one
+ lines.append("\n ");
+ i = StringTools.lineIterator(lines);
+ Assert.assertTrue(i.hasNext());
+ Assert.assertEquals("Toto", i.next());
+ Assert.assertFalse(i.hasNext());
+ // Three lines with a blank one
+ lines.append("\nTiti");
+ i = StringTools.lineIterator(lines);
+ Assert.assertTrue(i.hasNext());
+ Assert.assertEquals("Toto", i.next());
+ Assert.assertTrue(i.hasNext());
+ Assert.assertEquals("Titi", i.next());
+ Assert.assertFalse(i.hasNext());
+ }
- /**
- * replaceAccents test
- */
- @Test
- public void replaceAccents() {
- Assert.assertEquals(null, StringTools.replaceAccents(null));
- Assert.assertEquals("", StringTools.replaceAccents(""));
- Assert.assertEquals("AbCdEfGhIjKlMnOpQrStUvWxYz", StringTools.replaceAccents("AbCdEfGhIjKlMnOpQrStUvWxYz"));
- Assert.assertEquals("&e'(-e_ca)=u%*µ^¨$£}¤]@^`|[{#~", StringTools
- .replaceAccents("&é'(-è_çà)=ù%*µ^¨$£}¤]@^`|[{#~"));
- }
+ /**
+ * replaceAccents test
+ */
+ @Test
+ public void replaceAccents() {
+ Assert.assertEquals(null, StringTools.replaceAccents(null));
+ Assert.assertEquals("", StringTools.replaceAccents(""));
+ Assert.assertEquals("AbCdEfGhIjKlMnOpQrStUvWxYz", StringTools.replaceAccents("AbCdEfGhIjKlMnOpQrStUvWxYz"));
+ Assert.assertEquals("&e'(-e_ca)=u%*µ^¨$£}¤]@^`|[{#~", StringTools
+ .replaceAccents("&é'(-è_çà)=ù%*µ^¨$£}¤]@^`|[{#~"));
+ }
- /**
- * Replace consecutive whitespaces test
- */
- @Test
- public void replaceConsecutiveWhitespaces() {
- Assert.assertNull(StringTools.replaceConsecutiveWhitespaces(null));
- Assert.assertEquals("", StringTools.replaceConsecutiveWhitespaces(""));
- Assert.assertEquals(" ", StringTools.replaceConsecutiveWhitespaces(" "));
- Assert.assertEquals(" ", StringTools.replaceConsecutiveWhitespaces(" "));
- Assert.assertEquals(" toto titi ", StringTools.replaceConsecutiveWhitespaces(" toto titi "));
- }
+ /**
+ * Replace consecutive whitespaces test
+ */
+ @Test
+ public void replaceConsecutiveWhitespaces() {
+ Assert.assertNull(StringTools.replaceConsecutiveWhitespaces(null));
+ Assert.assertEquals("", StringTools.replaceConsecutiveWhitespaces(""));
+ Assert.assertEquals(" ", StringTools.replaceConsecutiveWhitespaces(" "));
+ Assert.assertEquals(" ", StringTools.replaceConsecutiveWhitespaces(" "));
+ Assert.assertEquals(" toto titi ", StringTools.replaceConsecutiveWhitespaces(" toto titi "));
+ }
- /**
- * Replace consecutive whitespaces by underscore test
- */
- @Test
- public void replaceConsecutiveWhitespacesByUnderscore() {
- Assert.assertNull(StringTools.replaceConsecutiveWhitespaces(null));
- Assert.assertEquals("", StringTools.replaceConsecutiveWhitespacesByUnderscore(""));
- Assert.assertEquals("_", StringTools.replaceConsecutiveWhitespacesByUnderscore(" "));
- Assert.assertEquals("_", StringTools.replaceConsecutiveWhitespacesByUnderscore(" "));
- Assert.assertEquals("_toto_titi_", StringTools.replaceConsecutiveWhitespacesByUnderscore(" toto titi "));
- }
+ /**
+ * Replace consecutive whitespaces by underscore test
+ */
+ @Test
+ public void replaceConsecutiveWhitespacesByUnderscore() {
+ Assert.assertNull(StringTools.replaceConsecutiveWhitespaces(null));
+ Assert.assertEquals("", StringTools.replaceConsecutiveWhitespacesByUnderscore(""));
+ Assert.assertEquals("_", StringTools.replaceConsecutiveWhitespacesByUnderscore(" "));
+ Assert.assertEquals("_", StringTools.replaceConsecutiveWhitespacesByUnderscore(" "));
+ Assert.assertEquals("_toto_titi_", StringTools.replaceConsecutiveWhitespacesByUnderscore(" toto titi "));
+ }
- /**
- * Replace non alpha test
- */
- @Test
- public void replaceNonAlpha() {
- Assert.assertNull(StringTools.replaceNonAlpha(null));
- Assert.assertEquals("", StringTools.replaceNonAlpha(""));
- Assert.assertEquals(" ", StringTools.replaceNonAlpha(" "));
- Assert.assertEquals("e", StringTools.replaceNonAlpha("e"));
- Assert.assertEquals(" ", StringTools.replaceNonAlpha("é"));
- Assert.assertEquals("tot ", StringTools.replaceNonAlpha("totô2"));
- }
+ /**
+ * Replace non alpha test
+ */
+ @Test
+ public void replaceNonAlpha() {
+ Assert.assertNull(StringTools.replaceNonAlpha(null));
+ Assert.assertEquals("", StringTools.replaceNonAlpha(""));
+ Assert.assertEquals(" ", StringTools.replaceNonAlpha(" "));
+ Assert.assertEquals("e", StringTools.replaceNonAlpha("e"));
+ Assert.assertEquals(" ", StringTools.replaceNonAlpha("é"));
+ Assert.assertEquals("tot ", StringTools.replaceNonAlpha("totô2"));
+ }
- /**
- * truncate test
- */
- @Test
- public void truncate() {
- String truncation = "..";
- StringBuilder toTruncate = new StringBuilder();
- // Null
- Assert.assertNull(StringTools.truncate((StringBuilder) null, truncation));
- Assert.assertNull(StringTools.truncate((String) null, truncation));
- // Empty
- Assert.assertNotNull(StringTools.truncate(toTruncate, truncation));
- Assert.assertTrue(StringTools.truncate(toTruncate, truncation).isEmpty());
- // Without truncation
- toTruncate.append(".");
- Assert.assertEquals(".", StringTools.truncate(toTruncate, truncation));
- // With truncation -> empty
- toTruncate.append(".");
- Assert.assertNotNull(StringTools.truncate(toTruncate, truncation));
- Assert.assertTrue(StringTools.truncate(toTruncate, truncation).isEmpty());
- // With truncation -> !empty
- toTruncate.append(".");
- Assert.assertEquals(".", StringTools.truncate(toTruncate, truncation));
- }
+ /**
+ * truncate test
+ */
+ @Test
+ public void truncate() {
+ String truncation = "..";
+ StringBuilder toTruncate = new StringBuilder();
+ // Null
+ Assert.assertNull(StringTools.truncate((StringBuilder) null, truncation));
+ Assert.assertNull(StringTools.truncate((String) null, truncation));
+ // Empty
+ Assert.assertNotNull(StringTools.truncate(toTruncate, truncation));
+ Assert.assertTrue(StringTools.truncate(toTruncate, truncation).isEmpty());
+ // Without truncation
+ toTruncate.append(".");
+ Assert.assertEquals(".", StringTools.truncate(toTruncate, truncation));
+ // With truncation -> empty
+ toTruncate.append(".");
+ Assert.assertNotNull(StringTools.truncate(toTruncate, truncation));
+ Assert.assertTrue(StringTools.truncate(toTruncate, truncation).isEmpty());
+ // With truncation -> !empty
+ toTruncate.append(".");
+ Assert.assertEquals(".", StringTools.truncate(toTruncate, truncation));
+ }
}
Modified: trunk/cantharella.utils/src/test/java/nc/ird/module/utils/StringTransformerTest.java
===================================================================
--- trunk/cantharella.utils/src/test/java/nc/ird/module/utils/StringTransformerTest.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.utils/src/test/java/nc/ird/module/utils/StringTransformerTest.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -32,125 +32,125 @@
*/
public class StringTransformerTest {
- /**
- * Capitalize test
- */
- @Test
- public void capitalize() {
- Assert.assertNull(new StringTransformer(null).capitalize().toString());
- Assert.assertEquals("", new StringTransformer("").capitalize().toString());
- Assert.assertEquals("AAa", new StringTransformer("AAa").capitalize().toString());
- Assert.assertEquals("AAa BBb", new StringTransformer("aAa bBb").capitalize().toString());
- Assert.assertEquals("AAa-bBb", new StringTransformer("aAa-bBb").capitalize().toString());
- }
+ /**
+ * Capitalize test
+ */
+ @Test
+ public void capitalize() {
+ Assert.assertNull(new StringTransformer(null).capitalize().toString());
+ Assert.assertEquals("", new StringTransformer("").capitalize().toString());
+ Assert.assertEquals("AAa", new StringTransformer("AAa").capitalize().toString());
+ Assert.assertEquals("AAa BBb", new StringTransformer("aAa bBb").capitalize().toString());
+ Assert.assertEquals("AAa-bBb", new StringTransformer("aAa-bBb").capitalize().toString());
+ }
- /**
- * Capitalize fully test
- */
- @Test
- public void capitalizeFully() {
- Assert.assertNull(new StringTransformer(null).capitalizeFully().toString());
- Assert.assertEquals("", new StringTransformer("").capitalizeFully().toString());
- Assert.assertEquals("Aaa", new StringTransformer("AAa").capitalizeFully().toString());
- Assert.assertEquals("Aaa Bbb", new StringTransformer("aAa bBb").capitalizeFully().toString());
- Assert.assertEquals("Aaa-bbb", new StringTransformer("aAa-bBb").capitalizeFully().toString());
- }
+ /**
+ * Capitalize fully test
+ */
+ @Test
+ public void capitalizeFully() {
+ Assert.assertNull(new StringTransformer(null).capitalizeFully().toString());
+ Assert.assertEquals("", new StringTransformer("").capitalizeFully().toString());
+ Assert.assertEquals("Aaa", new StringTransformer("AAa").capitalizeFully().toString());
+ Assert.assertEquals("Aaa Bbb", new StringTransformer("aAa bBb").capitalizeFully().toString());
+ Assert.assertEquals("Aaa-bbb", new StringTransformer("aAa-bBb").capitalizeFully().toString());
+ }
- /**
- * Init test
- */
- @Test
- public void init() {
- Assert.assertNull(new StringTransformer(null).toString());
- Assert.assertEquals("", new StringTransformer("").toString());
- Assert.assertEquals("toto", new StringTransformer("toto").toString());
+ /**
+ * Init test
+ */
+ @Test
+ public void init() {
+ Assert.assertNull(new StringTransformer(null).toString());
+ Assert.assertEquals("", new StringTransformer("").toString());
+ Assert.assertEquals("toto", new StringTransformer("toto").toString());
- StringTransformer st = new StringTransformer(null);
- Assert.assertEquals(st, st.trim());
- }
+ StringTransformer st = new StringTransformer(null);
+ Assert.assertEquals(st, st.trim());
+ }
- /**
- * Replace accents test
- */
- @Test
- public void replaceAccents() {
- Assert.assertNull(new StringTransformer(null).replaceAccents().toString());
- Assert.assertEquals("", new StringTransformer("").replaceAccents().toString());
- Assert.assertEquals("AbCdEfGhIjKlMnOpQrStUvWxYz", new StringTransformer("AbCdEfGhIjKlMnOpQrStUvWxYz")
- .replaceAccents().toString());
- Assert.assertEquals("&e'(-e_ca)=u%*µ^¨$£}¤]@^`|[{#~", new StringTransformer("&é'(-è_çà)=ù%*µ^¨$£}¤]@^`|[{#~")
- .replaceAccents().toString());
- }
+ /**
+ * Replace accents test
+ */
+ @Test
+ public void replaceAccents() {
+ Assert.assertNull(new StringTransformer(null).replaceAccents().toString());
+ Assert.assertEquals("", new StringTransformer("").replaceAccents().toString());
+ Assert.assertEquals("AbCdEfGhIjKlMnOpQrStUvWxYz", new StringTransformer("AbCdEfGhIjKlMnOpQrStUvWxYz")
+ .replaceAccents().toString());
+ Assert.assertEquals("&e'(-e_ca)=u%*µ^¨$£}¤]@^`|[{#~", new StringTransformer("&é'(-è_çà)=ù%*µ^¨$£}¤]@^`|[{#~")
+ .replaceAccents().toString());
+ }
- /**
- * Replace consecutive whitespaces test
- */
- @Test
- public void replaceConsecutiveWhitespaces() {
- Assert.assertNull(new StringTransformer(null).replaceConsecutiveWhitespaces().toString());
- Assert.assertEquals("", new StringTransformer("").replaceConsecutiveWhitespaces().toString());
- Assert.assertEquals(" ", new StringTransformer(" ").replaceConsecutiveWhitespaces().toString());
- Assert.assertEquals(" ", new StringTransformer(" ").replaceConsecutiveWhitespaces().toString());
- Assert.assertEquals(" toto titi ", new StringTransformer(" toto titi ").replaceConsecutiveWhitespaces()
- .toString());
- }
+ /**
+ * Replace consecutive whitespaces test
+ */
+ @Test
+ public void replaceConsecutiveWhitespaces() {
+ Assert.assertNull(new StringTransformer(null).replaceConsecutiveWhitespaces().toString());
+ Assert.assertEquals("", new StringTransformer("").replaceConsecutiveWhitespaces().toString());
+ Assert.assertEquals(" ", new StringTransformer(" ").replaceConsecutiveWhitespaces().toString());
+ Assert.assertEquals(" ", new StringTransformer(" ").replaceConsecutiveWhitespaces().toString());
+ Assert.assertEquals(" toto titi ", new StringTransformer(" toto titi ").replaceConsecutiveWhitespaces()
+ .toString());
+ }
- /**
- * Replace non alpha test
- */
- @Test
- public void replaceNonAlpha() {
- Assert.assertNull(new StringTransformer(null).toString());
- Assert.assertEquals("", new StringTransformer("").replaceNonAlpha().toString());
- Assert.assertEquals(" ", new StringTransformer(" ").replaceNonAlpha().toString());
- Assert.assertEquals("e", new StringTransformer("e").replaceNonAlpha().toString());
- Assert.assertEquals(" ", new StringTransformer("é").replaceNonAlpha().toString());
- Assert.assertEquals("tot ", new StringTransformer("totô2").replaceNonAlpha().toString());
- }
+ /**
+ * Replace non alpha test
+ */
+ @Test
+ public void replaceNonAlpha() {
+ Assert.assertNull(new StringTransformer(null).toString());
+ Assert.assertEquals("", new StringTransformer("").replaceNonAlpha().toString());
+ Assert.assertEquals(" ", new StringTransformer(" ").replaceNonAlpha().toString());
+ Assert.assertEquals("e", new StringTransformer("e").replaceNonAlpha().toString());
+ Assert.assertEquals(" ", new StringTransformer("é").replaceNonAlpha().toString());
+ Assert.assertEquals("tot ", new StringTransformer("totô2").replaceNonAlpha().toString());
+ }
- /**
- * To lower case test
- */
- @Test
- public void toLowerCase() {
- Assert.assertNull(new StringTransformer(null).toLowerCase().toString());
- Assert.assertEquals("", new StringTransformer("").toLowerCase().toString());
- Assert.assertEquals("a", new StringTransformer("A").toLowerCase().toString());
- Assert.assertEquals("aaaââ", new StringTransformer("aAaÂâ").toLowerCase().toString());
- }
+ /**
+ * To lower case test
+ */
+ @Test
+ public void toLowerCase() {
+ Assert.assertNull(new StringTransformer(null).toLowerCase().toString());
+ Assert.assertEquals("", new StringTransformer("").toLowerCase().toString());
+ Assert.assertEquals("a", new StringTransformer("A").toLowerCase().toString());
+ Assert.assertEquals("aaaââ", new StringTransformer("aAaÂâ").toLowerCase().toString());
+ }
- /**
- * To upper case test
- */
- @Test
- public void toUpperCase() {
- Assert.assertNull(new StringTransformer(null).toUpperCase().toString());
- Assert.assertEquals("", new StringTransformer("").toUpperCase().toString());
- Assert.assertEquals("A", new StringTransformer("a").toUpperCase().toString());
- Assert.assertEquals("AAAÂÂ", new StringTransformer("aAaÂâ").toUpperCase().toString());
- }
+ /**
+ * To upper case test
+ */
+ @Test
+ public void toUpperCase() {
+ Assert.assertNull(new StringTransformer(null).toUpperCase().toString());
+ Assert.assertEquals("", new StringTransformer("").toUpperCase().toString());
+ Assert.assertEquals("A", new StringTransformer("a").toUpperCase().toString());
+ Assert.assertEquals("AAAÂÂ", new StringTransformer("aAaÂâ").toUpperCase().toString());
+ }
- /**
- * Trim test
- */
- @Test
- public void trim() {
- Assert.assertNull(new StringTransformer(null).trim().toString());
- Assert.assertEquals("", new StringTransformer("").trim().toString());
- Assert.assertEquals("", new StringTransformer(" ").trim().toString());
- Assert.assertEquals("toto", new StringTransformer(" toto ").trim().toString());
- Assert.assertEquals("toto titi", new StringTransformer(" toto titi ").trim().toString());
- }
+ /**
+ * Trim test
+ */
+ @Test
+ public void trim() {
+ Assert.assertNull(new StringTransformer(null).trim().toString());
+ Assert.assertEquals("", new StringTransformer("").trim().toString());
+ Assert.assertEquals("", new StringTransformer(" ").trim().toString());
+ Assert.assertEquals("toto", new StringTransformer(" toto ").trim().toString());
+ Assert.assertEquals("toto titi", new StringTransformer(" toto titi ").trim().toString());
+ }
- /**
- * Trim to null test
- */
- @Test
- public void trimToNull() {
- Assert.assertNull(new StringTransformer(null).trimToNull().toString());
- Assert.assertNull(new StringTransformer("").trimToNull().toString());
- Assert.assertNull(new StringTransformer(" ").trimToNull().toString());
- Assert.assertEquals("toto", new StringTransformer(" toto ").trimToNull().toString());
- Assert.assertEquals("toto titi", new StringTransformer(" toto titi ").trim().toString());
- }
+ /**
+ * Trim to null test
+ */
+ @Test
+ public void trimToNull() {
+ Assert.assertNull(new StringTransformer(null).trimToNull().toString());
+ Assert.assertNull(new StringTransformer("").trimToNull().toString());
+ Assert.assertNull(new StringTransformer(" ").trimToNull().toString());
+ Assert.assertEquals("toto", new StringTransformer(" toto ").trimToNull().toString());
+ Assert.assertEquals("toto titi", new StringTransformer(" toto titi ").trim().toString());
+ }
}
Modified: trunk/cantharella.web/pom.xml
===================================================================
--- trunk/cantharella.web/pom.xml 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/pom.xml 2013-01-29 09:48:04 UTC (rev 65)
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
@@ -21,7 +20,7 @@
<deploy.integration-user>admin</deploy.integration-user>
<deploy.integration-password>INTEGRATION_PASSWD
</deploy.integration-password>
- <!-- Deployment details for the production server, host & password to update -->
+ <!-- Deployment details for the production server, host & password to update -->
<deploy.production-host>PROD_SVR</deploy.production-host>
<deploy.production-port>80</deploy.production-port>
<deploy.production-user>admin</deploy.production-user>
@@ -31,7 +30,7 @@
</properties>
<build>
<resources>
- <!-- for html in java packages (wicket) -->
+ <!-- for html in java packages (wicket) -->
<resource>
<filtering>false</filtering>
<directory>src/main/java</directory>
@@ -266,8 +265,8 @@
</dependency>
<!--dependency>
<groupId>org.apache.wicket</groupId>
- <artifactId>wicket-auth-roles</artifactId>
- </dependency-->
+ <artifactId>wicket-auth-roles</artifactId>
+ </dependency -->
<dependency>
<groupId>org.apache.wicket</groupId>
<artifactId>wicket-datetime</artifactId>
@@ -290,7 +289,7 @@
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
-
+
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/config/WebApplicationImpl.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/config/WebApplicationImpl.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/config/WebApplicationImpl.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -105,315 +105,315 @@
*/
public final class WebApplicationImpl extends WebApplication {
- /** Logger */
- private static final Log LOG = LogTools.getLog();
+ /** Logger */
+ private static final Log LOG = LogTools.getLog();
- /**
- * SpringBeans injector (some objects such as Pages are automatically injected, by not all of them)
- * @param object Object to be injected
- */
- public static void injectSpringBeans(Object object) {
- Injector.get().inject(object);
- }
+ /**
+ * SpringBeans injector (some objects such as Pages are automatically injected, by not all of them)
+ * @param object Object to be injected
+ */
+ public static void injectSpringBeans(Object object) {
+ Injector.get().inject(object);
+ }
- /** Debug mode */
- private final boolean debug;
+ /** Debug mode */
+ private final boolean debug;
- /** Internationalization messages */
- private final IStringResourceLoader[] messages;
+ /** Internationalization messages */
+ private final IStringResourceLoader[] messages;
- /** Optimize mode */
- private final boolean optimize;
+ /** Optimize mode */
+ private final boolean optimize;
- /** Service: personne */
- @SpringBean
- private PersonneService personneService;
+ /** Service: personne */
+ @SpringBean
+ private PersonneService personneService;
- /** Wicket configuration (Application.DEVELOPMENT or Application.DEPLOYMENT) */
- private final RuntimeConfigurationType wicketConfiguration;
+ /** Wicket configuration (Application.DEVELOPMENT or Application.DEPLOYMENT) */
+ private final RuntimeConfigurationType wicketConfiguration;
- /**
- * Constructor
- * @param debug Debug mode
- * @param optimize Optimize mode
- * @param wicketConfiguration Wicket configuration (DEVELOPMENT or DEPLOYMENT)
- * @param messages Internationalization messages
- */
- public WebApplicationImpl(boolean debug, boolean optimize, RuntimeConfigurationType wicketConfiguration,
- IStringResourceLoader... messages) {
- AssertTools.assertArrayNotNull(messages);
- this.debug = debug;
- this.optimize = optimize;
- this.wicketConfiguration = wicketConfiguration;
- this.messages = messages;
- }
+ /**
+ * Constructor
+ * @param debug Debug mode
+ * @param optimize Optimize mode
+ * @param wicketConfiguration Wicket configuration (DEVELOPMENT or DEPLOYMENT)
+ * @param messages Internationalization messages
+ */
+ public WebApplicationImpl(boolean debug, boolean optimize, RuntimeConfigurationType wicketConfiguration,
+ IStringResourceLoader... messages) {
+ AssertTools.assertArrayNotNull(messages);
+ this.debug = debug;
+ this.optimize = optimize;
+ this.wicketConfiguration = wicketConfiguration;
+ this.messages = messages;
+ }
- /** {@inheritDoc} */
- @Override
- public RuntimeConfigurationType getConfigurationType() {
- return wicketConfiguration;
- }
+ /** {@inheritDoc} */
+ @Override
+ public RuntimeConfigurationType getConfigurationType() {
+ return wicketConfiguration;
+ }
- /** {@inheritDoc} */
- @Override
- public Class<HomePage> getHomePage() {
- return HomePage.class;
- }
+ /** {@inheritDoc} */
+ @Override
+ public Class<HomePage> getHomePage() {
+ return HomePage.class;
+ }
- /** {@inheritDoc} */
- @Override
- protected void init() {
- super.init();
- getComponentInstantiationListeners().add(new SpringComponentInjector(this));
- injectSpringBeans(this);
- try {
- personneService.checkOrCreateAdmin();
- } catch (DataConstraintException e) {
- LOG.error(e.getMessage(), e);
- throw new UnexpectedException(e);
- }
- setApplicationSettings();
- setDebugSettings();
- setExceptionSettings();
- setFrameworkSettings();
- setMarkupSettings();
- setPageSettings();
- setRequestCycleSettings();
- setRequestLoggerSettings();
- setResourceSettings();
- setSecuritySettings();
- mountUrls();
- }
+ /** {@inheritDoc} */
+ @Override
+ protected void init() {
+ super.init();
+ getComponentInstantiationListeners().add(new SpringComponentInjector(this));
+ injectSpringBeans(this);
+ try {
+ personneService.checkOrCreateAdmin();
+ } catch (DataConstraintException e) {
+ LOG.error(e.getMessage(), e);
+ throw new UnexpectedException(e);
+ }
+ setApplicationSettings();
+ setDebugSettings();
+ setExceptionSettings();
+ setFrameworkSettings();
+ setMarkupSettings();
+ setPageSettings();
+ setRequestCycleSettings();
+ setRequestLoggerSettings();
+ setResourceSettings();
+ setSecuritySettings();
+ mountUrls();
+ }
- /** {@inheritDoc} */
- @Override
- protected IConverterLocator newConverterLocator() {
- ConverterLocator converterLocator = (ConverterLocator) super.newConverterLocator();
- converterLocator.set(Double.class, DoubleConverterImpl.INSTANCE);
- converterLocator.set(BigDecimal.class, BigDecimalConverterImpl.INSTANCE);
- return converterLocator;
- }
+ /** {@inheritDoc} */
+ @Override
+ protected IConverterLocator newConverterLocator() {
+ ConverterLocator converterLocator = (ConverterLocator) super.newConverterLocator();
+ converterLocator.set(Double.class, DoubleConverterImpl.INSTANCE);
+ converterLocator.set(BigDecimal.class, BigDecimalConverterImpl.INSTANCE);
+ return converterLocator;
+ }
- /** {@inheritDoc} */
- @Override
- public Session newSession(Request request, Response response) {
- return new AuthSession(request);
- }
+ /** {@inheritDoc} */
+ @Override
+ public Session newSession(Request request, Response response) {
+ return new AuthSession(request);
+ }
- /**
- * Application settings
- */
- private void setApplicationSettings() {
- getApplicationSettings().setAccessDeniedPage(AccessDeniedPage.class);
- getApplicationSettings().setDefaultMaximumUploadSize(WebContext.HTTP_MAXIMUM_UPLOAD);
- getApplicationSettings().setInternalErrorPage(InternalErrorPage.class);
- getApplicationSettings().setPageExpiredErrorPage(PageExpiredErrorPage.class);
- }
+ /**
+ * Application settings
+ */
+ private void setApplicationSettings() {
+ getApplicationSettings().setAccessDeniedPage(AccessDeniedPage.class);
+ getApplicationSettings().setDefaultMaximumUploadSize(WebContext.HTTP_MAXIMUM_UPLOAD);
+ getApplicationSettings().setInternalErrorPage(InternalErrorPage.class);
+ getApplicationSettings().setPageExpiredErrorPage(PageExpiredErrorPage.class);
+ }
- /**
- * Debug settings
- */
- private void setDebugSettings() {
- getDebugSettings().setAjaxDebugModeEnabled(debug);
- getDebugSettings().setComponentUseCheck(debug);
- getDebugSettings().setDevelopmentUtilitiesEnabled(debug);
- getDebugSettings().setLinePreciseReportingOnAddComponentEnabled(debug);
- getDebugSettings().setLinePreciseReportingOnNewComponentEnabled(debug);
- getDebugSettings().setOutputComponentPath(debug);
- getDebugSettings().setOutputMarkupContainerClassName(debug);
- }
+ /**
+ * Debug settings
+ */
+ private void setDebugSettings() {
+ getDebugSettings().setAjaxDebugModeEnabled(debug);
+ getDebugSettings().setComponentUseCheck(debug);
+ getDebugSettings().setDevelopmentUtilitiesEnabled(debug);
+ getDebugSettings().setLinePreciseReportingOnAddComponentEnabled(debug);
+ getDebugSettings().setLinePreciseReportingOnNewComponentEnabled(debug);
+ getDebugSettings().setOutputComponentPath(debug);
+ getDebugSettings().setOutputMarkupContainerClassName(debug);
+ }
- /**
- * Exception settings
- */
- private void setExceptionSettings() {
- getExceptionSettings().setUnexpectedExceptionDisplay(
- debug ? IExceptionSettings.SHOW_EXCEPTION_PAGE : IExceptionSettings.SHOW_INTERNAL_ERROR_PAGE);
- }
+ /**
+ * Exception settings
+ */
+ private void setExceptionSettings() {
+ getExceptionSettings().setUnexpectedExceptionDisplay(
+ debug ? IExceptionSettings.SHOW_EXCEPTION_PAGE : IExceptionSettings.SHOW_INTERNAL_ERROR_PAGE);
+ }
- /**
- * Framework settings
- */
- private void setFrameworkSettings() {
- getFrameworkSettings().setDetachListener(null);
- }
+ /**
+ * Framework settings
+ */
+ private void setFrameworkSettings() {
+ getFrameworkSettings().setDetachListener(null);
+ }
- /**
- * Markup settings
- */
- private void setMarkupSettings() {
- getMarkupSettings().setAutomaticLinking(false);
- getMarkupSettings().setCompressWhitespace(optimize);
- getMarkupSettings().setDefaultAfterDisabledLink("</strike");
- getMarkupSettings().setDefaultBeforeDisabledLink("<strike>");
- getMarkupSettings().setDefaultMarkupEncoding(DataContext.ENCODING);
- // getMarkupSettings().setMarkupCache(???);
- // getMarkupSettings().setMarkupParserFactory(???);
- getMarkupSettings().setStripComments(optimize);
- getMarkupSettings().setStripWicketTags(true);
+ /**
+ * Markup settings
+ */
+ private void setMarkupSettings() {
+ getMarkupSettings().setAutomaticLinking(false);
+ getMarkupSettings().setCompressWhitespace(optimize);
+ getMarkupSettings().setDefaultAfterDisabledLink("</strike");
+ getMarkupSettings().setDefaultBeforeDisabledLink("<strike>");
+ getMarkupSettings().setDefaultMarkupEncoding(DataContext.ENCODING);
+ // getMarkupSettings().setMarkupCache(???);
+ // getMarkupSettings().setMarkupParserFactory(???);
+ getMarkupSettings().setStripComments(optimize);
+ getMarkupSettings().setStripWicketTags(true);
- getMarkupSettings().setThrowExceptionOnMissingXmlDeclaration(false);
- }
+ getMarkupSettings().setThrowExceptionOnMissingXmlDeclaration(false);
+ }
- /**
- * Page settings
- */
- private void setPageSettings() {
- // getPageSettings().addComponentResolver(???);
- getPageSettings().setVersionPagesByDefault(true);
- }
+ /**
+ * Page settings
+ */
+ private void setPageSettings() {
+ // getPageSettings().addComponentResolver(???);
+ getPageSettings().setVersionPagesByDefault(true);
+ }
- /**
- * Request cycle settings
- */
- private void setRequestCycleSettings() {
- // getRequestCycleSettings().addResponseFilter(???);
- getRequestCycleSettings().setBufferResponse(true);
- getRequestCycleSettings().setGatherExtendedBrowserInfo(false);
- getRequestCycleSettings().setRenderStrategy(RenderStrategy.REDIRECT_TO_BUFFER);
- getRequestCycleSettings().setResponseRequestEncoding(DataContext.ENCODING);
- getRequestCycleSettings().setTimeout(WebContext.HTTP_TIME_OUT);
- }
+ /**
+ * Request cycle settings
+ */
+ private void setRequestCycleSettings() {
+ // getRequestCycleSettings().addResponseFilter(???);
+ getRequestCycleSettings().setBufferResponse(true);
+ getRequestCycleSettings().setGatherExtendedBrowserInfo(false);
+ getRequestCycleSettings().setRenderStrategy(RenderStrategy.REDIRECT_TO_BUFFER);
+ getRequestCycleSettings().setResponseRequestEncoding(DataContext.ENCODING);
+ getRequestCycleSettings().setTimeout(WebContext.HTTP_TIME_OUT);
+ }
- /**
- * Request logger settings
- */
- private void setRequestLoggerSettings() {
- getRequestLoggerSettings().setRecordSessionSize(debug);
- getRequestLoggerSettings().setRequestLoggerEnabled(debug);
- getRequestLoggerSettings().setRequestsWindowSize(WebContext.HTTP_REQUEST_LOGGER_WINDOW_SIZE);
- }
+ /**
+ * Request logger settings
+ */
+ private void setRequestLoggerSettings() {
+ getRequestLoggerSettings().setRecordSessionSize(debug);
+ getRequestLoggerSettings().setRequestLoggerEnabled(debug);
+ getRequestLoggerSettings().setRequestsWindowSize(WebContext.HTTP_REQUEST_LOGGER_WINDOW_SIZE);
+ }
- /**
- * Resource settings
- */
- private void setResourceSettings() {
- for (IStringResourceLoader message : messages) {
- getResourceSettings().getStringResourceLoaders().add(message);
- }
- getResourceSettings().setDefaultCacheDuration(optimize ? WebContext.HTTP_CACHE_DURATION : Duration.NONE);
+ /**
+ * Resource settings
+ */
+ private void setResourceSettings() {
+ for (IStringResourceLoader message : messages) {
+ getResourceSettings().getStringResourceLoaders().add(message);
+ }
+ getResourceSettings().setDefaultCacheDuration(optimize ? WebContext.HTTP_CACHE_DURATION : Duration.NONE);
- getResourceSettings().setJavaScriptCompressor(optimize ? new DefaultJavaScriptCompressor() : null);
+ getResourceSettings().setJavaScriptCompressor(optimize ? new DefaultJavaScriptCompressor() : null);
- getResourceSettings().setCssCompressor(optimize ? new NoOpTextCompressor() : null);
+ getResourceSettings().setCssCompressor(optimize ? new NoOpTextCompressor() : null);
- getResourceSettings().setParentFolderPlaceholder(null);
- getResourceSettings().setResourcePollFrequency(null);
+ getResourceSettings().setParentFolderPlaceholder(null);
+ getResourceSettings().setResourcePollFrequency(null);
- getResourceSettings().setThrowExceptionOnMissingResource(true);
- getResourceSettings().setUseDefaultOnMissingResource(!debug);
- }
+ getResourceSettings().setThrowExceptionOnMissingResource(true);
+ getResourceSettings().setUseDefaultOnMissingResource(!debug);
+ }
- /**
- * Security settings
- */
- private void setSecuritySettings() {
- getSecuritySettings().setAuthorizationStrategy(new AuthStrategy());
+ /**
+ * Security settings
+ */
+ private void setSecuritySettings() {
+ getSecuritySettings().setAuthorizationStrategy(new AuthStrategy());
- // Customize the cookie age for the authentification stategy
- IAuthenticationStrategy authStrategy = new DefaultAuthenticationStrategy(WebContext.AUTH_COOKIE_KEY) {
+ // Customize the cookie age for the authentification stategy
+ IAuthenticationStrategy authStrategy = new DefaultAuthenticationStrategy(WebContext.AUTH_COOKIE_KEY) {
- /** Cookie utils with custom settings */
- private CookieUtils cookieUtils;
+ /** Cookie utils with custom settings */
+ private CookieUtils cookieUtils;
- protected CookieUtils getCookieUtils() {
- if (cookieUtils == null) {
- cookieUtils = new CookieUtils();
- cookieUtils.getSettings().setMaxAge(WebContext.AUTH_COOKIE_MAX_AGE);
- }
- return cookieUtils;
- }
- };
- getSecuritySettings().setAuthenticationStrategy(authStrategy);
+ protected CookieUtils getCookieUtils() {
+ if (cookieUtils == null) {
+ cookieUtils = new CookieUtils();
+ cookieUtils.getSettings().setMaxAge(WebContext.AUTH_COOKIE_MAX_AGE);
+ }
+ return cookieUtils;
+ }
+ };
+ getSecuritySettings().setAuthenticationStrategy(authStrategy);
- getSecuritySettings().setEnforceMounts(false);
- }
+ getSecuritySettings().setEnforceMounts(false);
+ }
- /**
- * Configure the mapping of urls
- */
- private void mountUrls() {
+ /**
+ * Configure the mapping of urls
+ */
+ private void mountUrls() {
- getRootRequestMapperAsCompound().add(new MountedMapper("/campagne/list", ListCampagnesPage.class));
- mountPage("/campagne/list", ListCampagnesPage.class);
- getRootRequestMapperAsCompound().add(new MountedMapper("/campagne/edit", ManageCampagnePage.class));
- mountPage("/campagne/edit", ManageCampagnePage.class);
- getRootRequestMapperAsCompound().add(new MountedMapper("/campagne/view", ReadCampagnePage.class));
- mountPage("/campagne/view", ReadCampagnePage.class);
+ getRootRequestMapperAsCompound().add(new MountedMapper("/campagne/list", ListCampagnesPage.class));
+ mountPage("/campagne/list", ListCampagnesPage.class);
+ getRootRequestMapperAsCompound().add(new MountedMapper("/campagne/edit", ManageCampagnePage.class));
+ mountPage("/campagne/edit", ManageCampagnePage.class);
+ getRootRequestMapperAsCompound().add(new MountedMapper("/campagne/view", ReadCampagnePage.class));
+ mountPage("/campagne/view", ReadCampagnePage.class);
- getRootRequestMapperAsCompound().add(
- new MountMapper("/config", new PackageMapper(PackageName.forClass(ListConfigurationPage.class))));
+ getRootRequestMapperAsCompound().add(
+ new MountMapper("/config", new PackageMapper(PackageName.forClass(ListConfigurationPage.class))));
- getRootRequestMapperAsCompound().add(new MountedMapper("/extraction/list", ListExtractionsPage.class));
- mountPage("/extraction/list", ListExtractionsPage.class);
- getRootRequestMapperAsCompound().add(new MountedMapper("/extraction/edit", ManageExtractionPage.class));
- mountPage("/extraction/edit", ManageExtractionPage.class);
- getRootRequestMapperAsCompound().add(new MountedMapper("/extraction/view", ReadExtractionPage.class));
- mountPage("/extraction/view", ReadExtractionPage.class);
+ getRootRequestMapperAsCompound().add(new MountedMapper("/extraction/list", ListExtractionsPage.class));
+ mountPage("/extraction/list", ListExtractionsPage.class);
+ getRootRequestMapperAsCompound().add(new MountedMapper("/extraction/edit", ManageExtractionPage.class));
+ mountPage("/extraction/edit", ManageExtractionPage.class);
+ getRootRequestMapperAsCompound().add(new MountedMapper("/extraction/view", ReadExtractionPage.class));
+ mountPage("/extraction/view", ReadExtractionPage.class);
- getRootRequestMapperAsCompound().add(new MountedMapper("/lot/list", ListLotsPage.class));
- mountPage("/lot/list", ListLotsPage.class);
- getRootRequestMapperAsCompound().add(new MountedMapper("/lot/edit", ManageLotPage.class));
- mountPage("/lot/edit", ManageLotPage.class);
- getRootRequestMapperAsCompound().add(new MountedMapper("/lot/view", ReadLotPage.class));
- mountPage("/lot/view", ReadLotPage.class);
+ getRootRequestMapperAsCompound().add(new MountedMapper("/lot/list", ListLotsPage.class));
+ mountPage("/lot/list", ListLotsPage.class);
+ getRootRequestMapperAsCompound().add(new MountedMapper("/lot/edit", ManageLotPage.class));
+ mountPage("/lot/edit", ManageLotPage.class);
+ getRootRequestMapperAsCompound().add(new MountedMapper("/lot/view", ReadLotPage.class));
+ mountPage("/lot/view", ReadLotPage.class);
- getRootRequestMapperAsCompound().add(new MountedMapper("/personne/list", ListPersonnesPage.class));
- mountPage("/personne/list", ListPersonnesPage.class);
- getRootRequestMapperAsCompound().add(new MountedMapper("/personne/edit", ManagePersonnePage.class));
- mountPage("/personne/edit", ManagePersonnePage.class);
- getRootRequestMapperAsCompound().add(new MountedMapper("/personne/view", ReadPersonnePage.class));
- mountPage("/personne/view", ReadPersonnePage.class);
+ getRootRequestMapperAsCompound().add(new MountedMapper("/personne/list", ListPersonnesPage.class));
+ mountPage("/personne/list", ListPersonnesPage.class);
+ getRootRequestMapperAsCompound().add(new MountedMapper("/personne/edit", ManagePersonnePage.class));
+ mountPage("/personne/edit", ManagePersonnePage.class);
+ getRootRequestMapperAsCompound().add(new MountedMapper("/personne/view", ReadPersonnePage.class));
+ mountPage("/personne/view", ReadPersonnePage.class);
- getRootRequestMapperAsCompound().add(new MountedMapper("/purification/list", ListPurificationsPage.class));
- mountPage("/purification/list", ListPurificationsPage.class);
- getRootRequestMapperAsCompound().add(new MountedMapper("/purification/edit", ManagePurificationPage.class));
- mountPage("/purification/edit", ManagePurificationPage.class);
- getRootRequestMapperAsCompound().add(new MountedMapper("/purification/view", ReadPurificationPage.class));
- mountPage("/purification/view", ReadPurificationPage.class);
+ getRootRequestMapperAsCompound().add(new MountedMapper("/purification/list", ListPurificationsPage.class));
+ mountPage("/purification/list", ListPurificationsPage.class);
+ getRootRequestMapperAsCompound().add(new MountedMapper("/purification/edit", ManagePurificationPage.class));
+ mountPage("/purification/edit", ManagePurificationPage.class);
+ getRootRequestMapperAsCompound().add(new MountedMapper("/purification/view", ReadPurificationPage.class));
+ mountPage("/purification/view", ReadPurificationPage.class);
- getRootRequestMapperAsCompound().add(new MountedMapper("/specimen/list", ListSpecimensPage.class));
- mountPage("/specimen/list", ListSpecimensPage.class);
- getRootRequestMapperAsCompound().add(new MountedMapper("/specimen/edit", ManageSpecimenPage.class));
- mountPage("/specimen/edit", ManageSpecimenPage.class);
- getRootRequestMapperAsCompound().add(new MountedMapper("/specimen/view", ReadSpecimenPage.class));
- mountPage("/specimen/view", ReadSpecimenPage.class);
+ getRootRequestMapperAsCompound().add(new MountedMapper("/specimen/list", ListSpecimensPage.class));
+ mountPage("/specimen/list", ListSpecimensPage.class);
+ getRootRequestMapperAsCompound().add(new MountedMapper("/specimen/edit", ManageSpecimenPage.class));
+ mountPage("/specimen/edit", ManageSpecimenPage.class);
+ getRootRequestMapperAsCompound().add(new MountedMapper("/specimen/view", ReadSpecimenPage.class));
+ mountPage("/specimen/view", ReadSpecimenPage.class);
- getRootRequestMapperAsCompound().add(new MountedMapper("/station/list", ListStationsPage.class));
- mountPage("/station/list", ListStationsPage.class);
- getRootRequestMapperAsCompound().add(new MountedMapper("/station/edit", ManageStationPage.class));
- mountPage("/station/edit", ManageStationPage.class);
- getRootRequestMapperAsCompound().add(new MountedMapper("/station/view", ReadStationPage.class));
- mountPage("/station/view", ReadStationPage.class);
-
- getRootRequestMapperAsCompound().add(new MountedMapper("/molecule/list", ListMoleculesPage.class));
+ getRootRequestMapperAsCompound().add(new MountedMapper("/station/list", ListStationsPage.class));
+ mountPage("/station/list", ListStationsPage.class);
+ getRootRequestMapperAsCompound().add(new MountedMapper("/station/edit", ManageStationPage.class));
+ mountPage("/station/edit", ManageStationPage.class);
+ getRootRequestMapperAsCompound().add(new MountedMapper("/station/view", ReadStationPage.class));
+ mountPage("/station/view", ReadStationPage.class);
+
+ getRootRequestMapperAsCompound().add(new MountedMapper("/molecule/list", ListMoleculesPage.class));
mountPage("/molecule/list", ListMoleculesPage.class);
getRootRequestMapperAsCompound().add(new MountedMapper("/molecule/edit", ManageMoleculePage.class));
mountPage("/molecule/edit", ManageMoleculePage.class);
getRootRequestMapperAsCompound().add(new MountedMapper("/molecule/view", ReadMoleculePage.class));
mountPage("/molecule/view", ReadMoleculePage.class);
- getRootRequestMapperAsCompound().add(new MountedMapper("/testBio/list", ListTestsBioPage.class));
- mountPage("/testBio/list", ListTestsBioPage.class);
- getRootRequestMapperAsCompound().add(new MountedMapper("/testBio/edit", ManageTestBioPage.class));
- mountPage("/testBio/edit", ManageTestBioPage.class);
- getRootRequestMapperAsCompound().add(new MountedMapper("/testBio/view", ReadTestBioPage.class));
- mountPage("/testBio/view", ReadTestBioPage.class);
+ getRootRequestMapperAsCompound().add(new MountedMapper("/testBio/list", ListTestsBioPage.class));
+ mountPage("/testBio/list", ListTestsBioPage.class);
+ getRootRequestMapperAsCompound().add(new MountedMapper("/testBio/edit", ManageTestBioPage.class));
+ mountPage("/testBio/edit", ManageTestBioPage.class);
+ getRootRequestMapperAsCompound().add(new MountedMapper("/testBio/view", ReadTestBioPage.class));
+ mountPage("/testBio/view", ReadTestBioPage.class);
- getRootRequestMapperAsCompound().add(new MountedMapper("/utilisateur/edit", ManageUtilisateurPage.class));
- mountPage("/utilisateur/edit", ManageUtilisateurPage.class);
- getRootRequestMapperAsCompound().add(new MountedMapper("/utilisateur/update", UpdateUtilisateurPage.class));
- mountPage("/utilisateur/update", UpdateUtilisateurPage.class);
+ getRootRequestMapperAsCompound().add(new MountedMapper("/utilisateur/edit", ManageUtilisateurPage.class));
+ mountPage("/utilisateur/edit", ManageUtilisateurPage.class);
+ getRootRequestMapperAsCompound().add(new MountedMapper("/utilisateur/update", UpdateUtilisateurPage.class));
+ mountPage("/utilisateur/update", UpdateUtilisateurPage.class);
- getRootRequestMapperAsCompound().add(new MountedMapper("/contact", ContactPage.class));
- mountPage("/contact", ContactPage.class);
- getRootRequestMapperAsCompound().add(new MountedMapper("/register", RegisterPage.class));
- mountPage("/register", RegisterPage.class);
- getRootRequestMapperAsCompound().add(new MountedMapper("/passwordLost", ResetPasswordPage.class));
- mountPage("/passwordLost", ResetPasswordPage.class);
+ getRootRequestMapperAsCompound().add(new MountedMapper("/contact", ContactPage.class));
+ mountPage("/contact", ContactPage.class);
+ getRootRequestMapperAsCompound().add(new MountedMapper("/register", RegisterPage.class));
+ mountPage("/register", RegisterPage.class);
+ getRootRequestMapperAsCompound().add(new MountedMapper("/passwordLost", ResetPasswordPage.class));
+ mountPage("/passwordLost", ResetPasswordPage.class);
- getRootRequestMapperAsCompound().add(new MountedMapper("/search", SearchPage.class));
+ getRootRequestMapperAsCompound().add(new MountedMapper("/search", SearchPage.class));
mountPage("/search", SearchPage.class);
- }
+ }
}
\ No newline at end of file
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/config/WebContext.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/config/WebContext.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/config/WebContext.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -67,133 +67,133 @@
@Configuration
public abstract class WebContext {
- /** Cookie key for authentification */
- public static final String AUTH_COOKIE_KEY = "LoggedIn";
+ /** Cookie key for authentification */
+ public static final String AUTH_COOKIE_KEY = "LoggedIn";
- /** Cookie max age for authentification */
- public static final int AUTH_COOKIE_MAX_AGE = (int) Duration.days(1).seconds();
+ /** Cookie max age for authentification */
+ public static final int AUTH_COOKIE_MAX_AGE = (int) Duration.days(1).seconds();
- /**
- * Countries: Locale -> country code + country name (sorted by country name)
- */
- public static final Map<Locale, Map<String, String>> COUNTRIES;
+ /**
+ * Countries: Locale -> country code + country name (sorted by country name)
+ */
+ public static final Map<Locale, Map<String, String>> COUNTRIES;
- /** Country codes: Locale -> country code (sorted by country name) */
- public static final Map<Locale, List<String>> COUNTRY_CODES;
+ /** Country codes: Locale -> country code (sorted by country name) */
+ public static final Map<Locale, List<String>> COUNTRY_CODES;
- /** HTTP cache duraction */
- public static final Duration HTTP_CACHE_DURATION = Duration.days(1);
+ /** HTTP cache duraction */
+ public static final Duration HTTP_CACHE_DURATION = Duration.days(1);
- /** HTTP maximum upload */
- public static final Bytes HTTP_MAXIMUM_UPLOAD = Bytes.megabytes(1);
+ /** HTTP maximum upload */
+ public static final Bytes HTTP_MAXIMUM_UPLOAD = Bytes.megabytes(1);
- /** HTTP request logger window size */
- public static final int HTTP_REQUEST_LOGGER_WINDOW_SIZE = 2000;
+ /** HTTP request logger window size */
+ public static final int HTTP_REQUEST_LOGGER_WINDOW_SIZE = 2000;
- /** HTTP session max page maps */
- public static final int HTTP_SESSION_MAX_PAGE_MAPS = 5;
+ /** HTTP session max page maps */
+ public static final int HTTP_SESSION_MAX_PAGE_MAPS = 5;
- /** HTTP time out */
- public static final Duration HTTP_TIME_OUT = Duration.seconds(30);
+ /** HTTP time out */
+ public static final Duration HTTP_TIME_OUT = Duration.seconds(30);
- /** Référentiels codes */
- public static final List<Integer> REFERENTIEL_CODES = new ArrayList<Integer>(DataContext.REFERENTIELS.keySet());
+ /** Référentiels codes */
+ public static final List<Integer> REFERENTIEL_CODES = new ArrayList<Integer>(DataContext.REFERENTIELS.keySet());
- /** Percent format precision */
- public static final int PERCENT_PRECISION = 2;
+ /** Percent format precision */
+ public static final int PERCENT_PRECISION = 2;
- /** The maximum number of digits allowed in the fraction portion of doubles **/
- public static final int DOUBLE_MAX_FRACTION_DIGIT = 3;
+ /** The maximum number of digits allowed in the fraction portion of doubles **/
+ public static final int DOUBLE_MAX_FRACTION_DIGIT = 3;
- /** The maximum rows number displayed for a list page */
- public static final int ROWS_PER_PAGE = 20;
+ /** The maximum rows number displayed for a list page */
+ public static final int ROWS_PER_PAGE = 20;
- /** Message source for data layer */
- @Resource(name = "dataMessageSource")
- private MessageSourceAccessor dataMessageSource;
+ /** Message source for data layer */
+ @Resource(name = "dataMessageSource")
+ private MessageSourceAccessor dataMessageSource;
- /** Validator factory of the data layer */
- @Resource(name = "validatorFactory")
- private ValidatorFactory validatorFactory;
+ /** Validator factory of the data layer */
+ @Resource(name = "validatorFactory")
+ private ValidatorFactory validatorFactory;
- /** Debug mode */
- @Value("${app.debug}")
- protected boolean appDebugProperty;
+ /** Debug mode */
+ @Value("${app.debug}")
+ protected boolean appDebugProperty;
- /** Optimize mode */
- @Value("${app.optimize}")
- protected boolean appOptimizeProperty;
+ /** Optimize mode */
+ @Value("${app.optimize}")
+ protected boolean appOptimizeProperty;
- /** Wicket configuration string ("development" or "deployment") */
- @Value("${wicket.configuration}")
- protected String wicketConfiguration;
+ /** Wicket configuration string ("development" or "deployment") */
+ @Value("${wicket.configuration}")
+ protected String wicketConfiguration;
- static {
- Map<Locale, Map<String, String>> countries = new HashMap<Locale, Map<String, String>>(
- DataContext.LOCALES.size());
- Map<Locale, List<String>> countryCodes = new HashMap<Locale, List<String>>(DataContext.LOCALES.size());
- for (Locale locale : DataContext.LOCALES) {
- // Build (country code + country name) list
- List<Pair<String, Pair<String, String>>> sortedCountryList = new ArrayList<Pair<String, Pair<String, String>>>(
- DataContext.COUNTRY_CODES.size());
- for (String countryCode : DataContext.COUNTRY_CODES) {
- String countryName = new Locale(locale.getLanguage(), countryCode).getDisplayCountry(locale);
- sortedCountryList.add(new Pair<String, Pair<String, String>>(countryCode, new Pair<String, String>(
- StringTools.replaceAccents(countryName), countryName)));
- }
- // Sort by name (country code + country name) list
- Collections.sort(sortedCountryList, new Comparator<Pair<String, Pair<String, String>>>() {
- @Override
- public int compare(Pair<String, Pair<String, String>> pair1, Pair<String, Pair<String, String>> pair2) {
- return String.CASE_INSENSITIVE_ORDER.compare(pair1.getValue().getKey(), pair2.getValue().getKey());
- }
- });
- // Build (locale -> (country code + country name)) map (sorted by
- // name)
- // Build (locale -> (country code)) map (sorted by name)
- Map<String, String> sortedCountryMap = new LinkedHashMap<String, String>(sortedCountryList.size());
- List<String> sortedCountryCodesList = new ArrayList<String>(sortedCountryList.size());
- for (Pair<String, Pair<String, String>> countryPair : sortedCountryList) {
- sortedCountryMap.put(countryPair.getKey(), countryPair.getValue().getValue());
- sortedCountryCodesList.add(countryPair.getKey());
- }
- countries.put(locale, Collections.unmodifiableMap(sortedCountryMap));
- countryCodes.put(locale, Collections.unmodifiableList(sortedCountryCodesList));
- }
- COUNTRIES = Collections.unmodifiableMap(countries);
- COUNTRY_CODES = Collections.unmodifiableMap(countryCodes);
- }
+ static {
+ Map<Locale, Map<String, String>> countries = new HashMap<Locale, Map<String, String>>(
+ DataContext.LOCALES.size());
+ Map<Locale, List<String>> countryCodes = new HashMap<Locale, List<String>>(DataContext.LOCALES.size());
+ for (Locale locale : DataContext.LOCALES) {
+ // Build (country code + country name) list
+ List<Pair<String, Pair<String, String>>> sortedCountryList = new ArrayList<Pair<String, Pair<String, String>>>(
+ DataContext.COUNTRY_CODES.size());
+ for (String countryCode : DataContext.COUNTRY_CODES) {
+ String countryName = new Locale(locale.getLanguage(), countryCode).getDisplayCountry(locale);
+ sortedCountryList.add(new Pair<String, Pair<String, String>>(countryCode, new Pair<String, String>(
+ StringTools.replaceAccents(countryName), countryName)));
+ }
+ // Sort by name (country code + country name) list
+ Collections.sort(sortedCountryList, new Comparator<Pair<String, Pair<String, String>>>() {
+ @Override
+ public int compare(Pair<String, Pair<String, String>> pair1, Pair<String, Pair<String, String>> pair2) {
+ return String.CASE_INSENSITIVE_ORDER.compare(pair1.getValue().getKey(), pair2.getValue().getKey());
+ }
+ });
+ // Build (locale -> (country code + country name)) map (sorted by
+ // name)
+ // Build (locale -> (country code)) map (sorted by name)
+ Map<String, String> sortedCountryMap = new LinkedHashMap<String, String>(sortedCountryList.size());
+ List<String> sortedCountryCodesList = new ArrayList<String>(sortedCountryList.size());
+ for (Pair<String, Pair<String, String>> countryPair : sortedCountryList) {
+ sortedCountryMap.put(countryPair.getKey(), countryPair.getValue().getValue());
+ sortedCountryCodesList.add(countryPair.getKey());
+ }
+ countries.put(locale, Collections.unmodifiableMap(sortedCountryMap));
+ countryCodes.put(locale, Collections.unmodifiableList(sortedCountryCodesList));
+ }
+ COUNTRIES = Collections.unmodifiableMap(countries);
+ COUNTRY_CODES = Collections.unmodifiableMap(countryCodes);
+ }
- /**
- * @return Internationalization messages for web layer
- */
- @Bean
- public MessageSourceAccessor webMessageSource() {
- // The ResourceBundleMessageSource does not handle UTF-8, so we use the
- // Reloadable one
- ReloadableResourceBundleMessageSource source = new ReloadableResourceBundleMessageSource();
- source.setBasename("web");
- source.setDefaultEncoding(DataContext.ENCODING);
- source.setCacheSeconds(-1);
- return new MessageSourceAccessor(source);
- }
+ /**
+ * @return Internationalization messages for web layer
+ */
+ @Bean
+ public MessageSourceAccessor webMessageSource() {
+ // The ResourceBundleMessageSource does not handle UTF-8, so we use the
+ // Reloadable one
+ ReloadableResourceBundleMessageSource source = new ReloadableResourceBundleMessageSource();
+ source.setBasename("web");
+ source.setDefaultEncoding(DataContext.ENCODING);
+ source.setCacheSeconds(-1);
+ return new MessageSourceAccessor(source);
+ }
- /**
- * @return A Validator for models of the data & web layers
- */
- @Bean
- public ModelValidator webModelValidator() {
- return new ModelValidatorImpl(validatorFactory, webMessageSource(), dataMessageSource);
- }
+ /**
+ * @return A Validator for models of the data & web layers
+ */
+ @Bean
+ public ModelValidator webModelValidator() {
+ return new ModelValidatorImpl(validatorFactory, webMessageSource(), dataMessageSource);
+ }
- /**
- * @return Wicket application
- */
- @Bean
- public WebApplication webApplication() {
- RuntimeConfigurationType runtimeWicketConf = RuntimeConfigurationType
- .valueOf(wicketConfiguration.toUpperCase());
- return new WebApplicationImpl(appDebugProperty, appOptimizeProperty, runtimeWicketConf, new WebMessages(
- dataMessageSource), new WebMessages(webMessageSource()));
- }
+ /**
+ * @return Wicket application
+ */
+ @Bean
+ public WebApplication webApplication() {
+ RuntimeConfigurationType runtimeWicketConf = RuntimeConfigurationType
+ .valueOf(wicketConfiguration.toUpperCase());
+ return new WebApplicationImpl(appDebugProperty, appOptimizeProperty, runtimeWicketConf, new WebMessages(
+ dataMessageSource), new WebMessages(webMessageSource()));
+ }
}
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/ContactPage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/ContactPage.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/ContactPage.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -52,94 +52,94 @@
*/
public class ContactPage extends TemplatePage {
- /** Action : send */
- private static final String ACTION_SEND = "Send";
+ /** Action : send */
+ private static final String ACTION_SEND = "Send";
- /** Service : personne */
- @SpringBean
- private PersonneService personneService;
+ /** Service : personne */
+ @SpringBean
+ private PersonneService personneService;
- /** Validateur modèle */
- @SpringBean(name = "webModelValidator") private ModelValidator validator;
+ /** Validateur modèle */
+ @SpringBean(name = "webModelValidator") private ModelValidator validator;
- /**
- * Constructeur
- */
- public ContactPage() {
- super(ContactPage.class);
+ /**
+ * Constructeur
+ */
+ public ContactPage() {
+ super(ContactPage.class);
- // AuthMode = the user is authenticated, we already know his e-mail, the form is not protected with a captcha
- final boolean authMode = getSession().getRole() != AuthRole.VISITOR;
+ // AuthMode = the user is authenticated, we already know his e-mail, the form is not protected with a captcha
+ final boolean authMode = getSession().getRole() != AuthRole.VISITOR;
- // Models initialization
- final IModel<ContactModel> contactModel = new Model<ContactModel>(new ContactModel());
- final IModel<CaptchaModel> captchaModel = new Model<CaptchaModel>(new CaptchaModel());
- if (!authMode) {
- captchaModel.getObject().setCaptchaTextGenerated(CaptchaTools.random());
- }
+ // Models initialization
+ final IModel<ContactModel> contactModel = new Model<ContactModel>(new ContactModel());
+ final IModel<CaptchaModel> captchaModel = new Model<CaptchaModel>(new CaptchaModel());
+ if (!authMode) {
+ captchaModel.getObject().setCaptchaTextGenerated(CaptchaTools.random());
+ }
- final Form<Void> formView = new Form<Void>("Form");
+ final Form<Void> formView = new Form<Void>("Form");
- // ContactModel fields
- formView.add(new TextField<String>("ContactModel.mail", authMode ? new Model<String>(getSession()
- .getUtilisateur().getCourriel()) : new PropertyModel<String>(contactModel, "mail"))
- .setEnabled(!authMode));
- formView.add(new TextField<String>("ContactModel.subject", new PropertyModel<String>(contactModel, "subject")));
- formView.add(new TextArea<String>("ContactModel.message", new PropertyModel<String>(contactModel, "message")));
+ // ContactModel fields
+ formView.add(new TextField<String>("ContactModel.mail", authMode ? new Model<String>(getSession()
+ .getUtilisateur().getCourriel()) : new PropertyModel<String>(contactModel, "mail"))
+ .setEnabled(!authMode));
+ formView.add(new TextField<String>("ContactModel.subject", new PropertyModel<String>(contactModel, "subject")));
+ formView.add(new TextArea<String>("ContactModel.message", new PropertyModel<String>(contactModel, "message")));
- // CaptchaModel fields
- MarkupContainer captcha = new WebMarkupContainer("captcha");
- captcha.setVisibilityAllowed(!authMode);
- captcha.add(new NonCachingImage("CaptchaModel.captchaImage", new CaptchaImageResource(captchaModel.getObject()
- .getCaptchaTextGenerated())));
- final Component captchaTextView = new TextField<String>("CaptchaModel.captchaText", new PropertyModel<String>(
- captchaModel, "captchaText"));
- captcha.add(captchaTextView);
- formView.add(captcha);
+ // CaptchaModel fields
+ MarkupContainer captcha = new WebMarkupContainer("captcha");
+ captcha.setVisibilityAllowed(!authMode);
+ captcha.add(new NonCachingImage("CaptchaModel.captchaImage", new CaptchaImageResource(captchaModel.getObject()
+ .getCaptchaTextGenerated())));
+ final Component captchaTextView = new TextField<String>("CaptchaModel.captchaText", new PropertyModel<String>(
+ captchaModel, "captchaText"));
+ captcha.add(captchaTextView);
+ formView.add(captcha);
- // Action button
- formView.add(new SubmittableButton(ACTION_SEND, new SubmittableButtonEvents() {
+ // Action button
+ formView.add(new SubmittableButton(ACTION_SEND, new SubmittableButtonEvents() {
- @Override
- public void onProcess() throws EmailException {
- personneService.sendMailAdmins(contactModel.getObject().getSubject(), contactModel.getObject()
- .getMessage(), contactModel.getObject().getMail());
- }
+ @Override
+ public void onProcess() throws EmailException {
+ personneService.sendMailAdmins(contactModel.getObject().getSubject(), contactModel.getObject()
+ .getMessage(), contactModel.getObject().getMail());
+ }
- @Override
- public void onSuccess() {
- successNextPage(ACTION_SEND);
+ @Override
+ public void onSuccess() {
+ successNextPage(ACTION_SEND);
- setResponsePage(getApplication().getHomePage());
- }
+ setResponsePage(getApplication().getHomePage());
+ }
- @Override
- public void onValidate() {
- // Enforce the sender e-mail in authMode
- if (authMode) {
- contactModel.getObject().setMail(getSession().getUtilisateur().getCourriel());
- }
+ @Override
+ public void onValidate() {
+ // Enforce the sender e-mail in authMode
+ if (authMode) {
+ contactModel.getObject().setMail(getSession().getUtilisateur().getCourriel());
+ }
- // Validate ContactModel
- addValidationErrors(validator.validate(contactModel.getObject(), getSession().getLocale()));
+ // Validate ContactModel
+ addValidationErrors(validator.validate(contactModel.getObject(), getSession().getLocale()));
- // Validate CaptchaModel
- if (!authMode && !captchaModel.getObject().validate()) {
- errorCurrentPage(captchaTextView);
- }
- }
+ // Validate CaptchaModel
+ if (!authMode && !captchaModel.getObject().validate()) {
+ errorCurrentPage(captchaTextView);
+ }
+ }
- /**
- * Reset the captcha, on each page reload
- */
- /**
- * private void resetCaptcha() { if (!authMode) { captchaModel.getObject().setCaptchaText(null);
- * captchaModel.getObject().setCaptchaTextGenerated(CaptchaTools.random()); formView.replace(new
- * NonCachingImage("CaptchaModel.captchaImage", new CaptchaImageResource(
- * captchaModel.getObject().getCaptchaTextGenerated()))); } }
- **/
- }));
+ /**
+ * Reset the captcha, on each page reload
+ */
+ /**
+ * private void resetCaptcha() { if (!authMode) { captchaModel.getObject().setCaptchaText(null);
+ * captchaModel.getObject().setCaptchaTextGenerated(CaptchaTools.random()); formView.replace(new
+ * NonCachingImage("CaptchaModel.captchaImage", new CaptchaImageResource(
+ * captchaModel.getObject().getCaptchaTextGenerated()))); } }
+ **/
+ }));
- add(formView);
- }
+ add(formView);
+ }
}
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/HomePage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/HomePage.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/HomePage.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -81,282 +81,282 @@
*/
public final class HomePage extends TemplatePage {
- /** Logger */
- private static final Log LOG = LogTools.getLog();
+ /** Logger */
+ private static final Log LOG = LogTools.getLog();
- /** Action : login */
- private static final String ACTION_LOGIN = "Login";
+ /** Action : login */
+ private static final String ACTION_LOGIN = "Login";
- /** Service : personne */
- @SpringBean
- private PersonneService personneService;
+ /** Service : personne */
+ @SpringBean
+ private PersonneService personneService;
- /** Service : campagne */
- @SpringBean
- private CampagneService campagneService;
+ /** Service : campagne */
+ @SpringBean
+ private CampagneService campagneService;
- /** Service : station */
- @SpringBean
- private StationService stationService;
+ /** Service : station */
+ @SpringBean
+ private StationService stationService;
- /** Service : specimen */
- @SpringBean
- private SpecimenService specimenService;
+ /** Service : specimen */
+ @SpringBean
+ private SpecimenService specimenService;
- /** Service : lots */
- @SpringBean
- private LotService lotService;
+ /** Service : lots */
+ @SpringBean
+ private LotService lotService;
- /** Service : extraction */
- @SpringBean
- private ExtractionService extractionService;
+ /** Service : extraction */
+ @SpringBean
+ private ExtractionService extractionService;
- /** Service : purification */
- @SpringBean
- private PurificationService purificationService;
+ /** Service : purification */
+ @SpringBean
+ private PurificationService purificationService;
- /** Service : test biologique */
- @SpringBean
- private TestBioService testBioService;
+ /** Service : test biologique */
+ @SpringBean
+ private TestBioService testBioService;
- /** Validateur modèle */
- @SpringBean(name = "webModelValidator")
- private ModelValidator validator;
+ /** Validateur modèle */
+ @SpringBean(name = "webModelValidator")
+ private ModelValidator validator;
- /**
- * Constructeur
- */
- public HomePage() {
- super(HomePage.class);
- addVisitorContent();
- addUserContent();
- addAdminContent();
- }
+ /**
+ * Constructeur
+ */
+ public HomePage() {
+ super(HomePage.class);
+ addVisitorContent();
+ addUserContent();
+ addAdminContent();
+ }
- /**
- * Ajour du contenu administrateur
- */
- private void addAdminContent() {
- final AuthContainer adminContent = new AuthContainer("Content.ADMIN", AuthRole.ADMIN);
- if (adminContent.isAuthorized()) {
+ /**
+ * Ajour du contenu administrateur
+ */
+ private void addAdminContent() {
+ final AuthContainer adminContent = new AuthContainer("Content.ADMIN", AuthRole.ADMIN);
+ if (adminContent.isAuthorized()) {
- // Affiche les utilisateurs à valider sur la page d'accueil ADMIN
- final MarkupContainer invalidUtilisateursView = new WebMarkupContainer("InvalidUtilisateurs.List");
- invalidUtilisateursView.setOutputMarkupId(true);
+ // Affiche les utilisateurs à valider sur la page d'accueil ADMIN
+ final MarkupContainer invalidUtilisateursView = new WebMarkupContainer("InvalidUtilisateurs.List");
+ invalidUtilisateursView.setOutputMarkupId(true);
- final List<Utilisateur> utilisateursInvalid = personneService.listUtilisateursInvalid();
- invalidUtilisateursView.setVisibilityAllowed(!utilisateursInvalid.isEmpty());
- if (invalidUtilisateursView.isVisibilityAllowed()) {
- invalidUtilisateursView.add(new DataView<Utilisateur>("InvalidUtilisateurs.List.Utilisateur",
- new LoadableDetachableSortableListDataProvider<Utilisateur>(utilisateursInvalid, getSession()
- .getLocale())) {
- @Override
- protected void populateItem(Item<Utilisateur> item) {
- Utilisateur utilisateur = item.getModelObject();
- item.add(new Label("InvalidUtilisateurs.List.Utilisateur.Label", utilisateur.toString()));
+ final List<Utilisateur> utilisateursInvalid = personneService.listUtilisateursInvalid();
+ invalidUtilisateursView.setVisibilityAllowed(!utilisateursInvalid.isEmpty());
+ if (invalidUtilisateursView.isVisibilityAllowed()) {
+ invalidUtilisateursView.add(new DataView<Utilisateur>("InvalidUtilisateurs.List.Utilisateur",
+ new LoadableDetachableSortableListDataProvider<Utilisateur>(utilisateursInvalid, getSession()
+ .getLocale())) {
+ @Override
+ protected void populateItem(Item<Utilisateur> item) {
+ Utilisateur utilisateur = item.getModelObject();
+ item.add(new Label("InvalidUtilisateurs.List.Utilisateur.Label", utilisateur.toString()));
- // Action : valider l'utilisateur
- item.add(new AjaxFallbackLink<Utilisateur>("InvalidUtilisateurs.List.Utilisateur.Valid",
- new Model<Utilisateur>(utilisateur)) {
- @Override
- public void onClick(AjaxRequestTarget target) {
- try {
- // Validation
- personneService.validAndUpdateUtilisateur(getModelObject());
- successCurrentPage(ManageUtilisateurPage.class, "Update");
+ // Action : valider l'utilisateur
+ item.add(new AjaxFallbackLink<Utilisateur>("InvalidUtilisateurs.List.Utilisateur.Valid",
+ new Model<Utilisateur>(utilisateur)) {
+ @Override
+ public void onClick(AjaxRequestTarget target) {
+ try {
+ // Validation
+ personneService.validAndUpdateUtilisateur(getModelObject());
+ successCurrentPage(ManageUtilisateurPage.class, "Update");
- // Mise à jour de la liste
- CollectionTools.setter(utilisateursInvalid,
- personneService.listUtilisateursInvalid());
- invalidUtilisateursView.setVisibilityAllowed(!utilisateursInvalid.isEmpty());
- if (target != null) {
- target.add(invalidUtilisateursView);
- }
- } catch (DataConstraintException e) {
- errorCurrentPage(ManageUtilisateurPage.class, "Update", e);
- }
- refreshFeedbackPage(target);
- }
- });
+ // Mise à jour de la liste
+ CollectionTools.setter(utilisateursInvalid,
+ personneService.listUtilisateursInvalid());
+ invalidUtilisateursView.setVisibilityAllowed(!utilisateursInvalid.isEmpty());
+ if (target != null) {
+ target.add(invalidUtilisateursView);
+ }
+ } catch (DataConstraintException e) {
+ errorCurrentPage(ManageUtilisateurPage.class, "Update", e);
+ }
+ refreshFeedbackPage(target);
+ }
+ });
- // Action : mettre à jour l'utilisateur (redirection vers le formulaire)
- item.add(new Link<Utilisateur>("InvalidUtilisateurs.List.Utilisateur.Update",
- new Model<Utilisateur>(utilisateur)) {
- @Override
- public void onClick() {
- setResponsePage(new ManageUtilisateurPage(getModelObject().getIdPersonne(),
- new CallerPage(HomePage.class)));
- }
- });
+ // Action : mettre à jour l'utilisateur (redirection vers le formulaire)
+ item.add(new Link<Utilisateur>("InvalidUtilisateurs.List.Utilisateur.Update",
+ new Model<Utilisateur>(utilisateur)) {
+ @Override
+ public void onClick() {
+ setResponsePage(new ManageUtilisateurPage(getModelObject().getIdPersonne(),
+ new CallerPage(HomePage.class)));
+ }
+ });
- // Action : supprimer l'utilisateur
- Link<Utilisateur> deleteLink = new AjaxFallbackLink<Utilisateur>(
- "InvalidUtilisateurs.List.Utilisateur.Reject", new Model<Utilisateur>(utilisateur)) {
- @Override
- public void onClick(AjaxRequestTarget target) {
- // Suppression
- personneService.rejectUtilisateur(getModelObject());
- successCurrentPage(ManageUtilisateurPage.class, "Reject");
+ // Action : supprimer l'utilisateur
+ Link<Utilisateur> deleteLink = new AjaxFallbackLink<Utilisateur>(
+ "InvalidUtilisateurs.List.Utilisateur.Reject", new Model<Utilisateur>(utilisateur)) {
+ @Override
+ public void onClick(AjaxRequestTarget target) {
+ // Suppression
+ personneService.rejectUtilisateur(getModelObject());
+ successCurrentPage(ManageUtilisateurPage.class, "Reject");
- // Mise à jour de la liste
- CollectionTools.setter(utilisateursInvalid, personneService.listUtilisateursInvalid());
- invalidUtilisateursView.setVisibilityAllowed(!utilisateursInvalid.isEmpty());
- if (target != null) {
- target.add(invalidUtilisateursView);
- }
- refreshFeedbackPage(target);
- }
- };
- deleteLink.add(new JSConfirmationBehavior(getString("Confirm")));
- item.add(deleteLink);
- }
- });
+ // Mise à jour de la liste
+ CollectionTools.setter(utilisateursInvalid, personneService.listUtilisateursInvalid());
+ invalidUtilisateursView.setVisibilityAllowed(!utilisateursInvalid.isEmpty());
+ if (target != null) {
+ target.add(invalidUtilisateursView);
+ }
+ refreshFeedbackPage(target);
+ }
+ };
+ deleteLink.add(new JSConfirmationBehavior(getString("Confirm")));
+ item.add(deleteLink);
+ }
+ });
- }
+ }
- adminContent.add(invalidUtilisateursView);
+ adminContent.add(invalidUtilisateursView);
- }
- add(adminContent);
- }
+ }
+ add(adminContent);
+ }
- /**
- * Ajour du contenu utilisateur (s'affiche également pour l'admin)
- */
- private void addUserContent() {
- AuthContainer userContent = new AuthContainer("Content.USER", AuthRole.USER, AuthRole.ADMIN);
- if (userContent.isAuthorized()) {
- userContent.add(new Label(getResource() + ".Statistics.Personnes", String.valueOf(personneService
- .countPersonnes())));
- userContent.add(new Label(getResource() + ".Statistics.Campagnes", String.valueOf(campagneService
- .countCampagnes())));
- userContent.add(new Label(getResource() + ".Statistics.Stations", String.valueOf(stationService
- .countStations())));
- userContent.add(new Label(getResource() + ".Statistics.Specimens", String.valueOf(specimenService
- .countSpecimens())));
- userContent.add(new Label(getResource() + ".Statistics.Lots", String.valueOf(lotService.countLots())));
- userContent.add(new Label(getResource() + ".Statistics.Extractions", String.valueOf(extractionService
- .countExtractions())));
- userContent.add(new Label(getResource() + ".Statistics.Purifications", String.valueOf(purificationService
- .countPurifications())));
- userContent.add(new Label(getResource() + ".Statistics.TestsBio", String.valueOf(testBioService
- .countResultatsTestsBio())));
+ /**
+ * Ajour du contenu utilisateur (s'affiche également pour l'admin)
+ */
+ private void addUserContent() {
+ AuthContainer userContent = new AuthContainer("Content.USER", AuthRole.USER, AuthRole.ADMIN);
+ if (userContent.isAuthorized()) {
+ userContent.add(new Label(getResource() + ".Statistics.Personnes", String.valueOf(personneService
+ .countPersonnes())));
+ userContent.add(new Label(getResource() + ".Statistics.Campagnes", String.valueOf(campagneService
+ .countCampagnes())));
+ userContent.add(new Label(getResource() + ".Statistics.Stations", String.valueOf(stationService
+ .countStations())));
+ userContent.add(new Label(getResource() + ".Statistics.Specimens", String.valueOf(specimenService
+ .countSpecimens())));
+ userContent.add(new Label(getResource() + ".Statistics.Lots", String.valueOf(lotService.countLots())));
+ userContent.add(new Label(getResource() + ".Statistics.Extractions", String.valueOf(extractionService
+ .countExtractions())));
+ userContent.add(new Label(getResource() + ".Statistics.Purifications", String.valueOf(purificationService
+ .countPurifications())));
+ userContent.add(new Label(getResource() + ".Statistics.TestsBio", String.valueOf(testBioService
+ .countResultatsTestsBio())));
- // affichage du volet droits
- Link<Utilisateur> detailsRight = new Link<Utilisateur>("HomePage.Rights.User.Details",
- new Model<Utilisateur>(getSession().getUtilisateur())) {
- @Override
- public void onClick() {
- setResponsePage(new ReadUtilisateurPage(getModelObject().getIdPersonne(), new CallerPage(
- HomePage.this)));
- }
+ // affichage du volet droits
+ Link<Utilisateur> detailsRight = new Link<Utilisateur>("HomePage.Rights.User.Details",
+ new Model<Utilisateur>(getSession().getUtilisateur())) {
+ @Override
+ public void onClick() {
+ setResponsePage(new ReadUtilisateurPage(getModelObject().getIdPersonne(), new CallerPage(
+ HomePage.this)));
+ }
- /** {@inheritDoc} */
- @Override
- protected CharSequence getURL() {
- return super.getURL() + "#rights";
- }
+ /** {@inheritDoc} */
+ @Override
+ protected CharSequence getURL() {
+ return super.getURL() + "#rights";
+ }
- };
- userContent.add(detailsRight);
+ };
+ userContent.add(detailsRight);
- if (getSession().getUtilisateur().getTypeDroit() == TypeDroit.ADMINISTRATEUR) {
- userContent.add(new Label("HomePage.Rights.User1", getString("HomePage.Rights.Admin")));
- // pas d'affichage du lien de détails
- detailsRight.setVisibilityAllowed(false);
- EmptyPanel rights2 = new EmptyPanel("HomePage.Rights.User2");
- rights2.setVisibilityAllowed(false);
- userContent.add(rights2);
- } else {
- // pour l'utilisateur simple, nb de campagnes et de lots accessibles affichés
- Integer nbCampagnesDroits = getSession().getUtilisateur().getCampagnesDroits().size();
- Integer nbLotsDroits = getSession().getUtilisateur().getLotsDroits().size();
- String msgRights = MessageFormat.format(getString("HomePage.Rights.User"), nbCampagnesDroits,
- nbLotsDroits);
- userContent.add(new Label("HomePage.Rights.User1", msgRights));
+ if (getSession().getUtilisateur().getTypeDroit() == TypeDroit.ADMINISTRATEUR) {
+ userContent.add(new Label("HomePage.Rights.User1", getString("HomePage.Rights.Admin")));
+ // pas d'affichage du lien de détails
+ detailsRight.setVisibilityAllowed(false);
+ EmptyPanel rights2 = new EmptyPanel("HomePage.Rights.User2");
+ rights2.setVisibilityAllowed(false);
+ userContent.add(rights2);
+ } else {
+ // pour l'utilisateur simple, nb de campagnes et de lots accessibles affichés
+ Integer nbCampagnesDroits = getSession().getUtilisateur().getCampagnesDroits().size();
+ Integer nbLotsDroits = getSession().getUtilisateur().getLotsDroits().size();
+ String msgRights = MessageFormat.format(getString("HomePage.Rights.User"), nbCampagnesDroits,
+ nbLotsDroits);
+ userContent.add(new Label("HomePage.Rights.User1", msgRights));
- Integer nbCampagnesCrees = getSession().getUtilisateur().getCampagnesCreees().size();
- String msgRights2 = MessageFormat.format(getString("HomePage.Rights.User2"), nbCampagnesCrees);
- Label rights2 = new Label("HomePage.Rights.User2", msgRights2);
- rights2.setVisibilityAllowed(nbCampagnesCrees != 0);
- userContent.add(rights2);
- }
- }
- add(userContent);
- }
+ Integer nbCampagnesCrees = getSession().getUtilisateur().getCampagnesCreees().size();
+ String msgRights2 = MessageFormat.format(getString("HomePage.Rights.User2"), nbCampagnesCrees);
+ Label rights2 = new Label("HomePage.Rights.User2", msgRights2);
+ rights2.setVisibilityAllowed(nbCampagnesCrees != 0);
+ userContent.add(rights2);
+ }
+ }
+ add(userContent);
+ }
- /**
- * Ajout du contenu visiteur
- */
- private void addVisitorContent() {
- AuthContainer visitorContent = new AuthContainer("Content.VISITOR", AuthRole.VISITOR);
- if (visitorContent.isAuthorized()) {
+ /**
+ * Ajout du contenu visiteur
+ */
+ private void addVisitorContent() {
+ AuthContainer visitorContent = new AuthContainer("Content.VISITOR", AuthRole.VISITOR);
+ if (visitorContent.isAuthorized()) {
- // Initialisation des modèles pour la connexion
- final IModel<LoginModel> loginModel = new Model<LoginModel>(new LoginModel());
- final IModel<Utilisateur> utilisateurModel = new Model<Utilisateur>(new Utilisateur());
+ // Initialisation des modèles pour la connexion
+ final IModel<LoginModel> loginModel = new Model<LoginModel>(new LoginModel());
+ final IModel<Utilisateur> utilisateurModel = new Model<Utilisateur>(new Utilisateur());
- // Formulaire de connexion
- final Form<Void> formView = new Form<Void>("Form");
+ // Formulaire de connexion
+ final Form<Void> formView = new Form<Void>("Form");
- // Champs du formulaire
- formView.add(new TextField<String>("Personne.courriel", new PropertyModel<String>(utilisateurModel,
- "courriel")));
- formView.add(new PasswordTextField("LoginModel.password", new PropertyModel<String>(loginModel, "password"))
- .setRequired(false));
- formView.add(new CheckBox("LoginModel.rememberMe", new PropertyModel<Boolean>(loginModel, "rememberMe")));
+ // Champs du formulaire
+ formView.add(new TextField<String>("Personne.courriel", new PropertyModel<String>(utilisateurModel,
+ "courriel")));
+ formView.add(new PasswordTextField("LoginModel.password", new PropertyModel<String>(loginModel, "password"))
+ .setRequired(false));
+ formView.add(new CheckBox("LoginModel.rememberMe", new PropertyModel<Boolean>(loginModel, "rememberMe")));
- // Action : connexion
- formView.add(new SubmittableButton(ACTION_LOGIN, new SubmittableButtonEvents() {
+ // Action : connexion
+ formView.add(new SubmittableButton(ACTION_LOGIN, new SubmittableButtonEvents() {
- @Override
- public void onProcess() throws DataNotFoundException, DataConstraintException {
- if (getSession().authenticate(utilisateurModel.getObject().getCourriel(),
- personneService.hashPassword(loginModel.getObject().getPassword()))) {
- Utilisateur user = personneService.loadUtilisateur(utilisateurModel.getObject().getCourriel());
- getSession().connectUser(user, loginModel.getObject().getRememberMe());
- LOG.info("connexion de l'utilisateur : " + user.getPrenom() + " " + user.getNom());
- } else {
- // si échec dans l'authentification
- if (CollectionTools.containsWithValue(personneService.listUtilisateursInvalid(), "courriel",
- AccessType.GETTER, utilisateurModel.getObject().getCourriel())) {
- // si le courriel est celui d'un utilisateur non validé, message d'erreur approprié
- error(getString("HomePage.Login.NotYetValid"));
- } else {
- error(getString("HomePage.Login.KO"));
- }
- // Ràz du mot de passe
- loginModel.getObject().setPassword(null);
- }
- }
+ @Override
+ public void onProcess() throws DataNotFoundException, DataConstraintException {
+ if (getSession().authenticate(utilisateurModel.getObject().getCourriel(),
+ personneService.hashPassword(loginModel.getObject().getPassword()))) {
+ Utilisateur user = personneService.loadUtilisateur(utilisateurModel.getObject().getCourriel());
+ getSession().connectUser(user, loginModel.getObject().getRememberMe());
+ LOG.info("connexion de l'utilisateur : " + user.getPrenom() + " " + user.getNom());
+ } else {
+ // si échec dans l'authentification
+ if (CollectionTools.containsWithValue(personneService.listUtilisateursInvalid(), "courriel",
+ AccessType.GETTER, utilisateurModel.getObject().getCourriel())) {
+ // si le courriel est celui d'un utilisateur non validé, message d'erreur approprié
+ error(getString("HomePage.Login.NotYetValid"));
+ } else {
+ error(getString("HomePage.Login.KO"));
+ }
+ // Ràz du mot de passe
+ loginModel.getObject().setPassword(null);
+ }
+ }
- @Override
- public void onSuccess() {
- successNextPage(ACTION_LOGIN);
- setResponsePage(getApplication().getHomePage());
- }
+ @Override
+ public void onSuccess() {
+ successNextPage(ACTION_LOGIN);
+ setResponsePage(getApplication().getHomePage());
+ }
- @Override
- public void onValidate() {
- // Validate Utilisateur
- addValidationErrors(validator.validate(utilisateurModel.getObject(), getSession().getLocale(),
- "courriel"));
- // Validate LoginModel
- addValidationErrors(validator.validate(loginModel.getObject(), getSession().getLocale(),
- "password", "rememberMe"));
- }
- }));
+ @Override
+ public void onValidate() {
+ // Validate Utilisateur
+ addValidationErrors(validator.validate(utilisateurModel.getObject(), getSession().getLocale(),
+ "courriel"));
+ // Validate LoginModel
+ addValidationErrors(validator.validate(loginModel.getObject(), getSession().getLocale(),
+ "password", "rememberMe"));
+ }
+ }));
- // Lien pour regénérer le mot de passe
- formView.add(new BookmarkablePageLink<Void>(ResetPasswordPage.class.getSimpleName(),
- ResetPasswordPage.class));
+ // Lien pour regénérer le mot de passe
+ formView.add(new BookmarkablePageLink<Void>(ResetPasswordPage.class.getSimpleName(),
+ ResetPasswordPage.class));
- // Lien pour s'enregistrer
- visitorContent.add(new BookmarkablePageLink<Void>(RegisterPage.class.getSimpleName(), RegisterPage.class));
+ // Lien pour s'enregistrer
+ visitorContent.add(new BookmarkablePageLink<Void>(RegisterPage.class.getSimpleName(), RegisterPage.class));
- visitorContent.add(formView);
+ visitorContent.add(formView);
- }
- add(visitorContent);
- }
+ }
+ add(visitorContent);
+ }
}
\ No newline at end of file
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/SandboxPage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/SandboxPage.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/SandboxPage.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -42,55 +42,55 @@
*/
public class SandboxPage extends WebPage {
- /** Logger */
- private static final Log LOG = LogTools.getLog();
+ /** Logger */
+ private static final Log LOG = LogTools.getLog();
- /** DAO */
- @SpringBean
- private GenericDao dao;
+ /** DAO */
+ @SpringBean
+ private GenericDao dao;
- /** session factory hibernate **/
- // @SpringBean
- // private SessionFactory sf;
- /**
- * Constructor
- */
- @SuppressWarnings("unchecked")
- public SandboxPage() {
- long count = dao.count(PersonneDao.CRITERIA_LIST_ADMINS);
- LOG.debug(count);
+ /** session factory hibernate **/
+ // @SpringBean
+ // private SessionFactory sf;
+ /**
+ * Constructor
+ */
+ @SuppressWarnings("unchecked")
+ public SandboxPage() {
+ long count = dao.count(PersonneDao.CRITERIA_LIST_ADMINS);
+ LOG.debug(count);
- List<Utilisateur> users = (List<Utilisateur>) dao.list(DetachedCriteria.forClass(Utilisateur.class)
- .add(Restrictions.eq("typeDroit", TypeDroit.ADMINISTRATEUR))
- .add(Restrictions.eq("estValide", Boolean.TRUE)));
- LOG.debug(users);
- for (Utilisateur u : users) {
- LOG.debug(u);
- }
+ List<Utilisateur> users = (List<Utilisateur>) dao.list(DetachedCriteria.forClass(Utilisateur.class)
+ .add(Restrictions.eq("typeDroit", TypeDroit.ADMINISTRATEUR))
+ .add(Restrictions.eq("estValide", Boolean.TRUE)));
+ LOG.debug(users);
+ for (Utilisateur u : users) {
+ LOG.debug(u);
+ }
- List<Utilisateur> users2 = (List<Utilisateur>) dao.list(PersonneDao.CRITERIA_LIST_ADMINS);
- LOG.debug(users2);
- for (Utilisateur u : users2) {
- LOG.debug(u);
- }
+ List<Utilisateur> users2 = (List<Utilisateur>) dao.list(PersonneDao.CRITERIA_LIST_ADMINS);
+ LOG.debug(users2);
+ for (Utilisateur u : users2) {
+ LOG.debug(u);
+ }
- // LOG.debug("createur proxy : " + (p1.createur instanceof HibernateProxy));
- // LOG.debug(p1.createur);
- // Personne pers2 = (Personne) session.get(Personne.class, p1.createur.idPersonne);
- // LOG.debug(pers2.nom);
+ // LOG.debug("createur proxy : " + (p1.createur instanceof HibernateProxy));
+ // LOG.debug(p1.createur);
+ // Personne pers2 = (Personne) session.get(Personne.class, p1.createur.idPersonne);
+ // LOG.debug(pers2.nom);
- /*
- * Station st1 = (Station) session.load(Station.class, 47); LOG.debug(st1.getClass().getSimpleName());
- * LOG.debug(st1.idStation + " " + st1.nom); LOG.debug("createur proxy : " + (st1.createur instanceof
- * HibernateProxy)); LOG.debug(st1.createur); Personne pers1 = (Personne) session.load(Personne.class, 27);
- * LOG.debug(pers1.getClass().getSimpleName()); LOG.debug(pers1.idPersonne + " " + pers1.nom);
- * LOG.debug("proxy : " + (pers1 instanceof HibernateProxy)); LOG.debug(pers1.purificationsCrees);
- */
+ /*
+ * Station st1 = (Station) session.load(Station.class, 47); LOG.debug(st1.getClass().getSimpleName());
+ * LOG.debug(st1.idStation + " " + st1.nom); LOG.debug("createur proxy : " + (st1.createur instanceof
+ * HibernateProxy)); LOG.debug(st1.createur); Personne pers1 = (Personne) session.load(Personne.class, 27);
+ * LOG.debug(pers1.getClass().getSimpleName()); LOG.debug(pers1.idPersonne + " " + pers1.nom);
+ * LOG.debug("proxy : " + (pers1 instanceof HibernateProxy)); LOG.debug(pers1.purificationsCrees);
+ */
- /*
- * Map cacheEntries = sf.getStatistics() .getSecondLevelCacheStatistics(regionName) .getEntries();
- */
+ /*
+ * Map cacheEntries = sf.getStatistics() .getSecondLevelCacheStatistics(regionName) .getEntries();
+ */
- // session.close();
- }
+ // session.close();
+ }
}
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/TemplatePage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/TemplatePage.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/TemplatePage.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -74,387 +74,387 @@
*/
public abstract class TemplatePage extends WebPage implements IAjaxIndicatorAware, IHeaderContributor {
- /** Action: logout */
- private static final String ACTION_LOGOUT = "Logout";
+ /** Action: logout */
+ private static final String ACTION_LOGOUT = "Logout";
- /** Ajax indicator ID */
- private static final String ID_AJAX_INDICATOR = "AjaxIndicator";
+ /** Ajax indicator ID */
+ private static final String ID_AJAX_INDICATOR = "AjaxIndicator";
- /** Logger */
- private static final Log LOG = LogTools.getLog();
+ /** Logger */
+ private static final Log LOG = LogTools.getLog();
- /** Pattern: enum value label (simpleClassName.valueString) */
- public static final String PATTERN_ENUM_VALUE_LABEL = "%s.%s";
+ /** Pattern: enum value label (simpleClassName.valueString) */
+ public static final String PATTERN_ENUM_VALUE_LABEL = "%s.%s";
- /** Pattern: exception error on action (resource.action.simpleClassName) */
- private static final String PATTERN_ERROR_ACTION_EXCEPTION = "%s.%s.%s";
+ /** Pattern: exception error on action (resource.action.simpleClassName) */
+ private static final String PATTERN_ERROR_ACTION_EXCEPTION = "%s.%s.%s";
- /** Pattern: message error (resource.KO) */
- private static final String PATTERN_ERROR_MESSAGE = "%s.KO";
+ /** Pattern: message error (resource.KO) */
+ private static final String PATTERN_ERROR_MESSAGE = "%s.KO";
- /** Pattern error property: "property message" */
- private static final String PATTERN_ERROR_MESSAGE_VALIDATOR = "%s - %s";
+ /** Pattern error property: "property message" */
+ private static final String PATTERN_ERROR_MESSAGE_VALIDATOR = "%s - %s";
- /** Pattern: page title head (- resource) */
- private static final String PATTERN_PANEL_PAGE_TITLE_HEAD = " - %s";
+ /** Pattern: page title head (- resource) */
+ private static final String PATTERN_PANEL_PAGE_TITLE_HEAD = " - %s";
- /** Pattern: message success (resource.action.OK) */
- private static final String PATTERN_SUCCESS_ACTION_MESSAGE = "%s.%s.OK";
+ /** Pattern: message success (resource.action.OK) */
+ private static final String PATTERN_SUCCESS_ACTION_MESSAGE = "%s.%s.OK";
- /** Year */
- private static final String YEAR = String.valueOf(Calendar.getInstance().get(Calendar.YEAR));
+ /** Year */
+ private static final String YEAR = String.valueOf(Calendar.getInstance().get(Calendar.YEAR));
- /** Feedback panel container */
- private final MarkupContainer feedbackPanelContainer;
+ /** Feedback panel container */
+ private final MarkupContainer feedbackPanelContainer;
- /** Resource key */
- private final String resource;
+ /** Resource key */
+ private final String resource;
- /**
- * Constructor
- * @param page Page (permet de construire la "resource" qui servira d'identifiant à la page)
- */
- protected TemplatePage(Class<? extends TemplatePage> page) {
- super(new PageParameters());
- AssertTools.assertNotNull(page);
- resource = page.getSimpleName();
- addPageTitles();
- add(new BookmarkablePageLink<Void>(HomePage.class.getSimpleName(), getApplication().getHomePage()));
- add(createUserSatellite());
- add(createUserSearch());
- add(createVisitorMenu());
- add(createUserMenu());
- createLanguageLinks();
- feedbackPanelContainer = new WebMarkupContainer("FeedbackPageContainer");
- feedbackPanelContainer.add(new FeedbackPanel("FeedbackPage"));
- feedbackPanelContainer.setOutputMarkupId(true);
- add(feedbackPanelContainer);
- add(new Label("Year", YEAR));
- add(new BookmarkablePageLink<Void>(ContactPage.class.getSimpleName(), ContactPage.class));
- setVersioned(true);
- }
+ /**
+ * Constructor
+ * @param page Page (permet de construire la "resource" qui servira d'identifiant à la page)
+ */
+ protected TemplatePage(Class<? extends TemplatePage> page) {
+ super(new PageParameters());
+ AssertTools.assertNotNull(page);
+ resource = page.getSimpleName();
+ addPageTitles();
+ add(new BookmarkablePageLink<Void>(HomePage.class.getSimpleName(), getApplication().getHomePage()));
+ add(createUserSatellite());
+ add(createUserSearch());
+ add(createVisitorMenu());
+ add(createUserMenu());
+ createLanguageLinks();
+ feedbackPanelContainer = new WebMarkupContainer("FeedbackPageContainer");
+ feedbackPanelContainer.add(new FeedbackPanel("FeedbackPage"));
+ feedbackPanelContainer.setOutputMarkupId(true);
+ add(feedbackPanelContainer);
+ add(new Label("Year", YEAR));
+ add(new BookmarkablePageLink<Void>(ContactPage.class.getSimpleName(), ContactPage.class));
+ setVersioned(true);
+ }
- /** {@inheritDoc} */
- public void renderHead(IHeaderResponse response) {
- // dynamic declaration of the menu Css due to the internationalization
- response.renderCSSReference(getString("TemplatePage.Css.Menu"));
+ /** {@inheritDoc} */
+ public void renderHead(IHeaderResponse response) {
+ // dynamic declaration of the menu Css due to the internationalization
+ response.renderCSSReference(getString("TemplatePage.Css.Menu"));
- // scroll up to the anchor if any feedback message
- if (!getSession().getFeedbackMessages().isEmpty()) {
- response.renderOnLoadJavaScript("location.hash='header'");
- // LOG.debug("session FeedbackMessages is not empty");
- // for (FeedbackMessage msg : getSession().getFeedbackMessages()) {
- // LOG.debug(msg.getLevelAsString() + " : " + msg.getMessage() + ", from : " + msg.getReporter());
- // }
- }
- }
+ // scroll up to the anchor if any feedback message
+ if (!getSession().getFeedbackMessages().isEmpty()) {
+ response.renderOnLoadJavaScript("location.hash='header'");
+ // LOG.debug("session FeedbackMessages is not empty");
+ // for (FeedbackMessage msg : getSession().getFeedbackMessages()) {
+ // LOG.debug(msg.getLevelAsString() + " : " + msg.getMessage() + ", from : " + msg.getReporter());
+ // }
+ }
+ }
- /**
- * Création des liens vers les sélections de langue
- */
- private void createLanguageLinks() {
- this.add(new Link<Void>("SelectFrenchLang") {
- // Cas où on clique sur le drapeau français
- @Override
- public void onClick() {
- this.getSession().setLocale(Locale.FRENCH);
- }
- });
- this.add(new Link<Void>("SelectEnglishLang") {
- // Cas où on clique sur le drapeau anglais
- @Override
- public void onClick() {
- this.getSession().setLocale(Locale.ENGLISH);
- }
- });
- }
+ /**
+ * Création des liens vers les sélections de langue
+ */
+ private void createLanguageLinks() {
+ this.add(new Link<Void>("SelectFrenchLang") {
+ // Cas où on clique sur le drapeau français
+ @Override
+ public void onClick() {
+ this.getSession().setLocale(Locale.FRENCH);
+ }
+ });
+ this.add(new Link<Void>("SelectEnglishLang") {
+ // Cas où on clique sur le drapeau anglais
+ @Override
+ public void onClick() {
+ this.getSession().setLocale(Locale.ENGLISH);
+ }
+ });
+ }
- /**
- * Création de la partie satellite spécifique à un utilisateur
- * @return Le conteneur
- */
- private AuthContainer createUserSatellite() {
- AuthContainer userSatellite = new AuthContainer("Satellite.USER", AuthRole.USER, AuthRole.ADMIN);
- if (userSatellite.isAuthorized()) {
- Link<Void> link = new BookmarkablePageLink<Void>(UpdateUtilisateurPage.class.getSimpleName(),
- UpdateUtilisateurPage.class);
+ /**
+ * Création de la partie satellite spécifique à un utilisateur
+ * @return Le conteneur
+ */
+ private AuthContainer createUserSatellite() {
+ AuthContainer userSatellite = new AuthContainer("Satellite.USER", AuthRole.USER, AuthRole.ADMIN);
+ if (userSatellite.isAuthorized()) {
+ Link<Void> link = new BookmarkablePageLink<Void>(UpdateUtilisateurPage.class.getSimpleName(),
+ UpdateUtilisateurPage.class);
- link.add(new Label("Utilisateur", new PropertyModel<String>(this, "session.utilisateur")));
- userSatellite.add(link);
- userSatellite.add(new Link<Void>(TemplatePage.class.getSimpleName() + "." + ACTION_LOGOUT) {
- @Override
- public void onClick() {
- ((AuthSession) getSession()).logout();
- successNextPage(TemplatePage.class, ACTION_LOGOUT);
- setResponsePage(getApplication().getHomePage());
- }
- });
- }
- return userSatellite;
- }
+ link.add(new Label("Utilisateur", new PropertyModel<String>(this, "session.utilisateur")));
+ userSatellite.add(link);
+ userSatellite.add(new Link<Void>(TemplatePage.class.getSimpleName() + "." + ACTION_LOGOUT) {
+ @Override
+ public void onClick() {
+ ((AuthSession) getSession()).logout();
+ successNextPage(TemplatePage.class, ACTION_LOGOUT);
+ setResponsePage(getApplication().getHomePage());
+ }
+ });
+ }
+ return userSatellite;
+ }
- /**
- * Création de la partie recherche spécifique à un utilisateur
- * @return Le conteneur
- */
- private AuthContainer createUserSearch() {
- AuthContainer userSatellite = new AuthContainer("Search.USER", AuthRole.USER, AuthRole.ADMIN);
+ /**
+ * Création de la partie recherche spécifique à un utilisateur
+ * @return Le conteneur
+ */
+ private AuthContainer createUserSearch() {
+ AuthContainer userSatellite = new AuthContainer("Search.USER", AuthRole.USER, AuthRole.ADMIN);
- Form<ValueMap> searchForm = new Form<ValueMap>("Search.FORM", new CompoundPropertyModel<ValueMap>(new ValueMap())) {
- protected void onSubmit() {
- ValueMap values = getModelObject();
-
- String query = values.getString("query");
- setResponsePage(new SearchPage(query));
- }
- };
- searchForm.add(new TextField<String>("query").setType(String.class));
+ Form<ValueMap> searchForm = new Form<ValueMap>("Search.FORM", new CompoundPropertyModel<ValueMap>(new ValueMap())) {
+ protected void onSubmit() {
+ ValueMap values = getModelObject();
+
+ String query = values.getString("query");
+ setResponsePage(new SearchPage(query));
+ }
+ };
+ searchForm.add(new TextField<String>("query").setType(String.class));
- userSatellite.add(searchForm);
- return userSatellite;
- }
+ userSatellite.add(searchForm);
+ return userSatellite;
+ }
- /**
- * Création du menu visiteur
- * @return Le conteneur
- */
- private AuthContainer createVisitorMenu() {
- AuthContainer visitorMenu = new AuthContainer("Menu.VISITOR", AuthRole.VISITOR);
- return visitorMenu;
- }
+ /**
+ * Création du menu visiteur
+ * @return Le conteneur
+ */
+ private AuthContainer createVisitorMenu() {
+ AuthContainer visitorMenu = new AuthContainer("Menu.VISITOR", AuthRole.VISITOR);
+ return visitorMenu;
+ }
- /**
- * Création du menu utilisateur
- * @return Le conteneur
- */
- private AuthContainer createUserMenu() {
- AuthContainer userMenu = new AuthContainer("Menu.USER", AuthRole.USER, AuthRole.ADMIN);
- if (userMenu.isAuthorized()) {
+ /**
+ * Création du menu utilisateur
+ * @return Le conteneur
+ */
+ private AuthContainer createUserMenu() {
+ AuthContainer userMenu = new AuthContainer("Menu.USER", AuthRole.USER, AuthRole.ADMIN);
+ if (userMenu.isAuthorized()) {
- userMenu.add(createAdminMenu());
+ userMenu.add(createAdminMenu());
- userMenu.add(new BookmarkablePageLink<Void>(ListPersonnesPage.class.getSimpleName(),
- ListPersonnesPage.class));
- userMenu.add(new BookmarkablePageLink<Void>(ListCampagnesPage.class.getSimpleName(),
- ListCampagnesPage.class));
- userMenu.add(new BookmarkablePageLink<Void>(ListStationsPage.class.getSimpleName(), ListStationsPage.class));
- userMenu.add(new BookmarkablePageLink<Void>(ListLotsPage.class.getSimpleName(), ListLotsPage.class));
- userMenu.add(new BookmarkablePageLink<Void>(ListSpecimensPage.class.getSimpleName(),
- ListSpecimensPage.class));
- userMenu.add(new BookmarkablePageLink<Void>(ListExtractionsPage.class.getSimpleName(),
- ListExtractionsPage.class));
- userMenu.add(new BookmarkablePageLink<Void>(ListPurificationsPage.class.getSimpleName(),
- ListPurificationsPage.class));
- userMenu.add(new BookmarkablePageLink<Void>(ListMoleculesPage.class.getSimpleName(), ListMoleculesPage.class));
- userMenu.add(new BookmarkablePageLink<Void>(ListTestsBioPage.class.getSimpleName(), ListTestsBioPage.class));
+ userMenu.add(new BookmarkablePageLink<Void>(ListPersonnesPage.class.getSimpleName(),
+ ListPersonnesPage.class));
+ userMenu.add(new BookmarkablePageLink<Void>(ListCampagnesPage.class.getSimpleName(),
+ ListCampagnesPage.class));
+ userMenu.add(new BookmarkablePageLink<Void>(ListStationsPage.class.getSimpleName(), ListStationsPage.class));
+ userMenu.add(new BookmarkablePageLink<Void>(ListLotsPage.class.getSimpleName(), ListLotsPage.class));
+ userMenu.add(new BookmarkablePageLink<Void>(ListSpecimensPage.class.getSimpleName(),
+ ListSpecimensPage.class));
+ userMenu.add(new BookmarkablePageLink<Void>(ListExtractionsPage.class.getSimpleName(),
+ ListExtractionsPage.class));
+ userMenu.add(new BookmarkablePageLink<Void>(ListPurificationsPage.class.getSimpleName(),
+ ListPurificationsPage.class));
+ userMenu.add(new BookmarkablePageLink<Void>(ListMoleculesPage.class.getSimpleName(), ListMoleculesPage.class));
+ userMenu.add(new BookmarkablePageLink<Void>(ListTestsBioPage.class.getSimpleName(), ListTestsBioPage.class));
- // userMenu.add(new BookmarkablePageLink<Void>(SandboxPage.class.getSimpleName(), SandboxPage.class));
- }
- return userMenu;
- }
+ // userMenu.add(new BookmarkablePageLink<Void>(SandboxPage.class.getSimpleName(), SandboxPage.class));
+ }
+ return userMenu;
+ }
- /**
- * Création du menu administrateur
- * @return Le conteneur
- */
- private AuthContainer createAdminMenu() {
- AuthContainer adminMenu = new AuthContainer("Menu.ADMIN", AuthRole.ADMIN);
- if (adminMenu.isAuthorized()) {
- adminMenu.add(new BookmarkablePageLink<Void>(ListConfigurationPage.class.getSimpleName(),
- ListConfigurationPage.class));
- }
- return adminMenu;
- }
+ /**
+ * Création du menu administrateur
+ * @return Le conteneur
+ */
+ private AuthContainer createAdminMenu() {
+ AuthContainer adminMenu = new AuthContainer("Menu.ADMIN", AuthRole.ADMIN);
+ if (adminMenu.isAuthorized()) {
+ adminMenu.add(new BookmarkablePageLink<Void>(ListConfigurationPage.class.getSimpleName(),
+ ListConfigurationPage.class));
+ }
+ return adminMenu;
+ }
- /**
- * Add page titles (in head and body)
- */
- private void addPageTitles() {
- String page = getString(getResource());
+ /**
+ * Add page titles (in head and body)
+ */
+ private void addPageTitles() {
+ String page = getString(getResource());
- add(new Label("PageTitleHead", String.format(PATTERN_PANEL_PAGE_TITLE_HEAD, page)));
- add(new Label("PageTitleBody", page));
- }
+ add(new Label("PageTitleHead", String.format(PATTERN_PANEL_PAGE_TITLE_HEAD, page)));
+ add(new Label("PageTitleBody", page));
+ }
- /**
- * Convert validation errors (violations) into readable message, and display them
- * @param violations Violations
- */
- public final void addValidationErrors(Collection<String> violations) {
- for (String violation : violations) {
- error(violation);
- }
- }
+ /**
+ * Convert validation errors (violations) into readable message, and display them
+ * @param violations Violations
+ */
+ public final void addValidationErrors(Collection<String> violations) {
+ for (String violation : violations) {
+ error(violation);
+ }
+ }
- /**
- * Convert validation errors (violations) into readable message, and display them
- * @param violations Violations
- */
- public final void addValidationErrors(List<Pair<String, String>> violations) {
- for (Pair<String, String> violation : violations) {
- String label = violation.getKey();
- try {
- label = getString(label);
- } catch (MissingResourceException e) {
- //
- }
- error(String.format(PATTERN_ERROR_MESSAGE_VALIDATOR, label, violation.getValue()));
- }
- }
+ /**
+ * Convert validation errors (violations) into readable message, and display them
+ * @param violations Violations
+ */
+ public final void addValidationErrors(List<Pair<String, String>> violations) {
+ for (Pair<String, String> violation : violations) {
+ String label = violation.getKey();
+ try {
+ label = getString(label);
+ } catch (MissingResourceException e) {
+ //
+ }
+ error(String.format(PATTERN_ERROR_MESSAGE_VALIDATOR, label, violation.getValue()));
+ }
+ }
- /**
- * Display an error message (pageClass.action.Exception) on the current page
- * @param pageClass Page class
- * @param action Action
- * @param exception Exception
- */
- public final void errorCurrentPage(Class<? extends TemplatePage> pageClass, String action, Exception exception) {
- AssertTools.assertNotNull(pageClass);
- AssertTools.assertNotEmpty(action);
- AssertTools.assertNotNull(exception);
- String errorMessage = getString(String.format(PATTERN_ERROR_ACTION_EXCEPTION, pageClass.getSimpleName(),
- action, exception.getClass().getSimpleName()));
- LOG.warn(errorMessage);
- error(errorMessage);
- }
+ /**
+ * Display an error message (pageClass.action.Exception) on the current page
+ * @param pageClass Page class
+ * @param action Action
+ * @param exception Exception
+ */
+ public final void errorCurrentPage(Class<? extends TemplatePage> pageClass, String action, Exception exception) {
+ AssertTools.assertNotNull(pageClass);
+ AssertTools.assertNotEmpty(action);
+ AssertTools.assertNotNull(exception);
+ String errorMessage = getString(String.format(PATTERN_ERROR_ACTION_EXCEPTION, pageClass.getSimpleName(),
+ action, exception.getClass().getSimpleName()));
+ LOG.warn(errorMessage);
+ error(errorMessage);
+ }
- /**
- * Display an error message (componentId.KO) on the current page
- * @param component Component
- */
- public final void errorCurrentPage(Component component) {
- AssertTools.assertNotNull(component);
- String errorMessage = String.format(PATTERN_ERROR_MESSAGE, component.getId());
- try {
- errorMessage = getString(errorMessage);
- } catch (MissingResourceException e) {
- //
- }
- LOG.warn(errorMessage);
- error(errorMessage);
- }
+ /**
+ * Display an error message (componentId.KO) on the current page
+ * @param component Component
+ */
+ public final void errorCurrentPage(Component component) {
+ AssertTools.assertNotNull(component);
+ String errorMessage = String.format(PATTERN_ERROR_MESSAGE, component.getId());
+ try {
+ errorMessage = getString(errorMessage);
+ } catch (MissingResourceException e) {
+ //
+ }
+ LOG.warn(errorMessage);
+ error(errorMessage);
+ }
- /**
- * Display an error message (resource.action.Exception) on the current page
- * @param action Action
- * @param exception Exception
- */
- public final void errorCurrentPage(String action, Exception exception) {
- AssertTools.assertNotEmpty(action);
- AssertTools.assertNotNull(exception);
- String errorMessage = getString(String.format(PATTERN_ERROR_ACTION_EXCEPTION, getResource(), action, exception
- .getClass().getSimpleName()));
- LOG.warn(errorMessage);
- error(errorMessage);
- }
+ /**
+ * Display an error message (resource.action.Exception) on the current page
+ * @param action Action
+ * @param exception Exception
+ */
+ public final void errorCurrentPage(String action, Exception exception) {
+ AssertTools.assertNotEmpty(action);
+ AssertTools.assertNotNull(exception);
+ String errorMessage = getString(String.format(PATTERN_ERROR_ACTION_EXCEPTION, getResource(), action, exception
+ .getClass().getSimpleName()));
+ LOG.warn(errorMessage);
+ error(errorMessage);
+ }
- /** {@inheritDoc} */
- @Override
- public final String getAjaxIndicatorMarkupId() {
- return ID_AJAX_INDICATOR;
- }
+ /** {@inheritDoc} */
+ @Override
+ public final String getAjaxIndicatorMarkupId() {
+ return ID_AJAX_INDICATOR;
+ }
- /**
- * resource getter
- * @return resource
- */
- protected final String getResource() {
- return resource;
- }
+ /**
+ * resource getter
+ * @return resource
+ */
+ protected final String getResource() {
+ return resource;
+ }
- /** {@inheritDoc} */
- @Override
- public final AuthSession getSession() {
- return (AuthSession) super.getSession();
- }
+ /** {@inheritDoc} */
+ @Override
+ public final AuthSession getSession() {
+ return (AuthSession) super.getSession();
+ }
- /**
- * Refresh feedback page and scroll up to the anchor if any feedback message
- * @param target Ajax target
- */
- protected final void refreshFeedbackPage(AjaxRequestTarget target) {
- if (target != null) {
- target.add(feedbackPanelContainer);
- // scroll up to the anchor if any feedback message
- if (!getSession().getFeedbackMessages().isEmpty()) {
- LOG.debug("REFRESH FEEDBACK BY AJAX");
- target.appendJavaScript("window.location.hash = '#header';");
- // unless go back to button after scrolling up to the anchor
- target.focusComponent(feedbackPanelContainer);
- }
- }
- }
+ /**
+ * Refresh feedback page and scroll up to the anchor if any feedback message
+ * @param target Ajax target
+ */
+ protected final void refreshFeedbackPage(AjaxRequestTarget target) {
+ if (target != null) {
+ target.add(feedbackPanelContainer);
+ // scroll up to the anchor if any feedback message
+ if (!getSession().getFeedbackMessages().isEmpty()) {
+ LOG.debug("REFRESH FEEDBACK BY AJAX");
+ target.appendJavaScript("window.location.hash = '#header';");
+ // unless go back to button after scrolling up to the anchor
+ target.focusComponent(feedbackPanelContainer);
+ }
+ }
+ }
- /**
- * Display a success message on the current page (pageClass.action.OK)
- * @param pageClass Page class
- * @param action Action
- */
- public final void successCurrentPage(Class<? extends TemplatePage> pageClass, String action) {
- info(successMessage(pageClass, action));
- }
+ /**
+ * Display a success message on the current page (pageClass.action.OK)
+ * @param pageClass Page class
+ * @param action Action
+ */
+ public final void successCurrentPage(Class<? extends TemplatePage> pageClass, String action) {
+ info(successMessage(pageClass, action));
+ }
- /**
- * Display a success message on the current page (resource.action.OK)
- * @param action Action
- */
- public final void successCurrentPage(String action) {
- info(successMessage(action));
- }
+ /**
+ * Display a success message on the current page (resource.action.OK)
+ * @param action Action
+ */
+ public final void successCurrentPage(String action) {
+ info(successMessage(action));
+ }
- /**
- * Retrieve a success message (page.action.OK)
- * @param pageClass Page class
- * @param action Action
- * @return Success message
- */
- private String successMessage(Class<? extends TemplatePage> pageClass, String action) {
- AssertTools.assertNotNull(pageClass);
- AssertTools.assertNotEmpty(action);
- return getString(String.format(PATTERN_SUCCESS_ACTION_MESSAGE, pageClass.getSimpleName(), action));
- }
+ /**
+ * Retrieve a success message (page.action.OK)
+ * @param pageClass Page class
+ * @param action Action
+ * @return Success message
+ */
+ private String successMessage(Class<? extends TemplatePage> pageClass, String action) {
+ AssertTools.assertNotNull(pageClass);
+ AssertTools.assertNotEmpty(action);
+ return getString(String.format(PATTERN_SUCCESS_ACTION_MESSAGE, pageClass.getSimpleName(), action));
+ }
- /**
- * Retrieve a success message (resource.action.OK)
- * @param action Action
- * @return Success message
- */
- private String successMessage(String action) {
- AssertTools.assertNotEmpty(action);
- return getString(String.format(PATTERN_SUCCESS_ACTION_MESSAGE, getResource(), action));
- }
+ /**
+ * Retrieve a success message (resource.action.OK)
+ * @param action Action
+ * @return Success message
+ */
+ private String successMessage(String action) {
+ AssertTools.assertNotEmpty(action);
+ return getString(String.format(PATTERN_SUCCESS_ACTION_MESSAGE, getResource(), action));
+ }
- /**
- * Display a success message on the next page (pageClass.action.OK)
- * @param pageClass Page class
- * @param action Action
- */
- public final void successNextPage(Class<? extends TemplatePage> pageClass, String action) {
- getSession().info(successMessage(pageClass, action));
- }
+ /**
+ * Display a success message on the next page (pageClass.action.OK)
+ * @param pageClass Page class
+ * @param action Action
+ */
+ public final void successNextPage(Class<? extends TemplatePage> pageClass, String action) {
+ getSession().info(successMessage(pageClass, action));
+ }
- /**
- * Display a success message on the next page (resource.action.OK)
- * @param action Action
- */
- public final void successNextPage(String action) {
- getSession().info(successMessage(action));
- }
+ /**
+ * Display a success message on the next page (resource.action.OK)
+ * @param action Action
+ */
+ public final void successNextPage(String action) {
+ getSession().info(successMessage(action));
+ }
- /**
- * Retrieve an enum value message (class.value). Null-safe methode
- * @param <E> Enum type
- * @param enumValue Enum value, null is the enumValue is null
- * @return Enum value message
- */
- public final <E extends Enum<?>> String enumValueMessage(E enumValue) {
- if (enumValue == null) {
- return null;
- }
- String enumValueMessage = String.format(PATTERN_ENUM_VALUE_LABEL, enumValue.getClass().getSimpleName(),
- enumValue.toString());
+ /**
+ * Retrieve an enum value message (class.value). Null-safe methode
+ * @param <E> Enum type
+ * @param enumValue Enum value, null is the enumValue is null
+ * @return Enum value message
+ */
+ public final <E extends Enum<?>> String enumValueMessage(E enumValue) {
+ if (enumValue == null) {
+ return null;
+ }
+ String enumValueMessage = String.format(PATTERN_ENUM_VALUE_LABEL, enumValue.getClass().getSimpleName(),
+ enumValue.toString());
- return getString(enumValueMessage);
- }
+ return getString(enumValueMessage);
+ }
}
\ No newline at end of file
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/columns/LinkProduitPropertyColumn.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/columns/LinkProduitPropertyColumn.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/columns/LinkProduitPropertyColumn.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -42,64 +42,64 @@
*/
public abstract class LinkProduitPropertyColumn<T> extends LinkPropertyColumn<T> {
- /** page used to get messages */
- private final TemplatePage page;
+ /** page used to get messages */
+ private final TemplatePage page;
- /**
- * Constructor
- * @param displayModel displayModel
- * @param sortProperty sortProperty
- * @param propertyExpression propertyExpression
- * @param page page used to get messages
- */
- public LinkProduitPropertyColumn(IModel<String> displayModel, String sortProperty, String propertyExpression,
- TemplatePage page) {
- super(displayModel, sortProperty, propertyExpression);
- this.page = page;
- }
+ /**
+ * Constructor
+ * @param displayModel displayModel
+ * @param sortProperty sortProperty
+ * @param propertyExpression propertyExpression
+ * @param page page used to get messages
+ */
+ public LinkProduitPropertyColumn(IModel<String> displayModel, String sortProperty, String propertyExpression,
+ TemplatePage page) {
+ super(displayModel, sortProperty, propertyExpression);
+ this.page = page;
+ }
- /** {@inheritDoc} */
- @Override
- public void onClick(Item<ICellPopulator<T>> item, String componentId, IModel<T> model) {
- if (model.getObject() != null) {
- Produit prod = (Produit) BeanTools.getValue(model.getObject(), AccessType.GETTER, "produit");
+ /** {@inheritDoc} */
+ @Override
+ public void onClick(Item<ICellPopulator<T>> item, String componentId, IModel<T> model) {
+ if (model.getObject() != null) {
+ Produit prod = (Produit) BeanTools.getValue(model.getObject(), AccessType.GETTER, "produit");
- if (prod.isExtrait()) {
- Extrait extrait = (Extrait) prod;
- onClickIfExtrait(extrait);
- } else {
- // le produit est une fraction
- Fraction fraction = (Fraction) prod;
- onClickIfFraction(fraction);
- }
- }
- }
+ if (prod.isExtrait()) {
+ Extrait extrait = (Extrait) prod;
+ onClickIfExtrait(extrait);
+ } else {
+ // le produit est une fraction
+ Fraction fraction = (Fraction) prod;
+ onClickIfFraction(fraction);
+ }
+ }
+ }
- /** {@inheritDoc} */
- @Override
- public void populateItem(Item<ICellPopulator<T>> item, String componentId, IModel<T> model) {
- if (model.getObject() != null) {
- // title différent suivant si le produit provient d'une extraction ou d'une purification
- Produit prod = (Produit) BeanTools.getValue(model.getObject(), AccessType.GETTER, "produit");
- if (prod.isExtrait()) {
- linkTitle = page.getString("ReadExtraction");
- } else {
- linkTitle = page.getString("ReadPurification");
- }
- }
- super.populateItem(item, componentId, model);
- }
+ /** {@inheritDoc} */
+ @Override
+ public void populateItem(Item<ICellPopulator<T>> item, String componentId, IModel<T> model) {
+ if (model.getObject() != null) {
+ // title différent suivant si le produit provient d'une extraction ou d'une purification
+ Produit prod = (Produit) BeanTools.getValue(model.getObject(), AccessType.GETTER, "produit");
+ if (prod.isExtrait()) {
+ linkTitle = page.getString("ReadExtraction");
+ } else {
+ linkTitle = page.getString("ReadPurification");
+ }
+ }
+ super.populateItem(item, componentId, model);
+ }
- /**
- * Executed on click evenement when the produis is an extrait
- * @param extrait extrait
- */
- public abstract void onClickIfExtrait(Extrait extrait);
+ /**
+ * Executed on click evenement when the produis is an extrait
+ * @param extrait extrait
+ */
+ public abstract void onClickIfExtrait(Extrait extrait);
- /**
- * Executed on click evenement when the produis is a fraction
- * @param fraction fraction
- */
- public abstract void onClickIfFraction(Fraction fraction);
+ /**
+ * Executed on click evenement when the produis is a fraction
+ * @param fraction fraction
+ */
+ public abstract void onClickIfFraction(Fraction fraction);
}
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/columns/TaxonomyPropertyColumn.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/columns/TaxonomyPropertyColumn.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/columns/TaxonomyPropertyColumn.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -41,34 +41,34 @@
*/
public class TaxonomyPropertyColumn<T> extends PropertyColumn<T> implements ExportableColumn<T> {
- /**
- * Constructor
- * @param displayModel Display model
- * @param sortProperty Sort property
- * @param propertyExpression Property expression
- */
- public TaxonomyPropertyColumn(IModel<String> displayModel, String sortProperty, String propertyExpression) {
- super(displayModel, sortProperty, propertyExpression);
- }
+ /**
+ * Constructor
+ * @param displayModel Display model
+ * @param sortProperty Sort property
+ * @param propertyExpression Property expression
+ */
+ public TaxonomyPropertyColumn(IModel<String> displayModel, String sortProperty, String propertyExpression) {
+ super(displayModel, sortProperty, propertyExpression);
+ }
- /**
- * Constructor
- * @param displayModel Display model
- * @param propertyExpression Property expression
- */
- public TaxonomyPropertyColumn(IModel<String> displayModel, String propertyExpression) {
- super(displayModel, propertyExpression);
- }
+ /**
+ * Constructor
+ * @param displayModel Display model
+ * @param propertyExpression Property expression
+ */
+ public TaxonomyPropertyColumn(IModel<String> displayModel, String propertyExpression) {
+ super(displayModel, propertyExpression);
+ }
- /** {@inheritDoc} */
- @Override
- public void populateItem(Item<ICellPopulator<T>> item, String componentId, IModel<T> rowModel) {
- Label label = new Label(componentId, createLabelModel(rowModel));
- label.add(new AttributeModifier("class", new Model<String>("taxonomy")));
- item.add(label);
- }
-
- @Override
+ /** {@inheritDoc} */
+ @Override
+ public void populateItem(Item<ICellPopulator<T>> item, String componentId, IModel<T> rowModel) {
+ Label label = new Label(componentId, createLabelModel(rowModel));
+ label.add(new AttributeModifier("class", new Model<String>("taxonomy")));
+ item.add(label);
+ }
+
+ @Override
public String getHeaderName() {
return getDisplayModel().getObject().toString();
}
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/campagne/ListCampagnesPage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/campagne/ListCampagnesPage.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/campagne/ListCampagnesPage.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -59,87 +59,87 @@
@AuthRoles( { AuthRole.ADMIN, AuthRole.USER })
public final class ListCampagnesPage extends TemplatePage {
- /** Service : campagne */
- @SpringBean
- private CampagneService campagneService;
+ /** Service : campagne */
+ @SpringBean
+ private CampagneService campagneService;
- /**
- * Constructeur
- */
- public ListCampagnesPage() {
- super(ListCampagnesPage.class);
+ /**
+ * Constructeur
+ */
+ public ListCampagnesPage() {
+ super(ListCampagnesPage.class);
- final CallerPage currentPage = new CallerPage(ListCampagnesPage.class);
+ final CallerPage currentPage = new CallerPage(ListCampagnesPage.class);
- // Lien pour l'age d'une nouvelle campagne
- add(new Link<Void>(getResource() + ".NewCampagne") {
- @Override
- public void onClick() {
- setResponsePage(new ManageCampagnePage(currentPage, true));
- }
+ // Lien pour l'age d'une nouvelle campagne
+ add(new Link<Void>(getResource() + ".NewCampagne") {
+ @Override
+ public void onClick() {
+ setResponsePage(new ManageCampagnePage(currentPage, true));
+ }
- });
+ });
- // On englobe le "DataView" dans un composant neutre que l'on pourra
- // rafraichir quand la liste évoluera
- final MarkupContainer campagnesRefresh = new WebMarkupContainer(getResource() + ".Campagnes.Refresh");
- campagnesRefresh.setOutputMarkupId(true);
- add(campagnesRefresh);
+ // On englobe le "DataView" dans un composant neutre que l'on pourra
+ // rafraichir quand la liste évoluera
+ final MarkupContainer campagnesRefresh = new WebMarkupContainer(getResource() + ".Campagnes.Refresh");
+ campagnesRefresh.setOutputMarkupId(true);
+ add(campagnesRefresh);
- // Liste des campagnes
- final List<Campagne> campagnes = campagneService.listCampagnes(getSession().getUtilisateur());
+ // Liste des campagnes
+ final List<Campagne> campagnes = campagneService.listCampagnes(getSession().getUtilisateur());
- LoadableDetachableSortableListDataProvider<Campagne> campagnesDataProvider = new LoadableDetachableSortableListDataProvider<Campagne>(
- campagnes, getSession().getLocale());
+ LoadableDetachableSortableListDataProvider<Campagne> campagnesDataProvider = new LoadableDetachableSortableListDataProvider<Campagne>(
+ campagnes, getSession().getLocale());
- List<IColumn<Campagne>> columns = new ArrayList<IColumn<Campagne>>();
+ List<IColumn<Campagne>> columns = new ArrayList<IColumn<Campagne>>();
- columns.add(new LinkableImagePropertyColumn<Campagne>("images/read.png", getString("Read"), getString("Read")) {
- @Override
- public void onClick(Item<ICellPopulator<Campagne>> item, String componentId, IModel<Campagne> model) {
- setResponsePage(new ReadCampagnePage(model.getObject().getIdCampagne(), currentPage));
- }
- });
+ columns.add(new LinkableImagePropertyColumn<Campagne>("images/read.png", getString("Read"), getString("Read")) {
+ @Override
+ public void onClick(Item<ICellPopulator<Campagne>> item, String componentId, IModel<Campagne> model) {
+ setResponsePage(new ReadCampagnePage(model.getObject().getIdCampagne(), currentPage));
+ }
+ });
- columns.add(new LinkPropertyColumn<Campagne>(new Model<String>(getString("Campagne.nom")), "nom", "nom",
- getString("Read")) {
- @Override
- public void onClick(Item<ICellPopulator<Campagne>> item, String componentId, IModel<Campagne> model) {
- setResponsePage(new ReadCampagnePage(model.getObject().getIdCampagne(), currentPage));
- }
- });
+ columns.add(new LinkPropertyColumn<Campagne>(new Model<String>(getString("Campagne.nom")), "nom", "nom",
+ getString("Read")) {
+ @Override
+ public void onClick(Item<ICellPopulator<Campagne>> item, String componentId, IModel<Campagne> model) {
+ setResponsePage(new ReadCampagnePage(model.getObject().getIdCampagne(), currentPage));
+ }
+ });
- columns.add(new ShortDatePropertyColumn<Campagne>(new Model<String>(getString("Campagne.dateDeb")), "dateDeb",
- "dateDeb", getLocale()));
+ columns.add(new ShortDatePropertyColumn<Campagne>(new Model<String>(getString("Campagne.dateDeb")), "dateDeb",
+ "dateDeb", getLocale()));
- columns.add(new ShortDatePropertyColumn<Campagne>(new Model<String>(getString("Campagne.dateFin")), "dateFin",
- "dateFin", getLocale()));
+ columns.add(new ShortDatePropertyColumn<Campagne>(new Model<String>(getString("Campagne.dateFin")), "dateFin",
+ "dateFin", getLocale()));
- columns.add(new MapValuePropertyColumn<Campagne, String>(new Model<String>(getString("Campagne.codePays")),
- "codePays", "codePays", WebContext.COUNTRIES.get(getSession().getLocale())));
+ columns.add(new MapValuePropertyColumn<Campagne, String>(new Model<String>(getString("Campagne.codePays")),
+ "codePays", "codePays", WebContext.COUNTRIES.get(getSession().getLocale())));
- columns.add(new LinkableImagePropertyColumn<Campagne>("images/edit.png", getString("Update"),
- getString("Update")) {
- // pas de lien d'édition si l'utilisateur n'a pas les droits
- @Override
- public void populateItem(Item<ICellPopulator<Campagne>> item, String componentId, IModel<Campagne> model) {
- if (campagneService.updateOrdeleteCampagneEnabled(model.getObject(), getSession().getUtilisateur())) {
- item.add(new LinkableImagePanel(item, componentId, model));
- } else {
- // label vide
- item.add(new Label(componentId));
- }
- }
+ columns.add(new LinkableImagePropertyColumn<Campagne>("images/edit.png", getString("Update"),
+ getString("Update")) {
+ // pas de lien d'édition si l'utilisateur n'a pas les droits
+ @Override
+ public void populateItem(Item<ICellPopulator<Campagne>> item, String componentId, IModel<Campagne> model) {
+ if (campagneService.updateOrdeleteCampagneEnabled(model.getObject(), getSession().getUtilisateur())) {
+ item.add(new LinkableImagePanel(item, componentId, model));
+ } else {
+ // label vide
+ item.add(new Label(componentId));
+ }
+ }
- @Override
- public void onClick(Item<ICellPopulator<Campagne>> item, String componentId, IModel<Campagne> model) {
- setResponsePage(new ManageCampagnePage(model.getObject().getIdCampagne(), currentPage));
- }
- });
+ @Override
+ public void onClick(Item<ICellPopulator<Campagne>> item, String componentId, IModel<Campagne> model) {
+ setResponsePage(new ManageCampagnePage(model.getObject().getIdCampagne(), currentPage));
+ }
+ });
- final DataTable<Campagne> campagnesDataTable = new AjaxFallbackDefaultDataTable<Campagne>(
- "ListCampagnesPage.Campagnes", columns, campagnesDataProvider, WebContext.ROWS_PER_PAGE);
+ final DataTable<Campagne> campagnesDataTable = new AjaxFallbackDefaultDataTable<Campagne>(
+ "ListCampagnesPage.Campagnes", columns, campagnesDataProvider, WebContext.ROWS_PER_PAGE);
- campagnesRefresh.add(campagnesDataTable);
- }
+ campagnesRefresh.add(campagnesDataTable);
+ }
}
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/campagne/ManageCampagnePage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/campagne/ManageCampagnePage.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/campagne/ManageCampagnePage.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -92,629 +92,629 @@
@AuthRoles({ AuthRole.ADMIN, AuthRole.USER })
public final class ManageCampagnePage extends TemplatePage {
- /** Action : create */
- private static final String ACTION_CREATE = "Create";
+ /** Action : create */
+ private static final String ACTION_CREATE = "Create";
- /** Action : delete */
- public static final String ACTION_DELETE = "Delete";
+ /** Action : delete */
+ public static final String ACTION_DELETE = "Delete";
- /** Action : update */
- private static final String ACTION_UPDATE = "Update";
+ /** Action : update */
+ private static final String ACTION_UPDATE = "Update";
- /** Logger */
- private static final Log LOG = LogTools.getLog();
+ /** Logger */
+ private static final Log LOG = LogTools.getLog();
- /** Bouton d'ajout d'un participant */
- private Button addParticipant;
+ /** Bouton d'ajout d'un participant */
+ private Button addParticipant;
- /** Bouton d'ajout d'une station */
- private Button addStation;
+ /** Bouton d'ajout d'une station */
+ private Button addStation;
- /** Choix d'un participant */
- private AbstractSingleSelectChoice<Personne> availablePersonnes;
+ /** Choix d'un participant */
+ private AbstractSingleSelectChoice<Personne> availablePersonnes;
- /** Choix d'une station prospectée */
- private AbstractSingleSelectChoice<Station> availableStations;
+ /** Choix d'une station prospectée */
+ private AbstractSingleSelectChoice<Station> availableStations;
- /** Page appelante */
- private final CallerPage callerPage;
+ /** Page appelante */
+ private final CallerPage callerPage;
- /** Modèle : campagne */
- private final IModel<Campagne> campagneModel;
+ /** Modèle : campagne */
+ private final IModel<Campagne> campagneModel;
- /** Service : campagne */
- @SpringBean
- private CampagneService campagneService;
+ /** Service : campagne */
+ @SpringBean
+ private CampagneService campagneService;
- /** Service : station */
- @SpringBean
- private StationService stationService;
+ /** Service : station */
+ @SpringBean
+ private StationService stationService;
- /** Modèle : participant */
- private final IModel<CampagnePersonneParticipant> participantModel;
+ /** Modèle : participant */
+ private final IModel<CampagnePersonneParticipant> participantModel;
- /** Modèle : station */
- private final IModel<Station> stationModel;
+ /** Modèle : station */
+ private final IModel<Station> stationModel;
- /** Liste des personnes existantes */
- private final List<Personne> personnes;
+ /** Liste des personnes existantes */
+ private final List<Personne> personnes;
- /** Liste des stations existantes */
- private final List<Station> stations;
+ /** Liste des stations existantes */
+ private final List<Station> stations;
- /** Service : personnes */
- @SpringBean
- private PersonneService personneService;
+ /** Service : personnes */
+ @SpringBean
+ private PersonneService personneService;
- /** Validateur modèle */
- @SpringBean(name = "webModelValidator")
- private ModelValidator validator;
+ /** Validateur modèle */
+ @SpringBean(name = "webModelValidator")
+ private ModelValidator validator;
- /** ComplementView */
- FormComponent<String> complementView;
+ /** ComplementView */
+ FormComponent<String> complementView;
- /** Saisie multiple */
- private boolean multipleEntry;
+ /** Saisie multiple */
+ private boolean multipleEntry;
- /**
- * Constructeur (mode création)
- * @param callerPage Page appelante
- * @param multipleEntry Saisie multiple
- */
- public ManageCampagnePage(CallerPage callerPage, boolean multipleEntry) {
- this(null, null, callerPage, multipleEntry);
- }
+ /**
+ * Constructeur (mode création)
+ * @param callerPage Page appelante
+ * @param multipleEntry Saisie multiple
+ */
+ public ManageCampagnePage(CallerPage callerPage, boolean multipleEntry) {
+ this(null, null, callerPage, multipleEntry);
+ }
- /**
- * Constructeur (mode édition)
- * @param idCampagne ID campagne
- * @param callerPage Page appelante
- */
- public ManageCampagnePage(Integer idCampagne, CallerPage callerPage) {
- this(idCampagne, null, callerPage, false);
- }
+ /**
+ * Constructeur (mode édition)
+ * @param idCampagne ID campagne
+ * @param callerPage Page appelante
+ */
+ public ManageCampagnePage(Integer idCampagne, CallerPage callerPage) {
+ this(idCampagne, null, callerPage, false);
+ }
- /**
- * Constructeur (mode saisie de la campagne suivante)
- * @param campagne campagne
- * @param callerPage Page appelante
- */
- public ManageCampagnePage(Campagne campagne, CallerPage callerPage) {
- this(null, campagne, callerPage, true);
- }
+ /**
+ * Constructeur (mode saisie de la campagne suivante)
+ * @param campagne campagne
+ * @param callerPage Page appelante
+ */
+ public ManageCampagnePage(Campagne campagne, CallerPage callerPage) {
+ this(null, campagne, callerPage, true);
+ }
- /**
- * Constructeur. Si idCampagne et campagne sont null, on créée une nouvelle campagne. Si idCampagne est renseigné,
- * on édite la campagne correspondante. Si campagne est renseignée, on créée une nouvelle campagne à partir des
- * informations qu'elle contient.
- * @param idCampagne ID campagne
- * @param campagne Lot
- * @param callerPage Page appelante
- * @param multipleEntry Saisie multiple
- */
- private ManageCampagnePage(Integer idCampagne, Campagne campagne, final CallerPage callerPage, boolean multipleEntry) {
- super(ManageCampagnePage.class);
- assert idCampagne == null || campagne == null;
- this.callerPage = callerPage;
- this.multipleEntry = multipleEntry;
+ /**
+ * Constructeur. Si idCampagne et campagne sont null, on créée une nouvelle campagne. Si idCampagne est renseigné,
+ * on édite la campagne correspondante. Si campagne est renseignée, on créée une nouvelle campagne à partir des
+ * informations qu'elle contient.
+ * @param idCampagne ID campagne
+ * @param campagne Lot
+ * @param callerPage Page appelante
+ * @param multipleEntry Saisie multiple
+ */
+ private ManageCampagnePage(Integer idCampagne, Campagne campagne, final CallerPage callerPage, boolean multipleEntry) {
+ super(ManageCampagnePage.class);
+ assert idCampagne == null || campagne == null;
+ this.callerPage = callerPage;
+ this.multipleEntry = multipleEntry;
- // Initialisation des modèles
- try {
- campagneModel = new Model<Campagne>(idCampagne == null && campagne == null ? new Campagne()
- : campagne != null ? campagne : campagneService.loadCampagne(idCampagne));
- } catch (DataNotFoundException e) {
- LOG.error(e.getMessage(), e);
- throw new UnexpectedException(e);
- }
- boolean createMode = idCampagne == null;
- if (createMode) {
- campagneModel.getObject().setCreateur(getSession().getUtilisateur());
- }
- participantModel = new Model<CampagnePersonneParticipant>(new CampagnePersonneParticipant());
- participantModel.getObject().getId().setPk1(campagneModel.getObject());
- stationModel = new Model<Station>(new Station());
+ // Initialisation des modèles
+ try {
+ campagneModel = new Model<Campagne>(idCampagne == null && campagne == null ? new Campagne()
+ : campagne != null ? campagne : campagneService.loadCampagne(idCampagne));
+ } catch (DataNotFoundException e) {
+ LOG.error(e.getMessage(), e);
+ throw new UnexpectedException(e);
+ }
+ boolean createMode = idCampagne == null;
+ if (createMode) {
+ campagneModel.getObject().setCreateur(getSession().getUtilisateur());
+ }
+ participantModel = new Model<CampagnePersonneParticipant>(new CampagnePersonneParticipant());
+ participantModel.getObject().getId().setPk1(campagneModel.getObject());
+ stationModel = new Model<Station>(new Station());
- // Initialisation des listes
- List<String> programmes = campagneService.listCampagneProgrammes();
- personnes = personneService.listPersonnes();
- stations = stationService.listStations(getSession().getUtilisateur());
+ // Initialisation des listes
+ List<String> programmes = campagneService.listCampagneProgrammes();
+ personnes = personneService.listPersonnes();
+ stations = stationService.listStations(getSession().getUtilisateur());
- final Form<Void> formView = new Form<Void>("Form");
+ final Form<Void> formView = new Form<Void>("Form");
- formView.add(new TextField<String>("Campagne.nom", new PropertyModel<String>(campagneModel, "nom")));
+ formView.add(new TextField<String>("Campagne.nom", new PropertyModel<String>(campagneModel, "nom")));
- // Choix du code pays
- formView.add(new DropDownChoice<String>("Campagne.codePays", new PropertyModel<String>(campagneModel,
- "codePays"), WebContext.COUNTRY_CODES.get(getSession().getLocale()),
- new MapChoiceRenderer<String, String>(WebContext.COUNTRIES.get(getSession().getLocale()))));
- if (campagneModel.getObject().getCodePays() == null) {
- campagneModel.getObject().setCodePays(
- WebContext.COUNTRIES.get(getSession().getLocale()).entrySet().iterator().next().getKey());
- }
+ // Choix du code pays
+ formView.add(new DropDownChoice<String>("Campagne.codePays", new PropertyModel<String>(campagneModel,
+ "codePays"), WebContext.COUNTRY_CODES.get(getSession().getLocale()),
+ new MapChoiceRenderer<String, String>(WebContext.COUNTRIES.get(getSession().getLocale()))));
+ if (campagneModel.getObject().getCodePays() == null) {
+ campagneModel.getObject().setCodePays(
+ WebContext.COUNTRIES.get(getSession().getLocale()).entrySet().iterator().next().getKey());
+ }
- // Champs de type Date
- formView.add(new DateTextField("Campagne.dateDeb", new PropertyModel<Date>(campagneModel, "dateDeb"))
- .add(new DatePicker()));
+ // Champs de type Date
+ formView.add(new DateTextField("Campagne.dateDeb", new PropertyModel<Date>(campagneModel, "dateDeb"))
+ .add(new DatePicker()));
- formView.add(new DateTextField("Campagne.dateFin", new PropertyModel<Date>(campagneModel, "dateFin"))
- .add(new DatePicker()));
+ formView.add(new DateTextField("Campagne.dateFin", new PropertyModel<Date>(campagneModel, "dateFin"))
+ .add(new DatePicker()));
- formView.add(new TextArea<String>("Campagne.mentionLegale", new PropertyModel<String>(campagneModel,
- "mentionLegale")));
- formView.add(new SimpleTooltipPanel("Campagne.mentionLegale.info", new Model<String>(
- getString("Campagne.mentionLegale.info"))));
+ formView.add(new TextArea<String>("Campagne.mentionLegale", new PropertyModel<String>(campagneModel,
+ "mentionLegale")));
+ formView.add(new SimpleTooltipPanel("Campagne.mentionLegale.info", new Model<String>(
+ getString("Campagne.mentionLegale.info"))));
- formView.add(new TextArea<String>("Campagne.complement", new PropertyModel<String>(campagneModel, "complement")));
- formView.add(new SimpleTooltipPanel("Campagne.complement.info", new Model<String>(
- getString("Campagne.complement.info"))));
+ formView.add(new TextArea<String>("Campagne.complement", new PropertyModel<String>(campagneModel, "complement")));
+ formView.add(new SimpleTooltipPanel("Campagne.complement.info", new Model<String>(
+ getString("Campagne.complement.info"))));
- formView.add(new TextField<String>("Campagne.createur", new PropertyModel<String>(campagneModel, "createur"))
- .setEnabled(false));
+ formView.add(new TextField<String>("Campagne.createur", new PropertyModel<String>(campagneModel, "createur"))
+ .setEnabled(false));
- // Champs en lecture seule
- formView.add(new AutoCompleteTextFieldString("Campagne.programme", new PropertyModel<String>(campagneModel,
- "programme"), programmes, ComparisonMode.CONTAINS));
+ // Champs en lecture seule
+ formView.add(new AutoCompleteTextFieldString("Campagne.programme", new PropertyModel<String>(campagneModel,
+ "programme"), programmes, ComparisonMode.CONTAINS));
- initParticipantsFields(formView);
- initStationsFields(formView);
+ initParticipantsFields(formView);
+ initStationsFields(formView);
- // Action : création de la campagne
- Button createButton = new SubmittableButton(ACTION_CREATE, new SubmittableButtonEvents() {
- @Override
- public void onProcess() throws DataConstraintException {
- campagneService.createCampagne(campagneModel.getObject());
- }
+ // Action : création de la campagne
+ Button createButton = new SubmittableButton(ACTION_CREATE, new SubmittableButtonEvents() {
+ @Override
+ public void onProcess() throws DataConstraintException {
+ campagneService.createCampagne(campagneModel.getObject());
+ }
- @Override
- public void onSuccess() {
- successNextPage(ACTION_CREATE);
- redirect();
- }
+ @Override
+ public void onSuccess() {
+ successNextPage(ACTION_CREATE);
+ redirect();
+ }
- @Override
- public void onValidate() {
- validateModel();
- }
- });
- createButton.setVisibilityAllowed(createMode);
- formView.add(createButton);
+ @Override
+ public void onValidate() {
+ validateModel();
+ }
+ });
+ createButton.setVisibilityAllowed(createMode);
+ formView.add(createButton);
- // Action : mise à jour de la campagne
- Button updateButton = new SubmittableButton(ACTION_UPDATE, new SubmittableButtonEvents() {
- @Override
- public void onProcess() throws DataConstraintException {
- campagneService.updateCampagne(campagneModel.getObject());
- }
+ // Action : mise à jour de la campagne
+ Button updateButton = new SubmittableButton(ACTION_UPDATE, new SubmittableButtonEvents() {
+ @Override
+ public void onProcess() throws DataConstraintException {
+ campagneService.updateCampagne(campagneModel.getObject());
+ }
- @Override
- public void onSuccess() {
- successNextPage(ACTION_UPDATE);
- redirect();
- }
+ @Override
+ public void onSuccess() {
+ successNextPage(ACTION_UPDATE);
+ redirect();
+ }
- @Override
- public void onValidate() {
- validateModel();
- }
- });
- updateButton.setVisibilityAllowed(!createMode
- && campagneService.updateOrdeleteCampagneEnabled(campagneModel.getObject(), getSession()
- .getUtilisateur()));
- formView.add(updateButton);
+ @Override
+ public void onValidate() {
+ validateModel();
+ }
+ });
+ updateButton.setVisibilityAllowed(!createMode
+ && campagneService.updateOrdeleteCampagneEnabled(campagneModel.getObject(), getSession()
+ .getUtilisateur()));
+ formView.add(updateButton);
- // Action : suppression de la campagne
- Button deleteButton = new SubmittableButton(ACTION_DELETE, new SubmittableButtonEvents() {
- @Override
- public void onProcess() throws DataConstraintException {
- campagneService.deleteCampagne(campagneModel.getObject());
- }
+ // Action : suppression de la campagne
+ Button deleteButton = new SubmittableButton(ACTION_DELETE, new SubmittableButtonEvents() {
+ @Override
+ public void onProcess() throws DataConstraintException {
+ campagneService.deleteCampagne(campagneModel.getObject());
+ }
- @Override
- public void onSuccess() {
- successNextPage(ACTION_DELETE);
- redirect();
- }
- });
- deleteButton.setVisibilityAllowed(!createMode
- && campagneService.updateOrdeleteCampagneEnabled(campagneModel.getObject(), getSession()
- .getUtilisateur()));
- deleteButton.add(new JSConfirmationBehavior(getString("Confirm")));
- deleteButton.setDefaultFormProcessing(false);
- formView.add(deleteButton);
+ @Override
+ public void onSuccess() {
+ successNextPage(ACTION_DELETE);
+ redirect();
+ }
+ });
+ deleteButton.setVisibilityAllowed(!createMode
+ && campagneService.updateOrdeleteCampagneEnabled(campagneModel.getObject(), getSession()
+ .getUtilisateur()));
+ deleteButton.add(new JSConfirmationBehavior(getString("Confirm")));
+ deleteButton.setDefaultFormProcessing(false);
+ formView.add(deleteButton);
- // Action : annulation (lien)
- formView.add(new Link<Void>("Cancel") {
- // Cas où le formulaire est annulé
- @Override
- public void onClick() {
- callerPage.responsePage((TemplatePage) this.getPage());
- }
- });
+ // Action : annulation (lien)
+ formView.add(new Link<Void>("Cancel") {
+ // Cas où le formulaire est annulé
+ @Override
+ public void onClick() {
+ callerPage.responsePage((TemplatePage) this.getPage());
+ }
+ });
- cleanPersonnesChoice();
- cleanStationsChoice();
- add(formView);
- }
+ cleanPersonnesChoice();
+ cleanStationsChoice();
+ add(formView);
+ }
- /**
- * Initialize participants section
- * @param formView The form view
- */
- private void initParticipantsFields(final Form<Void> formView) {
- // Tableau des participants
- final MarkupContainer participantsTable = new WebMarkupContainer("Campagne.participants.Table");
- participantsTable.setOutputMarkupId(true);
+ /**
+ * Initialize participants section
+ * @param formView The form view
+ */
+ private void initParticipantsFields(final Form<Void> formView) {
+ // Tableau des participants
+ final MarkupContainer participantsTable = new WebMarkupContainer("Campagne.participants.Table");
+ participantsTable.setOutputMarkupId(true);
- // Liste des participants ajoutés
- participantsTable.add(new ListView<CampagnePersonneParticipant>("Campagne.participants.List",
- new PropertyModel<List<CampagnePersonneParticipant>>(campagneModel, "participants")) {
- @Override
- protected void populateItem(ListItem<CampagnePersonneParticipant> item) {
- if (item.getIndex() % 2 == 1) {
- item.add(new AttributeModifier("class", item.getIndex() % 2 == 0 ? "even" : "odd"));
- }
+ // Liste des participants ajoutés
+ participantsTable.add(new ListView<CampagnePersonneParticipant>("Campagne.participants.List",
+ new PropertyModel<List<CampagnePersonneParticipant>>(campagneModel, "participants")) {
+ @Override
+ protected void populateItem(ListItem<CampagnePersonneParticipant> item) {
+ if (item.getIndex() % 2 == 1) {
+ item.add(new AttributeModifier("class", item.getIndex() % 2 == 0 ? "even" : "odd"));
+ }
- final CampagnePersonneParticipant participant = item.getModelObject();
- // Colonnes
- item.add(new Label("Campagne.participants.List.personne", new PropertyModel<String>(participant,
- "id.pk2")));
- item.add(new Label("Campagne.participants.List.complement", new PropertyModel<String>(participant,
- "complement")));
+ final CampagnePersonneParticipant participant = item.getModelObject();
+ // Colonnes
+ item.add(new Label("Campagne.participants.List.personne", new PropertyModel<String>(participant,
+ "id.pk2")));
+ item.add(new Label("Campagne.participants.List.complement", new PropertyModel<String>(participant,
+ "complement")));
- // Action : suppression d'un participant
- Button deleteButton = new AjaxFallbackButton("Campagne.participants.Delete", formView) {
- @Override
- protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
- // Suppression
- campagneModel.getObject().getParticipants().remove(participant);
- cleanPersonnesChoice();
+ // Action : suppression d'un participant
+ Button deleteButton = new AjaxFallbackButton("Campagne.participants.Delete", formView) {
+ @Override
+ protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
+ // Suppression
+ campagneModel.getObject().getParticipants().remove(participant);
+ cleanPersonnesChoice();
- // Mise à jour des listes
- refreshModel();
- if (target != null) {
- target.add(participantsTable, availablePersonnes);
- }
- }
+ // Mise à jour des listes
+ refreshModel();
+ if (target != null) {
+ target.add(participantsTable, availablePersonnes);
+ }
+ }
- @Override
- protected void onError(AjaxRequestTarget target, Form<?> form) {
- // never called
- }
- };
- deleteButton.setDefaultFormProcessing(false);
- item.add(deleteButton);
- }
- });
+ @Override
+ protected void onError(AjaxRequestTarget target, Form<?> form) {
+ // never called
+ }
+ };
+ deleteButton.setDefaultFormProcessing(false);
+ item.add(deleteButton);
+ }
+ });
- // Liste des personnes "disponibles" (non encore ajoutées dans la liste des participants)
- availablePersonnes = new DropDownChoice<Personne>("Campagne.participant", new PropertyModel<Personne>(
- participantModel, "id.pk2"), new ArrayList<Personne>(), new PersonneRenderer());
- availablePersonnes.setNullValid(false);
- availablePersonnes.setOutputMarkupId(true);
+ // Liste des personnes "disponibles" (non encore ajoutées dans la liste des participants)
+ availablePersonnes = new DropDownChoice<Personne>("Campagne.participant", new PropertyModel<Personne>(
+ participantModel, "id.pk2"), new ArrayList<Personne>(), new PersonneRenderer());
+ availablePersonnes.setNullValid(false);
+ availablePersonnes.setOutputMarkupId(true);
- participantsTable.add(availablePersonnes);
+ participantsTable.add(availablePersonnes);
- complementView = new TextField<String>("CampagnePersonneParticipant.complement", new PropertyModel<String>(
- participantModel, "complement"));
- participantsTable.add(complementView);
+ complementView = new TextField<String>("CampagnePersonneParticipant.complement", new PropertyModel<String>(
+ participantModel, "complement"));
+ participantsTable.add(complementView);
- // Bouton AJAX pour ajouter un participant
- addParticipant = new AjaxFallbackButton("Campagne.participants.Add", formView) {
- @Override
- protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
- if (participantModel.getObject().getId().getPk2() != null) {
- try {
- // Ajout du participant
- campagneModel.getObject().getParticipants().add(participantModel.getObject().clone());
- cleanPersonnesChoice();
- // réinit de la ligne d'ajout
- participantModel.getObject().getId().setPk2(null);
- participantModel.getObject().setComplement(null);
- } catch (CloneNotSupportedException e) {
- LOG.error(e.getMessage(), e);
- throw new UnexpectedException(e);
- }
+ // Bouton AJAX pour ajouter un participant
+ addParticipant = new AjaxFallbackButton("Campagne.participants.Add", formView) {
+ @Override
+ protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
+ if (participantModel.getObject().getId().getPk2() != null) {
+ try {
+ // Ajout du participant
+ campagneModel.getObject().getParticipants().add(participantModel.getObject().clone());
+ cleanPersonnesChoice();
+ // réinit de la ligne d'ajout
+ participantModel.getObject().getId().setPk2(null);
+ participantModel.getObject().setComplement(null);
+ } catch (CloneNotSupportedException e) {
+ LOG.error(e.getMessage(), e);
+ throw new UnexpectedException(e);
+ }
- // Mise à jour des listes
- refreshModel();
- if (target != null) {
- target.add(participantsTable, availablePersonnes);
- }
- }
- }
+ // Mise à jour des listes
+ refreshModel();
+ if (target != null) {
+ target.add(participantsTable, availablePersonnes);
+ }
+ }
+ }
- @Override
- protected void onError(AjaxRequestTarget target, Form<?> form) {
- refreshFeedbackPage(target);
- }
+ @Override
+ protected void onError(AjaxRequestTarget target, Form<?> form) {
+ refreshFeedbackPage(target);
+ }
- };
- participantsTable.add(addParticipant);
+ };
+ participantsTable.add(addParticipant);
- formView.add(participantsTable);
+ formView.add(participantsTable);
- // Action : création d'une nouvelle personne
- // ajaxSubmitLink permet de sauvegarder l'état du formulaire
- participantsTable.add(new AjaxSubmitLink("NewPersonne") {
- @Override
- protected void onSubmit(AjaxRequestTarget arg0, Form<?> arg1) {
- setResponsePage(new ManagePersonnePage(new CallerPage((TemplatePage) getPage()), false));
- }
+ // Action : création d'une nouvelle personne
+ // ajaxSubmitLink permet de sauvegarder l'état du formulaire
+ participantsTable.add(new AjaxSubmitLink("NewPersonne") {
+ @Override
+ protected void onSubmit(AjaxRequestTarget arg0, Form<?> arg1) {
+ setResponsePage(new ManagePersonnePage(new CallerPage((TemplatePage) getPage()), false));
+ }
- // si erreur, le formulaire est également enregistré puis la redirection effectuée
- @Override
- protected void onError(AjaxRequestTarget target, Form<?> form) {
- setResponsePage(new ManagePersonnePage(new CallerPage((TemplatePage) getPage()), false));
- }
- });
- }
+ // si erreur, le formulaire est également enregistré puis la redirection effectuée
+ @Override
+ protected void onError(AjaxRequestTarget target, Form<?> form) {
+ setResponsePage(new ManagePersonnePage(new CallerPage((TemplatePage) getPage()), false));
+ }
+ });
+ }
- /**
- * Initialize stations section
- * @param formView The form view
- */
- private void initStationsFields(final Form<Void> formView) {
- // Tableau des participants
- final MarkupContainer stationsTable = new WebMarkupContainer("Campagne.stations.Table");
- stationsTable.setOutputMarkupId(true);
+ /**
+ * Initialize stations section
+ * @param formView The form view
+ */
+ private void initStationsFields(final Form<Void> formView) {
+ // Tableau des participants
+ final MarkupContainer stationsTable = new WebMarkupContainer("Campagne.stations.Table");
+ stationsTable.setOutputMarkupId(true);
- // Liste des stations ajoutées
- stationsTable.add(new ListView<Station>("Campagne.stations.List", new PropertyModel<List<Station>>(
- campagneModel, "sortedStations")) {
- @Override
- protected void populateItem(ListItem<Station> item) {
- if (item.getIndex() % 2 == 1) {
- item.add(new AttributeModifier("class", item.getIndex() % 2 == 0 ? "even" : "odd"));
- }
+ // Liste des stations ajoutées
+ stationsTable.add(new ListView<Station>("Campagne.stations.List", new PropertyModel<List<Station>>(
+ campagneModel, "sortedStations")) {
+ @Override
+ protected void populateItem(ListItem<Station> item) {
+ if (item.getIndex() % 2 == 1) {
+ item.add(new AttributeModifier("class", item.getIndex() % 2 == 0 ? "even" : "odd"));
+ }
- final Station station = item.getModelObject();
- // Colonnes
- item.add(new Label("Campagne.stations.List.station", new PropertyModel<String>(station, "nom"))
- .add(new ReplaceEmptyLabelBehavior()));
- item.add(new Label("Campagne.stations.List.codePays", new DisplayMapValuePropertyModel<String>(station,
- "codePays", WebContext.COUNTRIES.get(getSession().getLocale())))
- .add(new ReplaceEmptyLabelBehavior()));
- item.add(new Label("Campagne.stations.List.localite", new PropertyModel<String>(station, "localite"))
- .add(new ReplaceEmptyLabelBehavior()));
- item.add(new Label("Campagne.stations.List.latitude", new PropertyModel<String>(station, "latitude"))
- .add(new ReplaceEmptyLabelBehavior()));
- item.add(new Label("Campagne.stations.List.longitude", new PropertyModel<String>(station, "longitude"))
- .add(new ReplaceEmptyLabelBehavior()));
+ final Station station = item.getModelObject();
+ // Colonnes
+ item.add(new Label("Campagne.stations.List.station", new PropertyModel<String>(station, "nom"))
+ .add(new ReplaceEmptyLabelBehavior()));
+ item.add(new Label("Campagne.stations.List.codePays", new DisplayMapValuePropertyModel<String>(station,
+ "codePays", WebContext.COUNTRIES.get(getSession().getLocale())))
+ .add(new ReplaceEmptyLabelBehavior()));
+ item.add(new Label("Campagne.stations.List.localite", new PropertyModel<String>(station, "localite"))
+ .add(new ReplaceEmptyLabelBehavior()));
+ item.add(new Label("Campagne.stations.List.latitude", new PropertyModel<String>(station, "latitude"))
+ .add(new ReplaceEmptyLabelBehavior()));
+ item.add(new Label("Campagne.stations.List.longitude", new PropertyModel<String>(station, "longitude"))
+ .add(new ReplaceEmptyLabelBehavior()));
- // Action : suppression d'une station
- Button deleteButton = new AjaxFallbackButton("Campagne.stations.Delete", formView) {
- @Override
- protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
- // Suppression
- campagneModel.getObject().getStations().remove(station);
- cleanStationsChoice();
+ // Action : suppression d'une station
+ Button deleteButton = new AjaxFallbackButton("Campagne.stations.Delete", formView) {
+ @Override
+ protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
+ // Suppression
+ campagneModel.getObject().getStations().remove(station);
+ cleanStationsChoice();
- // Mise à jour des listes
- refreshModel();
- if (target != null) {
- target.add(stationsTable, availableStations);
- }
- }
+ // Mise à jour des listes
+ refreshModel();
+ if (target != null) {
+ target.add(stationsTable, availableStations);
+ }
+ }
- @Override
- protected void onError(AjaxRequestTarget target, Form<?> form) {
- // never called
- }
+ @Override
+ protected void onError(AjaxRequestTarget target, Form<?> form) {
+ // never called
+ }
- };
- deleteButton.setDefaultFormProcessing(false);
- item.add(deleteButton);
- }
- });
+ };
+ deleteButton.setDefaultFormProcessing(false);
+ item.add(deleteButton);
+ }
+ });
- // Liste des stations "disponibles" (non encore ajoutées dans la liste des stations)
- availableStations = new DropDownChoice<Station>("Campagne.station", stationModel, new ArrayList<Station>());
- availableStations.setNullValid(false);
- availableStations.setOutputMarkupId(true);
+ // Liste des stations "disponibles" (non encore ajoutées dans la liste des stations)
+ availableStations = new DropDownChoice<Station>("Campagne.station", stationModel, new ArrayList<Station>());
+ availableStations.setNullValid(false);
+ availableStations.setOutputMarkupId(true);
- stationsTable.add(availableStations);
+ stationsTable.add(availableStations);
- final Label codePaysLabel = new Label("Campagne.station.codePays", new DisplayMapValuePropertyModel<String>(
- stationModel, "codePays", WebContext.COUNTRIES.get(getSession().getLocale())));
- codePaysLabel.setOutputMarkupId(true);
- stationsTable.add(codePaysLabel);
+ final Label codePaysLabel = new Label("Campagne.station.codePays", new DisplayMapValuePropertyModel<String>(
+ stationModel, "codePays", WebContext.COUNTRIES.get(getSession().getLocale())));
+ codePaysLabel.setOutputMarkupId(true);
+ stationsTable.add(codePaysLabel);
- final Label localiteLabel = new Label("Campagne.station.localite", new PropertyModel<String>(stationModel,
- "localite"));
- localiteLabel.setOutputMarkupId(true);
- stationsTable.add(localiteLabel);
+ final Label localiteLabel = new Label("Campagne.station.localite", new PropertyModel<String>(stationModel,
+ "localite"));
+ localiteLabel.setOutputMarkupId(true);
+ stationsTable.add(localiteLabel);
- final Label latitudeLabel = new Label("Campagne.station.latitude", new PropertyModel<String>(stationModel,
- "latitude"));
- latitudeLabel.setOutputMarkupId(true);
- stationsTable.add(latitudeLabel);
+ final Label latitudeLabel = new Label("Campagne.station.latitude", new PropertyModel<String>(stationModel,
+ "latitude"));
+ latitudeLabel.setOutputMarkupId(true);
+ stationsTable.add(latitudeLabel);
- final Label longitudeLabel = new Label("Campagne.station.longitude", new PropertyModel<String>(stationModel,
- "longitude"));
- longitudeLabel.setOutputMarkupId(true);
- stationsTable.add(longitudeLabel);
+ final Label longitudeLabel = new Label("Campagne.station.longitude", new PropertyModel<String>(stationModel,
+ "longitude"));
+ longitudeLabel.setOutputMarkupId(true);
+ stationsTable.add(longitudeLabel);
- availableStations.add(new AjaxFormComponentUpdatingBehavior("onchange") {
- protected void onUpdate(AjaxRequestTarget target) {
- target.add(codePaysLabel, localiteLabel, latitudeLabel, longitudeLabel);
- }
- });
+ availableStations.add(new AjaxFormComponentUpdatingBehavior("onchange") {
+ protected void onUpdate(AjaxRequestTarget target) {
+ target.add(codePaysLabel, localiteLabel, latitudeLabel, longitudeLabel);
+ }
+ });
- // Bouton AJAX pour ajouter une station
- addStation = new AjaxFallbackButton("Campagne.stations.Add", formView) {
- @Override
- protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
- if (stationModel.getObject() != null) {
- try {
- // Ajout du participant
- participantModel.getObject().setComplement(complementView.getValue());
- campagneModel.getObject().getStations().add(stationModel.getObject().clone());
- cleanStationsChoice();
- // réinit de la ligne d'ajout
- stationModel.setObject(new Station());
- } catch (CloneNotSupportedException e) {
- LOG.error(e.getMessage(), e);
- throw new UnexpectedException(e);
- }
+ // Bouton AJAX pour ajouter une station
+ addStation = new AjaxFallbackButton("Campagne.stations.Add", formView) {
+ @Override
+ protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
+ if (stationModel.getObject() != null) {
+ try {
+ // Ajout du participant
+ participantModel.getObject().setComplement(complementView.getValue());
+ campagneModel.getObject().getStations().add(stationModel.getObject().clone());
+ cleanStationsChoice();
+ // réinit de la ligne d'ajout
+ stationModel.setObject(new Station());
+ } catch (CloneNotSupportedException e) {
+ LOG.error(e.getMessage(), e);
+ throw new UnexpectedException(e);
+ }
- // Mise à jour des listes
- refreshModel();
- if (target != null) {
- target.add(stationsTable, availableStations);
- }
- }
- }
+ // Mise à jour des listes
+ refreshModel();
+ if (target != null) {
+ target.add(stationsTable, availableStations);
+ }
+ }
+ }
- @Override
- protected void onError(AjaxRequestTarget target, Form<?> form) {
- refreshFeedbackPage(target);
- }
+ @Override
+ protected void onError(AjaxRequestTarget target, Form<?> form) {
+ refreshFeedbackPage(target);
+ }
- };
- stationsTable.add(addStation);
+ };
+ stationsTable.add(addStation);
- formView.add(stationsTable);
+ formView.add(stationsTable);
- // Action : création d'une nouvelle station
- // ajaxSubmitLink permet de sauvegarder l'état du formulaire
- stationsTable.add(new AjaxSubmitLink("NewStation") {
- @Override
- protected void onSubmit(AjaxRequestTarget arg0, Form<?> arg1) {
- setResponsePage(new ManageStationPage(new CallerPage((TemplatePage) getPage()), false));
- }
+ // Action : création d'une nouvelle station
+ // ajaxSubmitLink permet de sauvegarder l'état du formulaire
+ stationsTable.add(new AjaxSubmitLink("NewStation") {
+ @Override
+ protected void onSubmit(AjaxRequestTarget arg0, Form<?> arg1) {
+ setResponsePage(new ManageStationPage(new CallerPage((TemplatePage) getPage()), false));
+ }
- // si erreur, le formulaire est également enregistré puis la redirection effectuée
- @Override
- protected void onError(AjaxRequestTarget target, Form<?> form) {
- setResponsePage(new ManageStationPage(new CallerPage((TemplatePage) getPage()), false));
- }
- });
- }
+ // si erreur, le formulaire est également enregistré puis la redirection effectuée
+ @Override
+ protected void onError(AjaxRequestTarget target, Form<?> form) {
+ setResponsePage(new ManageStationPage(new CallerPage((TemplatePage) getPage()), false));
+ }
+ });
+ }
- /** {@inheritDoc} */
- @Override
- protected void onBeforeRender() {
- // On rafraichit le modèle lorsque la page est rechargée (par exemple après l'ajout d'une nouvelle entité
- // Station, Spécimen ou Campagne)
- refreshModel();
- super.onBeforeRender();
- }
+ /** {@inheritDoc} */
+ @Override
+ protected void onBeforeRender() {
+ // On rafraichit le modèle lorsque la page est rechargée (par exemple après l'ajout d'une nouvelle entité
+ // Station, Spécimen ou Campagne)
+ refreshModel();
+ super.onBeforeRender();
+ }
- /**
- * Redirection vers une autre page. Cas où le formulaire est validé
- */
- private void redirect() {
- if (multipleEntry) {
- // Redirection vers l'écran de saisie d'une nouvelle campagne, en fournissant déjà quelques données
- Campagne nextCampagne = new Campagne();
+ /**
+ * Redirection vers une autre page. Cas où le formulaire est validé
+ */
+ private void redirect() {
+ if (multipleEntry) {
+ // Redirection vers l'écran de saisie d'une nouvelle campagne, en fournissant déjà quelques données
+ Campagne nextCampagne = new Campagne();
- nextCampagne.setCodePays(campagneModel.getObject().getCodePays());
- nextCampagne.setProgramme(campagneModel.getObject().getProgramme());
- nextCampagne.setMentionLegale(campagneModel.getObject().getMentionLegale());
- setResponsePage(new ManageCampagnePage(nextCampagne, callerPage));
- } else if (callerPage != null) {
- // On passe la campagne associée à cette page, en paramètre de la prochaine page, pour lui permettre de
- // l'exploiter si besoin
- callerPage.addPageParameter(Campagne.class.getSimpleName(), campagneModel.getObject().getIdCampagne());
- callerPage.responsePage(this);
- }
- }
+ nextCampagne.setCodePays(campagneModel.getObject().getCodePays());
+ nextCampagne.setProgramme(campagneModel.getObject().getProgramme());
+ nextCampagne.setMentionLegale(campagneModel.getObject().getMentionLegale());
+ setResponsePage(new ManageCampagnePage(nextCampagne, callerPage));
+ } else if (callerPage != null) {
+ // On passe la campagne associée à cette page, en paramètre de la prochaine page, pour lui permettre de
+ // l'exploiter si besoin
+ callerPage.addPageParameter(Campagne.class.getSimpleName(), campagneModel.getObject().getIdCampagne());
+ callerPage.responsePage(this);
+ }
+ }
- /**
- * Mets à jour les personnes disponibles (non encore ajoutées)
- */
- private void refreshModel() {
- // Récupère (et supprime) les éventuels nouveaux objets créés dans les paramètres de la page.
- String key = Personne.class.getSimpleName();
- if (getPageParameters().getNamedKeys().contains(key)) {
- CollectionTools.setter(personnes, personneService.listPersonnes());
- cleanPersonnesChoice();
- try {
- Personne createdPersonne = personneService.loadPersonne(getPageParameters().get(key).toInt());
- participantModel.getObject().getId().setPk2(createdPersonne);
+ /**
+ * Mets à jour les personnes disponibles (non encore ajoutées)
+ */
+ private void refreshModel() {
+ // Récupère (et supprime) les éventuels nouveaux objets créés dans les paramètres de la page.
+ String key = Personne.class.getSimpleName();
+ if (getPageParameters().getNamedKeys().contains(key)) {
+ CollectionTools.setter(personnes, personneService.listPersonnes());
+ cleanPersonnesChoice();
+ try {
+ Personne createdPersonne = personneService.loadPersonne(getPageParameters().get(key).toInt());
+ participantModel.getObject().getId().setPk2(createdPersonne);
- } catch (StringValueConversionException e) {
- LOG.error(e.getMessage(), e);
- throw new UnexpectedException(e);
- } catch (DataNotFoundException e) {
- LOG.error(e.getMessage(), e);
- throw new UnexpectedException(e);
- }
- getPageParameters().remove(key);
- }
+ } catch (StringValueConversionException e) {
+ LOG.error(e.getMessage(), e);
+ throw new UnexpectedException(e);
+ } catch (DataNotFoundException e) {
+ LOG.error(e.getMessage(), e);
+ throw new UnexpectedException(e);
+ }
+ getPageParameters().remove(key);
+ }
- key = Station.class.getSimpleName();
- if (getPageParameters().getNamedKeys().contains(key)) {
- CollectionTools.setter(stations, stationService.listStations(getSession().getUtilisateur()));
- cleanStationsChoice();
- try {
- Station createdStation = stationService.loadStation(getPageParameters().get(key).toInt());
- stationModel.setObject(createdStation);
- } catch (StringValueConversionException e) {
- LOG.error(e.getMessage(), e);
- throw new UnexpectedException(e);
- } catch (DataNotFoundException e) {
- LOG.error(e.getMessage(), e);
- throw new UnexpectedException(e);
- }
- getPageParameters().remove(key);
- }
+ key = Station.class.getSimpleName();
+ if (getPageParameters().getNamedKeys().contains(key)) {
+ CollectionTools.setter(stations, stationService.listStations(getSession().getUtilisateur()));
+ cleanStationsChoice();
+ try {
+ Station createdStation = stationService.loadStation(getPageParameters().get(key).toInt());
+ stationModel.setObject(createdStation);
+ } catch (StringValueConversionException e) {
+ LOG.error(e.getMessage(), e);
+ throw new UnexpectedException(e);
+ } catch (DataNotFoundException e) {
+ LOG.error(e.getMessage(), e);
+ throw new UnexpectedException(e);
+ }
+ getPageParameters().remove(key);
+ }
- }
+ }
- /**
- * Suprimme de la liste des personnes proposées, les personnes qui sont déjà ajoutées comme participant
- */
- private void cleanPersonnesChoice() {
- List<Personne> choices = new ArrayList<Personne>(personnes);
- for (CampagnePersonneParticipant participant : campagneModel.getObject().getParticipants()) {
- for (Personne personne : personnes) {
- if (participant.getId().getPk2().getIdPersonne() == personne.getIdPersonne()) {
- choices.remove(personne);
- }
- }
- }
- availablePersonnes.setChoices(choices);
- availablePersonnes.setEnabled(!choices.isEmpty());
- addParticipant.setEnabled(!choices.isEmpty());
- complementView.setEnabled(!choices.isEmpty());
+ /**
+ * Suprimme de la liste des personnes proposées, les personnes qui sont déjà ajoutées comme participant
+ */
+ private void cleanPersonnesChoice() {
+ List<Personne> choices = new ArrayList<Personne>(personnes);
+ for (CampagnePersonneParticipant participant : campagneModel.getObject().getParticipants()) {
+ for (Personne personne : personnes) {
+ if (participant.getId().getPk2().getIdPersonne() == personne.getIdPersonne()) {
+ choices.remove(personne);
+ }
+ }
+ }
+ availablePersonnes.setChoices(choices);
+ availablePersonnes.setEnabled(!choices.isEmpty());
+ addParticipant.setEnabled(!choices.isEmpty());
+ complementView.setEnabled(!choices.isEmpty());
- }
+ }
- /**
- * Suprimme de la liste des stations proposées, les stations qui sont déjà ajoutées comme station prospectée
- */
- private void cleanStationsChoice() {
- List<Station> choices = new ArrayList<Station>(stations);
- for (Station curStationAdded : campagneModel.getObject().getStations()) {
- for (Station curStation : stations) {
- if (curStationAdded.getIdStation() == curStation.getIdStation()) {
- choices.remove(curStation);
- }
- }
- }
- availableStations.setChoices(choices);
- availableStations.setEnabled(!choices.isEmpty());
- addStation.setEnabled(!choices.isEmpty());
- availableStations.setEnabled(!choices.isEmpty());
- }
+ /**
+ * Suprimme de la liste des stations proposées, les stations qui sont déjà ajoutées comme station prospectée
+ */
+ private void cleanStationsChoice() {
+ List<Station> choices = new ArrayList<Station>(stations);
+ for (Station curStationAdded : campagneModel.getObject().getStations()) {
+ for (Station curStation : stations) {
+ if (curStationAdded.getIdStation() == curStation.getIdStation()) {
+ choices.remove(curStation);
+ }
+ }
+ }
+ availableStations.setChoices(choices);
+ availableStations.setEnabled(!choices.isEmpty());
+ addStation.setEnabled(!choices.isEmpty());
+ availableStations.setEnabled(!choices.isEmpty());
+ }
- /**
- * Validate the campagne model (for update & create)
- */
- private void validateModel() {
- if (campagneModel.getObject().getCreateur() == null) {
- campagneModel.getObject().setCreateur(getSession().getUtilisateur());
- }
- addValidationErrors(validator.validate(campagneModel.getObject(), getSession().getLocale(), "nom", "codePays",
- "programme", "complement", "createur"));
- List<String> dateErrors = validator.validate(campagneModel.getObject(), getSession().getLocale(), "dateDeb",
- "dateFin");
- addValidationErrors(dateErrors);
- if (dateErrors.size() == 0
- && (campagneModel.getObject().getDateDeb() == null || campagneModel.getObject().getDateFin() == null || !campagneModel
- .getObject().getDateDeb().before(campagneModel.getObject().getDateFin()))) {
- getPage().error(getString("Campagne.dates.KO"));
- }
- }
+ /**
+ * Validate the campagne model (for update & create)
+ */
+ private void validateModel() {
+ if (campagneModel.getObject().getCreateur() == null) {
+ campagneModel.getObject().setCreateur(getSession().getUtilisateur());
+ }
+ addValidationErrors(validator.validate(campagneModel.getObject(), getSession().getLocale(), "nom", "codePays",
+ "programme", "complement", "createur"));
+ List<String> dateErrors = validator.validate(campagneModel.getObject(), getSession().getLocale(), "dateDeb",
+ "dateFin");
+ addValidationErrors(dateErrors);
+ if (dateErrors.size() == 0
+ && (campagneModel.getObject().getDateDeb() == null || campagneModel.getObject().getDateFin() == null || !campagneModel
+ .getObject().getDateDeb().before(campagneModel.getObject().getDateFin()))) {
+ getPage().error(getString("Campagne.dates.KO"));
+ }
+ }
}
\ No newline at end of file
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/campagne/ReadCampagnePage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/campagne/ReadCampagnePage.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/campagne/ReadCampagnePage.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -68,252 +68,252 @@
*/
public final class ReadCampagnePage extends TemplatePage {
- /** Logger */
- // private static final Log LOG = LogTools.getLog();
- /** Action : delete */
- public static final String ACTION_DELETE = "Delete";
+ /** Logger */
+ // private static final Log LOG = LogTools.getLog();
+ /** Action : delete */
+ public static final String ACTION_DELETE = "Delete";
- /** Page appelante */
- private final CallerPage callerPage;
+ /** Page appelante */
+ private final CallerPage callerPage;
- /** Modèle : campagne */
- private final IModel<Campagne> campagneModel;
+ /** Modèle : campagne */
+ private final IModel<Campagne> campagneModel;
- /** Service : campagne */
- @SpringBean
- private CampagneService campagneService;
+ /** Service : campagne */
+ @SpringBean
+ private CampagneService campagneService;
- /** Service : station */
- @SpringBean
- private StationService stationService;
+ /** Service : station */
+ @SpringBean
+ private StationService stationService;
- /**
- * Constructeur
- * @param idCampagne ID campagne
- * @param callerPage Page appelante
- */
- public ReadCampagnePage(Integer idCampagne, final CallerPage callerPage) {
+ /**
+ * Constructeur
+ * @param idCampagne ID campagne
+ * @param callerPage Page appelante
+ */
+ public ReadCampagnePage(Integer idCampagne, final CallerPage callerPage) {
- super(ReadCampagnePage.class);
- final CallerPage currentPage = new CallerPage((TemplatePage) getPage());
- this.callerPage = callerPage;
+ super(ReadCampagnePage.class);
+ final CallerPage currentPage = new CallerPage((TemplatePage) getPage());
+ this.callerPage = callerPage;
- // Initialisation des modèles
- campagneModel = new GenericLoadableDetachableModel<Campagne>(Campagne.class, idCampagne);
+ // Initialisation des modèles
+ campagneModel = new GenericLoadableDetachableModel<Campagne>(Campagne.class, idCampagne);
- final Campagne campagne = campagneModel.getObject();
+ final Campagne campagne = campagneModel.getObject();
- // Mapping des champs du modèle
- add(new Label("Campagne.nom", new PropertyModel<String>(campagneModel, "nom"))
- .add(new ReplaceEmptyLabelBehavior()));
+ // Mapping des champs du modèle
+ add(new Label("Campagne.nom", new PropertyModel<String>(campagneModel, "nom"))
+ .add(new ReplaceEmptyLabelBehavior()));
- // Affichage du pays
- add(new Label("Campagne.codePays", new DisplayMapValuePropertyModel<String>(campagneModel, "codePays",
- WebContext.COUNTRIES.get(getSession().getLocale()))).add(new ReplaceEmptyLabelBehavior()));
- add(new Label("Campagne.dateDeb", new PropertyModel<String>(campagneModel, "dateDeb"))
- .add(new ReplaceEmptyLabelBehavior()));
- add(new Label("Campagne.dateFin", new PropertyModel<String>(campagneModel, "dateFin"))
- .add(new ReplaceEmptyLabelBehavior()));
- add(new Label("Campagne.programme", new PropertyModel<String>(campagneModel, "programme"))
- .add(new ReplaceEmptyLabelBehavior()));
- add(new MultiLineLabel("Campagne.mentionLegale", new PropertyModel<String>(campagneModel, "mentionLegale"))
- .add(new ReplaceEmptyLabelBehavior()));
- add(new SimpleTooltipPanel("Campagne.mentionLegale.info", new Model<String>(
- getString("Campagne.mentionLegale.info2"))));
- add(new MultiLineLabel("Campagne.complement", new PropertyModel<String>(campagneModel, "complement"))
- .add(new ReplaceEmptyLabelBehavior()));
+ // Affichage du pays
+ add(new Label("Campagne.codePays", new DisplayMapValuePropertyModel<String>(campagneModel, "codePays",
+ WebContext.COUNTRIES.get(getSession().getLocale()))).add(new ReplaceEmptyLabelBehavior()));
+ add(new Label("Campagne.dateDeb", new PropertyModel<String>(campagneModel, "dateDeb"))
+ .add(new ReplaceEmptyLabelBehavior()));
+ add(new Label("Campagne.dateFin", new PropertyModel<String>(campagneModel, "dateFin"))
+ .add(new ReplaceEmptyLabelBehavior()));
+ add(new Label("Campagne.programme", new PropertyModel<String>(campagneModel, "programme"))
+ .add(new ReplaceEmptyLabelBehavior()));
+ add(new MultiLineLabel("Campagne.mentionLegale", new PropertyModel<String>(campagneModel, "mentionLegale"))
+ .add(new ReplaceEmptyLabelBehavior()));
+ add(new SimpleTooltipPanel("Campagne.mentionLegale.info", new Model<String>(
+ getString("Campagne.mentionLegale.info2"))));
+ add(new MultiLineLabel("Campagne.complement", new PropertyModel<String>(campagneModel, "complement"))
+ .add(new ReplaceEmptyLabelBehavior()));
- add(new PropertyLabelLinkPanel<Personne>("Campagne.createur", new PropertyModel<Personne>(campagneModel,
- "createur"), getString("Read")) {
- @Override
- public void onClick() {
- setResponsePage(new ReadPersonnePage(getModelObject().getIdPersonne(), currentPage));
- }
- });
+ add(new PropertyLabelLinkPanel<Personne>("Campagne.createur", new PropertyModel<Personne>(campagneModel,
+ "createur"), getString("Read")) {
+ @Override
+ public void onClick() {
+ setResponsePage(new ReadPersonnePage(getModelObject().getIdPersonne(), currentPage));
+ }
+ });
- initParticipantsFields(currentPage);
- initStationsFields(currentPage);
+ initParticipantsFields(currentPage);
+ initStationsFields(currentPage);
- // Ajout du formulaire pour les actions
- final Form<Void> formView = new Form<Void>("Form");
+ // Ajout du formulaire pour les actions
+ final Form<Void> formView = new Form<Void>("Form");
- // Action : mise à jour (redirection vers le formulaire)
- Link<Campagne> updateLink = new Link<Campagne>(getResource() + ".Campagne.Update",
- new Model<Campagne>(campagne)) {
- @Override
- public void onClick() {
- setResponsePage(new ManageCampagnePage(getModelObject().getIdCampagne(), currentPage));
- }
- };
- updateLink.setVisibilityAllowed(campagneService.updateOrdeleteCampagneEnabled(campagne, getSession()
- .getUtilisateur()));
- formView.add(updateLink);
+ // Action : mise à jour (redirection vers le formulaire)
+ Link<Campagne> updateLink = new Link<Campagne>(getResource() + ".Campagne.Update",
+ new Model<Campagne>(campagne)) {
+ @Override
+ public void onClick() {
+ setResponsePage(new ManageCampagnePage(getModelObject().getIdCampagne(), currentPage));
+ }
+ };
+ updateLink.setVisibilityAllowed(campagneService.updateOrdeleteCampagneEnabled(campagne, getSession()
+ .getUtilisateur()));
+ formView.add(updateLink);
- // Action : retour à la page précédente
- formView.add(new Link<Void>(getResource() + ".Campagne.Back") {
- @Override
- public void onClick() {
- redirect();
- }
- });
+ // Action : retour à la page précédente
+ formView.add(new Link<Void>(getResource() + ".Campagne.Back") {
+ @Override
+ public void onClick() {
+ redirect();
+ }
+ });
- // Action : suppression de la campagne
- Button deleteButton = new SubmittableButton(ACTION_DELETE, ManageCampagnePage.class,
- new SubmittableButtonEvents() {
- @Override
- public void onProcess() throws DataConstraintException {
- campagneService.deleteCampagne(campagne);
- }
+ // Action : suppression de la campagne
+ Button deleteButton = new SubmittableButton(ACTION_DELETE, ManageCampagnePage.class,
+ new SubmittableButtonEvents() {
+ @Override
+ public void onProcess() throws DataConstraintException {
+ campagneService.deleteCampagne(campagne);
+ }
- @Override
- public void onSuccess() {
- successNextPage(ManageCampagnePage.class, ACTION_DELETE);
- redirect();
- }
- });
- deleteButton.setVisibilityAllowed(campagneService.updateOrdeleteCampagneEnabled(campagne, getSession()
- .getUtilisateur()));
- deleteButton.add(new JSConfirmationBehavior(getString("Confirm")));
- formView.add(deleteButton);
- add(formView);
- }
+ @Override
+ public void onSuccess() {
+ successNextPage(ManageCampagnePage.class, ACTION_DELETE);
+ redirect();
+ }
+ });
+ deleteButton.setVisibilityAllowed(campagneService.updateOrdeleteCampagneEnabled(campagne, getSession()
+ .getUtilisateur()));
+ deleteButton.add(new JSConfirmationBehavior(getString("Confirm")));
+ formView.add(deleteButton);
+ add(formView);
+ }
- /**
- * Initialize participants section
- * @param currentPage The current page
- */
- private void initParticipantsFields(final CallerPage currentPage) {
- ListView<CampagnePersonneParticipant> campagneParticipants = new ListView<CampagnePersonneParticipant>(
- "Campagne.participants.List", new PropertyModel<List<CampagnePersonneParticipant>>(campagneModel,
- "participants")) {
- @Override
- protected void populateItem(ListItem<CampagnePersonneParticipant> item) {
- if (item.getIndex() % 2 == 1) {
- item.add(new AttributeModifier("class", item.getIndex() % 2 == 0 ? "even" : "odd"));
- }
+ /**
+ * Initialize participants section
+ * @param currentPage The current page
+ */
+ private void initParticipantsFields(final CallerPage currentPage) {
+ ListView<CampagnePersonneParticipant> campagneParticipants = new ListView<CampagnePersonneParticipant>(
+ "Campagne.participants.List", new PropertyModel<List<CampagnePersonneParticipant>>(campagneModel,
+ "participants")) {
+ @Override
+ protected void populateItem(ListItem<CampagnePersonneParticipant> item) {
+ if (item.getIndex() % 2 == 1) {
+ item.add(new AttributeModifier("class", item.getIndex() % 2 == 0 ? "even" : "odd"));
+ }
- CampagnePersonneParticipant participant = item.getModelObject();
- // affichage + lien vers la fiche
- item.add(new PropertyLabelLinkPanel<Personne>("Campagne.participants.List.personne",
- new Model<Personne>(participant.getId().getPk2()), getString("Read")) {
- @Override
- public void onClick() {
- setResponsePage(new ReadPersonnePage(getModelObject().getIdPersonne(), currentPage));
- }
- });
- item.add(new Label("Campagne.participants.List.complement", new PropertyModel<String>(participant,
- "complement")));
- }
- };
+ CampagnePersonneParticipant participant = item.getModelObject();
+ // affichage + lien vers la fiche
+ item.add(new PropertyLabelLinkPanel<Personne>("Campagne.participants.List.personne",
+ new Model<Personne>(participant.getId().getPk2()), getString("Read")) {
+ @Override
+ public void onClick() {
+ setResponsePage(new ReadPersonnePage(getModelObject().getIdPersonne(), currentPage));
+ }
+ });
+ item.add(new Label("Campagne.participants.List.complement", new PropertyModel<String>(participant,
+ "complement")));
+ }
+ };
- // Selon l'existence d'elements dans la liste on affiche la table
- MarkupContainer tableParticipants = new WebMarkupContainer("Campagne.participants.Table") {
- @Override
- public boolean isVisible() {
- return campagneModel.getObject().getParticipants().size() != 0;
- }
- };
- tableParticipants.add(campagneParticipants);
- add(tableParticipants);
+ // Selon l'existence d'elements dans la liste on affiche la table
+ MarkupContainer tableParticipants = new WebMarkupContainer("Campagne.participants.Table") {
+ @Override
+ public boolean isVisible() {
+ return campagneModel.getObject().getParticipants().size() != 0;
+ }
+ };
+ tableParticipants.add(campagneParticipants);
+ add(tableParticipants);
- // Selon la non existence d'elements dans la liste on affiche le span
- MarkupContainer noTableParticipants = new WebMarkupContainer("Campagne.participants.NoTable") {
- @Override
- public boolean isVisible() {
- return campagneModel.getObject().getParticipants().size() == 0;
- }
- };
- add(noTableParticipants);
- }
+ // Selon la non existence d'elements dans la liste on affiche le span
+ MarkupContainer noTableParticipants = new WebMarkupContainer("Campagne.participants.NoTable") {
+ @Override
+ public boolean isVisible() {
+ return campagneModel.getObject().getParticipants().size() == 0;
+ }
+ };
+ add(noTableParticipants);
+ }
- /**
- * Initialize stations section
- * @param currentPage The current page
- */
- private void initStationsFields(final CallerPage currentPage) {
+ /**
+ * Initialize stations section
+ * @param currentPage The current page
+ */
+ private void initStationsFields(final CallerPage currentPage) {
- // Selon l'existence d'elements dans la liste on affiche la table
- MarkupContainer tableStations = new WebMarkupContainer("Campagne.stations.Table") {
- @Override
- public boolean isVisible() {
- return !campagneModel.getObject().getStations().isEmpty();
- }
- };
- add(tableStations);
+ // Selon l'existence d'elements dans la liste on affiche la table
+ MarkupContainer tableStations = new WebMarkupContainer("Campagne.stations.Table") {
+ @Override
+ public boolean isVisible() {
+ return !campagneModel.getObject().getStations().isEmpty();
+ }
+ };
+ add(tableStations);
- final WebMarkupContainer stationsNotAccessiblesCont = new WebMarkupContainer(
- "Campagne.stations.stationsNotAccessibles");
- stationsNotAccessiblesCont.setOutputMarkupPlaceholderTag(true);
- tableStations.add(stationsNotAccessiblesCont);
+ final WebMarkupContainer stationsNotAccessiblesCont = new WebMarkupContainer(
+ "Campagne.stations.stationsNotAccessibles");
+ stationsNotAccessiblesCont.setOutputMarkupPlaceholderTag(true);
+ tableStations.add(stationsNotAccessiblesCont);
- // Model de liste des stations
- final LoadableDetachableModel<List<Station>> listStationsModel = new LoadableDetachableModel<List<Station>>() {
- @Override
- protected List<Station> load() {
- boolean isOneResultNotAccessible = false;
- final List<Station> accessiblesStations = stationService.listStations(getSession().getUtilisateur());
+ // Model de liste des stations
+ final LoadableDetachableModel<List<Station>> listStationsModel = new LoadableDetachableModel<List<Station>>() {
+ @Override
+ protected List<Station> load() {
+ boolean isOneResultNotAccessible = false;
+ final List<Station> accessiblesStations = stationService.listStations(getSession().getUtilisateur());
- List<Station> listStations = new ArrayList<Station>();
+ List<Station> listStations = new ArrayList<Station>();
- for (Station st : campagneModel.getObject().getSortedStations()) {
+ for (Station st : campagneModel.getObject().getSortedStations()) {
- if (accessiblesStations.contains(st)) {
- listStations.add(st);
- } else {
- isOneResultNotAccessible = true;
- }
- }
- // si une des stations non accessibles, on rend visible le message d'avertissement
- stationsNotAccessiblesCont.setVisibilityAllowed(isOneResultNotAccessible);
- return listStations;
- }
- };
+ if (accessiblesStations.contains(st)) {
+ listStations.add(st);
+ } else {
+ isOneResultNotAccessible = true;
+ }
+ }
+ // si une des stations non accessibles, on rend visible le message d'avertissement
+ stationsNotAccessiblesCont.setVisibilityAllowed(isOneResultNotAccessible);
+ return listStations;
+ }
+ };
- ListView<Station> stationsListView = new ListView<Station>("Campagne.stations.List", listStationsModel) {
- @Override
- protected void populateItem(ListItem<Station> item) {
- if (item.getIndex() % 2 == 1) {
- item.add(new AttributeModifier("class", item.getIndex() % 2 == 0 ? "even" : "odd"));
- }
+ ListView<Station> stationsListView = new ListView<Station>("Campagne.stations.List", listStationsModel) {
+ @Override
+ protected void populateItem(ListItem<Station> item) {
+ if (item.getIndex() % 2 == 1) {
+ item.add(new AttributeModifier("class", item.getIndex() % 2 == 0 ? "even" : "odd"));
+ }
- IModel<Station> stationModel = item.getModel();
- // affichage + lien vers la fiche
- item.add(new PropertyLabelLinkPanel<Station>("Campagne.stations.List.station", item.getModel(),
- getString("Read")) {
- @Override
- public void onClick() {
- setResponsePage(new ReadStationPage(getModelObject().getIdStation(), currentPage));
- }
- });
+ IModel<Station> stationModel = item.getModel();
+ // affichage + lien vers la fiche
+ item.add(new PropertyLabelLinkPanel<Station>("Campagne.stations.List.station", item.getModel(),
+ getString("Read")) {
+ @Override
+ public void onClick() {
+ setResponsePage(new ReadStationPage(getModelObject().getIdStation(), currentPage));
+ }
+ });
- item.add(new Label("Campagne.stations.List.codePays", new DisplayMapValuePropertyModel<String>(
- stationModel, "codePays", WebContext.COUNTRIES.get(getSession().getLocale())))
- .add(new ReplaceEmptyLabelBehavior()));
- item.add(new Label("Campagne.stations.List.localite", new PropertyModel<String>(stationModel,
- "localite")).add(new ReplaceEmptyLabelBehavior()));
- item.add(new Label("Campagne.stations.List.latitude", new PropertyModel<String>(stationModel,
- "latitude")).add(new ReplaceEmptyLabelBehavior()));
- item.add(new Label("Campagne.stations.List.longitude", new PropertyModel<String>(stationModel,
- "longitude")).add(new ReplaceEmptyLabelBehavior()));
- }
- };
- tableStations.add(stationsListView);
+ item.add(new Label("Campagne.stations.List.codePays", new DisplayMapValuePropertyModel<String>(
+ stationModel, "codePays", WebContext.COUNTRIES.get(getSession().getLocale())))
+ .add(new ReplaceEmptyLabelBehavior()));
+ item.add(new Label("Campagne.stations.List.localite", new PropertyModel<String>(stationModel,
+ "localite")).add(new ReplaceEmptyLabelBehavior()));
+ item.add(new Label("Campagne.stations.List.latitude", new PropertyModel<String>(stationModel,
+ "latitude")).add(new ReplaceEmptyLabelBehavior()));
+ item.add(new Label("Campagne.stations.List.longitude", new PropertyModel<String>(stationModel,
+ "longitude")).add(new ReplaceEmptyLabelBehavior()));
+ }
+ };
+ tableStations.add(stationsListView);
- // Selon la non existence d'elements dans la liste on affiche le span
- MarkupContainer noTableStations = new WebMarkupContainer("Campagne.stations.NoTable") {
- @Override
- public boolean isVisible() {
- return campagneModel.getObject().getStations().isEmpty();
- }
- };
- add(noTableStations);
- }
+ // Selon la non existence d'elements dans la liste on affiche le span
+ MarkupContainer noTableStations = new WebMarkupContainer("Campagne.stations.NoTable") {
+ @Override
+ public boolean isVisible() {
+ return campagneModel.getObject().getStations().isEmpty();
+ }
+ };
+ add(noTableStations);
+ }
- /**
- * Redirection vers une autre page
- */
- private void redirect() {
- callerPage.responsePage(this);
- }
+ /**
+ * Redirection vers une autre page
+ */
+ private void redirect() {
+ callerPage.responsePage(this);
+ }
}
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/config/ListConfigurationPage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/config/ListConfigurationPage.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/config/ListConfigurationPage.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -44,97 +44,97 @@
@AuthRoles({ AuthRole.ADMIN })
public final class ListConfigurationPage extends TemplatePage {
- /** The opened param value */
- final private String OPENED_PARAM_VALUE = "opened";
+ /** The opened param value */
+ final private String OPENED_PARAM_VALUE = "opened";
- /**
- * Constructor
- * @param params The page parameters
- */
- public ListConfigurationPage(PageParameters params) {
- super(ListConfigurationPage.class);
+ /**
+ * Constructor
+ * @param params The page parameters
+ */
+ public ListConfigurationPage(PageParameters params) {
+ super(ListConfigurationPage.class);
- // check the parameters to know which panel must be opened
- boolean partieOpened = checkIfPanelOpened(params, "partie");
- boolean methExtrOpened = checkIfPanelOpened(params, "methodeExtraction");
- boolean methPuriOpened = checkIfPanelOpened(params, "methodePurification");
- boolean methTestOpened = checkIfPanelOpened(params, "methodeTestBio");
- boolean errTestOpened = checkIfPanelOpened(params, "erreurTestBio");
- boolean rebIndexOpened = checkIfPanelOpened(params, "rebuildLuceneIndex");
+ // check the parameters to know which panel must be opened
+ boolean partieOpened = checkIfPanelOpened(params, "partie");
+ boolean methExtrOpened = checkIfPanelOpened(params, "methodeExtraction");
+ boolean methPuriOpened = checkIfPanelOpened(params, "methodePurification");
+ boolean methTestOpened = checkIfPanelOpened(params, "methodeTestBio");
+ boolean errTestOpened = checkIfPanelOpened(params, "erreurTestBio");
+ boolean rebIndexOpened = checkIfPanelOpened(params, "rebuildLuceneIndex");
- if (params.get("openedTab").equals("partie")) {
- partieOpened = true;
- } else if (params.get("openedTab").equals("methodeExtraction")) {
- methExtrOpened = true;
- } else
+ if (params.get("openedTab").equals("partie")) {
+ partieOpened = true;
+ } else if (params.get("openedTab").equals("methodeExtraction")) {
+ methExtrOpened = true;
+ } else
- // initialize the Partie panel
- add(new CollapsiblePanel(getResource() + ".ListPartiePanel", new Model<String>(
- getString("ListConfigurationPage.Parties")), partieOpened) {
+ // initialize the Partie panel
+ add(new CollapsiblePanel(getResource() + ".ListPartiePanel", new Model<String>(
+ getString("ListConfigurationPage.Parties")), partieOpened) {
- @Override
- protected Panel getInnerPanel(String markupId) {
- return new ListPartiePanel(markupId);
- }
- });
+ @Override
+ protected Panel getInnerPanel(String markupId) {
+ return new ListPartiePanel(markupId);
+ }
+ });
- // initialize the MethodeExtraction panel
- add(new CollapsiblePanel(getResource() + ".ListMethodeExtractionPanel", new Model<String>(
- getString("ListConfigurationPage.MethodesExtraction")), methExtrOpened) {
+ // initialize the MethodeExtraction panel
+ add(new CollapsiblePanel(getResource() + ".ListMethodeExtractionPanel", new Model<String>(
+ getString("ListConfigurationPage.MethodesExtraction")), methExtrOpened) {
- @Override
- protected Panel getInnerPanel(String markupId) {
- return new ListMethodeExtractionPanel(markupId);
- }
- });
+ @Override
+ protected Panel getInnerPanel(String markupId) {
+ return new ListMethodeExtractionPanel(markupId);
+ }
+ });
- // initialize the MethodePurification panel
- add(new CollapsiblePanel(getResource() + ".ListMethodePurificationPanel", new Model<String>(
- getString("ListConfigurationPage.MethodesPurification")), methPuriOpened) {
+ // initialize the MethodePurification panel
+ add(new CollapsiblePanel(getResource() + ".ListMethodePurificationPanel", new Model<String>(
+ getString("ListConfigurationPage.MethodesPurification")), methPuriOpened) {
- @Override
- protected Panel getInnerPanel(String markupId) {
- return new ListMethodePurificationPanel(markupId);
- }
- });
+ @Override
+ protected Panel getInnerPanel(String markupId) {
+ return new ListMethodePurificationPanel(markupId);
+ }
+ });
- // initialize the MethodeTest panel
- add(new CollapsiblePanel(getResource() + ".ListMethodeTestBioPanel", new Model<String>(
- getString("ListConfigurationPage.MethodesTestBio")), methTestOpened) {
+ // initialize the MethodeTest panel
+ add(new CollapsiblePanel(getResource() + ".ListMethodeTestBioPanel", new Model<String>(
+ getString("ListConfigurationPage.MethodesTestBio")), methTestOpened) {
- @Override
- protected Panel getInnerPanel(String markupId) {
- return new ListMethodeTestBioPanel(markupId);
- }
- });
+ @Override
+ protected Panel getInnerPanel(String markupId) {
+ return new ListMethodeTestBioPanel(markupId);
+ }
+ });
- // initialize the TestErreur panel
- add(new CollapsiblePanel(getResource() + ".ListErreurTestBioPanel", new Model<String>(
- getString("ListConfigurationPage.ErreursTestBio")), errTestOpened) {
+ // initialize the TestErreur panel
+ add(new CollapsiblePanel(getResource() + ".ListErreurTestBioPanel", new Model<String>(
+ getString("ListConfigurationPage.ErreursTestBio")), errTestOpened) {
- @Override
- protected Panel getInnerPanel(String markupId) {
- return new ListErreurTestBioPanel(markupId);
- }
- });
-
- // initialize the RebuidLuceneIndex panel
- add(new CollapsiblePanel(getResource() + ".RebuildLuceneIndexPanel", new Model<String>(
- getString("ListConfigurationPage.RebuildLuceneIndex")), rebIndexOpened) {
@Override
protected Panel getInnerPanel(String markupId) {
+ return new ListErreurTestBioPanel(markupId);
+ }
+ });
+
+ // initialize the RebuidLuceneIndex panel
+ add(new CollapsiblePanel(getResource() + ".RebuildLuceneIndexPanel", new Model<String>(
+ getString("ListConfigurationPage.RebuildLuceneIndex")), rebIndexOpened) {
+ @Override
+ protected Panel getInnerPanel(String markupId) {
return new RebuildLuceneIndexPanel(markupId);
}
});
- }
+ }
- /**
- * Check in the request parameters if a panel should be opened
- * @param params The parameters
- * @param paramName The parameter name to check
- * @return the answer
- */
- private boolean checkIfPanelOpened(PageParameters params, String paramName) {
- return params.get(paramName) != null && OPENED_PARAM_VALUE.equals(params.get(paramName).toString());
- }
+ /**
+ * Check in the request parameters if a panel should be opened
+ * @param params The parameters
+ * @param paramName The parameter name to check
+ * @return the answer
+ */
+ private boolean checkIfPanelOpened(PageParameters params, String paramName) {
+ return params.get(paramName) != null && OPENED_PARAM_VALUE.equals(params.get(paramName).toString());
+ }
}
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/config/ManageErreurTestBioPage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/config/ManageErreurTestBioPage.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/config/ManageErreurTestBioPage.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -56,152 +56,152 @@
@AuthRoles({ AuthRole.ADMIN })
public final class ManageErreurTestBioPage extends TemplatePage {
- /** Action : create */
- private static final String ACTION_CREATE = "Create";
+ /** Action : create */
+ private static final String ACTION_CREATE = "Create";
- /** Action : update */
- private static final String ACTION_UPDATE = "Update";
+ /** Action : update */
+ private static final String ACTION_UPDATE = "Update";
- /** Action : delete */
- public static final String ACTION_DELETE = "Delete";
+ /** Action : delete */
+ public static final String ACTION_DELETE = "Delete";
- /** The return page parameter (key and value) */
- final private String[] RETURN_PARAM = { "erreurTestBio", "opened" };
+ /** The return page parameter (key and value) */
+ final private String[] RETURN_PARAM = { "erreurTestBio", "opened" };
- /** Logger */
- private static final Log LOG = LogTools.getLog();
+ /** Logger */
+ private static final Log LOG = LogTools.getLog();
- /** erreurTest Model */
- private final IModel<ErreurTestBio> erreurTestModel;
+ /** erreurTest Model */
+ private final IModel<ErreurTestBio> erreurTestModel;
- /** Service : test (for erreurs) */
- @SpringBean
- private TestBioService testService;
+ /** Service : test (for erreurs) */
+ @SpringBean
+ private TestBioService testService;
- /** Model validateur */
- @SpringBean(name = "webModelValidator")
- private ModelValidator validator;
+ /** Model validateur */
+ @SpringBean(name = "webModelValidator")
+ private ModelValidator validator;
- /**
- * Constructor
- */
- public ManageErreurTestBioPage() {
- this(null);
- }
+ /**
+ * Constructor
+ */
+ public ManageErreurTestBioPage() {
+ this(null);
+ }
- /**
- * Constructor. If idErreurTest is null, creating a new error, else editing the corresponding error
- * @param idErreurTest The ID of the erreurTest
- */
- public ManageErreurTestBioPage(Integer idErreurTest) {
- super(ManageErreurTestBioPage.class);
+ /**
+ * Constructor. If idErreurTest is null, creating a new error, else editing the corresponding error
+ * @param idErreurTest The ID of the erreurTest
+ */
+ public ManageErreurTestBioPage(Integer idErreurTest) {
+ super(ManageErreurTestBioPage.class);
- boolean createMode;
+ boolean createMode;
- // model initialization
- if (idErreurTest == null) {
- // creation mode
- erreurTestModel = new Model<ErreurTestBio>(new ErreurTestBio());
- createMode = true;
- } else {
- try {
- erreurTestModel = new Model<ErreurTestBio>(testService.loadErreurTestBio(idErreurTest));
- } catch (DataNotFoundException e) {
- LOG.error(e.getMessage(), e);
- throw new UnexpectedException(e);
- }
- createMode = false;
- }
+ // model initialization
+ if (idErreurTest == null) {
+ // creation mode
+ erreurTestModel = new Model<ErreurTestBio>(new ErreurTestBio());
+ createMode = true;
+ } else {
+ try {
+ erreurTestModel = new Model<ErreurTestBio>(testService.loadErreurTestBio(idErreurTest));
+ } catch (DataNotFoundException e) {
+ LOG.error(e.getMessage(), e);
+ throw new UnexpectedException(e);
+ }
+ createMode = false;
+ }
- // bind with markup
- final Form<Void> formView = new Form<Void>("Form");
+ // bind with markup
+ final Form<Void> formView = new Form<Void>("Form");
- formView.add(new TextField<String>("ErreurTestBio.nom", new PropertyModel<String>(erreurTestModel, "nom")));
- formView.add(new TextArea<String>("ErreurTestBio.description", new PropertyModel<String>(erreurTestModel,
- "description")));
+ formView.add(new TextField<String>("ErreurTestBio.nom", new PropertyModel<String>(erreurTestModel, "nom")));
+ formView.add(new TextArea<String>("ErreurTestBio.description", new PropertyModel<String>(erreurTestModel,
+ "description")));
- // Action : create the erreurTest
- Button createButton = new SubmittableButton(ACTION_CREATE, new SubmittableButtonEvents() {
- @Override
- public void onProcess() throws DataConstraintException {
- testService.createErreurTest(erreurTestModel.getObject());
- }
+ // Action : create the erreurTest
+ Button createButton = new SubmittableButton(ACTION_CREATE, new SubmittableButtonEvents() {
+ @Override
+ public void onProcess() throws DataConstraintException {
+ testService.createErreurTest(erreurTestModel.getObject());
+ }
- @Override
- public void onSuccess() {
- successNextPage(ACTION_CREATE);
- PageParameters params = new PageParameters();
- params.add(RETURN_PARAM[0], RETURN_PARAM[1]);
- setResponsePage(ListConfigurationPage.class, params);
- }
+ @Override
+ public void onSuccess() {
+ successNextPage(ACTION_CREATE);
+ PageParameters params = new PageParameters();
+ params.add(RETURN_PARAM[0], RETURN_PARAM[1]);
+ setResponsePage(ListConfigurationPage.class, params);
+ }
- @Override
- public void onValidate() {
- validateModel();
- }
- });
- createButton.setVisibilityAllowed(createMode);
- formView.add(createButton);
+ @Override
+ public void onValidate() {
+ validateModel();
+ }
+ });
+ createButton.setVisibilityAllowed(createMode);
+ formView.add(createButton);
- // Action : update the erreurTest
- Button updateButton = new SubmittableButton(ACTION_UPDATE, new SubmittableButtonEvents() {
- @Override
- public void onProcess() throws DataConstraintException {
- testService.updateErreurTestBio(erreurTestModel.getObject());
- }
+ // Action : update the erreurTest
+ Button updateButton = new SubmittableButton(ACTION_UPDATE, new SubmittableButtonEvents() {
+ @Override
+ public void onProcess() throws DataConstraintException {
+ testService.updateErreurTestBio(erreurTestModel.getObject());
+ }
- @Override
- public void onSuccess() {
- successNextPage(ACTION_UPDATE);
- PageParameters params = new PageParameters();
- params.add(RETURN_PARAM[0], RETURN_PARAM[1]);
- setResponsePage(ListConfigurationPage.class, params);
- }
+ @Override
+ public void onSuccess() {
+ successNextPage(ACTION_UPDATE);
+ PageParameters params = new PageParameters();
+ params.add(RETURN_PARAM[0], RETURN_PARAM[1]);
+ setResponsePage(ListConfigurationPage.class, params);
+ }
- @Override
- public void onValidate() {
- validateModel();
- }
- });
- updateButton.setVisibilityAllowed(!createMode);
- formView.add(updateButton);
+ @Override
+ public void onValidate() {
+ validateModel();
+ }
+ });
+ updateButton.setVisibilityAllowed(!createMode);
+ formView.add(updateButton);
- // Action : suppression
- Button deleteButton = new SubmittableButton(ACTION_DELETE, new SubmittableButtonEvents() {
- @Override
- public void onProcess() throws DataConstraintException {
- testService.deleteErreurTest(erreurTestModel.getObject());
- }
+ // Action : suppression
+ Button deleteButton = new SubmittableButton(ACTION_DELETE, new SubmittableButtonEvents() {
+ @Override
+ public void onProcess() throws DataConstraintException {
+ testService.deleteErreurTest(erreurTestModel.getObject());
+ }
- @Override
- public void onSuccess() {
- successNextPage(ACTION_DELETE);
- PageParameters params = new PageParameters();
- params.add(RETURN_PARAM[0], RETURN_PARAM[1]);
- setResponsePage(ListConfigurationPage.class, params);
- }
- });
- deleteButton.setVisibilityAllowed(!createMode);
- deleteButton.setDefaultFormProcessing(false);
- deleteButton.add(new JSConfirmationBehavior(getString("Confirm")));
- formView.add(deleteButton);
+ @Override
+ public void onSuccess() {
+ successNextPage(ACTION_DELETE);
+ PageParameters params = new PageParameters();
+ params.add(RETURN_PARAM[0], RETURN_PARAM[1]);
+ setResponsePage(ListConfigurationPage.class, params);
+ }
+ });
+ deleteButton.setVisibilityAllowed(!createMode);
+ deleteButton.setDefaultFormProcessing(false);
+ deleteButton.add(new JSConfirmationBehavior(getString("Confirm")));
+ formView.add(deleteButton);
- formView.add(new Link<Void>("Cancel") {
- @Override
- public void onClick() {
- PageParameters params = new PageParameters();
- params.add(RETURN_PARAM[0], RETURN_PARAM[1]);
- setResponsePage(ListConfigurationPage.class, params);
- }
- });
+ formView.add(new Link<Void>("Cancel") {
+ @Override
+ public void onClick() {
+ PageParameters params = new PageParameters();
+ params.add(RETURN_PARAM[0], RETURN_PARAM[1]);
+ setResponsePage(ListConfigurationPage.class, params);
+ }
+ });
- add(formView);
- }
+ add(formView);
+ }
- /**
- * Validate model
- */
- private void validateModel() {
- addValidationErrors(validator.validate(erreurTestModel.getObject(), getSession().getLocale()));
- }
+ /**
+ * Validate model
+ */
+ private void validateModel() {
+ addValidationErrors(validator.validate(erreurTestModel.getObject(), getSession().getLocale()));
+ }
}
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/config/ManageMethodeExtractionPage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/config/ManageMethodeExtractionPage.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/config/ManageMethodeExtractionPage.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -71,285 +71,285 @@
@AuthRoles({ AuthRole.ADMIN })
public final class ManageMethodeExtractionPage extends TemplatePage {
- /** Action : create */
- private static final String ACTION_CREATE = "Create";
+ /** Action : create */
+ private static final String ACTION_CREATE = "Create";
- /** Action : update */
- private static final String ACTION_UPDATE = "Update";
+ /** Action : update */
+ private static final String ACTION_UPDATE = "Update";
- /** Action : delete */
- public static final String ACTION_DELETE = "Delete";
+ /** Action : delete */
+ public static final String ACTION_DELETE = "Delete";
- /** The return page parameter (key and value) */
- final private String[] RETURN_PARAM = { "methodeExtraction", "opened" };
+ /** The return page parameter (key and value) */
+ final private String[] RETURN_PARAM = { "methodeExtraction", "opened" };
- /** Logger */
- private static final Log LOG = LogTools.getLog();
+ /** Logger */
+ private static final Log LOG = LogTools.getLog();
- /** erreurTest Model */
- private final IModel<MethodeExtraction> methodeExtractionModel;
+ /** erreurTest Model */
+ private final IModel<MethodeExtraction> methodeExtractionModel;
- /** model for adding TypeExtrait */
- private IModel<TypeExtrait> newTypeExtraitModel;
+ /** model for adding TypeExtrait */
+ private IModel<TypeExtrait> newTypeExtraitModel;
- /** Service : extraits */
- @SpringBean
- private ExtractionService extraitService;
+ /** Service : extraits */
+ @SpringBean
+ private ExtractionService extraitService;
- /** Model validateur */
- @SpringBean(name = "webModelValidator")
- private ModelValidator validator;
+ /** Model validateur */
+ @SpringBean(name = "webModelValidator")
+ private ModelValidator validator;
- /**
- * couple of <initiale, TypeExtrait> in order to recuperate the id of the deleted type usefull in case of delete
- * thus add of same initial type
- */
- private HashMap<String, TypeExtrait> typesDeleted;
+ /**
+ * couple of <initiale, TypeExtrait> in order to recuperate the id of the deleted type usefull in case of delete
+ * thus add of same initial type
+ */
+ private HashMap<String, TypeExtrait> typesDeleted;
- /**
- * Constructor
- */
- public ManageMethodeExtractionPage() {
- this(null);
- }
+ /**
+ * Constructor
+ */
+ public ManageMethodeExtractionPage() {
+ this(null);
+ }
- /**
- * Constructor. If idMethodeExtraction is null, creating a new methode, else editing the corresponding methode
- * @param idMethode The ID of the methode
- */
- public ManageMethodeExtractionPage(Integer idMethode) {
- super(ManageMethodeExtractionPage.class);
+ /**
+ * Constructor. If idMethodeExtraction is null, creating a new methode, else editing the corresponding methode
+ * @param idMethode The ID of the methode
+ */
+ public ManageMethodeExtractionPage(Integer idMethode) {
+ super(ManageMethodeExtractionPage.class);
- boolean createMode;
+ boolean createMode;
- typesDeleted = new HashMap<String, TypeExtrait>();
+ typesDeleted = new HashMap<String, TypeExtrait>();
- // model initialization
- newTypeExtraitModel = new Model<TypeExtrait>(new TypeExtrait());
- if (idMethode == null) {
- // creation mode
- methodeExtractionModel = new Model<MethodeExtraction>(new MethodeExtraction());
- createMode = true;
- } else {
- try {
- methodeExtractionModel = new Model<MethodeExtraction>(extraitService.loadMethodeExtraction(idMethode));
- } catch (DataNotFoundException e) {
- LOG.error(e.getMessage(), e);
- throw new UnexpectedException(e);
- }
- createMode = false;
- }
+ // model initialization
+ newTypeExtraitModel = new Model<TypeExtrait>(new TypeExtrait());
+ if (idMethode == null) {
+ // creation mode
+ methodeExtractionModel = new Model<MethodeExtraction>(new MethodeExtraction());
+ createMode = true;
+ } else {
+ try {
+ methodeExtractionModel = new Model<MethodeExtraction>(extraitService.loadMethodeExtraction(idMethode));
+ } catch (DataNotFoundException e) {
+ LOG.error(e.getMessage(), e);
+ throw new UnexpectedException(e);
+ }
+ createMode = false;
+ }
- // bind with markup
- final Form<Void> formView = new Form<Void>("Form");
+ // bind with markup
+ final Form<Void> formView = new Form<Void>("Form");
- formView.add(new TextField<String>("MethodeExtraction.nom", new PropertyModel<String>(methodeExtractionModel,
- "nom")));
- formView.add(new TextArea<String>("MethodeExtraction.description", new PropertyModel<String>(
- methodeExtractionModel, "description")));
+ formView.add(new TextField<String>("MethodeExtraction.nom", new PropertyModel<String>(methodeExtractionModel,
+ "nom")));
+ formView.add(new TextArea<String>("MethodeExtraction.description", new PropertyModel<String>(
+ methodeExtractionModel, "description")));
- // Tableau des types en sortie
- final MarkupContainer typesEnSortieTable = new WebMarkupContainer("MethodeExtraction.typesEnSortie.Table");
- typesEnSortieTable.setOutputMarkupId(true);
+ // Tableau des types en sortie
+ final MarkupContainer typesEnSortieTable = new WebMarkupContainer("MethodeExtraction.typesEnSortie.Table");
+ typesEnSortieTable.setOutputMarkupId(true);
- // Liste des types extraits ajoutés
- typesEnSortieTable.add(new ListView<TypeExtrait>("MethodeExtraction.typesEnSortie.List",
- new PropertyModel<List<TypeExtrait>>(methodeExtractionModel, "sortedTypesEnSortie")) {
- @Override
- protected void populateItem(ListItem<TypeExtrait> item) {
- if (item.getIndex() % 2 == 1) {
- item.add(new AttributeModifier("class", item.getIndex() % 2 == 0 ? "even" : "odd"));
- }
+ // Liste des types extraits ajoutés
+ typesEnSortieTable.add(new ListView<TypeExtrait>("MethodeExtraction.typesEnSortie.List",
+ new PropertyModel<List<TypeExtrait>>(methodeExtractionModel, "sortedTypesEnSortie")) {
+ @Override
+ protected void populateItem(ListItem<TypeExtrait> item) {
+ if (item.getIndex() % 2 == 1) {
+ item.add(new AttributeModifier("class", item.getIndex() % 2 == 0 ? "even" : "odd"));
+ }
- final TypeExtrait typeExtrait = item.getModelObject();
- // Colonnes
- item.add(new Label("MethodeExtraction.typesEnSortie.List.initiales", new PropertyModel<String>(
- typeExtrait, "initiales")));
- item.add(new Label("MethodeExtraction.typesEnSortie.List.description", new PropertyModel<String>(
- typeExtrait, "description")));
+ final TypeExtrait typeExtrait = item.getModelObject();
+ // Colonnes
+ item.add(new Label("MethodeExtraction.typesEnSortie.List.initiales", new PropertyModel<String>(
+ typeExtrait, "initiales")));
+ item.add(new Label("MethodeExtraction.typesEnSortie.List.description", new PropertyModel<String>(
+ typeExtrait, "description")));
- // Action : suppression d'un type extrait
- Button deleteButton = new AjaxFallbackButton("MethodeExtraction.typesEnSortie.List.Delete", formView) {
- @Override
- protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
- // Suppression
- methodeExtractionModel.getObject().getTypesEnSortie().remove(typeExtrait);
- // keep the id of the deleted 'extrait' in case of new one with the same 'initiales'
- typesDeleted.put(typeExtrait.getInitiales(), typeExtrait);
+ // Action : suppression d'un type extrait
+ Button deleteButton = new AjaxFallbackButton("MethodeExtraction.typesEnSortie.List.Delete", formView) {
+ @Override
+ protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
+ // Suppression
+ methodeExtractionModel.getObject().getTypesEnSortie().remove(typeExtrait);
+ // keep the id of the deleted 'extrait' in case of new one with the same 'initiales'
+ typesDeleted.put(typeExtrait.getInitiales(), typeExtrait);
- if (target != null) {
- target.add(typesEnSortieTable);
- }
- }
+ if (target != null) {
+ target.add(typesEnSortieTable);
+ }
+ }
- @Override
- protected void onError(AjaxRequestTarget target, Form<?> form) {
- // never called
- }
+ @Override
+ protected void onError(AjaxRequestTarget target, Form<?> form) {
+ // never called
+ }
- };
- deleteButton.setDefaultFormProcessing(false);
- item.add(deleteButton);
- }
- });
+ };
+ deleteButton.setDefaultFormProcessing(false);
+ item.add(deleteButton);
+ }
+ });
- final FormComponent<String> initialesInput = new TextField<String>("MethodeExtraction.typesEnSortie.initiales",
- new PropertyModel<String>(newTypeExtraitModel, "initiales"));
- typesEnSortieTable.add(initialesInput);
+ final FormComponent<String> initialesInput = new TextField<String>("MethodeExtraction.typesEnSortie.initiales",
+ new PropertyModel<String>(newTypeExtraitModel, "initiales"));
+ typesEnSortieTable.add(initialesInput);
- final FormComponent<String> descriptionInput = new TextField<String>(
- "MethodeExtraction.typesEnSortie.description", new PropertyModel<String>(newTypeExtraitModel,
- "description"));
- typesEnSortieTable.add(descriptionInput);
+ final FormComponent<String> descriptionInput = new TextField<String>(
+ "MethodeExtraction.typesEnSortie.description", new PropertyModel<String>(newTypeExtraitModel,
+ "description"));
+ typesEnSortieTable.add(descriptionInput);
- // Bouton AJAX pour ajouter un type extrait
- Button addButton = new AjaxFallbackButton("MethodeExtraction.typeEnSortie.Add", formView) {
- @Override
- protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
- try {
- // normalisation du type extrait
- newTypeExtraitModel.getObject().setInitiales(
- Normalizer.normalize(ConfigNameNormalizer.class, newTypeExtraitModel.getObject()
- .getInitiales()));
- // Ajout du type extrait
- newTypeExtraitModel.getObject().setMethodeExtraction(methodeExtractionModel.getObject());
- // recuperate the id if an just deleted type
- if (typesDeleted.get(newTypeExtraitModel.getObject().getInitiales()) != null) {
- newTypeExtraitModel.getObject().setIdTypeExtrait(
- typesDeleted.get(newTypeExtraitModel.getObject().getInitiales()).getIdTypeExtrait());
- }
+ // Bouton AJAX pour ajouter un type extrait
+ Button addButton = new AjaxFallbackButton("MethodeExtraction.typeEnSortie.Add", formView) {
+ @Override
+ protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
+ try {
+ // normalisation du type extrait
+ newTypeExtraitModel.getObject().setInitiales(
+ Normalizer.normalize(ConfigNameNormalizer.class, newTypeExtraitModel.getObject()
+ .getInitiales()));
+ // Ajout du type extrait
+ newTypeExtraitModel.getObject().setMethodeExtraction(methodeExtractionModel.getObject());
+ // recuperate the id if an just deleted type
+ if (typesDeleted.get(newTypeExtraitModel.getObject().getInitiales()) != null) {
+ newTypeExtraitModel.getObject().setIdTypeExtrait(
+ typesDeleted.get(newTypeExtraitModel.getObject().getInitiales()).getIdTypeExtrait());
+ }
- // ajout à la liste
- TypeExtrait typeExtraitAdded = newTypeExtraitModel.getObject().clone();
- methodeExtractionModel.getObject().getTypesEnSortie().add(typeExtraitAdded);
+ // ajout à la liste
+ TypeExtrait typeExtraitAdded = newTypeExtraitModel.getObject().clone();
+ methodeExtractionModel.getObject().getTypesEnSortie().add(typeExtraitAdded);
- List<String> errors = validator.validate(newTypeExtraitModel.getObject(), getSession().getLocale());
- if (errors.isEmpty()) {
- if (typesDeleted.get(newTypeExtraitModel.getObject().getInitiales()) != null) {
- // si ancien extrait supprimé, on l'enlève de la liste des supprimés
- typesDeleted.remove(newTypeExtraitModel.getObject().getInitiales());
- }
+ List<String> errors = validator.validate(newTypeExtraitModel.getObject(), getSession().getLocale());
+ if (errors.isEmpty()) {
+ if (typesDeleted.get(newTypeExtraitModel.getObject().getInitiales()) != null) {
+ // si ancien extrait supprimé, on l'enlève de la liste des supprimés
+ typesDeleted.remove(newTypeExtraitModel.getObject().getInitiales());
+ }
- // réinit du champ ajout
- newTypeExtraitModel.getObject().setInitiales(null);
- newTypeExtraitModel.getObject().setDescription(null);
- } else {
- methodeExtractionModel.getObject().getTypesEnSortie().remove(typeExtraitAdded);
- addValidationErrors(errors);
- }
- } catch (CloneNotSupportedException e) {
- LOG.error(e.getMessage(), e);
- throw new UnexpectedException(e);
- }
+ // réinit du champ ajout
+ newTypeExtraitModel.getObject().setInitiales(null);
+ newTypeExtraitModel.getObject().setDescription(null);
+ } else {
+ methodeExtractionModel.getObject().getTypesEnSortie().remove(typeExtraitAdded);
+ addValidationErrors(errors);
+ }
+ } catch (CloneNotSupportedException e) {
+ LOG.error(e.getMessage(), e);
+ throw new UnexpectedException(e);
+ }
- if (target != null) {
- target.add(typesEnSortieTable);
- refreshFeedbackPage(target);
- }
- }
+ if (target != null) {
+ target.add(typesEnSortieTable);
+ refreshFeedbackPage(target);
+ }
+ }
- @Override
- protected void onError(AjaxRequestTarget target, Form<?> form) {
- refreshFeedbackPage(target);
- }
+ @Override
+ protected void onError(AjaxRequestTarget target, Form<?> form) {
+ refreshFeedbackPage(target);
+ }
- };
- typesEnSortieTable.add(addButton);
+ };
+ typesEnSortieTable.add(addButton);
- // Action : create the methodeExtraction
- Button createButton = new SubmittableButton(ACTION_CREATE, new SubmittableButtonEvents() {
- @Override
- public void onProcess() throws DataConstraintException {
- extraitService.createMethodeExtraction(methodeExtractionModel.getObject());
- }
+ // Action : create the methodeExtraction
+ Button createButton = new SubmittableButton(ACTION_CREATE, new SubmittableButtonEvents() {
+ @Override
+ public void onProcess() throws DataConstraintException {
+ extraitService.createMethodeExtraction(methodeExtractionModel.getObject());
+ }
- @Override
- public void onSuccess() {
- successNextPage(ACTION_CREATE);
- PageParameters params = new PageParameters();
- params.add(RETURN_PARAM[0], RETURN_PARAM[1]);
- setResponsePage(ListConfigurationPage.class, params);
- }
+ @Override
+ public void onSuccess() {
+ successNextPage(ACTION_CREATE);
+ PageParameters params = new PageParameters();
+ params.add(RETURN_PARAM[0], RETURN_PARAM[1]);
+ setResponsePage(ListConfigurationPage.class, params);
+ }
- @Override
- public void onValidate() {
- validateModel();
- }
- });
- createButton.setVisibilityAllowed(createMode);
- formView.add(createButton);
+ @Override
+ public void onValidate() {
+ validateModel();
+ }
+ });
+ createButton.setVisibilityAllowed(createMode);
+ formView.add(createButton);
- formView.add(typesEnSortieTable);
+ formView.add(typesEnSortieTable);
- // Action : update the methodeExtraction
- Button updateButton = new SubmittableButton(ACTION_UPDATE, new SubmittableButtonEvents() {
- @Override
- public void onProcess() throws DataConstraintException {
- extraitService.updateMethodeExtraction(methodeExtractionModel.getObject());
- }
+ // Action : update the methodeExtraction
+ Button updateButton = new SubmittableButton(ACTION_UPDATE, new SubmittableButtonEvents() {
+ @Override
+ public void onProcess() throws DataConstraintException {
+ extraitService.updateMethodeExtraction(methodeExtractionModel.getObject());
+ }
- @Override
- public void onSuccess() {
- successNextPage(ACTION_UPDATE);
- PageParameters params = new PageParameters();
- params.add(RETURN_PARAM[0], RETURN_PARAM[1]);
- setResponsePage(ListConfigurationPage.class, params);
- }
+ @Override
+ public void onSuccess() {
+ successNextPage(ACTION_UPDATE);
+ PageParameters params = new PageParameters();
+ params.add(RETURN_PARAM[0], RETURN_PARAM[1]);
+ setResponsePage(ListConfigurationPage.class, params);
+ }
- @Override
- public void onValidate() {
- validateModel();
- }
- });
- updateButton.setVisibilityAllowed(!createMode);
- formView.add(updateButton);
+ @Override
+ public void onValidate() {
+ validateModel();
+ }
+ });
+ updateButton.setVisibilityAllowed(!createMode);
+ formView.add(updateButton);
- // Action : suppression
- Button deleteButton = new SubmittableButton(ACTION_DELETE, new SubmittableButtonEvents() {
- @Override
- public void onProcess() throws DataConstraintException {
- extraitService.deleteMethodeExtraction(methodeExtractionModel.getObject());
- }
+ // Action : suppression
+ Button deleteButton = new SubmittableButton(ACTION_DELETE, new SubmittableButtonEvents() {
+ @Override
+ public void onProcess() throws DataConstraintException {
+ extraitService.deleteMethodeExtraction(methodeExtractionModel.getObject());
+ }
- @Override
- public void onSuccess() {
- successNextPage(ACTION_DELETE);
- PageParameters params = new PageParameters();
- params.add(RETURN_PARAM[0], RETURN_PARAM[1]);
- setResponsePage(ListConfigurationPage.class, params);
- }
- });
- deleteButton.setVisibilityAllowed(!createMode);
- deleteButton.setDefaultFormProcessing(false);
- deleteButton.add(new JSConfirmationBehavior(getString("Confirm")));
- formView.add(deleteButton);
+ @Override
+ public void onSuccess() {
+ successNextPage(ACTION_DELETE);
+ PageParameters params = new PageParameters();
+ params.add(RETURN_PARAM[0], RETURN_PARAM[1]);
+ setResponsePage(ListConfigurationPage.class, params);
+ }
+ });
+ deleteButton.setVisibilityAllowed(!createMode);
+ deleteButton.setDefaultFormProcessing(false);
+ deleteButton.add(new JSConfirmationBehavior(getString("Confirm")));
+ formView.add(deleteButton);
- formView.add(new Link<Void>("Cancel") {
- @Override
- public void onClick() {
- PageParameters params = new PageParameters();
- params.add(RETURN_PARAM[0], RETURN_PARAM[1]);
- setResponsePage(ListConfigurationPage.class, params);
- }
- });
+ formView.add(new Link<Void>("Cancel") {
+ @Override
+ public void onClick() {
+ PageParameters params = new PageParameters();
+ params.add(RETURN_PARAM[0], RETURN_PARAM[1]);
+ setResponsePage(ListConfigurationPage.class, params);
+ }
+ });
- formView.setDefaultButton(addButton);
- add(formView);
- }
+ formView.setDefaultButton(addButton);
+ add(formView);
+ }
- /**
- * Validate model
- */
- private void validateModel() {
- addValidationErrors(validator.validate(methodeExtractionModel.getObject(), getSession().getLocale()));
+ /**
+ * Validate model
+ */
+ private void validateModel() {
+ addValidationErrors(validator.validate(methodeExtractionModel.getObject(), getSession().getLocale()));
- // vérifie s'il existe des types supprimés qui sont tjr référencés
- for (TypeExtrait curDelType : typesDeleted.values()) {
- if (extraitService.isTypeExtraitReferenced(curDelType)) {
- getPage().error(
- getString("TypeExtrait.isReferenced",
- new Model<Serializable>(new Serializable[] { curDelType.getInitiales() })));
- }
- }
- }
+ // vérifie s'il existe des types supprimés qui sont tjr référencés
+ for (TypeExtrait curDelType : typesDeleted.values()) {
+ if (extraitService.isTypeExtraitReferenced(curDelType)) {
+ getPage().error(
+ getString("TypeExtrait.isReferenced",
+ new Model<Serializable>(new Serializable[] { curDelType.getInitiales() })));
+ }
+ }
+ }
}
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/config/ManageMethodePurificationPage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/config/ManageMethodePurificationPage.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/config/ManageMethodePurificationPage.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -71,287 +71,287 @@
@AuthRoles({ AuthRole.ADMIN })
public final class ManageMethodePurificationPage extends TemplatePage {
- /** Action : create */
- private static final String ACTION_CREATE = "Create";
+ /** Action : create */
+ private static final String ACTION_CREATE = "Create";
- /** Action : update */
- private static final String ACTION_UPDATE = "Update";
+ /** Action : update */
+ private static final String ACTION_UPDATE = "Update";
- /** Action : delete */
- public static final String ACTION_DELETE = "Delete";
+ /** Action : delete */
+ public static final String ACTION_DELETE = "Delete";
- /** The return page parameter (key and value) */
- final private String[] RETURN_PARAM = { "methodePurification", "opened" };
+ /** The return page parameter (key and value) */
+ final private String[] RETURN_PARAM = { "methodePurification", "opened" };
- /** Logger */
- private static final Log LOG = LogTools.getLog();
+ /** Logger */
+ private static final Log LOG = LogTools.getLog();
- /** erreurTest Model */
- private final IModel<MethodePurification> methodePurificationModel;
+ /** erreurTest Model */
+ private final IModel<MethodePurification> methodePurificationModel;
- /** model for adding Parametre */
- private IModel<ParamMethoPuri> newParamModel;
+ /** model for adding Parametre */
+ private IModel<ParamMethoPuri> newParamModel;
- /** Service : purification */
- @SpringBean
- private PurificationService purificationService;
+ /** Service : purification */
+ @SpringBean
+ private PurificationService purificationService;
- /** Model validateur */
- @SpringBean(name = "webModelValidator")
- private ModelValidator validator;
+ /** Model validateur */
+ @SpringBean(name = "webModelValidator")
+ private ModelValidator validator;
- /**
- * couple of <nom, param> in order to recuperate the id of the deleted parametre usefull in case of delete thus add
- * of same initial type
- */
- private HashMap<String, ParamMethoPuri> paramsDeleted;
+ /**
+ * couple of <nom, param> in order to recuperate the id of the deleted parametre usefull in case of delete thus add
+ * of same initial type
+ */
+ private HashMap<String, ParamMethoPuri> paramsDeleted;
- /**
- * Constructor
- */
- public ManageMethodePurificationPage() {
- this(null);
- }
+ /**
+ * Constructor
+ */
+ public ManageMethodePurificationPage() {
+ this(null);
+ }
- /**
- * Constructor. If idMethodePurification is null, creating a new methode, else editing the corresponding methode
- * @param idMethode The ID of the methode
- */
- public ManageMethodePurificationPage(Integer idMethode) {
- super(ManageMethodePurificationPage.class);
+ /**
+ * Constructor. If idMethodePurification is null, creating a new methode, else editing the corresponding methode
+ * @param idMethode The ID of the methode
+ */
+ public ManageMethodePurificationPage(Integer idMethode) {
+ super(ManageMethodePurificationPage.class);
- boolean createMode;
+ boolean createMode;
- paramsDeleted = new HashMap<String, ParamMethoPuri>();
+ paramsDeleted = new HashMap<String, ParamMethoPuri>();
- // model initialization
- newParamModel = new Model<ParamMethoPuri>(new ParamMethoPuri());
- if (idMethode == null) {
- // creation mode
- methodePurificationModel = new Model<MethodePurification>(new MethodePurification());
- createMode = true;
- } else {
- try {
- methodePurificationModel = new Model<MethodePurification>(
- purificationService.loadMethodePurification(idMethode));
- } catch (DataNotFoundException e) {
- LOG.error(e.getMessage(), e);
- throw new UnexpectedException(e);
- }
- createMode = false;
- }
+ // model initialization
+ newParamModel = new Model<ParamMethoPuri>(new ParamMethoPuri());
+ if (idMethode == null) {
+ // creation mode
+ methodePurificationModel = new Model<MethodePurification>(new MethodePurification());
+ createMode = true;
+ } else {
+ try {
+ methodePurificationModel = new Model<MethodePurification>(
+ purificationService.loadMethodePurification(idMethode));
+ } catch (DataNotFoundException e) {
+ LOG.error(e.getMessage(), e);
+ throw new UnexpectedException(e);
+ }
+ createMode = false;
+ }
- // bind with markup
- final Form<Void> formView = new Form<Void>("Form");
+ // bind with markup
+ final Form<Void> formView = new Form<Void>("Form");
- formView.add(new TextField<String>("MethodePurification.nom", new PropertyModel<String>(
- methodePurificationModel, "nom")));
- formView.add(new TextArea<String>("MethodePurification.description", new PropertyModel<String>(
- methodePurificationModel, "description")));
+ formView.add(new TextField<String>("MethodePurification.nom", new PropertyModel<String>(
+ methodePurificationModel, "nom")));
+ formView.add(new TextArea<String>("MethodePurification.description", new PropertyModel<String>(
+ methodePurificationModel, "description")));
- // Tableau des types en sortie
- final MarkupContainer typesEnSortieTable = new WebMarkupContainer("MethodePurification.parametres.Table");
- typesEnSortieTable.setOutputMarkupId(true);
+ // Tableau des types en sortie
+ final MarkupContainer typesEnSortieTable = new WebMarkupContainer("MethodePurification.parametres.Table");
+ typesEnSortieTable.setOutputMarkupId(true);
- // Liste des types extraits ajoutés
- typesEnSortieTable.add(new ListView<ParamMethoPuri>("MethodePurification.parametres.List",
- new PropertyModel<List<ParamMethoPuri>>(methodePurificationModel, "sortedParametres")) {
- @Override
- protected void populateItem(final ListItem<ParamMethoPuri> item) {
- if (item.getIndex() % 2 == 1) {
- item.add(new AttributeModifier("class", item.getIndex() % 2 == 0 ? "even" : "odd"));
- }
+ // Liste des types extraits ajoutés
+ typesEnSortieTable.add(new ListView<ParamMethoPuri>("MethodePurification.parametres.List",
+ new PropertyModel<List<ParamMethoPuri>>(methodePurificationModel, "sortedParametres")) {
+ @Override
+ protected void populateItem(final ListItem<ParamMethoPuri> item) {
+ if (item.getIndex() % 2 == 1) {
+ item.add(new AttributeModifier("class", item.getIndex() % 2 == 0 ? "even" : "odd"));
+ }
- final ParamMethoPuri param = item.getModelObject();
- // Colonnes
- item.add(new Label("MethodePurification.parametres.List.nom", new PropertyModel<String>(param, "nom")));
- item.add(new Label("MethodePurification.parametres.List.description", new PropertyModel<String>(param,
- "description")));
- item.add(new Label("MethodePurification.parametres.List.index", new PropertyModel<String>(param,
- "index")));
+ final ParamMethoPuri param = item.getModelObject();
+ // Colonnes
+ item.add(new Label("MethodePurification.parametres.List.nom", new PropertyModel<String>(param, "nom")));
+ item.add(new Label("MethodePurification.parametres.List.description", new PropertyModel<String>(param,
+ "description")));
+ item.add(new Label("MethodePurification.parametres.List.index", new PropertyModel<String>(param,
+ "index")));
- // Action : suppression d'un type extrait
- Button deleteButton = new AjaxFallbackButton("MethodePurification.parametres.List.Delete", formView) {
- @Override
- protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
- // Suppression
- methodePurificationModel.getObject().getParametres().remove(param);
- // keep the id of the deleted 'extrait' in case of new one with the same 'initiales'
- paramsDeleted.put(param.getNom(), param);
- if (target != null) {
- target.add(typesEnSortieTable);
- }
- }
+ // Action : suppression d'un type extrait
+ Button deleteButton = new AjaxFallbackButton("MethodePurification.parametres.List.Delete", formView) {
+ @Override
+ protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
+ // Suppression
+ methodePurificationModel.getObject().getParametres().remove(param);
+ // keep the id of the deleted 'extrait' in case of new one with the same 'initiales'
+ paramsDeleted.put(param.getNom(), param);
+ if (target != null) {
+ target.add(typesEnSortieTable);
+ }
+ }
- @Override
- protected void onError(AjaxRequestTarget target, Form<?> form) {
- // never called
- }
+ @Override
+ protected void onError(AjaxRequestTarget target, Form<?> form) {
+ // never called
+ }
- };
- deleteButton.setDefaultFormProcessing(false);
- item.add(deleteButton);
- }
- });
+ };
+ deleteButton.setDefaultFormProcessing(false);
+ item.add(deleteButton);
+ }
+ });
- final FormComponent<String> nomParamInput = new TextField<String>("MethodePurification.parametres.nom",
- new PropertyModel<String>(newParamModel, "nom"));
- typesEnSortieTable.add(nomParamInput);
+ final FormComponent<String> nomParamInput = new TextField<String>("MethodePurification.parametres.nom",
+ new PropertyModel<String>(newParamModel, "nom"));
+ typesEnSortieTable.add(nomParamInput);
- final FormComponent<String> descriptionParamInput = new TextField<String>(
- "MethodePurification.parametres.description", new PropertyModel<String>(newParamModel, "description"));
- typesEnSortieTable.add(descriptionParamInput);
+ final FormComponent<String> descriptionParamInput = new TextField<String>(
+ "MethodePurification.parametres.description", new PropertyModel<String>(newParamModel, "description"));
+ typesEnSortieTable.add(descriptionParamInput);
- final FormComponent<String> indexParamInput = new TextField<String>("MethodePurification.parametres.index",
- new PropertyModel<String>(newParamModel, "index"));
- typesEnSortieTable.add(indexParamInput);
+ final FormComponent<String> indexParamInput = new TextField<String>("MethodePurification.parametres.index",
+ new PropertyModel<String>(newParamModel, "index"));
+ typesEnSortieTable.add(indexParamInput);
- // Bouton AJAX pour ajouter un type extrait
- Button addButton = new AjaxFallbackButton("MethodePurification.parametres.Add", formView) {
- @Override
- protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
- try {
- // normalisation du type extrait
- newParamModel.getObject().setNom(
- Normalizer.normalize(ConfigNameNormalizer.class, newParamModel.getObject().getNom()));
- // Ajout du type extrait
- newParamModel.getObject().setMethodePurification(methodePurificationModel.getObject());
- // recuperate the id if an just deleted type
- if (paramsDeleted.get(newParamModel.getObject().getNom()) != null) {
- newParamModel.getObject().setIdParamMethoPuri(
- paramsDeleted.get(newParamModel.getObject().getNom()).getIdParamMethoPuri());
- }
+ // Bouton AJAX pour ajouter un type extrait
+ Button addButton = new AjaxFallbackButton("MethodePurification.parametres.Add", formView) {
+ @Override
+ protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
+ try {
+ // normalisation du type extrait
+ newParamModel.getObject().setNom(
+ Normalizer.normalize(ConfigNameNormalizer.class, newParamModel.getObject().getNom()));
+ // Ajout du type extrait
+ newParamModel.getObject().setMethodePurification(methodePurificationModel.getObject());
+ // recuperate the id if an just deleted type
+ if (paramsDeleted.get(newParamModel.getObject().getNom()) != null) {
+ newParamModel.getObject().setIdParamMethoPuri(
+ paramsDeleted.get(newParamModel.getObject().getNom()).getIdParamMethoPuri());
+ }
- // ajout à la liste
- ParamMethoPuri paramAdded = newParamModel.getObject().clone();
- methodePurificationModel.getObject().getParametres().add(paramAdded);
+ // ajout à la liste
+ ParamMethoPuri paramAdded = newParamModel.getObject().clone();
+ methodePurificationModel.getObject().getParametres().add(paramAdded);
- List<String> errors = validator.validate(newParamModel.getObject(), getSession().getLocale());
- if (errors.isEmpty()) {
- if (paramsDeleted.get(newParamModel.getObject().getNom()) != null) {
- // si ancien extrait supprimé, on l'enlève de la liste des supprimés
- paramsDeleted.remove(newParamModel.getObject().getNom());
- }
- // réinit du champ ajout
- newParamModel.getObject().setNom(null);
- newParamModel.getObject().setDescription(null);
- } else {
- methodePurificationModel.getObject().getParametres().remove(paramAdded);
- addValidationErrors(errors);
- }
- } catch (CloneNotSupportedException e) {
- LOG.error(e.getMessage(), e);
- throw new UnexpectedException(e);
- }
+ List<String> errors = validator.validate(newParamModel.getObject(), getSession().getLocale());
+ if (errors.isEmpty()) {
+ if (paramsDeleted.get(newParamModel.getObject().getNom()) != null) {
+ // si ancien extrait supprimé, on l'enlève de la liste des supprimés
+ paramsDeleted.remove(newParamModel.getObject().getNom());
+ }
+ // réinit du champ ajout
+ newParamModel.getObject().setNom(null);
+ newParamModel.getObject().setDescription(null);
+ } else {
+ methodePurificationModel.getObject().getParametres().remove(paramAdded);
+ addValidationErrors(errors);
+ }
+ } catch (CloneNotSupportedException e) {
+ LOG.error(e.getMessage(), e);
+ throw new UnexpectedException(e);
+ }
- if (target != null) {
- target.add(typesEnSortieTable);
- refreshFeedbackPage(target);
- }
- }
+ if (target != null) {
+ target.add(typesEnSortieTable);
+ refreshFeedbackPage(target);
+ }
+ }
- @Override
- protected void onError(AjaxRequestTarget target, Form<?> form) {
- refreshFeedbackPage(target);
- }
+ @Override
+ protected void onError(AjaxRequestTarget target, Form<?> form) {
+ refreshFeedbackPage(target);
+ }
- };
- typesEnSortieTable.add(addButton);
+ };
+ typesEnSortieTable.add(addButton);
- // Action : create the methodePurification
- Button createButton = new SubmittableButton(ACTION_CREATE, new SubmittableButtonEvents() {
- @Override
- public void onProcess() throws DataConstraintException {
- purificationService.createMethodePurification(methodePurificationModel.getObject());
- }
+ // Action : create the methodePurification
+ Button createButton = new SubmittableButton(ACTION_CREATE, new SubmittableButtonEvents() {
+ @Override
+ public void onProcess() throws DataConstraintException {
+ purificationService.createMethodePurification(methodePurificationModel.getObject());
+ }
- @Override
- public void onSuccess() {
- successNextPage(ACTION_CREATE);
- PageParameters params = new PageParameters();
- params.add(RETURN_PARAM[0], RETURN_PARAM[1]);
- setResponsePage(ListConfigurationPage.class, params);
- }
+ @Override
+ public void onSuccess() {
+ successNextPage(ACTION_CREATE);
+ PageParameters params = new PageParameters();
+ params.add(RETURN_PARAM[0], RETURN_PARAM[1]);
+ setResponsePage(ListConfigurationPage.class, params);
+ }
- @Override
- public void onValidate() {
- validateModel();
- }
- });
- createButton.setVisibilityAllowed(createMode);
- formView.add(createButton);
+ @Override
+ public void onValidate() {
+ validateModel();
+ }
+ });
+ createButton.setVisibilityAllowed(createMode);
+ formView.add(createButton);
- formView.add(typesEnSortieTable);
+ formView.add(typesEnSortieTable);
- // Action : update the methodePurificationModel
- Button updateButton = new SubmittableButton(ACTION_UPDATE, new SubmittableButtonEvents() {
- @Override
- public void onProcess() throws DataConstraintException {
- purificationService.updateMethodePurification(methodePurificationModel.getObject());
- }
+ // Action : update the methodePurificationModel
+ Button updateButton = new SubmittableButton(ACTION_UPDATE, new SubmittableButtonEvents() {
+ @Override
+ public void onProcess() throws DataConstraintException {
+ purificationService.updateMethodePurification(methodePurificationModel.getObject());
+ }
- @Override
- public void onSuccess() {
- successNextPage(ACTION_UPDATE);
- PageParameters params = new PageParameters();
- params.add(RETURN_PARAM[0], RETURN_PARAM[1]);
- setResponsePage(ListConfigurationPage.class, params);
- }
+ @Override
+ public void onSuccess() {
+ successNextPage(ACTION_UPDATE);
+ PageParameters params = new PageParameters();
+ params.add(RETURN_PARAM[0], RETURN_PARAM[1]);
+ setResponsePage(ListConfigurationPage.class, params);
+ }
- @Override
- public void onValidate() {
- validateModel();
- }
- });
- updateButton.setVisibilityAllowed(!createMode);
- formView.add(updateButton);
+ @Override
+ public void onValidate() {
+ validateModel();
+ }
+ });
+ updateButton.setVisibilityAllowed(!createMode);
+ formView.add(updateButton);
- // Action : suppression
- Button deleteButton = new SubmittableButton(ACTION_DELETE, new SubmittableButtonEvents() {
- @Override
- public void onProcess() throws DataConstraintException {
- purificationService.deleteMethodePurification(methodePurificationModel.getObject());
- }
+ // Action : suppression
+ Button deleteButton = new SubmittableButton(ACTION_DELETE, new SubmittableButtonEvents() {
+ @Override
+ public void onProcess() throws DataConstraintException {
+ purificationService.deleteMethodePurification(methodePurificationModel.getObject());
+ }
- @Override
- public void onSuccess() {
- successNextPage(ACTION_DELETE);
- PageParameters params = new PageParameters();
- params.add(RETURN_PARAM[0], RETURN_PARAM[1]);
- setResponsePage(ListConfigurationPage.class, params);
- }
- });
- deleteButton.setVisibilityAllowed(!createMode);
- deleteButton.setDefaultFormProcessing(false);
- deleteButton.add(new JSConfirmationBehavior(getString("Confirm")));
- formView.add(deleteButton);
+ @Override
+ public void onSuccess() {
+ successNextPage(ACTION_DELETE);
+ PageParameters params = new PageParameters();
+ params.add(RETURN_PARAM[0], RETURN_PARAM[1]);
+ setResponsePage(ListConfigurationPage.class, params);
+ }
+ });
+ deleteButton.setVisibilityAllowed(!createMode);
+ deleteButton.setDefaultFormProcessing(false);
+ deleteButton.add(new JSConfirmationBehavior(getString("Confirm")));
+ formView.add(deleteButton);
- formView.add(new Link<Void>("Cancel") {
- @Override
- public void onClick() {
- PageParameters params = new PageParameters();
- params.add(RETURN_PARAM[0], RETURN_PARAM[1]);
- setResponsePage(ListConfigurationPage.class, params);
- }
- });
+ formView.add(new Link<Void>("Cancel") {
+ @Override
+ public void onClick() {
+ PageParameters params = new PageParameters();
+ params.add(RETURN_PARAM[0], RETURN_PARAM[1]);
+ setResponsePage(ListConfigurationPage.class, params);
+ }
+ });
- formView.setDefaultButton(addButton);
- add(formView);
- }
+ formView.setDefaultButton(addButton);
+ add(formView);
+ }
- /**
- * Validate model
- */
- private void validateModel() {
- addValidationErrors(validator.validate(methodePurificationModel.getObject(), getSession().getLocale()));
+ /**
+ * Validate model
+ */
+ private void validateModel() {
+ addValidationErrors(validator.validate(methodePurificationModel.getObject(), getSession().getLocale()));
- // vérifie s'il existe des paramètres supprimés qui sont tjr référencés
- for (ParamMethoPuri curDelParam : paramsDeleted.values()) {
- if (purificationService.isParamMethoPuriReferenced(curDelParam)) {
- getPage().error(
- getString("ParamMethoPuri.isReferenced", new Model<Serializable>(
- new Serializable[] { curDelParam.getNom() })));
- }
- }
- }
+ // vérifie s'il existe des paramètres supprimés qui sont tjr référencés
+ for (ParamMethoPuri curDelParam : paramsDeleted.values()) {
+ if (purificationService.isParamMethoPuriReferenced(curDelParam)) {
+ getPage().error(
+ getString("ParamMethoPuri.isReferenced", new Model<Serializable>(
+ new Serializable[] { curDelParam.getNom() })));
+ }
+ }
+ }
}
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/config/ManageMethodeTestBioPage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/config/ManageMethodeTestBioPage.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/config/ManageMethodeTestBioPage.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -59,166 +59,166 @@
@AuthRoles({ AuthRole.ADMIN })
public final class ManageMethodeTestBioPage extends TemplatePage {
- /** Action : create */
- private static final String ACTION_CREATE = "Create";
+ /** Action : create */
+ private static final String ACTION_CREATE = "Create";
- /** Action : update */
- private static final String ACTION_UPDATE = "Update";
+ /** Action : update */
+ private static final String ACTION_UPDATE = "Update";
- /** Action : delete */
- public static final String ACTION_DELETE = "Delete";
+ /** Action : delete */
+ public static final String ACTION_DELETE = "Delete";
- /** The return page parameter (key and value) */
- final private String[] RETURN_PARAM = { "methodeTestBio", "opened" };
+ /** The return page parameter (key and value) */
+ final private String[] RETURN_PARAM = { "methodeTestBio", "opened" };
- /** Logger */
- private static final Log LOG = LogTools.getLog();
+ /** Logger */
+ private static final Log LOG = LogTools.getLog();
- /** erreurTest Model */
- private final IModel<MethodeTestBio> methodeTestModel;
+ /** erreurTest Model */
+ private final IModel<MethodeTestBio> methodeTestModel;
- /** Service : test (for erreurs) */
- @SpringBean
- private TestBioService testService;
+ /** Service : test (for erreurs) */
+ @SpringBean
+ private TestBioService testService;
- /** Model validateur */
- @SpringBean(name = "webModelValidator")
- private ModelValidator validator;
+ /** Model validateur */
+ @SpringBean(name = "webModelValidator")
+ private ModelValidator validator;
- /**
- * Constructor
- */
- public ManageMethodeTestBioPage() {
- this(null);
- }
+ /**
+ * Constructor
+ */
+ public ManageMethodeTestBioPage() {
+ this(null);
+ }
- /**
- * Constructor. If idMethodeTest is null, creating a new methode, else editing the corresponding methode
- * @param idMethodeTest The ID of the methode
- */
- public ManageMethodeTestBioPage(Integer idMethodeTest) {
- super(ManageMethodeTestBioPage.class);
+ /**
+ * Constructor. If idMethodeTest is null, creating a new methode, else editing the corresponding methode
+ * @param idMethodeTest The ID of the methode
+ */
+ public ManageMethodeTestBioPage(Integer idMethodeTest) {
+ super(ManageMethodeTestBioPage.class);
- boolean createMode;
+ boolean createMode;
- // model initialization
- if (idMethodeTest == null) {
- // creation mode
- methodeTestModel = new Model<MethodeTestBio>(new MethodeTestBio());
- createMode = true;
- } else {
- try {
- methodeTestModel = new Model<MethodeTestBio>(testService.loadMethodeTest(idMethodeTest));
- } catch (DataNotFoundException e) {
- LOG.error(e.getMessage(), e);
- throw new UnexpectedException(e);
- }
- createMode = false;
- }
+ // model initialization
+ if (idMethodeTest == null) {
+ // creation mode
+ methodeTestModel = new Model<MethodeTestBio>(new MethodeTestBio());
+ createMode = true;
+ } else {
+ try {
+ methodeTestModel = new Model<MethodeTestBio>(testService.loadMethodeTest(idMethodeTest));
+ } catch (DataNotFoundException e) {
+ LOG.error(e.getMessage(), e);
+ throw new UnexpectedException(e);
+ }
+ createMode = false;
+ }
- // Initialisation des liste (pour le AutoCompleteTextField)
- // liste des valeurs déjà existantes pour la propriété correspondante
- List<String> domaines = testService.listDomainesMethodes();
- List<String> unites = testService.listUnitesResultatMethodes();
+ // Initialisation des liste (pour le AutoCompleteTextField)
+ // liste des valeurs déjà existantes pour la propriété correspondante
+ List<String> domaines = testService.listDomainesMethodes();
+ List<String> unites = testService.listUnitesResultatMethodes();
- // bind with markup
- final Form<Void> formView = new Form<Void>("Form");
+ // bind with markup
+ final Form<Void> formView = new Form<Void>("Form");
- formView.add(new TextField<String>("MethodeTestBio.nom", new PropertyModel<String>(methodeTestModel, "nom")));
- formView.add(new TextField<String>("MethodeTestBio.cible", new PropertyModel<String>(methodeTestModel, "cible")));
- formView.add(new AutoCompleteTextFieldString("MethodeTestBio.domaine", new PropertyModel<String>(
- methodeTestModel, "domaine"), domaines, ComparisonMode.CONTAINS));
- formView.add(new TextArea<String>("MethodeTestBio.description", new PropertyModel<String>(methodeTestModel,
- "description")));
- formView.add(new TextField<String>("MethodeTestBio.valeurMesuree", new PropertyModel<String>(methodeTestModel,
- "valeurMesuree")));
- formView.add(new AutoCompleteTextFieldString("MethodeTestBio.uniteResultat", new PropertyModel<String>(
- methodeTestModel, "uniteResultat"), unites, ComparisonMode.STARTS_WITH));
- formView.add(new TextField<String>("MethodeTestBio.critereActivite", new PropertyModel<String>(
- methodeTestModel, "critereActivite")));
+ formView.add(new TextField<String>("MethodeTestBio.nom", new PropertyModel<String>(methodeTestModel, "nom")));
+ formView.add(new TextField<String>("MethodeTestBio.cible", new PropertyModel<String>(methodeTestModel, "cible")));
+ formView.add(new AutoCompleteTextFieldString("MethodeTestBio.domaine", new PropertyModel<String>(
+ methodeTestModel, "domaine"), domaines, ComparisonMode.CONTAINS));
+ formView.add(new TextArea<String>("MethodeTestBio.description", new PropertyModel<String>(methodeTestModel,
+ "description")));
+ formView.add(new TextField<String>("MethodeTestBio.valeurMesuree", new PropertyModel<String>(methodeTestModel,
+ "valeurMesuree")));
+ formView.add(new AutoCompleteTextFieldString("MethodeTestBio.uniteResultat", new PropertyModel<String>(
+ methodeTestModel, "uniteResultat"), unites, ComparisonMode.STARTS_WITH));
+ formView.add(new TextField<String>("MethodeTestBio.critereActivite", new PropertyModel<String>(
+ methodeTestModel, "critereActivite")));
- // Action : create the methodeTest
- Button createButton = new SubmittableButton(ACTION_CREATE, new SubmittableButtonEvents() {
- @Override
- public void onProcess() throws DataConstraintException {
- testService.createMethodeTestBio(methodeTestModel.getObject());
- }
+ // Action : create the methodeTest
+ Button createButton = new SubmittableButton(ACTION_CREATE, new SubmittableButtonEvents() {
+ @Override
+ public void onProcess() throws DataConstraintException {
+ testService.createMethodeTestBio(methodeTestModel.getObject());
+ }
- @Override
- public void onSuccess() {
- successNextPage(ACTION_CREATE);
- PageParameters params = new PageParameters();
- params.add(RETURN_PARAM[0], RETURN_PARAM[1]);
- setResponsePage(ListConfigurationPage.class, params);
- }
+ @Override
+ public void onSuccess() {
+ successNextPage(ACTION_CREATE);
+ PageParameters params = new PageParameters();
+ params.add(RETURN_PARAM[0], RETURN_PARAM[1]);
+ setResponsePage(ListConfigurationPage.class, params);
+ }
- @Override
- public void onValidate() {
- validateModel();
- }
- });
- createButton.setVisibilityAllowed(createMode);
- formView.add(createButton);
+ @Override
+ public void onValidate() {
+ validateModel();
+ }
+ });
+ createButton.setVisibilityAllowed(createMode);
+ formView.add(createButton);
- // Action : update the methodeTest
- Button updateButton = new SubmittableButton(ACTION_UPDATE, new SubmittableButtonEvents() {
- @Override
- public void onProcess() throws DataConstraintException {
- testService.updateMethodeTest(methodeTestModel.getObject());
- }
+ // Action : update the methodeTest
+ Button updateButton = new SubmittableButton(ACTION_UPDATE, new SubmittableButtonEvents() {
+ @Override
+ public void onProcess() throws DataConstraintException {
+ testService.updateMethodeTest(methodeTestModel.getObject());
+ }
- @Override
- public void onSuccess() {
- successNextPage(ACTION_UPDATE);
- PageParameters params = new PageParameters();
- params.add(RETURN_PARAM[0], RETURN_PARAM[1]);
- setResponsePage(ListConfigurationPage.class, params);
- }
+ @Override
+ public void onSuccess() {
+ successNextPage(ACTION_UPDATE);
+ PageParameters params = new PageParameters();
+ params.add(RETURN_PARAM[0], RETURN_PARAM[1]);
+ setResponsePage(ListConfigurationPage.class, params);
+ }
- @Override
- public void onValidate() {
- validateModel();
- }
- });
- updateButton.setVisibilityAllowed(!createMode);
- formView.add(updateButton);
+ @Override
+ public void onValidate() {
+ validateModel();
+ }
+ });
+ updateButton.setVisibilityAllowed(!createMode);
+ formView.add(updateButton);
- // Action : suppression
- Button deleteButton = new SubmittableButton(ACTION_DELETE, new SubmittableButtonEvents() {
- @Override
- public void onProcess() throws DataConstraintException {
- testService.deleteMethodeTestBio(methodeTestModel.getObject());
- }
+ // Action : suppression
+ Button deleteButton = new SubmittableButton(ACTION_DELETE, new SubmittableButtonEvents() {
+ @Override
+ public void onProcess() throws DataConstraintException {
+ testService.deleteMethodeTestBio(methodeTestModel.getObject());
+ }
- @Override
- public void onSuccess() {
- successNextPage(ACTION_DELETE);
- PageParameters params = new PageParameters();
- params.add(RETURN_PARAM[0], RETURN_PARAM[1]);
- setResponsePage(ListConfigurationPage.class, params);
- }
- });
- deleteButton.setVisibilityAllowed(!createMode);
- deleteButton.setDefaultFormProcessing(false);
- deleteButton.add(new JSConfirmationBehavior(getString("Confirm")));
- formView.add(deleteButton);
+ @Override
+ public void onSuccess() {
+ successNextPage(ACTION_DELETE);
+ PageParameters params = new PageParameters();
+ params.add(RETURN_PARAM[0], RETURN_PARAM[1]);
+ setResponsePage(ListConfigurationPage.class, params);
+ }
+ });
+ deleteButton.setVisibilityAllowed(!createMode);
+ deleteButton.setDefaultFormProcessing(false);
+ deleteButton.add(new JSConfirmationBehavior(getString("Confirm")));
+ formView.add(deleteButton);
- formView.add(new Link<Void>("Cancel") {
- @Override
- public void onClick() {
- PageParameters params = new PageParameters();
- params.add(RETURN_PARAM[0], RETURN_PARAM[1]);
- setResponsePage(ListConfigurationPage.class, params);
- }
- });
+ formView.add(new Link<Void>("Cancel") {
+ @Override
+ public void onClick() {
+ PageParameters params = new PageParameters();
+ params.add(RETURN_PARAM[0], RETURN_PARAM[1]);
+ setResponsePage(ListConfigurationPage.class, params);
+ }
+ });
- add(formView);
- }
+ add(formView);
+ }
- /**
- * Validate model
- */
- private void validateModel() {
- addValidationErrors(validator.validate(methodeTestModel.getObject(), getSession().getLocale()));
- }
+ /**
+ * Validate model
+ */
+ private void validateModel() {
+ addValidationErrors(validator.validate(methodeTestModel.getObject(), getSession().getLocale()));
+ }
}
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/config/ManagePartiePage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/config/ManagePartiePage.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/config/ManagePartiePage.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -55,150 +55,150 @@
@AuthRoles({ AuthRole.ADMIN })
public final class ManagePartiePage extends TemplatePage {
- /** Action : create */
- private static final String ACTION_CREATE = "Create";
+ /** Action : create */
+ private static final String ACTION_CREATE = "Create";
- /** Action : update */
- private static final String ACTION_UPDATE = "Update";
+ /** Action : update */
+ private static final String ACTION_UPDATE = "Update";
- /** Action : delete */
- public static final String ACTION_DELETE = "Delete";
+ /** Action : delete */
+ public static final String ACTION_DELETE = "Delete";
- /** The return page parameter (key and value) */
- final private String[] RETURN_PARAM = { "partie", "opened" };
+ /** The return page parameter (key and value) */
+ final private String[] RETURN_PARAM = { "partie", "opened" };
- /** Logger */
- private static final Log LOG = LogTools.getLog();
+ /** Logger */
+ private static final Log LOG = LogTools.getLog();
- /** partie Model */
- private final IModel<Partie> partieModel;
+ /** partie Model */
+ private final IModel<Partie> partieModel;
- /** Service : lot (for parties) */
- @SpringBean
- private LotService lotService;
+ /** Service : lot (for parties) */
+ @SpringBean
+ private LotService lotService;
- /** Model validateur */
- @SpringBean(name = "webModelValidator")
- private ModelValidator validator;
+ /** Model validateur */
+ @SpringBean(name = "webModelValidator")
+ private ModelValidator validator;
- /**
- * Constructor
- */
- public ManagePartiePage() {
- this(null);
- }
+ /**
+ * Constructor
+ */
+ public ManagePartiePage() {
+ this(null);
+ }
- /**
- * Constructor. If idPartie is null, creating a new partie, else editing the corresponding partie
- * @param idPartie The ID of the partie
- */
- public ManagePartiePage(Integer idPartie) {
- super(ManagePartiePage.class);
+ /**
+ * Constructor. If idPartie is null, creating a new partie, else editing the corresponding partie
+ * @param idPartie The ID of the partie
+ */
+ public ManagePartiePage(Integer idPartie) {
+ super(ManagePartiePage.class);
- boolean createMode;
+ boolean createMode;
- // model initialization
- if (idPartie == null) {
- // creation mode
- partieModel = new Model<Partie>(new Partie());
- createMode = true;
- } else {
- try {
- partieModel = new Model<Partie>(lotService.loadPartie(idPartie));
- } catch (DataNotFoundException e) {
- LOG.error(e.getMessage(), e);
- throw new UnexpectedException(e);
- }
- createMode = false;
- }
+ // model initialization
+ if (idPartie == null) {
+ // creation mode
+ partieModel = new Model<Partie>(new Partie());
+ createMode = true;
+ } else {
+ try {
+ partieModel = new Model<Partie>(lotService.loadPartie(idPartie));
+ } catch (DataNotFoundException e) {
+ LOG.error(e.getMessage(), e);
+ throw new UnexpectedException(e);
+ }
+ createMode = false;
+ }
- // bind with markup
- final Form<Void> formView = new Form<Void>("Form");
+ // bind with markup
+ final Form<Void> formView = new Form<Void>("Form");
- formView.add(new TextField<String>("Partie.nom", new PropertyModel<String>(partieModel, "nom")));
+ formView.add(new TextField<String>("Partie.nom", new PropertyModel<String>(partieModel, "nom")));
- // Action : create the partie
- Button createButton = new SubmittableButton(ACTION_CREATE, new SubmittableButtonEvents() {
- @Override
- public void onProcess() throws DataConstraintException {
- lotService.createPartie(partieModel.getObject());
- }
+ // Action : create the partie
+ Button createButton = new SubmittableButton(ACTION_CREATE, new SubmittableButtonEvents() {
+ @Override
+ public void onProcess() throws DataConstraintException {
+ lotService.createPartie(partieModel.getObject());
+ }
- @Override
- public void onSuccess() {
- successNextPage(ACTION_CREATE);
- PageParameters params = new PageParameters();
- params.add(RETURN_PARAM[0], RETURN_PARAM[1]);
- setResponsePage(ListConfigurationPage.class, params);
- }
+ @Override
+ public void onSuccess() {
+ successNextPage(ACTION_CREATE);
+ PageParameters params = new PageParameters();
+ params.add(RETURN_PARAM[0], RETURN_PARAM[1]);
+ setResponsePage(ListConfigurationPage.class, params);
+ }
- @Override
- public void onValidate() {
- validateModel();
- }
- });
- createButton.setVisibilityAllowed(createMode);
- formView.add(createButton);
+ @Override
+ public void onValidate() {
+ validateModel();
+ }
+ });
+ createButton.setVisibilityAllowed(createMode);
+ formView.add(createButton);
- // Action : update the partie
- Button updateButton = new SubmittableButton(ACTION_UPDATE, new SubmittableButtonEvents() {
- @Override
- public void onProcess() throws DataConstraintException {
- lotService.updatePartie(partieModel.getObject());
- }
+ // Action : update the partie
+ Button updateButton = new SubmittableButton(ACTION_UPDATE, new SubmittableButtonEvents() {
+ @Override
+ public void onProcess() throws DataConstraintException {
+ lotService.updatePartie(partieModel.getObject());
+ }
- @Override
- public void onSuccess() {
- successNextPage(ACTION_UPDATE);
- PageParameters params = new PageParameters();
- params.add(RETURN_PARAM[0], RETURN_PARAM[1]);
- setResponsePage(ListConfigurationPage.class, params);
- }
+ @Override
+ public void onSuccess() {
+ successNextPage(ACTION_UPDATE);
+ PageParameters params = new PageParameters();
+ params.add(RETURN_PARAM[0], RETURN_PARAM[1]);
+ setResponsePage(ListConfigurationPage.class, params);
+ }
- @Override
- public void onValidate() {
- validateModel();
- }
- });
- updateButton.setVisibilityAllowed(!createMode);
- formView.add(updateButton);
+ @Override
+ public void onValidate() {
+ validateModel();
+ }
+ });
+ updateButton.setVisibilityAllowed(!createMode);
+ formView.add(updateButton);
- // Action : suppression de la personne
- Button deleteButton = new SubmittableButton(ACTION_DELETE, new SubmittableButtonEvents() {
- @Override
- public void onProcess() throws DataConstraintException {
- lotService.deletePartie(partieModel.getObject());
- }
+ // Action : suppression de la personne
+ Button deleteButton = new SubmittableButton(ACTION_DELETE, new SubmittableButtonEvents() {
+ @Override
+ public void onProcess() throws DataConstraintException {
+ lotService.deletePartie(partieModel.getObject());
+ }
- @Override
- public void onSuccess() {
- successNextPage(ACTION_DELETE);
- PageParameters params = new PageParameters();
- params.add(RETURN_PARAM[0], RETURN_PARAM[1]);
- setResponsePage(ListConfigurationPage.class, params);
- }
- });
- deleteButton.setVisibilityAllowed(!createMode);
- deleteButton.setDefaultFormProcessing(false);
- deleteButton.add(new JSConfirmationBehavior(getString("Confirm")));
- formView.add(deleteButton);
+ @Override
+ public void onSuccess() {
+ successNextPage(ACTION_DELETE);
+ PageParameters params = new PageParameters();
+ params.add(RETURN_PARAM[0], RETURN_PARAM[1]);
+ setResponsePage(ListConfigurationPage.class, params);
+ }
+ });
+ deleteButton.setVisibilityAllowed(!createMode);
+ deleteButton.setDefaultFormProcessing(false);
+ deleteButton.add(new JSConfirmationBehavior(getString("Confirm")));
+ formView.add(deleteButton);
- formView.add(new Link<Void>("Cancel") {
- @Override
- public void onClick() {
- PageParameters params = new PageParameters();
- params.add(RETURN_PARAM[0], RETURN_PARAM[1]);
- setResponsePage(ListConfigurationPage.class, params);
- }
- });
+ formView.add(new Link<Void>("Cancel") {
+ @Override
+ public void onClick() {
+ PageParameters params = new PageParameters();
+ params.add(RETURN_PARAM[0], RETURN_PARAM[1]);
+ setResponsePage(ListConfigurationPage.class, params);
+ }
+ });
- add(formView);
- }
+ add(formView);
+ }
- /**
- * Validate model
- */
- private void validateModel() {
- addValidationErrors(validator.validate(partieModel.getObject(), getSession().getLocale()));
- }
+ /**
+ * Validate model
+ */
+ private void validateModel() {
+ addValidationErrors(validator.validate(partieModel.getObject(), getSession().getLocale()));
+ }
}
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/config/panels/ListErreurTestBioPanel.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/config/panels/ListErreurTestBioPanel.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/config/panels/ListErreurTestBioPanel.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -49,57 +49,57 @@
*/
public class ListErreurTestBioPanel extends Panel {
- /** Service : test */
- @SpringBean
- private TestBioService testService;
+ /** Service : test */
+ @SpringBean
+ private TestBioService testService;
- /**
- * Constructor
- * @param id The panel ID
- */
- public ListErreurTestBioPanel(String id) {
- super(id);
+ /**
+ * Constructor
+ * @param id The panel ID
+ */
+ public ListErreurTestBioPanel(String id) {
+ super(id);
- add(new BookmarkablePageLink<Void>("ListErreurTestBioPanel.NewErreurTestBio", ManageErreurTestBioPage.class));
+ add(new BookmarkablePageLink<Void>("ListErreurTestBioPanel.NewErreurTestBio", ManageErreurTestBioPage.class));
- // On englobe le "DataView" dans un composant neutre que l'on pourra
- // rafraichir quand la liste évoluera
- final MarkupContainer erreursTestRefresh = new WebMarkupContainer(
- "ListErreurTestBioPanel.ErreursTestBio.Refresh");
- erreursTestRefresh.setOutputMarkupId(true);
- add(erreursTestRefresh);
+ // On englobe le "DataView" dans un composant neutre que l'on pourra
+ // rafraichir quand la liste évoluera
+ final MarkupContainer erreursTestRefresh = new WebMarkupContainer(
+ "ListErreurTestBioPanel.ErreursTestBio.Refresh");
+ erreursTestRefresh.setOutputMarkupId(true);
+ add(erreursTestRefresh);
- // Liste des erreursTest
- final List<ErreurTestBio> erreurTest = testService.listErreursTestBio();
- LoadableDetachableSortableListDataProvider<ErreurTestBio> erreursDataProvider = new LoadableDetachableSortableListDataProvider<ErreurTestBio>(
- erreurTest, getSession().getLocale());
+ // Liste des erreursTest
+ final List<ErreurTestBio> erreurTest = testService.listErreursTestBio();
+ LoadableDetachableSortableListDataProvider<ErreurTestBio> erreursDataProvider = new LoadableDetachableSortableListDataProvider<ErreurTestBio>(
+ erreurTest, getSession().getLocale());
- erreursTestRefresh
- .add(new DataView<ErreurTestBio>("ListErreurTestBioPanel.ErreursTestBio", erreursDataProvider) {
- @Override
- protected void populateItem(Item<ErreurTestBio> item) {
- if (item.getIndex() % 2 == 1) {
- item.add(new AttributeModifier("class", item.getIndex() % 2 == 0 ? "even" : "odd"));
- }
+ erreursTestRefresh
+ .add(new DataView<ErreurTestBio>("ListErreurTestBioPanel.ErreursTestBio", erreursDataProvider) {
+ @Override
+ protected void populateItem(Item<ErreurTestBio> item) {
+ if (item.getIndex() % 2 == 1) {
+ item.add(new AttributeModifier("class", item.getIndex() % 2 == 0 ? "even" : "odd"));
+ }
- ErreurTestBio erreurTest = item.getModelObject();
- // Colonnes
- item.add(new Label("ListErreurTestBioPanel.ErreursTestBio.nom", new PropertyModel<String>(
- erreurTest, "nom")));
- item.add(new Label("ListErreurTestBioPanel.ErreursTestBio.description",
- new PropertyModel<String>(erreurTest, "description")));
+ ErreurTestBio erreurTest = item.getModelObject();
+ // Colonnes
+ item.add(new Label("ListErreurTestBioPanel.ErreursTestBio.nom", new PropertyModel<String>(
+ erreurTest, "nom")));
+ item.add(new Label("ListErreurTestBioPanel.ErreursTestBio.description",
+ new PropertyModel<String>(erreurTest, "description")));
- // Action : mise à jour (redirection vers le formulaire)
- Link<ErreurTestBio> updateLink = new Link<ErreurTestBio>(
- "ListErreurTestBioPanel.ErreursTestBio.Update", new Model<ErreurTestBio>(erreurTest)) {
- @Override
- public void onClick() {
- setResponsePage(new ManageErreurTestBioPage(getModelObject().getIdErreurTest()));
- }
- };
- item.add(updateLink);
- }
- });
- }
+ // Action : mise à jour (redirection vers le formulaire)
+ Link<ErreurTestBio> updateLink = new Link<ErreurTestBio>(
+ "ListErreurTestBioPanel.ErreursTestBio.Update", new Model<ErreurTestBio>(erreurTest)) {
+ @Override
+ public void onClick() {
+ setResponsePage(new ManageErreurTestBioPage(getModelObject().getIdErreurTest()));
+ }
+ };
+ item.add(updateLink);
+ }
+ });
+ }
}
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/config/panels/ListMethodeExtractionPanel.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/config/panels/ListMethodeExtractionPanel.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/config/panels/ListMethodeExtractionPanel.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -50,64 +50,64 @@
*/
public class ListMethodeExtractionPanel extends Panel {
- /** Service : extrait */
- @SpringBean
- private ExtractionService extraitService;
+ /** Service : extrait */
+ @SpringBean
+ private ExtractionService extraitService;
- /**
- * Constructor
- * @param id The panel ID
- */
- public ListMethodeExtractionPanel(String id) {
- super(id);
+ /**
+ * Constructor
+ * @param id The panel ID
+ */
+ public ListMethodeExtractionPanel(String id) {
+ super(id);
- add(new BookmarkablePageLink<Void>("ListMethodeExtractionPanel.NewMethodeExtraction",
- ManageMethodeExtractionPage.class));
+ add(new BookmarkablePageLink<Void>("ListMethodeExtractionPanel.NewMethodeExtraction",
+ ManageMethodeExtractionPage.class));
- // On englobe le "DataView" dans un composant neutre que l'on pourra
- // rafraichir quand la liste évoluera
- final MarkupContainer methodesExtractionRefresh = new WebMarkupContainer(
- "ListMethodeExtractionPanel.MethodesExtraction.Refresh");
- methodesExtractionRefresh.setOutputMarkupId(true);
- add(methodesExtractionRefresh);
+ // On englobe le "DataView" dans un composant neutre que l'on pourra
+ // rafraichir quand la liste évoluera
+ final MarkupContainer methodesExtractionRefresh = new WebMarkupContainer(
+ "ListMethodeExtractionPanel.MethodesExtraction.Refresh");
+ methodesExtractionRefresh.setOutputMarkupId(true);
+ add(methodesExtractionRefresh);
- // Liste des methodesExtraction
- final List<MethodeExtraction> methodesExtraction = extraitService.listMethodesExtraction();
- LoadableDetachableSortableListDataProvider<MethodeExtraction> methodesDataProvider = new LoadableDetachableSortableListDataProvider<MethodeExtraction>(
- methodesExtraction, getSession().getLocale());
+ // Liste des methodesExtraction
+ final List<MethodeExtraction> methodesExtraction = extraitService.listMethodesExtraction();
+ LoadableDetachableSortableListDataProvider<MethodeExtraction> methodesDataProvider = new LoadableDetachableSortableListDataProvider<MethodeExtraction>(
+ methodesExtraction, getSession().getLocale());
- methodesExtractionRefresh.add(new DataView<MethodeExtraction>("ListMethodeExtractionPanel.MethodesExtraction",
- methodesDataProvider) {
- @Override
- protected void populateItem(Item<MethodeExtraction> item) {
- if (item.getIndex() % 2 == 1) {
- item.add(new AttributeModifier("class", item.getIndex() % 2 == 0 ? "even" : "odd"));
- }
+ methodesExtractionRefresh.add(new DataView<MethodeExtraction>("ListMethodeExtractionPanel.MethodesExtraction",
+ methodesDataProvider) {
+ @Override
+ protected void populateItem(Item<MethodeExtraction> item) {
+ if (item.getIndex() % 2 == 1) {
+ item.add(new AttributeModifier("class", item.getIndex() % 2 == 0 ? "even" : "odd"));
+ }
- MethodeExtraction methodeExtraction = item.getModelObject();
- // Refresh the methodeExtraction for Ajax refreshes (typesEnSorties is LAZY and session different from
- // the one used for the init)
- extraitService.refreshMethodeExtraction(methodeExtraction);
- // Colonnes
- item.add(new Label("ListMethodeExtractionPanel.MethodesExtraction.nom", new PropertyModel<String>(
- methodeExtraction, "nom")));
- item.add(new MultiLineLabel("ListMethodeExtractionPanel.MethodesExtraction.description",
- new PropertyModel<String>(methodeExtraction, "description")));
- item.add(new Label("ListMethodeExtractionPanel.MethodesExtraction.typesEnSortie", StringUtils.join(
- methodeExtraction.getSortedTypesEnSortie(), ", ")));
+ MethodeExtraction methodeExtraction = item.getModelObject();
+ // Refresh the methodeExtraction for Ajax refreshes (typesEnSorties is LAZY and session different from
+ // the one used for the init)
+ extraitService.refreshMethodeExtraction(methodeExtraction);
+ // Colonnes
+ item.add(new Label("ListMethodeExtractionPanel.MethodesExtraction.nom", new PropertyModel<String>(
+ methodeExtraction, "nom")));
+ item.add(new MultiLineLabel("ListMethodeExtractionPanel.MethodesExtraction.description",
+ new PropertyModel<String>(methodeExtraction, "description")));
+ item.add(new Label("ListMethodeExtractionPanel.MethodesExtraction.typesEnSortie", StringUtils.join(
+ methodeExtraction.getSortedTypesEnSortie(), ", ")));
- // Action : mise à jour (redirection vers le formulaire)
- Link<MethodeExtraction> updateLink = new Link<MethodeExtraction>(
- "ListMethodeExtractionPanel.MethodesExtraction.Update", new Model<MethodeExtraction>(
- methodeExtraction)) {
- @Override
- public void onClick() {
- setResponsePage(new ManageMethodeExtractionPage(getModelObject().getIdMethodeExtraction()));
- }
- };
- item.add(updateLink);
- }
- });
- }
+ // Action : mise à jour (redirection vers le formulaire)
+ Link<MethodeExtraction> updateLink = new Link<MethodeExtraction>(
+ "ListMethodeExtractionPanel.MethodesExtraction.Update", new Model<MethodeExtraction>(
+ methodeExtraction)) {
+ @Override
+ public void onClick() {
+ setResponsePage(new ManageMethodeExtractionPage(getModelObject().getIdMethodeExtraction()));
+ }
+ };
+ item.add(updateLink);
+ }
+ });
+ }
}
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/config/panels/ListMethodePurificationPanel.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/config/panels/ListMethodePurificationPanel.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/config/panels/ListMethodePurificationPanel.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -49,65 +49,65 @@
*/
public class ListMethodePurificationPanel extends Panel {
- /** Service : purification */
- @SpringBean
- private PurificationService purificationService;
+ /** Service : purification */
+ @SpringBean
+ private PurificationService purificationService;
- /**
- * Constructor
- * @param id The panel ID
- */
- public ListMethodePurificationPanel(String id) {
- super(id);
+ /**
+ * Constructor
+ * @param id The panel ID
+ */
+ public ListMethodePurificationPanel(String id) {
+ super(id);
- add(new BookmarkablePageLink<Void>("ListMethodePurificationPanel.NewMethodePurification",
- ManageMethodePurificationPage.class));
+ add(new BookmarkablePageLink<Void>("ListMethodePurificationPanel.NewMethodePurification",
+ ManageMethodePurificationPage.class));
- // On englobe le "DataView" dans un composant neutre que l'on pourra
- // rafraichir quand la liste évoluera
- final MarkupContainer methodesPurificationRefresh = new WebMarkupContainer(
- "ListMethodePurificationPanel.MethodesPurification.Refresh");
- methodesPurificationRefresh.setOutputMarkupId(true);
- add(methodesPurificationRefresh);
+ // On englobe le "DataView" dans un composant neutre que l'on pourra
+ // rafraichir quand la liste évoluera
+ final MarkupContainer methodesPurificationRefresh = new WebMarkupContainer(
+ "ListMethodePurificationPanel.MethodesPurification.Refresh");
+ methodesPurificationRefresh.setOutputMarkupId(true);
+ add(methodesPurificationRefresh);
- // Liste des methodesPurification
- final List<MethodePurification> methodesPurification = purificationService.listMethodesPurification();
- LoadableDetachableSortableListDataProvider<MethodePurification> methodesDataProvider = new LoadableDetachableSortableListDataProvider<MethodePurification>(
- methodesPurification, getSession().getLocale());
+ // Liste des methodesPurification
+ final List<MethodePurification> methodesPurification = purificationService.listMethodesPurification();
+ LoadableDetachableSortableListDataProvider<MethodePurification> methodesDataProvider = new LoadableDetachableSortableListDataProvider<MethodePurification>(
+ methodesPurification, getSession().getLocale());
- methodesPurificationRefresh.add(new DataView<MethodePurification>(
- "ListMethodePurificationPanel.MethodesPurification", methodesDataProvider) {
- @Override
- protected void populateItem(Item<MethodePurification> item) {
- if (item.getIndex() % 2 == 1) {
- item.add(new AttributeModifier("class", item.getIndex() % 2 == 0 ? "even" : "odd"));
- }
+ methodesPurificationRefresh.add(new DataView<MethodePurification>(
+ "ListMethodePurificationPanel.MethodesPurification", methodesDataProvider) {
+ @Override
+ protected void populateItem(Item<MethodePurification> item) {
+ if (item.getIndex() % 2 == 1) {
+ item.add(new AttributeModifier("class", item.getIndex() % 2 == 0 ? "even" : "odd"));
+ }
- MethodePurification methodePurification = item.getModelObject();
- // Refresh the methodePurification for Ajax refreshes (parametres is LAZY and session different from
- // the one used for the init)
- purificationService.refreshMethodePurification(methodePurification);
- // Colonnes
- item.add(new Label("ListMethodePurificationPanel.MethodesPurification.nom", methodePurification
- .getNom()));
- item.add(new MultiLineLabel("ListMethodePurificationPanel.MethodesPurification.description",
- methodePurification.getDescription()));
- item.add(new Label("ListMethodePurificationPanel.MethodesPurification.parametres", StringUtils.join(
- methodePurification.getParametres(), ", ")));
+ MethodePurification methodePurification = item.getModelObject();
+ // Refresh the methodePurification for Ajax refreshes (parametres is LAZY and session different from
+ // the one used for the init)
+ purificationService.refreshMethodePurification(methodePurification);
+ // Colonnes
+ item.add(new Label("ListMethodePurificationPanel.MethodesPurification.nom", methodePurification
+ .getNom()));
+ item.add(new MultiLineLabel("ListMethodePurificationPanel.MethodesPurification.description",
+ methodePurification.getDescription()));
+ item.add(new Label("ListMethodePurificationPanel.MethodesPurification.parametres", StringUtils.join(
+ methodePurification.getParametres(), ", ")));
- // Action : mise à jour (redirection vers le formulaire)
- Link<MethodePurification> updateLink = new Link<MethodePurification>(
- "ListMethodePurificationPanel.MethodesPurification.Update", new Model<MethodePurification>(
- methodePurification)) {
- @Override
- public void onClick() {
- setResponsePage(new ManageMethodePurificationPage(getModelObject().getIdMethodePurification()));
- }
- };
- item.add(updateLink);
- }
- });
+ // Action : mise à jour (redirection vers le formulaire)
+ Link<MethodePurification> updateLink = new Link<MethodePurification>(
+ "ListMethodePurificationPanel.MethodesPurification.Update", new Model<MethodePurification>(
+ methodePurification)) {
+ @Override
+ public void onClick() {
+ setResponsePage(new ManageMethodePurificationPage(getModelObject().getIdMethodePurification()));
+ }
+ };
+ item.add(updateLink);
+ }
+ });
- }
+ }
}
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/config/panels/ListMethodeTestBioPanel.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/config/panels/ListMethodeTestBioPanel.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/config/panels/ListMethodeTestBioPanel.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -49,68 +49,68 @@
*/
public class ListMethodeTestBioPanel extends Panel {
- /** Service : test */
- @SpringBean
- private TestBioService testService;
+ /** Service : test */
+ @SpringBean
+ private TestBioService testService;
- /**
- * Constructor
- * @param id The panel ID
- */
- public ListMethodeTestBioPanel(String id) {
- super(id);
+ /**
+ * Constructor
+ * @param id The panel ID
+ */
+ public ListMethodeTestBioPanel(String id) {
+ super(id);
- add(new BookmarkablePageLink<Void>("ListMethodeTestBioPanel.NewMethodeTestBio", ManageMethodeTestBioPage.class));
+ add(new BookmarkablePageLink<Void>("ListMethodeTestBioPanel.NewMethodeTestBio", ManageMethodeTestBioPage.class));
- // On englobe le "DataView" dans un composant neutre que l'on pourra
- // rafraichir quand la liste évoluera
- final MarkupContainer methodesTestRefresh = new WebMarkupContainer(
- "ListMethodeTestBioPanel.MethodesTestBio.Refresh");
- methodesTestRefresh.setOutputMarkupId(true);
- add(methodesTestRefresh);
+ // On englobe le "DataView" dans un composant neutre que l'on pourra
+ // rafraichir quand la liste évoluera
+ final MarkupContainer methodesTestRefresh = new WebMarkupContainer(
+ "ListMethodeTestBioPanel.MethodesTestBio.Refresh");
+ methodesTestRefresh.setOutputMarkupId(true);
+ add(methodesTestRefresh);
- // Liste des methodesTest
- final List<MethodeTestBio> methodesTest = testService.listMethodesTestBio();
- LoadableDetachableSortableListDataProvider<MethodeTestBio> methodesDataProvider = new LoadableDetachableSortableListDataProvider<MethodeTestBio>(
- methodesTest, getSession().getLocale());
+ // Liste des methodesTest
+ final List<MethodeTestBio> methodesTest = testService.listMethodesTestBio();
+ LoadableDetachableSortableListDataProvider<MethodeTestBio> methodesDataProvider = new LoadableDetachableSortableListDataProvider<MethodeTestBio>(
+ methodesTest, getSession().getLocale());
- methodesTestRefresh.add(new DataView<MethodeTestBio>("ListMethodeTestBioPanel.MethodesTestBio",
- methodesDataProvider) {
- @Override
- protected void populateItem(Item<MethodeTestBio> item) {
- if (item.getIndex() % 2 == 1) {
- item.add(new AttributeModifier("class", item.getIndex() % 2 == 0 ? "even" : "odd"));
- }
+ methodesTestRefresh.add(new DataView<MethodeTestBio>("ListMethodeTestBioPanel.MethodesTestBio",
+ methodesDataProvider) {
+ @Override
+ protected void populateItem(Item<MethodeTestBio> item) {
+ if (item.getIndex() % 2 == 1) {
+ item.add(new AttributeModifier("class", item.getIndex() % 2 == 0 ? "even" : "odd"));
+ }
- MethodeTestBio methodeExtraction = item.getModelObject();
+ MethodeTestBio methodeExtraction = item.getModelObject();
- // Colonnes
- item.add(new Label("ListMethodeTestBioPanel.MethodesTestBio.nom", new PropertyModel<String>(
- methodeExtraction, "nom")));
- item.add(new Label("ListMethodeTestBioPanel.MethodesTestBio.cible", new PropertyModel<String>(
- methodeExtraction, "cible")));
- item.add(new Label("ListMethodeTestBioPanel.MethodesTestBio.domaine", new PropertyModel<String>(
- methodeExtraction, "domaine")));
- item.add(new MultiLineLabel("ListMethodeTestBioPanel.MethodesTestBio.description",
- new PropertyModel<String>(methodeExtraction, "description")));
- item.add(new Label("ListMethodeTestBioPanel.MethodesTestBio.valeurMesuree", new PropertyModel<String>(
- methodeExtraction, "valeurMesuree")));
- item.add(new Label("ListMethodeTestBioPanel.MethodesTestBio.uniteResultat", new PropertyModel<String>(
- methodeExtraction, "uniteResultat")));
- item.add(new Label("ListMethodeTestBioPanel.MethodesTestBio.critereActivite",
- new PropertyModel<String>(methodeExtraction, "critereActivite")));
+ // Colonnes
+ item.add(new Label("ListMethodeTestBioPanel.MethodesTestBio.nom", new PropertyModel<String>(
+ methodeExtraction, "nom")));
+ item.add(new Label("ListMethodeTestBioPanel.MethodesTestBio.cible", new PropertyModel<String>(
+ methodeExtraction, "cible")));
+ item.add(new Label("ListMethodeTestBioPanel.MethodesTestBio.domaine", new PropertyModel<String>(
+ methodeExtraction, "domaine")));
+ item.add(new MultiLineLabel("ListMethodeTestBioPanel.MethodesTestBio.description",
+ new PropertyModel<String>(methodeExtraction, "description")));
+ item.add(new Label("ListMethodeTestBioPanel.MethodesTestBio.valeurMesuree", new PropertyModel<String>(
+ methodeExtraction, "valeurMesuree")));
+ item.add(new Label("ListMethodeTestBioPanel.MethodesTestBio.uniteResultat", new PropertyModel<String>(
+ methodeExtraction, "uniteResultat")));
+ item.add(new Label("ListMethodeTestBioPanel.MethodesTestBio.critereActivite",
+ new PropertyModel<String>(methodeExtraction, "critereActivite")));
- // Action : mise à jour (redirection vers le formulaire)
- Link<MethodeTestBio> updateLink = new Link<MethodeTestBio>(
- "ListMethodeTestBioPanel.MethodesTestBio.Update", new Model<MethodeTestBio>(methodeExtraction)) {
- @Override
- public void onClick() {
- setResponsePage(new ManageMethodeTestBioPage(getModelObject().getIdMethodeTest()));
- }
- };
- item.add(updateLink);
- }
- });
- }
+ // Action : mise à jour (redirection vers le formulaire)
+ Link<MethodeTestBio> updateLink = new Link<MethodeTestBio>(
+ "ListMethodeTestBioPanel.MethodesTestBio.Update", new Model<MethodeTestBio>(methodeExtraction)) {
+ @Override
+ public void onClick() {
+ setResponsePage(new ManageMethodeTestBioPage(getModelObject().getIdMethodeTest()));
+ }
+ };
+ item.add(updateLink);
+ }
+ });
+ }
}
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/config/panels/ListPartiePanel.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/config/panels/ListPartiePanel.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/config/panels/ListPartiePanel.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -49,51 +49,51 @@
*/
public class ListPartiePanel extends Panel {
- /** Service : lot */
- @SpringBean
- private LotService lotService;
+ /** Service : lot */
+ @SpringBean
+ private LotService lotService;
- /**
- * Constructor
- * @param id The panel ID
- */
- public ListPartiePanel(String id) {
- super(id);
+ /**
+ * Constructor
+ * @param id The panel ID
+ */
+ public ListPartiePanel(String id) {
+ super(id);
- add(new BookmarkablePageLink<Void>("ListPartiePanel.NewPartie", ManagePartiePage.class));
+ add(new BookmarkablePageLink<Void>("ListPartiePanel.NewPartie", ManagePartiePage.class));
- // On englobe le "DataView" dans un composant neutre que l'on pourra
- // rafraichir quand la liste évoluera
- final MarkupContainer partiesRefresh = new WebMarkupContainer("ListPartiePanel.Parties.Refresh");
- partiesRefresh.setOutputMarkupId(true);
- add(partiesRefresh);
+ // On englobe le "DataView" dans un composant neutre que l'on pourra
+ // rafraichir quand la liste évoluera
+ final MarkupContainer partiesRefresh = new WebMarkupContainer("ListPartiePanel.Parties.Refresh");
+ partiesRefresh.setOutputMarkupId(true);
+ add(partiesRefresh);
- // Liste des parties
- final List<Partie> parties = lotService.listParties();
- LoadableDetachableSortableListDataProvider<Partie> partiesDataProvider = new LoadableDetachableSortableListDataProvider<Partie>(
- parties, getSession().getLocale());
+ // Liste des parties
+ final List<Partie> parties = lotService.listParties();
+ LoadableDetachableSortableListDataProvider<Partie> partiesDataProvider = new LoadableDetachableSortableListDataProvider<Partie>(
+ parties, getSession().getLocale());
- partiesRefresh.add(new DataView<Partie>("ListPartiePanel.Parties", partiesDataProvider) {
- @Override
- protected void populateItem(Item<Partie> item) {
- if (item.getIndex() % 2 == 1) {
- item.add(new AttributeModifier("class", item.getIndex() % 2 == 0 ? "even" : "odd"));
- }
+ partiesRefresh.add(new DataView<Partie>("ListPartiePanel.Parties", partiesDataProvider) {
+ @Override
+ protected void populateItem(Item<Partie> item) {
+ if (item.getIndex() % 2 == 1) {
+ item.add(new AttributeModifier("class", item.getIndex() % 2 == 0 ? "even" : "odd"));
+ }
- Partie partie = item.getModelObject();
- // Colonnes
- item.add(new Label("ListPartiePanel.Parties.nom", new PropertyModel<String>(partie, "nom")));
+ Partie partie = item.getModelObject();
+ // Colonnes
+ item.add(new Label("ListPartiePanel.Parties.nom", new PropertyModel<String>(partie, "nom")));
- // Action : mise à jour (redirection vers le formulaire)
- Link<Partie> updateLink = new Link<Partie>("ListPartiePanel.Parties.Update", new Model<Partie>(partie)) {
- @Override
- public void onClick() {
- setResponsePage(new ManagePartiePage(getModelObject().getIdPartie()));
- }
- };
- item.add(updateLink);
- }
- });
- }
+ // Action : mise à jour (redirection vers le formulaire)
+ Link<Partie> updateLink = new Link<Partie>("ListPartiePanel.Parties.Update", new Model<Partie>(partie)) {
+ @Override
+ public void onClick() {
+ setResponsePage(new ManagePartiePage(getModelObject().getIdPartie()));
+ }
+ };
+ item.add(updateLink);
+ }
+ });
+ }
}
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/config/panels/RebuildLuceneIndexPanel.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/config/panels/RebuildLuceneIndexPanel.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/config/panels/RebuildLuceneIndexPanel.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -40,20 +40,20 @@
*/
public class RebuildLuceneIndexPanel extends Panel {
- /** Service : test */
- @SpringBean
- private SearchService searchService;
+ /** Service : test */
+ @SpringBean
+ private SearchService searchService;
- protected Label rebuildResultLabel;
+ protected Label rebuildResultLabel;
- /**
- * Constructor
- * @param id The panel ID
- */
- public RebuildLuceneIndexPanel(String id) {
- super(id);
+ /**
+ * Constructor
+ * @param id The panel ID
+ */
+ public RebuildLuceneIndexPanel(String id) {
+ super(id);
- final Form<Void> formView = new Form<Void>("Form");
+ final Form<Void> formView = new Form<Void>("Form");
Button addButton = new AjaxFallbackButton("Rebuild", formView) {
@Override
@@ -72,5 +72,5 @@
rebuildResultLabel = new Label("rebuildResult", new Model<String>(""));
formView.add(rebuildResultLabel);
add(formView);
- }
+ }
}
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/extraction/ListExtractionsPage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/extraction/ListExtractionsPage.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/extraction/ListExtractionsPage.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -68,146 +68,146 @@
@AuthRoles({ AuthRole.ADMIN, AuthRole.USER })
public final class ListExtractionsPage extends TemplatePage {
- /** Service : manipExtraction */
- @SpringBean
- private ExtractionService extractionService;
+ /** Service : manipExtraction */
+ @SpringBean
+ private ExtractionService extractionService;
- /**
- * Nombre d'extraits affichés dans la colonne de résumés des extraits
- */
- private static int MAX_EXTRAITS_DISPLAY = 4;
+ /**
+ * Nombre d'extraits affichés dans la colonne de résumés des extraits
+ */
+ private static int MAX_EXTRAITS_DISPLAY = 4;
- /**
- * Constructeur
- */
- public ListExtractionsPage() {
- super(ListExtractionsPage.class);
+ /**
+ * Constructeur
+ */
+ public ListExtractionsPage() {
+ super(ListExtractionsPage.class);
- final CallerPage currentPage = new CallerPage(ListExtractionsPage.class);
+ final CallerPage currentPage = new CallerPage(ListExtractionsPage.class);
- add(new Link<Void>(getResource() + ".NewExtraction") {
- @Override
- public void onClick() {
- setResponsePage(new ManageExtractionPage(currentPage, true));
- }
- });
+ add(new Link<Void>(getResource() + ".NewExtraction") {
+ @Override
+ public void onClick() {
+ setResponsePage(new ManageExtractionPage(currentPage, true));
+ }
+ });
- // On englobe le "DataView" dans un composant neutre que l'on pourra
- // rafraichir quand la liste évoluera
- final MarkupContainer extractionsRefresh = new WebMarkupContainer(getResource() + ".Extractions.Refresh");
- extractionsRefresh.setOutputMarkupId(true);
- add(extractionsRefresh);
+ // On englobe le "DataView" dans un composant neutre que l'on pourra
+ // rafraichir quand la liste évoluera
+ final MarkupContainer extractionsRefresh = new WebMarkupContainer(getResource() + ".Extractions.Refresh");
+ extractionsRefresh.setOutputMarkupId(true);
+ add(extractionsRefresh);
- // Liste des Extractions
- final List<Extraction> extractions = extractionService.listExtractions(getSession().getUtilisateur());
+ // Liste des Extractions
+ final List<Extraction> extractions = extractionService.listExtractions(getSession().getUtilisateur());
- LoadableDetachableSortableListDataProvider<Extraction> extractionsDataProvider = new LoadableDetachableSortableListDataProvider<Extraction>(
- extractions, getSession().getLocale());
+ LoadableDetachableSortableListDataProvider<Extraction> extractionsDataProvider = new LoadableDetachableSortableListDataProvider<Extraction>(
+ extractions, getSession().getLocale());
- List<IColumn<Extraction>> columns = new ArrayList<IColumn<Extraction>>();
+ List<IColumn<Extraction>> columns = new ArrayList<IColumn<Extraction>>();
- columns.add(new LinkableImagePropertyColumn<Extraction>("images/read.png", getString("Read"), getString("Read")) {
- @Override
- public void onClick(Item<ICellPopulator<Extraction>> item, String componentId, IModel<Extraction> model) {
- setResponsePage(new ReadExtractionPage(model.getObject().getIdExtraction(), currentPage));
- }
- });
+ columns.add(new LinkableImagePropertyColumn<Extraction>("images/read.png", getString("Read"), getString("Read")) {
+ @Override
+ public void onClick(Item<ICellPopulator<Extraction>> item, String componentId, IModel<Extraction> model) {
+ setResponsePage(new ReadExtractionPage(model.getObject().getIdExtraction(), currentPage));
+ }
+ });
- columns.add(new LinkPropertyColumn<Extraction>(new Model<String>(getString("Extraction.lot")), "lot", "lot",
- getString("Read")) {
- @Override
- public void onClick(Item<ICellPopulator<Extraction>> item, String componentId, IModel<Extraction> model) {
- setResponsePage(new ReadLotPage(model.getObject().getLot().getIdLot(), currentPage));
- }
- });
+ columns.add(new LinkPropertyColumn<Extraction>(new Model<String>(getString("Extraction.lot")), "lot", "lot",
+ getString("Read")) {
+ @Override
+ public void onClick(Item<ICellPopulator<Extraction>> item, String componentId, IModel<Extraction> model) {
+ setResponsePage(new ReadLotPage(model.getObject().getLot().getIdLot(), currentPage));
+ }
+ });
- columns.add(new LinkPropertyColumn<Extraction>(new Model<String>(getString("Extraction.ref")), "ref", "ref",
- getString("Read")) {
- @Override
- public void onClick(Item<ICellPopulator<Extraction>> item, String componentId, IModel<Extraction> model) {
- setResponsePage(new ReadExtractionPage(model.getObject().getIdExtraction(), currentPage));
- }
- });
+ columns.add(new LinkPropertyColumn<Extraction>(new Model<String>(getString("Extraction.ref")), "ref", "ref",
+ getString("Read")) {
+ @Override
+ public void onClick(Item<ICellPopulator<Extraction>> item, String componentId, IModel<Extraction> model) {
+ setResponsePage(new ReadExtractionPage(model.getObject().getIdExtraction(), currentPage));
+ }
+ });
- columns.add(new ShortDatePropertyColumn<Extraction>(new Model<String>(getString("Extraction.date")), "date",
- "date", getLocale()));
+ columns.add(new ShortDatePropertyColumn<Extraction>(new Model<String>(getString("Extraction.date")), "date",
+ "date", getLocale()));
- columns.add(new PropertyColumn<Extraction>(new Model<String>(getString("Extraction.methode2")), "methode",
- "methode"));
+ columns.add(new PropertyColumn<Extraction>(new Model<String>(getString("Extraction.methode2")), "methode",
+ "methode"));
- columns.add(new DecimalPropertyColumn<Extraction>(new Model<String>(getString("Extraction.masseDepart2")),
- "masseDepart", "masseDepart", DecimalDisplFormat.SMALL, getLocale()));
+ columns.add(new DecimalPropertyColumn<Extraction>(new Model<String>(getString("Extraction.masseDepart2")),
+ "masseDepart", "masseDepart", DecimalDisplFormat.SMALL, getLocale()));
- columns.add(new LinkPropertyColumn<Extraction>(new Model<String>(getString("Campagne")), "lot.campagne",
- "lot.campagne", getString("Read")) {
- @Override
- public void onClick(Item<ICellPopulator<Extraction>> item, String componentId, IModel<Extraction> model) {
- setResponsePage(new ReadCampagnePage(model.getObject().getLot().getCampagne().getIdCampagne(),
- currentPage));
- }
- });
+ columns.add(new LinkPropertyColumn<Extraction>(new Model<String>(getString("Campagne")), "lot.campagne",
+ "lot.campagne", getString("Read")) {
+ @Override
+ public void onClick(Item<ICellPopulator<Extraction>> item, String componentId, IModel<Extraction> model) {
+ setResponsePage(new ReadCampagnePage(model.getObject().getLot().getCampagne().getIdCampagne(),
+ currentPage));
+ }
+ });
- columns.add(new AbstractColumn<Extraction>(new Model<String>(getString("Extraction.extraits"))) {
- @Override
- public void populateItem(Item<ICellPopulator<Extraction>> cellItem, String componentId,
- IModel<Extraction> rowModel) {
+ columns.add(new AbstractColumn<Extraction>(new Model<String>(getString("Extraction.extraits"))) {
+ @Override
+ public void populateItem(Item<ICellPopulator<Extraction>> cellItem, String componentId,
+ IModel<Extraction> rowModel) {
- // affiche un résumé des types extraits et des masses, allant jusqu'à MAX_EXTRAITS_DISPLAY extraits
- Label extraitsLabel = new Label(componentId, new Model<Serializable>(rowModel) {
- /** {@inheritDoc} */
- @Override
- public String getObject() {
- StringBuilder extraitsResume = new StringBuilder();
- List<Extrait> extraits = new PropertyModel<List<Extrait>>(super.getObject(), "sortedExtraits")
- .getObject();
- for (int i = 0; i < MAX_EXTRAITS_DISPLAY && i < extraits.size(); i++) {
- Extrait curExtrait = extraits.get(i);
- extraitsResume.append("<b>");
- extraitsResume.append(curExtrait.getTypeExtrait().getInitiales());
- extraitsResume.append("</b>");
- extraitsResume.append(" : ");
- extraitsResume.append(curExtrait.getMasseObtenue() == null ? ReplaceEmptyLabelBehavior.NULL_PROPERTY
- : new DisplayDecimalPropertyModel(curExtrait, "masseObtenue",
- DecimalDisplFormat.SMALL, getLocale()).getObject());
- if (i < MAX_EXTRAITS_DISPLAY - 1 && i < extraits.size() - 1) {
- extraitsResume.append(", ");
- }
- if (i == MAX_EXTRAITS_DISPLAY - 1 && i < extraits.size() - 1) {
- extraitsResume.append(", ...");
- }
- }
- return extraitsResume.toString();
- }
- });
- extraitsLabel.setEscapeModelStrings(false);
- extraitsLabel.add(new ReplaceEmptyLabelBehavior());
- cellItem.add(extraitsLabel);
- }
+ // affiche un résumé des types extraits et des masses, allant jusqu'à MAX_EXTRAITS_DISPLAY extraits
+ Label extraitsLabel = new Label(componentId, new Model<Serializable>(rowModel) {
+ /** {@inheritDoc} */
+ @Override
+ public String getObject() {
+ StringBuilder extraitsResume = new StringBuilder();
+ List<Extrait> extraits = new PropertyModel<List<Extrait>>(super.getObject(), "sortedExtraits")
+ .getObject();
+ for (int i = 0; i < MAX_EXTRAITS_DISPLAY && i < extraits.size(); i++) {
+ Extrait curExtrait = extraits.get(i);
+ extraitsResume.append("<b>");
+ extraitsResume.append(curExtrait.getTypeExtrait().getInitiales());
+ extraitsResume.append("</b>");
+ extraitsResume.append(" : ");
+ extraitsResume.append(curExtrait.getMasseObtenue() == null ? ReplaceEmptyLabelBehavior.NULL_PROPERTY
+ : new DisplayDecimalPropertyModel(curExtrait, "masseObtenue",
+ DecimalDisplFormat.SMALL, getLocale()).getObject());
+ if (i < MAX_EXTRAITS_DISPLAY - 1 && i < extraits.size() - 1) {
+ extraitsResume.append(", ");
+ }
+ if (i == MAX_EXTRAITS_DISPLAY - 1 && i < extraits.size() - 1) {
+ extraitsResume.append(", ...");
+ }
+ }
+ return extraitsResume.toString();
+ }
+ });
+ extraitsLabel.setEscapeModelStrings(false);
+ extraitsLabel.add(new ReplaceEmptyLabelBehavior());
+ cellItem.add(extraitsLabel);
+ }
- });
+ });
- columns.add(new LinkableImagePropertyColumn<Extraction>("images/edit.png", getString("Update"),
- getString("Update")) {
- // pas de lien d'édition si l'utilisateur n'a pas les droits
- @Override
- public void populateItem(Item<ICellPopulator<Extraction>> item, String componentId, IModel<Extraction> model) {
- if (extractionService.updateOrdeleteExtractionEnabled(model.getObject(), getSession().getUtilisateur())) {
- item.add(new LinkableImagePanel(item, componentId, model));
- } else {
- // label vide
- item.add(new Label(componentId));
- }
- }
+ columns.add(new LinkableImagePropertyColumn<Extraction>("images/edit.png", getString("Update"),
+ getString("Update")) {
+ // pas de lien d'édition si l'utilisateur n'a pas les droits
+ @Override
+ public void populateItem(Item<ICellPopulator<Extraction>> item, String componentId, IModel<Extraction> model) {
+ if (extractionService.updateOrdeleteExtractionEnabled(model.getObject(), getSession().getUtilisateur())) {
+ item.add(new LinkableImagePanel(item, componentId, model));
+ } else {
+ // label vide
+ item.add(new Label(componentId));
+ }
+ }
- @Override
- public void onClick(Item<ICellPopulator<Extraction>> item, String componentId, IModel<Extraction> model) {
- setResponsePage(new ManageExtractionPage(model.getObject().getIdExtraction(), currentPage));
- }
- });
+ @Override
+ public void onClick(Item<ICellPopulator<Extraction>> item, String componentId, IModel<Extraction> model) {
+ setResponsePage(new ManageExtractionPage(model.getObject().getIdExtraction(), currentPage));
+ }
+ });
- final DataTable<Extraction> extractionsDataTable = new AjaxFallbackDefaultDataTable<Extraction>(
- "ListExtractionsPage.Extractions", columns, extractionsDataProvider, WebContext.ROWS_PER_PAGE);
- extractionsRefresh.add(extractionsDataTable);
+ final DataTable<Extraction> extractionsDataTable = new AjaxFallbackDefaultDataTable<Extraction>(
+ "ListExtractionsPage.Extractions", columns, extractionsDataProvider, WebContext.ROWS_PER_PAGE);
+ extractionsRefresh.add(extractionsDataTable);
- }
+ }
}
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/extraction/ManageExtractionPage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/extraction/ManageExtractionPage.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/extraction/ManageExtractionPage.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -97,692 +97,692 @@
@AuthRoles({ AuthRole.ADMIN, AuthRole.USER })
public final class ManageExtractionPage extends TemplatePage {
- /** Action : create */
- private static final String ACTION_CREATE = "Create";
+ /** Action : create */
+ private static final String ACTION_CREATE = "Create";
- /** Action : update */
- private static final String ACTION_UPDATE = "Update";
+ /** Action : update */
+ private static final String ACTION_UPDATE = "Update";
- /** Action : delete */
- public static final String ACTION_DELETE = "Delete";
+ /** Action : delete */
+ public static final String ACTION_DELETE = "Delete";
- /** Logger */
- private static final Log LOG = LogTools.getLog();
+ /** Logger */
+ private static final Log LOG = LogTools.getLog();
- /** extraction Model */
- private final IModel<Extraction> extractionModel;
+ /** extraction Model */
+ private final IModel<Extraction> extractionModel;
- /** model for adding Extrait */
- private IModel<Extrait> newExtraitModel;
+ /** model for adding Extrait */
+ private IModel<Extrait> newExtraitModel;
- /** Service : extraits */
- @SpringBean
- private ExtractionService extractionService;
+ /** Service : extraits */
+ @SpringBean
+ private ExtractionService extractionService;
- /** Service : personnes */
- @SpringBean
- private PersonneService personneService;
+ /** Service : personnes */
+ @SpringBean
+ private PersonneService personneService;
- /** Service : produits */
- @SpringBean
- private ProduitService produitService;
+ /** Service : produits */
+ @SpringBean
+ private ProduitService produitService;
- /** Service : lots */
- @SpringBean
- private LotService lotService;
+ /** Service : lots */
+ @SpringBean
+ private LotService lotService;
- /** Liste des personnes existantes */
- private final List<Personne> personnes;
+ /** Liste des personnes existantes */
+ private final List<Personne> personnes;
- /** Liste des méthodes d'extraction existantes */
- private final List<MethodeExtraction> methodes;
+ /** Liste des méthodes d'extraction existantes */
+ private final List<MethodeExtraction> methodes;
- /** Liste des types d'extraits issue de la méthode sélectionnée */
- private List<TypeExtrait> typesExtrait;
+ /** Liste des types d'extraits issue de la méthode sélectionnée */
+ private List<TypeExtrait> typesExtrait;
- /** Liste des lots existants */
- private List<Lot> lots;
+ /** Liste des lots existants */
+ private List<Lot> lots;
- /** Model validateur */
- @SpringBean(name = "webModelValidator")
- private ModelValidator validator;
+ /** Model validateur */
+ @SpringBean(name = "webModelValidator")
+ private ModelValidator validator;
- /** Page appelante */
- private final CallerPage callerPage;
+ /** Page appelante */
+ private final CallerPage callerPage;
- /** Saisie multiple */
- private boolean multipleEntry;
+ /** Saisie multiple */
+ private boolean multipleEntry;
- /** createMode true si le formulaire est en creation, false en édition **/
- private boolean createMode;
+ /** createMode true si le formulaire est en creation, false en édition **/
+ private boolean createMode;
- /**
- * Couple of <ref, id> in order to recuperate the id of the deleted type usefull in case of delete thus add of same
- * initial type
- */
- private HashMap<String, Integer> extraitsDeleted;
+ /**
+ * Couple of <ref, id> in order to recuperate the id of the deleted type usefull in case of delete thus add of same
+ * initial type
+ */
+ private HashMap<String, Integer> extraitsDeleted;
- /** Container pour la table des extraits (ajoutés, et saisie) */
- private MarkupContainer extraitsTable;
+ /** Container pour la table des extraits (ajoutés, et saisie) */
+ private MarkupContainer extraitsTable;
- /** Saisie typeExtrait pour l'ajout d'un extrait */
- private AbstractSingleSelectChoice<TypeExtrait> typeExtraitInput;
+ /** Saisie typeExtrait pour l'ajout d'un extrait */
+ private AbstractSingleSelectChoice<TypeExtrait> typeExtraitInput;
- /** Info-bulle comprenant la description du type d'extrait **/
- private SimpleTooltipPanel typeExtraitTooltip;
+ /** Info-bulle comprenant la description du type d'extrait **/
+ private SimpleTooltipPanel typeExtraitTooltip;
- /** Saisie ref pour l'ajout d'un extrait */
- private FormComponent<String> refInput;
+ /** Saisie ref pour l'ajout d'un extrait */
+ private FormComponent<String> refInput;
- /** Saisie masse pour l'ajout d'un extrait */
- private FormComponent<BigDecimal> masseObtenueInput;
+ /** Saisie masse pour l'ajout d'un extrait */
+ private FormComponent<BigDecimal> masseObtenueInput;
- /** Bouton d'ajout d'un extrait **/
- private Button addExtraitButton;
+ /** Bouton d'ajout d'un extrait **/
+ private Button addExtraitButton;
- /** Pattern pour le renseignement automatique des réf d'extrait */
- private static final String PATTERN_REF_EXTRAIT = "%s%s";
+ /** Pattern pour le renseignement automatique des réf d'extrait */
+ private static final String PATTERN_REF_EXTRAIT = "%s%s";
- /**
- * Constructeur (mode création)
- * @param callerPage Page appelante
- * @param multipleEntry Saisie multiple
- */
- public ManageExtractionPage(CallerPage callerPage, boolean multipleEntry) {
- this(null, null, callerPage, multipleEntry);
- }
+ /**
+ * Constructeur (mode création)
+ * @param callerPage Page appelante
+ * @param multipleEntry Saisie multiple
+ */
+ public ManageExtractionPage(CallerPage callerPage, boolean multipleEntry) {
+ this(null, null, callerPage, multipleEntry);
+ }
- /**
- * Constructeur (mode édition)
- * @param idManip Id de la manip d'extraction
- * @param callerPage Page appelante
- */
- public ManageExtractionPage(Integer idManip, CallerPage callerPage) {
- this(idManip, null, callerPage, false);
- }
+ /**
+ * Constructeur (mode édition)
+ * @param idManip Id de la manip d'extraction
+ * @param callerPage Page appelante
+ */
+ public ManageExtractionPage(Integer idManip, CallerPage callerPage) {
+ this(idManip, null, callerPage, false);
+ }
- /**
- * Constructeur (mode saisie de la manip suivante)
- * @param manip Manip d'extraction
- * @param callerPage Page appelante
- */
- public ManageExtractionPage(Extraction manip, CallerPage callerPage) {
- this(null, manip, callerPage, true);
- }
+ /**
+ * Constructeur (mode saisie de la manip suivante)
+ * @param manip Manip d'extraction
+ * @param callerPage Page appelante
+ */
+ public ManageExtractionPage(Extraction manip, CallerPage callerPage) {
+ this(null, manip, callerPage, true);
+ }
- /**
- * Constructeur. Si refManip et manip sont nuls, on créée une nouvelle manip d'extraction. Si refManip est
- * renseignée, on édite la manip correspondante. Si manip est renseigné, on créée une nouvelle manipulation à partir
- * des informations qu'elle contient.
- * @param idManip Id de la manip d'extraction
- * @param manip Manip d'extraction
- * @param callerPage Page appelante
- * @param multipleEntry Saisie multiple
- */
- private ManageExtractionPage(Integer idManip, Extraction manip, final CallerPage callerPage, boolean multipleEntry) {
- super(ManageExtractionPage.class);
- assert idManip == null || manip == null;
- this.callerPage = callerPage;
- this.multipleEntry = multipleEntry;
+ /**
+ * Constructeur. Si refManip et manip sont nuls, on créée une nouvelle manip d'extraction. Si refManip est
+ * renseignée, on édite la manip correspondante. Si manip est renseigné, on créée une nouvelle manipulation à partir
+ * des informations qu'elle contient.
+ * @param idManip Id de la manip d'extraction
+ * @param manip Manip d'extraction
+ * @param callerPage Page appelante
+ * @param multipleEntry Saisie multiple
+ */
+ private ManageExtractionPage(Integer idManip, Extraction manip, final CallerPage callerPage, boolean multipleEntry) {
+ super(ManageExtractionPage.class);
+ assert idManip == null || manip == null;
+ this.callerPage = callerPage;
+ this.multipleEntry = multipleEntry;
- extraitsDeleted = new HashMap<String, Integer>();
- newExtraitModel = new Model<Extrait>(new Extrait());
+ extraitsDeleted = new HashMap<String, Integer>();
+ newExtraitModel = new Model<Extrait>(new Extrait());
- // Initialisation du modèle
- try {
- extractionModel = new Model<Extraction>(idManip == null && manip == null ? new Extraction()
- : manip != null ? manip : extractionService.loadExtraction(idManip));
- } catch (DataNotFoundException e) {
- LOG.error(e.getMessage(), e);
- throw new UnexpectedException(e);
- }
+ // Initialisation du modèle
+ try {
+ extractionModel = new Model<Extraction>(idManip == null && manip == null ? new Extraction()
+ : manip != null ? manip : extractionService.loadExtraction(idManip));
+ } catch (DataNotFoundException e) {
+ LOG.error(e.getMessage(), e);
+ throw new UnexpectedException(e);
+ }
- createMode = idManip == null;
- if (createMode) {
- extractionModel.getObject().setCreateur(getSession().getUtilisateur());
- }
+ createMode = idManip == null;
+ if (createMode) {
+ extractionModel.getObject().setCreateur(getSession().getUtilisateur());
+ }
- // Initialisation des listes (pour le dropDownChoice)
- personnes = personneService.listPersonnes();
- methodes = extractionService.listMethodesExtraction();
- lots = lotService.listLots(getSession().getUtilisateur());
+ // Initialisation des listes (pour le dropDownChoice)
+ personnes = personneService.listPersonnes();
+ methodes = extractionService.listMethodesExtraction();
+ lots = lotService.listLots(getSession().getUtilisateur());
- if (manip != null) {
- // qd saisie multiple avec préremplissage, hack nécessaire afin d'avoir dans le model le même objet que
- // celui de la liste de choix (sinon comme les objets viennent de sessions hibernate différentes, on n'a pas
- // l'égalité entre les objets)
- extractionModel.getObject().setManipulateur(
- CollectionTools.findWithValue(personnes, "idPersonne", AccessType.GETTER, extractionModel
- .getObject().getManipulateur().getIdPersonne()));
- extractionModel.getObject().setMethode(
- CollectionTools.findWithValue(methodes, "idMethodeExtraction", AccessType.GETTER, extractionModel
- .getObject().getMethode().getIdMethodeExtraction()));
- }
+ if (manip != null) {
+ // qd saisie multiple avec préremplissage, hack nécessaire afin d'avoir dans le model le même objet que
+ // celui de la liste de choix (sinon comme les objets viennent de sessions hibernate différentes, on n'a pas
+ // l'égalité entre les objets)
+ extractionModel.getObject().setManipulateur(
+ CollectionTools.findWithValue(personnes, "idPersonne", AccessType.GETTER, extractionModel
+ .getObject().getManipulateur().getIdPersonne()));
+ extractionModel.getObject().setMethode(
+ CollectionTools.findWithValue(methodes, "idMethodeExtraction", AccessType.GETTER, extractionModel
+ .getObject().getMethode().getIdMethodeExtraction()));
+ }
- typesExtrait = new ArrayList<TypeExtrait>();
+ typesExtrait = new ArrayList<TypeExtrait>();
- // bind with markup
- final Form<Void> formView = new Form<Void>("Form");
+ // bind with markup
+ final Form<Void> formView = new Form<Void>("Form");
- initPrincipalFields(formView);
+ initPrincipalFields(formView);
- initMethodeFields(formView);
+ initMethodeFields(formView);
- initExtraitsFields(formView);
+ initExtraitsFields(formView);
- // Action : create the extraction
- Button createButton = new SubmittableButton(ACTION_CREATE, new SubmittableButtonEvents() {
- @Override
- public void onProcess() throws DataConstraintException {
- extractionService.createExtraction(extractionModel.getObject());
- }
+ // Action : create the extraction
+ Button createButton = new SubmittableButton(ACTION_CREATE, new SubmittableButtonEvents() {
+ @Override
+ public void onProcess() throws DataConstraintException {
+ extractionService.createExtraction(extractionModel.getObject());
+ }
- @Override
- public void onSuccess() {
- successNextPage(ACTION_CREATE);
- redirect();
- }
+ @Override
+ public void onSuccess() {
+ successNextPage(ACTION_CREATE);
+ redirect();
+ }
- @Override
- public void onValidate() {
- validateModel();
+ @Override
+ public void onValidate() {
+ validateModel();
- }
- });
- createButton.setVisibilityAllowed(createMode);
- formView.add(createButton);
+ }
+ });
+ createButton.setVisibilityAllowed(createMode);
+ formView.add(createButton);
- // Action : update the extraction
- Button updateButton = new SubmittableButton(ACTION_UPDATE, ManageExtractionPage.class,
- new SubmittableButtonEvents() {
- @Override
- public void onProcess() throws DataConstraintException {
- extractionService.updateExtraction(extractionModel.getObject());
- }
+ // Action : update the extraction
+ Button updateButton = new SubmittableButton(ACTION_UPDATE, ManageExtractionPage.class,
+ new SubmittableButtonEvents() {
+ @Override
+ public void onProcess() throws DataConstraintException {
+ extractionService.updateExtraction(extractionModel.getObject());
+ }
- @Override
- public void onSuccess() {
- successNextPage(ACTION_UPDATE);
- callerPage.responsePage((TemplatePage) getPage());
- }
+ @Override
+ public void onSuccess() {
+ successNextPage(ACTION_UPDATE);
+ callerPage.responsePage((TemplatePage) getPage());
+ }
- @Override
- public void onValidate() {
- validateModel();
- }
- });
- updateButton.setVisibilityAllowed(!createMode);
- formView.add(updateButton);
+ @Override
+ public void onValidate() {
+ validateModel();
+ }
+ });
+ updateButton.setVisibilityAllowed(!createMode);
+ formView.add(updateButton);
- // Action : suppression
- Button deleteButton = new SubmittableButton(ACTION_DELETE, new SubmittableButtonEvents() {
- @Override
- public void onProcess() throws DataConstraintException {
- extractionService.deleteExtraction(extractionModel.getObject());
- }
+ // Action : suppression
+ Button deleteButton = new SubmittableButton(ACTION_DELETE, new SubmittableButtonEvents() {
+ @Override
+ public void onProcess() throws DataConstraintException {
+ extractionService.deleteExtraction(extractionModel.getObject());
+ }
- @Override
- public void onSuccess() {
- successNextPage(ACTION_DELETE);
- callerPage.responsePage((TemplatePage) getPage());
- }
- });
- deleteButton.setVisibilityAllowed(!createMode);
- deleteButton.setDefaultFormProcessing(false);
- deleteButton.add(new JSConfirmationBehavior(getString("Confirm")));
- formView.add(deleteButton);
+ @Override
+ public void onSuccess() {
+ successNextPage(ACTION_DELETE);
+ callerPage.responsePage((TemplatePage) getPage());
+ }
+ });
+ deleteButton.setVisibilityAllowed(!createMode);
+ deleteButton.setDefaultFormProcessing(false);
+ deleteButton.add(new JSConfirmationBehavior(getString("Confirm")));
+ formView.add(deleteButton);
- formView.add(new Link<Void>("Cancel") {
- // Cas où le formulaire est annulé
- @Override
- public void onClick() {
- callerPage.responsePage((TemplatePage) getPage());
- }
- });
+ formView.add(new Link<Void>("Cancel") {
+ // Cas où le formulaire est annulé
+ @Override
+ public void onClick() {
+ callerPage.responsePage((TemplatePage) getPage());
+ }
+ });
- formView.setDefaultButton(addExtraitButton);
- add(formView);
- }
+ formView.setDefaultButton(addExtraitButton);
+ add(formView);
+ }
- /**
- * Initialise les champs principaux
- * @param formView le formulaire
- */
- private void initPrincipalFields(final Form<Void> formView) {
- formView.add(new TextField<String>("Extraction.ref", new PropertyModel<String>(extractionModel, "ref")));
+ /**
+ * Initialise les champs principaux
+ * @param formView le formulaire
+ */
+ private void initPrincipalFields(final Form<Void> formView) {
+ formView.add(new TextField<String>("Extraction.ref", new PropertyModel<String>(extractionModel, "ref")));
- DropDownChoice<Personne> pers = new DropDownChoice<Personne>("Extraction.manipulateur",
- new PropertyModel<Personne>(extractionModel, "manipulateur"), personnes, new PersonneRenderer());
- pers.setNullValid(false);
+ DropDownChoice<Personne> pers = new DropDownChoice<Personne>("Extraction.manipulateur",
+ new PropertyModel<Personne>(extractionModel, "manipulateur"), personnes, new PersonneRenderer());
+ pers.setNullValid(false);
- pers.setModelObject(extractionModel.getObject().getManipulateur());
- formView.add(pers);
- pers.getChoices().indexOf(pers.getModelObject());
- // Action : création d'une nouvelle personne
- // ajaxSubmitLink permet de sauvegarder l'état du formulaire
- formView.add(new AjaxSubmitLink("NewPersonne") {
- @Override
- protected void onSubmit(AjaxRequestTarget arg0, Form<?> arg1) {
- setResponsePage(new ManagePersonnePage(new CallerPage((TemplatePage) getPage()), false));
- }
+ pers.setModelObject(extractionModel.getObject().getManipulateur());
+ formView.add(pers);
+ pers.getChoices().indexOf(pers.getModelObject());
+ // Action : création d'une nouvelle personne
+ // ajaxSubmitLink permet de sauvegarder l'état du formulaire
+ formView.add(new AjaxSubmitLink("NewPersonne") {
+ @Override
+ protected void onSubmit(AjaxRequestTarget arg0, Form<?> arg1) {
+ setResponsePage(new ManagePersonnePage(new CallerPage((TemplatePage) getPage()), false));
+ }
- // si erreur, le formulaire est également enregistré puis la redirection effectuée
- @Override
- protected void onError(AjaxRequestTarget target, Form<?> form) {
- setResponsePage(new ManagePersonnePage(new CallerPage((TemplatePage) getPage()), false));
- }
- });
+ // si erreur, le formulaire est également enregistré puis la redirection effectuée
+ @Override
+ protected void onError(AjaxRequestTarget target, Form<?> form) {
+ setResponsePage(new ManagePersonnePage(new CallerPage((TemplatePage) getPage()), false));
+ }
+ });
- formView.add(new DateTextField("Extraction.date", new PropertyModel<Date>(extractionModel, "date"))
- .add(new DatePicker()));
+ formView.add(new DateTextField("Extraction.date", new PropertyModel<Date>(extractionModel, "date"))
+ .add(new DatePicker()));
- final AbstractSingleSelectChoice<Lot> lotsChoice = new DropDownChoice<Lot>("Extraction.lot",
- new PropertyModel<Lot>(extractionModel, "lot"), lots);
- lotsChoice.setNullValid(false);
- lotsChoice.setEnabled(createMode);
- lotsChoice.add(new AjaxFormComponentUpdatingBehavior("onchange") {
- protected void onUpdate(AjaxRequestTarget target) {
- updateRefExtrait(target);
- }
- });
- formView.add(lotsChoice);
+ final AbstractSingleSelectChoice<Lot> lotsChoice = new DropDownChoice<Lot>("Extraction.lot",
+ new PropertyModel<Lot>(extractionModel, "lot"), lots);
+ lotsChoice.setNullValid(false);
+ lotsChoice.setEnabled(createMode);
+ lotsChoice.add(new AjaxFormComponentUpdatingBehavior("onchange") {
+ protected void onUpdate(AjaxRequestTarget target) {
+ updateRefExtrait(target);
+ }
+ });
+ formView.add(lotsChoice);
- // Action : création d'un nouveau lot
- // ajaxSubmitLink permet de sauvegarder l'état du formulaire
- AbstractLink newLot = new AjaxSubmitLink("NewLot") {
- @Override
- protected void onSubmit(AjaxRequestTarget arg0, Form<?> arg1) {
- setResponsePage(new ManageLotPage(new CallerPage((TemplatePage) getPage()), false));
- }
+ // Action : création d'un nouveau lot
+ // ajaxSubmitLink permet de sauvegarder l'état du formulaire
+ AbstractLink newLot = new AjaxSubmitLink("NewLot") {
+ @Override
+ protected void onSubmit(AjaxRequestTarget arg0, Form<?> arg1) {
+ setResponsePage(new ManageLotPage(new CallerPage((TemplatePage) getPage()), false));
+ }
- // si erreur, le formulaire est également enregistré puis la redirection effectuée
- @Override
- protected void onError(AjaxRequestTarget target, Form<?> form) {
- setResponsePage(new ManageLotPage(new CallerPage((TemplatePage) getPage()), false));
- }
- };
- newLot.setOutputMarkupPlaceholderTag(true);
- newLot.setVisibilityAllowed(createMode);
- formView.add(newLot);
+ // si erreur, le formulaire est également enregistré puis la redirection effectuée
+ @Override
+ protected void onError(AjaxRequestTarget target, Form<?> form) {
+ setResponsePage(new ManageLotPage(new CallerPage((TemplatePage) getPage()), false));
+ }
+ };
+ newLot.setOutputMarkupPlaceholderTag(true);
+ newLot.setVisibilityAllowed(createMode);
+ formView.add(newLot);
- TextField<BigDecimal> masseDepartInput = new TextField<BigDecimal>("Extraction.masseDepart",
- new PropertyModel<BigDecimal>(extractionModel, "masseDepart"));
- masseDepartInput.add(new AjaxFormComponentUpdatingBehavior("onchange") {
- protected void onUpdate(AjaxRequestTarget target) {
- };
- });
- formView.add(masseDepartInput);
+ TextField<BigDecimal> masseDepartInput = new TextField<BigDecimal>("Extraction.masseDepart",
+ new PropertyModel<BigDecimal>(extractionModel, "masseDepart"));
+ masseDepartInput.add(new AjaxFormComponentUpdatingBehavior("onchange") {
+ protected void onUpdate(AjaxRequestTarget target) {
+ };
+ });
+ formView.add(masseDepartInput);
- formView.add(new TextArea<String>("Extraction.complement", new PropertyModel<String>(extractionModel,
- "complement")));
- // Créateur en lecture seule
- formView.add(new TextField<String>("Extraction.createur",
- new PropertyModel<String>(extractionModel, "createur")).setEnabled(false));
- }
+ formView.add(new TextArea<String>("Extraction.complement", new PropertyModel<String>(extractionModel,
+ "complement")));
+ // Créateur en lecture seule
+ formView.add(new TextField<String>("Extraction.createur",
+ new PropertyModel<String>(extractionModel, "createur")).setEnabled(false));
+ }
- /**
- * Initialise les champs relatifs à la méthode
- * @param formView le formulaire
- */
- private void initMethodeFields(final Form<Void> formView) {
- // Champs méthode
+ /**
+ * Initialise les champs relatifs à la méthode
+ * @param formView le formulaire
+ */
+ private void initMethodeFields(final Form<Void> formView) {
+ // Champs méthode
- final WebMarkupContainer descriptionMethoContainer = new WebMarkupContainer("TestBio.descriptionMethodeCont") {
- @Override
- public boolean isVisible() {
- // description cachée si pas de méthode sélectionnée
- return extractionModel.getObject().getMethode() != null;
- }
- };
- descriptionMethoContainer.setOutputMarkupId(true); // pour l'update Ajax
- descriptionMethoContainer.setOutputMarkupPlaceholderTag(true); // pour accéder à l'élement html qd son état est
- // non visible
- formView.add(descriptionMethoContainer);
+ final WebMarkupContainer descriptionMethoContainer = new WebMarkupContainer("TestBio.descriptionMethodeCont") {
+ @Override
+ public boolean isVisible() {
+ // description cachée si pas de méthode sélectionnée
+ return extractionModel.getObject().getMethode() != null;
+ }
+ };
+ descriptionMethoContainer.setOutputMarkupId(true); // pour l'update Ajax
+ descriptionMethoContainer.setOutputMarkupPlaceholderTag(true); // pour accéder à l'élement html qd son état est
+ // non visible
+ formView.add(descriptionMethoContainer);
- descriptionMethoContainer.add(new MultiLineLabel("Extraction.methode.description", new PropertyModel<String>(
- extractionModel, "methode.description")));
+ descriptionMethoContainer.add(new MultiLineLabel("Extraction.methode.description", new PropertyModel<String>(
+ extractionModel, "methode.description")));
- final DropDownChoice<MethodeExtraction> methodeChoice = new DropDownChoice<MethodeExtraction>(
- "Extraction.methode.nom", new PropertyModel<MethodeExtraction>(extractionModel, "methode"), methodes);
- methodeChoice.setNullValid(false);
- methodeChoice.setOutputMarkupId(true); // pour l'update Ajax
- // mise à jour de la description de la méthode et des extraits lors de la sélection de la méthode
- methodeChoice.add(new AjaxFormComponentUpdatingBehavior("onchange") {
- protected void onUpdate(AjaxRequestTarget target) {
- extractionModel.getObject().getExtraits().clear();
- // maj de la liste des typesExtraits suivant la sélection
- typesExtrait.clear();
- if (extractionModel.getObject().getMethode() != null) {
- // rafraichi la méthode pour pouvoir accéder aux types en sortie accédés en LAZY
- extractionService.refreshMethodeExtraction(extractionModel.getObject().getMethode());
- typesExtrait.addAll(extractionModel.getObject().getMethode().getSortedTypesEnSortie());
- }
- // mise à jour de typesExtrait
- updateTypesExtrait(true, target);
+ final DropDownChoice<MethodeExtraction> methodeChoice = new DropDownChoice<MethodeExtraction>(
+ "Extraction.methode.nom", new PropertyModel<MethodeExtraction>(extractionModel, "methode"), methodes);
+ methodeChoice.setNullValid(false);
+ methodeChoice.setOutputMarkupId(true); // pour l'update Ajax
+ // mise à jour de la description de la méthode et des extraits lors de la sélection de la méthode
+ methodeChoice.add(new AjaxFormComponentUpdatingBehavior("onchange") {
+ protected void onUpdate(AjaxRequestTarget target) {
+ extractionModel.getObject().getExtraits().clear();
+ // maj de la liste des typesExtraits suivant la sélection
+ typesExtrait.clear();
+ if (extractionModel.getObject().getMethode() != null) {
+ // rafraichi la méthode pour pouvoir accéder aux types en sortie accédés en LAZY
+ extractionService.refreshMethodeExtraction(extractionModel.getObject().getMethode());
+ typesExtrait.addAll(extractionModel.getObject().getMethode().getSortedTypesEnSortie());
+ }
+ // mise à jour de typesExtrait
+ updateTypesExtrait(true, target);
- target.add(methodeChoice, descriptionMethoContainer);
- }
- });
- formView.add(methodeChoice);
- }
+ target.add(methodeChoice, descriptionMethoContainer);
+ }
+ });
+ formView.add(methodeChoice);
+ }
- /**
- * Initialise les champs relatifs aux extraits
- * @param formView le formulaire
- */
- private void initExtraitsFields(final Form<Void> formView) {
+ /**
+ * Initialise les champs relatifs aux extraits
+ * @param formView le formulaire
+ */
+ private void initExtraitsFields(final Form<Void> formView) {
- extraitsTable = new WebMarkupContainer("Extraction.extraits.Table");
- // Contenu tableaux extrait
- // Liste des types extraits ajoutés (pour raffraichissements)
- extraitsTable.add(new ListView<Extrait>("Extraction.extraits.List", new PropertyModel<List<Extrait>>(
- extractionModel, "sortedExtraits")) {
- @Override
- protected void populateItem(ListItem<Extrait> item) {
- if (item.getIndex() % 2 == 1) {
- item.add(new AttributeModifier("class", item.getIndex() % 2 == 0 ? "even" : "odd"));
- }
+ extraitsTable = new WebMarkupContainer("Extraction.extraits.Table");
+ // Contenu tableaux extrait
+ // Liste des types extraits ajoutés (pour raffraichissements)
+ extraitsTable.add(new ListView<Extrait>("Extraction.extraits.List", new PropertyModel<List<Extrait>>(
+ extractionModel, "sortedExtraits")) {
+ @Override
+ protected void populateItem(ListItem<Extrait> item) {
+ if (item.getIndex() % 2 == 1) {
+ item.add(new AttributeModifier("class", item.getIndex() % 2 == 0 ? "even" : "odd"));
+ }
- IModel<Extrait> extraitModel = item.getModel();
- final Extrait extrait = item.getModelObject();
- // Colonnes
- item.add(new Label("Extraction.extraits.List.typeExtrait", new PropertyModel<String>(extrait,
- "typeExtrait")));
- // info-bulle comprenant la description du type d'extrait
- item.add(new SimpleTooltipPanel("Extraction.extraits.List.typeExtrait.info", new PropertyModel<String>(
- extrait, "typeExtrait.description")));
- item.add(new Label("Extraction.extraits.List.ref", new PropertyModel<String>(extrait, "ref")));
- item.add(new Label("Extraction.extraits.List.masseObtenue", new PropertyModel<String>(extrait,
- "masseObtenue")));
+ IModel<Extrait> extraitModel = item.getModel();
+ final Extrait extrait = item.getModelObject();
+ // Colonnes
+ item.add(new Label("Extraction.extraits.List.typeExtrait", new PropertyModel<String>(extrait,
+ "typeExtrait")));
+ // info-bulle comprenant la description du type d'extrait
+ item.add(new SimpleTooltipPanel("Extraction.extraits.List.typeExtrait.info", new PropertyModel<String>(
+ extrait, "typeExtrait.description")));
+ item.add(new Label("Extraction.extraits.List.ref", new PropertyModel<String>(extrait, "ref")));
+ item.add(new Label("Extraction.extraits.List.masseObtenue", new PropertyModel<String>(extrait,
+ "masseObtenue")));
- item.add(new Label("Extraction.extraits.List.rendement", new DisplayPercentPropertyModel(extraitModel,
- "rendement", getLocale())).add(new ReplaceEmptyLabelBehavior()));
+ item.add(new Label("Extraction.extraits.List.rendement", new DisplayPercentPropertyModel(extraitModel,
+ "rendement", getLocale())).add(new ReplaceEmptyLabelBehavior()));
- // Action : suppression d'un extrait
- Button deleteButton = new AjaxFallbackButton("Extraction.extraits.List.Delete", formView) {
- @Override
- protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
- // vérification si des données liées existe
- if (produitService.isProduitReferenced(extrait)) {
- getPage().error(getString("Extrait.isReferenced"));
- } else {
- // Suppression
- extractionModel.getObject().getExtraits().remove(extrait);
- // keep the id of the deleted 'extrait' for the case of a new one with the same 'ref'
- extraitsDeleted.put(extrait.getRef(), extrait.getId());
+ // Action : suppression d'un extrait
+ Button deleteButton = new AjaxFallbackButton("Extraction.extraits.List.Delete", formView) {
+ @Override
+ protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
+ // vérification si des données liées existe
+ if (produitService.isProduitReferenced(extrait)) {
+ getPage().error(getString("Extrait.isReferenced"));
+ } else {
+ // Suppression
+ extractionModel.getObject().getExtraits().remove(extrait);
+ // keep the id of the deleted 'extrait' for the case of a new one with the same 'ref'
+ extraitsDeleted.put(extrait.getRef(), extrait.getId());
- // mise à jour de l'extrait
- updateTypesExtrait(false, target);
- }
- if (target != null) {
- target.add(extraitsTable);
- refreshFeedbackPage(target);
- }
- }
+ // mise à jour de l'extrait
+ updateTypesExtrait(false, target);
+ }
+ if (target != null) {
+ target.add(extraitsTable);
+ refreshFeedbackPage(target);
+ }
+ }
- @Override
- protected void onError(AjaxRequestTarget target, Form<?> form) {
- // never called
- }
+ @Override
+ protected void onError(AjaxRequestTarget target, Form<?> form) {
+ // never called
+ }
- };
- deleteButton.setDefaultFormProcessing(false);
- item.add(deleteButton);
- }
- });
- extraitsTable.setOutputMarkupId(true);
+ };
+ deleteButton.setDefaultFormProcessing(false);
+ item.add(deleteButton);
+ }
+ });
+ extraitsTable.setOutputMarkupId(true);
- typeExtraitInput = new DropDownChoice<TypeExtrait>("Extraction.extraits.typeExtrait",
- new PropertyModel<TypeExtrait>(newExtraitModel, "typeExtrait"), typesExtrait).setNullValid(false);
- // info-bulle comprenant la description du type d'extrait
- typeExtraitTooltip = new SimpleTooltipPanel("Extraction.extraits.typeExtrait.info", new PropertyModel<String>(
- newExtraitModel, "typeExtrait.description"));
- // permet la mise en visibité ou non en Ajax
- typeExtraitTooltip.setOutputMarkupId(true);
- typeExtraitTooltip.setOutputMarkupPlaceholderTag(true);
- extraitsTable.add(typeExtraitTooltip);
+ typeExtraitInput = new DropDownChoice<TypeExtrait>("Extraction.extraits.typeExtrait",
+ new PropertyModel<TypeExtrait>(newExtraitModel, "typeExtrait"), typesExtrait).setNullValid(false);
+ // info-bulle comprenant la description du type d'extrait
+ typeExtraitTooltip = new SimpleTooltipPanel("Extraction.extraits.typeExtrait.info", new PropertyModel<String>(
+ newExtraitModel, "typeExtrait.description"));
+ // permet la mise en visibité ou non en Ajax
+ typeExtraitTooltip.setOutputMarkupId(true);
+ typeExtraitTooltip.setOutputMarkupPlaceholderTag(true);
+ extraitsTable.add(typeExtraitTooltip);
- typeExtraitInput.add(new AjaxFormComponentUpdatingBehavior("onchange") {
- protected void onUpdate(AjaxRequestTarget target) {
- updateRefExtrait(target);
- target.add(typeExtraitTooltip);
- }
- });
- extraitsTable.add(typeExtraitInput);
+ typeExtraitInput.add(new AjaxFormComponentUpdatingBehavior("onchange") {
+ protected void onUpdate(AjaxRequestTarget target) {
+ updateRefExtrait(target);
+ target.add(typeExtraitTooltip);
+ }
+ });
+ extraitsTable.add(typeExtraitInput);
- refInput = new TextField<String>("Extraction.extraits.ref", new PropertyModel<String>(newExtraitModel, "ref"));
- refInput.setOutputMarkupId(true);
- extraitsTable.add(refInput);
+ refInput = new TextField<String>("Extraction.extraits.ref", new PropertyModel<String>(newExtraitModel, "ref"));
+ refInput.setOutputMarkupId(true);
+ extraitsTable.add(refInput);
- masseObtenueInput = new TextField<BigDecimal>("Extraction.extraits.masseObtenue",
- new PropertyModel<BigDecimal>(newExtraitModel, "masseObtenue"));
- masseObtenueInput.setOutputMarkupId(true);
- extraitsTable.add(masseObtenueInput);
+ masseObtenueInput = new TextField<BigDecimal>("Extraction.extraits.masseObtenue",
+ new PropertyModel<BigDecimal>(newExtraitModel, "masseObtenue"));
+ masseObtenueInput.setOutputMarkupId(true);
+ extraitsTable.add(masseObtenueInput);
- // Bouton AJAX pour ajouter un extrait
- addExtraitButton = new AjaxFallbackButton("Extraction.extraits.Add", formView) {
- @Override
- protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
- try {
- // normalisation de l'extrait
- newExtraitModel.getObject().setRef(
- Normalizer.normalize(UniqueFieldNormalizer.class, newExtraitModel.getObject().getRef()));
- // Ajout du type extrait
- newExtraitModel.getObject().setExtraction(extractionModel.getObject());
- // recuperate the id if an just deleted type, null otherwise
- newExtraitModel.getObject().setId(extraitsDeleted.get(newExtraitModel.getObject().getRef()));
+ // Bouton AJAX pour ajouter un extrait
+ addExtraitButton = new AjaxFallbackButton("Extraction.extraits.Add", formView) {
+ @Override
+ protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
+ try {
+ // normalisation de l'extrait
+ newExtraitModel.getObject().setRef(
+ Normalizer.normalize(UniqueFieldNormalizer.class, newExtraitModel.getObject().getRef()));
+ // Ajout du type extrait
+ newExtraitModel.getObject().setExtraction(extractionModel.getObject());
+ // recuperate the id if an just deleted type, null otherwise
+ newExtraitModel.getObject().setId(extraitsDeleted.get(newExtraitModel.getObject().getRef()));
- // ajout à la liste
- Extrait extraitAdded = newExtraitModel.getObject().clone();
- extractionModel.getObject().getExtraits().add(extraitAdded);
+ // ajout à la liste
+ Extrait extraitAdded = newExtraitModel.getObject().clone();
+ extractionModel.getObject().getExtraits().add(extraitAdded);
- List<String> errors = validator.validate(newExtraitModel.getObject(), getSession().getLocale());
- // test si unicité dans la base
- // erreur si non unique dans la base ET extrait de même réf non supprimé de la liste (dans ce
- // dernier cas, ajout avec son ancien id) ET non pris en compte par la validation de
- // CollectionUniqueFieldValidator
- if (!extractionService.isExtraitUnique(extraitAdded)
- && extraitAdded.getRef() != null
- && extraitsDeleted.get(extraitAdded.getRef()) == null
- && CollectionTools.countWithValue(extraitAdded.getExtraction().getExtraits(), "ref",
- AccessType.GETTER, extraitAdded.getRef()) == 1) {
- errors.add(getString("Extrait.notUnique"));
- }
+ List<String> errors = validator.validate(newExtraitModel.getObject(), getSession().getLocale());
+ // test si unicité dans la base
+ // erreur si non unique dans la base ET extrait de même réf non supprimé de la liste (dans ce
+ // dernier cas, ajout avec son ancien id) ET non pris en compte par la validation de
+ // CollectionUniqueFieldValidator
+ if (!extractionService.isExtraitUnique(extraitAdded)
+ && extraitAdded.getRef() != null
+ && extraitsDeleted.get(extraitAdded.getRef()) == null
+ && CollectionTools.countWithValue(extraitAdded.getExtraction().getExtraits(), "ref",
+ AccessType.GETTER, extraitAdded.getRef()) == 1) {
+ errors.add(getString("Extrait.notUnique"));
+ }
- if (errors.isEmpty()) {
- // réinit du champ ajout
- newExtraitModel.getObject().setRef(null);
- newExtraitModel.getObject().setMasseObtenue(null);
+ if (errors.isEmpty()) {
+ // réinit du champ ajout
+ newExtraitModel.getObject().setRef(null);
+ newExtraitModel.getObject().setMasseObtenue(null);
- // mise à jour de typesExtrait
- updateTypesExtrait(true, target);
- } else {
- extractionModel.getObject().getExtraits().remove(extraitAdded);
- addValidationErrors(errors);
- }
- } catch (CloneNotSupportedException e) {
- LOG.error(e.getMessage(), e);
- throw new UnexpectedException(e);
- }
+ // mise à jour de typesExtrait
+ updateTypesExtrait(true, target);
+ } else {
+ extractionModel.getObject().getExtraits().remove(extraitAdded);
+ addValidationErrors(errors);
+ }
+ } catch (CloneNotSupportedException e) {
+ LOG.error(e.getMessage(), e);
+ throw new UnexpectedException(e);
+ }
- if (target != null) {
- target.add(extraitsTable);
- refreshFeedbackPage(target);
- }
- }
+ if (target != null) {
+ target.add(extraitsTable);
+ refreshFeedbackPage(target);
+ }
+ }
- @Override
- protected void onError(AjaxRequestTarget target, Form<?> form) {
- refreshFeedbackPage(target);
- }
+ @Override
+ protected void onError(AjaxRequestTarget target, Form<?> form) {
+ refreshFeedbackPage(target);
+ }
- };
- addExtraitButton.setOutputMarkupId(true);
- extraitsTable.add(addExtraitButton);
+ };
+ addExtraitButton.setOutputMarkupId(true);
+ extraitsTable.add(addExtraitButton);
- formView.add(extraitsTable);
- updateTypesExtrait(true, null);
- }
+ formView.add(extraitsTable);
+ updateTypesExtrait(true, null);
+ }
- /** {@inheritDoc} */
- @Override
- protected void onBeforeRender() {
- // On rafraichit le modèle lorsque la page est rechargée (par exemple après l'ajout d'une nouvelle entité
- // Personne ou Lot)
- refreshModel();
- super.onBeforeRender();
- }
+ /** {@inheritDoc} */
+ @Override
+ protected void onBeforeRender() {
+ // On rafraichit le modèle lorsque la page est rechargée (par exemple après l'ajout d'une nouvelle entité
+ // Personne ou Lot)
+ refreshModel();
+ super.onBeforeRender();
+ }
- /**
- * Redirection vers une autre page. Cas où le formulaire est validé
- */
- private void redirect() {
- if (multipleEntry) {
- // Redirection de nouveau vers l'écran de saisie d'une nouvelle extraction
- Extraction nextManip = new Extraction();
- nextManip.setManipulateur(extractionModel.getObject().getManipulateur());
- nextManip.setMethode(extractionModel.getObject().getMethode());
- nextManip.setMasseDepart(extractionModel.getObject().getMasseDepart());
- setResponsePage(new ManageExtractionPage(nextManip, callerPage));
- } else if (callerPage != null) {
- // On passe l'id de l'extraction associée à cette page, en paramètre de la prochaine page, pour lui
- // permettre de
- // l'exploiter si besoin
- callerPage
- .addPageParameter(Extraction.class.getSimpleName(), extractionModel.getObject().getIdExtraction());
- callerPage.responsePage(this);
- }
- }
+ /**
+ * Redirection vers une autre page. Cas où le formulaire est validé
+ */
+ private void redirect() {
+ if (multipleEntry) {
+ // Redirection de nouveau vers l'écran de saisie d'une nouvelle extraction
+ Extraction nextManip = new Extraction();
+ nextManip.setManipulateur(extractionModel.getObject().getManipulateur());
+ nextManip.setMethode(extractionModel.getObject().getMethode());
+ nextManip.setMasseDepart(extractionModel.getObject().getMasseDepart());
+ setResponsePage(new ManageExtractionPage(nextManip, callerPage));
+ } else if (callerPage != null) {
+ // On passe l'id de l'extraction associée à cette page, en paramètre de la prochaine page, pour lui
+ // permettre de
+ // l'exploiter si besoin
+ callerPage
+ .addPageParameter(Extraction.class.getSimpleName(), extractionModel.getObject().getIdExtraction());
+ callerPage.responsePage(this);
+ }
+ }
- /**
- * Refresh model, appelé au rechargement de la page
- */
- private void refreshModel() {
- // Récupère (et supprime) les éventuels nouveaux objets créés dans les paramètres de la page.
- String key = Personne.class.getSimpleName();
- if (getPageParameters().getNamedKeys().contains(key)) {
- CollectionTools.setter(personnes, personneService.listPersonnes());
- try {
- Personne createdPersonne = personneService.loadPersonne(getPageParameters().get(key).toInt());
- extractionModel.getObject().setManipulateur(createdPersonne);
- } catch (StringValueConversionException e) {
- LOG.error(e.getMessage(), e);
- throw new UnexpectedException(e);
- } catch (DataNotFoundException e) {
- LOG.error(e.getMessage(), e);
- throw new UnexpectedException(e);
- }
- getPageParameters().remove(key);
- }
+ /**
+ * Refresh model, appelé au rechargement de la page
+ */
+ private void refreshModel() {
+ // Récupère (et supprime) les éventuels nouveaux objets créés dans les paramètres de la page.
+ String key = Personne.class.getSimpleName();
+ if (getPageParameters().getNamedKeys().contains(key)) {
+ CollectionTools.setter(personnes, personneService.listPersonnes());
+ try {
+ Personne createdPersonne = personneService.loadPersonne(getPageParameters().get(key).toInt());
+ extractionModel.getObject().setManipulateur(createdPersonne);
+ } catch (StringValueConversionException e) {
+ LOG.error(e.getMessage(), e);
+ throw new UnexpectedException(e);
+ } catch (DataNotFoundException e) {
+ LOG.error(e.getMessage(), e);
+ throw new UnexpectedException(e);
+ }
+ getPageParameters().remove(key);
+ }
- key = Lot.class.getSimpleName();
- if (getPageParameters().getNamedKeys().contains(key)) {
- CollectionTools.setter(lots, lotService.listLots(getSession().getUtilisateur()));
- try {
- Lot createdLot = lotService.loadLot(getPageParameters().get(key).toInt());
- extractionModel.getObject().setLot(createdLot);
- } catch (StringValueConversionException e) {
- LOG.error(e.getMessage(), e);
- throw new UnexpectedException(e);
- } catch (DataNotFoundException e) {
- LOG.error(e.getMessage(), e);
- throw new UnexpectedException(e);
- }
- getPageParameters().remove(key);
- }
+ key = Lot.class.getSimpleName();
+ if (getPageParameters().getNamedKeys().contains(key)) {
+ CollectionTools.setter(lots, lotService.listLots(getSession().getUtilisateur()));
+ try {
+ Lot createdLot = lotService.loadLot(getPageParameters().get(key).toInt());
+ extractionModel.getObject().setLot(createdLot);
+ } catch (StringValueConversionException e) {
+ LOG.error(e.getMessage(), e);
+ throw new UnexpectedException(e);
+ } catch (DataNotFoundException e) {
+ LOG.error(e.getMessage(), e);
+ throw new UnexpectedException(e);
+ }
+ getPageParameters().remove(key);
+ }
- // mise à jour du champ réf d'un nouvel extrait au cas où retour sur le formulaire avec un nouveau lot
- // sélectionné
- updateRefExtrait(null);
- }
+ // mise à jour du champ réf d'un nouvel extrait au cas où retour sur le formulaire avec un nouveau lot
+ // sélectionné
+ updateRefExtrait(null);
+ }
- /**
- * Update the extrait reference with an auto-generated value (ref and typeExtrait concatenated)
- * @param target An AjaxRequestTarget, null if not a ajax request
- */
- private void updateRefExtrait(AjaxRequestTarget target) {
- if (extractionModel.getObject().getLot() != null && newExtraitModel.getObject().getTypeExtrait() != null) {
- // met à jour la réf de l'extrait suivant celle du lot et le type d'extrait
- newExtraitModel.getObject().setRef(
- String.format(PATTERN_REF_EXTRAIT, extractionModel.getObject().getLot().getRef(), newExtraitModel
- .getObject().getTypeExtrait().getInitiales()));
- if (target != null) {
- target.add(refInput);
- }
- }
- }
+ /**
+ * Update the extrait reference with an auto-generated value (ref and typeExtrait concatenated)
+ * @param target An AjaxRequestTarget, null if not a ajax request
+ */
+ private void updateRefExtrait(AjaxRequestTarget target) {
+ if (extractionModel.getObject().getLot() != null && newExtraitModel.getObject().getTypeExtrait() != null) {
+ // met à jour la réf de l'extrait suivant celle du lot et le type d'extrait
+ newExtraitModel.getObject().setRef(
+ String.format(PATTERN_REF_EXTRAIT, extractionModel.getObject().getLot().getRef(), newExtraitModel
+ .getObject().getTypeExtrait().getInitiales()));
+ if (target != null) {
+ target.add(refInput);
+ }
+ }
+ }
- /**
- * Met à jour la liste des types extrait (suivant la méthode et les extraits déjà saisis)
- * @param target An AjaxRequestTarget, null if not a ajax request
- * @param selectFirstTypeExtrait If the first element of the TypeExtraits combobox need to be selected
- */
- private void updateTypesExtrait(boolean selectFirstTypeExtrait, AjaxRequestTarget target) {
- if (extractionModel.getObject().getMethode() != null) {
- CollectionTools.setter(typesExtrait, extractionModel.getObject().getMethode().getSortedTypesEnSortie());
- for (Extrait curExtrait : extractionModel.getObject().getExtraits()) {
- typesExtrait.remove(curExtrait.getTypeExtrait());
- }
- }
- configureExtraitInputs();
+ /**
+ * Met à jour la liste des types extrait (suivant la méthode et les extraits déjà saisis)
+ * @param target An AjaxRequestTarget, null if not a ajax request
+ * @param selectFirstTypeExtrait If the first element of the TypeExtraits combobox need to be selected
+ */
+ private void updateTypesExtrait(boolean selectFirstTypeExtrait, AjaxRequestTarget target) {
+ if (extractionModel.getObject().getMethode() != null) {
+ CollectionTools.setter(typesExtrait, extractionModel.getObject().getMethode().getSortedTypesEnSortie());
+ for (Extrait curExtrait : extractionModel.getObject().getExtraits()) {
+ typesExtrait.remove(curExtrait.getTypeExtrait());
+ }
+ }
+ configureExtraitInputs();
- if (selectFirstTypeExtrait) {
- // Si liste des types extraits non vide, sélection du premier élement
- newExtraitModel.getObject().setTypeExtrait(
- typeExtraitInput.getChoices().isEmpty() ? null : typeExtraitInput.getChoices().get(0));
- }
+ if (selectFirstTypeExtrait) {
+ // Si liste des types extraits non vide, sélection du premier élement
+ newExtraitModel.getObject().setTypeExtrait(
+ typeExtraitInput.getChoices().isEmpty() ? null : typeExtraitInput.getChoices().get(0));
+ }
- updateRefExtrait(target);
+ updateRefExtrait(target);
- if (target != null) {
- target.add(typeExtraitInput, typeExtraitTooltip, refInput, masseObtenueInput, addExtraitButton);
- }
- }
+ if (target != null) {
+ target.add(typeExtraitInput, typeExtraitTooltip, refInput, masseObtenueInput, addExtraitButton);
+ }
+ }
- /**
- * Configure les composants pour la saisie d'extraits
- */
- private void configureExtraitInputs() {
- // désactivation de la saisie d'un extrait si pas de méthode ou si déjà un extrait par type d'extrait
- if (extractionModel.getObject().getMethode() == null
- || extractionModel.getObject().getExtraits() != null
- && extractionModel.getObject().getExtraits().size() == extractionModel.getObject().getMethode()
- .getTypesEnSortie().size()) {
- disableExtraitAdding();
- } else {
- enableExtraitAdding();
- }
- }
+ /**
+ * Configure les composants pour la saisie d'extraits
+ */
+ private void configureExtraitInputs() {
+ // désactivation de la saisie d'un extrait si pas de méthode ou si déjà un extrait par type d'extrait
+ if (extractionModel.getObject().getMethode() == null
+ || extractionModel.getObject().getExtraits() != null
+ && extractionModel.getObject().getExtraits().size() == extractionModel.getObject().getMethode()
+ .getTypesEnSortie().size()) {
+ disableExtraitAdding();
+ } else {
+ enableExtraitAdding();
+ }
+ }
- /**
- * Active la saisie pour ajouter un nouvel extrait
- */
- private void enableExtraitAdding() {
- typeExtraitInput.setEnabled(true);
- typeExtraitTooltip.setVisibilityAllowed(true);
- refInput.setEnabled(true);
- masseObtenueInput.setEnabled(true);
- addExtraitButton.setEnabled(true);
- }
+ /**
+ * Active la saisie pour ajouter un nouvel extrait
+ */
+ private void enableExtraitAdding() {
+ typeExtraitInput.setEnabled(true);
+ typeExtraitTooltip.setVisibilityAllowed(true);
+ refInput.setEnabled(true);
+ masseObtenueInput.setEnabled(true);
+ addExtraitButton.setEnabled(true);
+ }
- /**
- * Désactive la saisie pour ajouter un nouvel extrait
- */
- private void disableExtraitAdding() {
- typeExtraitInput.setEnabled(false);
- typeExtraitTooltip.setVisibilityAllowed(false);
- refInput.setEnabled(false);
- masseObtenueInput.setEnabled(false);
- addExtraitButton.setEnabled(false);
- }
+ /**
+ * Désactive la saisie pour ajouter un nouvel extrait
+ */
+ private void disableExtraitAdding() {
+ typeExtraitInput.setEnabled(false);
+ typeExtraitTooltip.setVisibilityAllowed(false);
+ refInput.setEnabled(false);
+ masseObtenueInput.setEnabled(false);
+ addExtraitButton.setEnabled(false);
+ }
- /**
- * Validate model
- */
- private void validateModel() {
- addValidationErrors(validator.validate(extractionModel.getObject(), getSession().getLocale()));
- if (!extractionService.isExtractionUnique(extractionModel.getObject())) {
- error(getString("Extraction.notUnique"));
- }
- }
+ /**
+ * Validate model
+ */
+ private void validateModel() {
+ addValidationErrors(validator.validate(extractionModel.getObject(), getSession().getLocale()));
+ if (!extractionService.isExtractionUnique(extractionModel.getObject())) {
+ error(getString("Extraction.notUnique"));
+ }
+ }
}
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/extraction/ReadExtractionPage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/extraction/ReadExtractionPage.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/extraction/ReadExtractionPage.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -68,171 +68,171 @@
*/
public final class ReadExtractionPage extends TemplatePage {
- /** Action : delete */
- public static final String ACTION_DELETE = "Delete";
+ /** Action : delete */
+ public static final String ACTION_DELETE = "Delete";
- /** Logger */
- // private static final Log LOG = LogTools.getLog();
- /** extraction Model */
- private final IModel<Extraction> extractionModel;
+ /** Logger */
+ // private static final Log LOG = LogTools.getLog();
+ /** extraction Model */
+ private final IModel<Extraction> extractionModel;
- /** Service : extraits */
- @SpringBean
- private ExtractionService extractionService;
+ /** Service : extraits */
+ @SpringBean
+ private ExtractionService extractionService;
- /** Page appelante */
- private final CallerPage callerPage;
+ /** Page appelante */
+ private final CallerPage callerPage;
- /** Container contenant la liste des extraits */
- private MarkupContainer extraitsTable;
+ /** Container contenant la liste des extraits */
+ private MarkupContainer extraitsTable;
- /**
- * Constructeur
- * @param idExtraction identifiant de la manip
- * @param callerPage Page appelante
- */
- public ReadExtractionPage(Integer idExtraction, final CallerPage callerPage) {
- super(ReadExtractionPage.class);
- this.callerPage = callerPage;
- final CallerPage currentPage = new CallerPage((TemplatePage) getPage());
+ /**
+ * Constructeur
+ * @param idExtraction identifiant de la manip
+ * @param callerPage Page appelante
+ */
+ public ReadExtractionPage(Integer idExtraction, final CallerPage callerPage) {
+ super(ReadExtractionPage.class);
+ this.callerPage = callerPage;
+ final CallerPage currentPage = new CallerPage((TemplatePage) getPage());
- // Initialisation du modèle
- extractionModel = new GenericLoadableDetachableModel<Extraction>(Extraction.class, idExtraction);
+ // Initialisation du modèle
+ extractionModel = new GenericLoadableDetachableModel<Extraction>(Extraction.class, idExtraction);
- add(new Label("Extraction.ref", new PropertyModel<String>(extractionModel, "ref"))
- .add(new ReplaceEmptyLabelBehavior()));
+ add(new Label("Extraction.ref", new PropertyModel<String>(extractionModel, "ref"))
+ .add(new ReplaceEmptyLabelBehavior()));
- add(new PropertyLabelLinkPanel<Personne>("Extraction.manipulateur", new PropertyModel<Personne>(
- extractionModel, "manipulateur"), getString("Read")) {
- @Override
- public void onClick() {
- setResponsePage(new ReadPersonnePage(getModelObject().getIdPersonne(), currentPage));
- }
- });
+ add(new PropertyLabelLinkPanel<Personne>("Extraction.manipulateur", new PropertyModel<Personne>(
+ extractionModel, "manipulateur"), getString("Read")) {
+ @Override
+ public void onClick() {
+ setResponsePage(new ReadPersonnePage(getModelObject().getIdPersonne(), currentPage));
+ }
+ });
- add(new Label("Extraction.date", new PropertyModel<Date>(extractionModel, "date"))
- .add(new ReplaceEmptyLabelBehavior()));
+ add(new Label("Extraction.date", new PropertyModel<Date>(extractionModel, "date"))
+ .add(new ReplaceEmptyLabelBehavior()));
- add(new PropertyLabelLinkPanel<Lot>("Extraction.lot", new PropertyModel<Lot>(extractionModel, "lot"),
- getString("Read")) {
- @Override
- public void onClick() {
- setResponsePage(new ReadLotPage(getModelObject().getIdLot(), currentPage));
- }
- });
- add(new Label("Extraction.masseDepart", new DisplayDecimalPropertyModel(extractionModel, "masseDepart",
- DecimalDisplFormat.SMALL, getLocale())).add(new ReplaceEmptyLabelBehavior()));
- add(new MultiLineLabel("Extraction.complement", new PropertyModel<String>(extractionModel, "complement"))
- .add(new ReplaceEmptyLabelBehavior()));
+ add(new PropertyLabelLinkPanel<Lot>("Extraction.lot", new PropertyModel<Lot>(extractionModel, "lot"),
+ getString("Read")) {
+ @Override
+ public void onClick() {
+ setResponsePage(new ReadLotPage(getModelObject().getIdLot(), currentPage));
+ }
+ });
+ add(new Label("Extraction.masseDepart", new DisplayDecimalPropertyModel(extractionModel, "masseDepart",
+ DecimalDisplFormat.SMALL, getLocale())).add(new ReplaceEmptyLabelBehavior()));
+ add(new MultiLineLabel("Extraction.complement", new PropertyModel<String>(extractionModel, "complement"))
+ .add(new ReplaceEmptyLabelBehavior()));
- add(new PropertyLabelLinkPanel<Personne>("Extraction.createur", new PropertyModel<Personne>(extractionModel,
- "createur"), getString("Read")) {
- @Override
- public void onClick() {
- setResponsePage(new ReadPersonnePage(getModelObject().getIdPersonne(), currentPage));
- }
- });
+ add(new PropertyLabelLinkPanel<Personne>("Extraction.createur", new PropertyModel<Personne>(extractionModel,
+ "createur"), getString("Read")) {
+ @Override
+ public void onClick() {
+ setResponsePage(new ReadPersonnePage(getModelObject().getIdPersonne(), currentPage));
+ }
+ });
- // Méthode d'extraction
- add(new MultiLineLabel("Extraction.methode.description", new PropertyModel<String>(extractionModel,
- "methode.description")).add(new ReplaceEmptyLabelBehavior()));
- add(new Label("Extraction.methode.nom", new PropertyModel<MethodeExtraction>(extractionModel, "methode"))
- .add(new ReplaceEmptyLabelBehavior()));
+ // Méthode d'extraction
+ add(new MultiLineLabel("Extraction.methode.description", new PropertyModel<String>(extractionModel,
+ "methode.description")).add(new ReplaceEmptyLabelBehavior()));
+ add(new Label("Extraction.methode.nom", new PropertyModel<MethodeExtraction>(extractionModel, "methode"))
+ .add(new ReplaceEmptyLabelBehavior()));
- // Déclaration tableau des extraits
- extraitsTable = new WebMarkupContainer("Extraction.extraits.Table") {
- @Override
- public boolean isVisible() {
- return extractionModel.getObject().getExtraits().size() > 0;
- }
- };
- extraitsTable.setOutputMarkupId(true);
+ // Déclaration tableau des extraits
+ extraitsTable = new WebMarkupContainer("Extraction.extraits.Table") {
+ @Override
+ public boolean isVisible() {
+ return extractionModel.getObject().getExtraits().size() > 0;
+ }
+ };
+ extraitsTable.setOutputMarkupId(true);
- // Contenu tableaux extrait
- // Liste des types extraits ajoutés
- extraitsTable.add(new ListView<Extrait>("Extraction.extraits.List", new PropertyModel<List<Extrait>>(
- extractionModel, "sortedExtraits")) {
- @Override
- protected void populateItem(ListItem<Extrait> item) {
- if (item.getIndex() % 2 == 1) {
- item.add(new AttributeModifier("class", item.getIndex() % 2 == 0 ? "even" : "odd"));
- }
+ // Contenu tableaux extrait
+ // Liste des types extraits ajoutés
+ extraitsTable.add(new ListView<Extrait>("Extraction.extraits.List", new PropertyModel<List<Extrait>>(
+ extractionModel, "sortedExtraits")) {
+ @Override
+ protected void populateItem(ListItem<Extrait> item) {
+ if (item.getIndex() % 2 == 1) {
+ item.add(new AttributeModifier("class", item.getIndex() % 2 == 0 ? "even" : "odd"));
+ }
- IModel<Extrait> extraitModel = item.getModel();
- final Extrait extrait = item.getModelObject();
- // Colonnes
- item.add(new Label("Extraction.extraits.List.typeExtrait", new PropertyModel<String>(extrait,
- "typeExtrait")));
- // info-bulle comprenant la description du type d'extrait
- item.add(new SimpleTooltipPanel("Extraction.extraits.List.typeExtrait.info", new PropertyModel<String>(
- extrait, "typeExtrait.description")));
- item.add(new Label("Extraction.extraits.List.ref", new PropertyModel<String>(extrait, "ref")));
- item.add(new Label("Extraction.extraits.List.masseObtenue", new DisplayDecimalPropertyModel(
- extraitModel, "masseObtenue", DecimalDisplFormat.SMALL, getLocale())));
+ IModel<Extrait> extraitModel = item.getModel();
+ final Extrait extrait = item.getModelObject();
+ // Colonnes
+ item.add(new Label("Extraction.extraits.List.typeExtrait", new PropertyModel<String>(extrait,
+ "typeExtrait")));
+ // info-bulle comprenant la description du type d'extrait
+ item.add(new SimpleTooltipPanel("Extraction.extraits.List.typeExtrait.info", new PropertyModel<String>(
+ extrait, "typeExtrait.description")));
+ item.add(new Label("Extraction.extraits.List.ref", new PropertyModel<String>(extrait, "ref")));
+ item.add(new Label("Extraction.extraits.List.masseObtenue", new DisplayDecimalPropertyModel(
+ extraitModel, "masseObtenue", DecimalDisplFormat.SMALL, getLocale())));
- item.add(new Label("Extraction.extraits.List.rendement", new DisplayPercentPropertyModel(extraitModel,
- "rendement", getLocale())).add(new ReplaceEmptyLabelBehavior()));
- }
- });
- add(extraitsTable);
+ item.add(new Label("Extraction.extraits.List.rendement", new DisplayPercentPropertyModel(extraitModel,
+ "rendement", getLocale())).add(new ReplaceEmptyLabelBehavior()));
+ }
+ });
+ add(extraitsTable);
- // Selon la non existence d'elements dans la liste on affiche le span
- add(new WebMarkupContainer("Extraction.extraits.noTable") {
- @Override
- public boolean isVisible() {
- return !extraitsTable.isVisible();
- }
- });
+ // Selon la non existence d'elements dans la liste on affiche le span
+ add(new WebMarkupContainer("Extraction.extraits.noTable") {
+ @Override
+ public boolean isVisible() {
+ return !extraitsTable.isVisible();
+ }
+ });
- // Formulaire des actions
- final Form<Void> formView = new Form<Void>("Form");
+ // Formulaire des actions
+ final Form<Void> formView = new Form<Void>("Form");
- // Action : mise à jour (redirection vers le formulaire)
- Link<Extraction> updateLink = new Link<Extraction>(getResource() + ".Extraction.Update", new Model<Extraction>(
- extractionModel.getObject())) {
- @Override
- public void onClick() {
- setResponsePage(new ManageExtractionPage(getModelObject().getIdExtraction(), currentPage));
- }
- };
- updateLink.setVisibilityAllowed(extractionService.updateOrdeleteExtractionEnabled(extractionModel.getObject(),
- getSession().getUtilisateur()));
- formView.add(updateLink);
+ // Action : mise à jour (redirection vers le formulaire)
+ Link<Extraction> updateLink = new Link<Extraction>(getResource() + ".Extraction.Update", new Model<Extraction>(
+ extractionModel.getObject())) {
+ @Override
+ public void onClick() {
+ setResponsePage(new ManageExtractionPage(getModelObject().getIdExtraction(), currentPage));
+ }
+ };
+ updateLink.setVisibilityAllowed(extractionService.updateOrdeleteExtractionEnabled(extractionModel.getObject(),
+ getSession().getUtilisateur()));
+ formView.add(updateLink);
- // Action : suppression
- Button deleteButton = new SubmittableButton(ACTION_DELETE, ManageExtractionPage.class,
- new SubmittableButtonEvents() {
- @Override
- public void onProcess() throws DataConstraintException {
- extractionService.deleteExtraction(extractionModel.getObject());
- }
+ // Action : suppression
+ Button deleteButton = new SubmittableButton(ACTION_DELETE, ManageExtractionPage.class,
+ new SubmittableButtonEvents() {
+ @Override
+ public void onProcess() throws DataConstraintException {
+ extractionService.deleteExtraction(extractionModel.getObject());
+ }
- @Override
- public void onSuccess() {
- successNextPage(ManageExtractionPage.class, ACTION_DELETE);
- redirect();
- }
- });
- deleteButton.setVisibilityAllowed(extractionService.updateOrdeleteExtractionEnabled(
- extractionModel.getObject(), getSession().getUtilisateur()));
- deleteButton.add(new JSConfirmationBehavior(getString("Confirm")));
- deleteButton.setDefaultFormProcessing(false);
- formView.add(deleteButton);
+ @Override
+ public void onSuccess() {
+ successNextPage(ManageExtractionPage.class, ACTION_DELETE);
+ redirect();
+ }
+ });
+ deleteButton.setVisibilityAllowed(extractionService.updateOrdeleteExtractionEnabled(
+ extractionModel.getObject(), getSession().getUtilisateur()));
+ deleteButton.add(new JSConfirmationBehavior(getString("Confirm")));
+ deleteButton.setDefaultFormProcessing(false);
+ formView.add(deleteButton);
- // Action : retour
- formView.add(new Link<Void>(getResource() + ".Extraction.Back") {
- @Override
- public void onClick() {
- callerPage.responsePage((TemplatePage) getPage());
- }
- });
- add(formView);
- }
+ // Action : retour
+ formView.add(new Link<Void>(getResource() + ".Extraction.Back") {
+ @Override
+ public void onClick() {
+ callerPage.responsePage((TemplatePage) getPage());
+ }
+ });
+ add(formView);
+ }
- /**
- * Redirection vers une autre page
- */
- private void redirect() {
- callerPage.responsePage(this);
- }
+ /**
+ * Redirection vers une autre page
+ */
+ private void redirect() {
+ callerPage.responsePage(this);
+ }
}
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/lot/ListLotsPage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/lot/ListLotsPage.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/lot/ListLotsPage.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -66,127 +66,127 @@
@AuthRoles( { AuthRole.ADMIN, AuthRole.USER })
public final class ListLotsPage extends TemplatePage {
- /** Service : lot */
- @SpringBean
- private LotService lotService;
+ /** Service : lot */
+ @SpringBean
+ private LotService lotService;
- /**
- * Constructeur
- */
- public ListLotsPage() {
- super(ListLotsPage.class);
- final CallerPage currentPage = new CallerPage(ListLotsPage.class);
+ /**
+ * Constructeur
+ */
+ public ListLotsPage() {
+ super(ListLotsPage.class);
+ final CallerPage currentPage = new CallerPage(ListLotsPage.class);
- add(new Link<Void>(getResource() + ".NewLot") {
- @Override
- public void onClick() {
- setResponsePage(new ManageLotPage(currentPage, true));
- }
- });
+ add(new Link<Void>(getResource() + ".NewLot") {
+ @Override
+ public void onClick() {
+ setResponsePage(new ManageLotPage(currentPage, true));
+ }
+ });
- // On englobe le "DataView" dans un composant neutre que l'on pourra
- // rafraichir quand la liste évoluera
- final MarkupContainer lotsRefresh = new WebMarkupContainer(getResource() + ".Lots.Refresh");
- lotsRefresh.setOutputMarkupId(true);
- add(lotsRefresh);
+ // On englobe le "DataView" dans un composant neutre que l'on pourra
+ // rafraichir quand la liste évoluera
+ final MarkupContainer lotsRefresh = new WebMarkupContainer(getResource() + ".Lots.Refresh");
+ lotsRefresh.setOutputMarkupId(true);
+ add(lotsRefresh);
- // Liste des lots
- final List<Lot> lots = lotService.listLots(getSession().getUtilisateur());
+ // Liste des lots
+ final List<Lot> lots = lotService.listLots(getSession().getUtilisateur());
- LoadableDetachableSortableListDataProvider<Lot> lotsDataProvider = new LoadableDetachableSortableListDataProvider<Lot>(
- lots, getSession().getLocale());
+ LoadableDetachableSortableListDataProvider<Lot> lotsDataProvider = new LoadableDetachableSortableListDataProvider<Lot>(
+ lots, getSession().getLocale());
- List<IColumn<Lot>> columns = new ArrayList<IColumn<Lot>>();
+ List<IColumn<Lot>> columns = new ArrayList<IColumn<Lot>>();
- columns.add(new LinkableImagePropertyColumn<Lot>("images/read.png", getString("Read"), getString("Read")) {
- @Override
- public void onClick(Item<ICellPopulator<Lot>> item, String componentId, IModel<Lot> model) {
- setResponsePage(new ReadLotPage(model.getObject().getIdLot(), currentPage));
- }
- });
+ columns.add(new LinkableImagePropertyColumn<Lot>("images/read.png", getString("Read"), getString("Read")) {
+ @Override
+ public void onClick(Item<ICellPopulator<Lot>> item, String componentId, IModel<Lot> model) {
+ setResponsePage(new ReadLotPage(model.getObject().getIdLot(), currentPage));
+ }
+ });
- columns.add(new LinkPropertyColumn<Lot>(new Model<String>(getString("Lot.ref")), "ref", "ref",
- getString("Read")) {
- @Override
- public void onClick(Item<ICellPopulator<Lot>> item, String componentId, IModel<Lot> model) {
- setResponsePage(new ReadLotPage(model.getObject().getIdLot(), currentPage));
- }
- });
+ columns.add(new LinkPropertyColumn<Lot>(new Model<String>(getString("Lot.ref")), "ref", "ref",
+ getString("Read")) {
+ @Override
+ public void onClick(Item<ICellPopulator<Lot>> item, String componentId, IModel<Lot> model) {
+ setResponsePage(new ReadLotPage(model.getObject().getIdLot(), currentPage));
+ }
+ });
- columns.add(new PropertyColumn<Lot>(new Model<String>(getString("Lot.dateRecolte2")), "dateRecolte",
- "dateRecolte"));
+ columns.add(new PropertyColumn<Lot>(new Model<String>(getString("Lot.dateRecolte2")), "dateRecolte",
+ "dateRecolte"));
- columns.add(new LinkPropertyColumn<Lot>(new Model<String>(getString("Lot.station")), "station", "station",
- getString("Read")) {
- @Override
- public void onClick(Item<ICellPopulator<Lot>> item, String componentId, IModel<Lot> model) {
- setResponsePage(new ReadStationPage(model.getObject().getStation().getIdStation(), currentPage));
- }
- });
+ columns.add(new LinkPropertyColumn<Lot>(new Model<String>(getString("Lot.station")), "station", "station",
+ getString("Read")) {
+ @Override
+ public void onClick(Item<ICellPopulator<Lot>> item, String componentId, IModel<Lot> model) {
+ setResponsePage(new ReadStationPage(model.getObject().getStation().getIdStation(), currentPage));
+ }
+ });
- columns.add(new LinkPropertyColumn<Lot>(new Model<String>(getString("Lot.specimenRef2")), "specimenRef",
- "specimenRef", getString("Read")) {
- @Override
- public void onClick(Item<ICellPopulator<Lot>> item, String componentId, IModel<Lot> model) {
- setResponsePage(new ReadSpecimenPage(model.getObject().getSpecimenRef().getIdSpecimen(), currentPage));
- }
- });
+ columns.add(new LinkPropertyColumn<Lot>(new Model<String>(getString("Lot.specimenRef2")), "specimenRef",
+ "specimenRef", getString("Read")) {
+ @Override
+ public void onClick(Item<ICellPopulator<Lot>> item, String componentId, IModel<Lot> model) {
+ setResponsePage(new ReadSpecimenPage(model.getObject().getSpecimenRef().getIdSpecimen(), currentPage));
+ }
+ });
- columns.add(new EnumPropertyColumn<Lot>(new Model<String>(getString("Specimen.typeOrganisme")),
- "specimenRef.typeOrganisme", "specimenRef.typeOrganisme", ListLotsPage.this));
+ columns.add(new EnumPropertyColumn<Lot>(new Model<String>(getString("Specimen.typeOrganisme")),
+ "specimenRef.typeOrganisme", "specimenRef.typeOrganisme", ListLotsPage.this));
- columns.add(new TaxonomyPropertyColumn<Lot>(new Model<String>(getString("Specimen.embranchement")),
- "specimenRef.embranchement", "specimenRef.embranchement"));
+ columns.add(new TaxonomyPropertyColumn<Lot>(new Model<String>(getString("Specimen.embranchement")),
+ "specimenRef.embranchement", "specimenRef.embranchement"));
- columns.add(new TaxonomyPropertyColumn<Lot>(new Model<String>(getString("Specimen.famille")),
- "specimenRef.famille", "specimenRef.famille"));
+ columns.add(new TaxonomyPropertyColumn<Lot>(new Model<String>(getString("Specimen.famille")),
+ "specimenRef.famille", "specimenRef.famille"));
- columns.add(new TaxonomyPropertyColumn<Lot>(new Model<String>(getString("Specimen.genre")),
- "specimenRef.genre", "specimenRef.genre"));
+ columns.add(new TaxonomyPropertyColumn<Lot>(new Model<String>(getString("Specimen.genre")),
+ "specimenRef.genre", "specimenRef.genre"));
- columns.add(new TaxonomyPropertyColumn<Lot>(new Model<String>(getString("Specimen.espece")),
- "specimenRef.espece", "specimenRef.espece"));
+ columns.add(new TaxonomyPropertyColumn<Lot>(new Model<String>(getString("Specimen.espece")),
+ "specimenRef.espece", "specimenRef.espece"));
- columns.add(new PropertyColumn<Lot>(new Model<String>(getString("Lot.partie")), "partie", "partie"));
+ columns.add(new PropertyColumn<Lot>(new Model<String>(getString("Lot.partie")), "partie", "partie"));
- columns.add(new DecimalPropertyColumn<Lot>(new Model<String>(getString("Lot.masseFraiche2")), "masseFraiche",
- "masseFraiche", DecimalDisplFormat.SMALL, getLocale()));
+ columns.add(new DecimalPropertyColumn<Lot>(new Model<String>(getString("Lot.masseFraiche2")), "masseFraiche",
+ "masseFraiche", DecimalDisplFormat.SMALL, getLocale()));
- columns.add(new DecimalPropertyColumn<Lot>(new Model<String>(getString("Lot.masseSeche2")), "masseSeche",
- "masseSeche", DecimalDisplFormat.SMALL, getLocale()));
+ columns.add(new DecimalPropertyColumn<Lot>(new Model<String>(getString("Lot.masseSeche2")), "masseSeche",
+ "masseSeche", DecimalDisplFormat.SMALL, getLocale()));
- columns.add(new LinkPropertyColumn<Lot>(new Model<String>(getString("Lot.campagne")), "campagne", "campagne",
- getString("Read")) {
- @Override
- public void onClick(Item<ICellPopulator<Lot>> item, String componentId, IModel<Lot> model) {
- setResponsePage(new ReadCampagnePage(model.getObject().getCampagne().getIdCampagne(), currentPage));
- }
- });
+ columns.add(new LinkPropertyColumn<Lot>(new Model<String>(getString("Lot.campagne")), "campagne", "campagne",
+ getString("Read")) {
+ @Override
+ public void onClick(Item<ICellPopulator<Lot>> item, String componentId, IModel<Lot> model) {
+ setResponsePage(new ReadCampagnePage(model.getObject().getCampagne().getIdCampagne(), currentPage));
+ }
+ });
- columns.add(new MapValuePropertyColumn<Lot, String>(new Model<String>(getString("Campagne.codePays")),
- "campagne.codePays", "campagne.codePays", WebContext.COUNTRIES.get(getSession().getLocale())));
+ columns.add(new MapValuePropertyColumn<Lot, String>(new Model<String>(getString("Campagne.codePays")),
+ "campagne.codePays", "campagne.codePays", WebContext.COUNTRIES.get(getSession().getLocale())));
- columns.add(new LinkableImagePropertyColumn<Lot>("images/edit.png", getString("Update"), getString("Update")) {
- // pas de lien d'édition si l'utilisateur n'a pas les droits
- @Override
- public void populateItem(Item<ICellPopulator<Lot>> item, String componentId, IModel<Lot> model) {
- if (lotService.updateOrdeleteLotEnabled(model.getObject(), getSession().getUtilisateur())) {
- item.add(new LinkableImagePanel(item, componentId, model));
- } else {
- // label vide
- item.add(new Label(componentId));
- }
- }
+ columns.add(new LinkableImagePropertyColumn<Lot>("images/edit.png", getString("Update"), getString("Update")) {
+ // pas de lien d'édition si l'utilisateur n'a pas les droits
+ @Override
+ public void populateItem(Item<ICellPopulator<Lot>> item, String componentId, IModel<Lot> model) {
+ if (lotService.updateOrdeleteLotEnabled(model.getObject(), getSession().getUtilisateur())) {
+ item.add(new LinkableImagePanel(item, componentId, model));
+ } else {
+ // label vide
+ item.add(new Label(componentId));
+ }
+ }
- @Override
- public void onClick(Item<ICellPopulator<Lot>> item, String componentId, IModel<Lot> model) {
- setResponsePage(new ManageLotPage(model.getObject().getIdLot(), currentPage));
- }
- });
+ @Override
+ public void onClick(Item<ICellPopulator<Lot>> item, String componentId, IModel<Lot> model) {
+ setResponsePage(new ManageLotPage(model.getObject().getIdLot(), currentPage));
+ }
+ });
- final DataTable<Lot> lotsDataTable = new AjaxFallbackDefaultDataTable<Lot>("ListLotsPage.Lots", columns,
- lotsDataProvider, WebContext.ROWS_PER_PAGE);
- lotsRefresh.add(lotsDataTable);
+ final DataTable<Lot> lotsDataTable = new AjaxFallbackDefaultDataTable<Lot>("ListLotsPage.Lots", columns,
+ lotsDataProvider, WebContext.ROWS_PER_PAGE);
+ lotsRefresh.add(lotsDataTable);
- }
+ }
}
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/lot/ManageLotPage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/lot/ManageLotPage.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/lot/ManageLotPage.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -80,364 +80,364 @@
@AuthRoles({ AuthRole.USER, AuthRole.ADMIN })
public final class ManageLotPage extends TemplatePage {
- /** Action : create */
- private static final String ACTION_CREATE = "Create";
+ /** Action : create */
+ private static final String ACTION_CREATE = "Create";
- /** Action : delete */
- public static final String ACTION_DELETE = "Delete";
+ /** Action : delete */
+ public static final String ACTION_DELETE = "Delete";
- /** Action : update */
- private static final String ACTION_UPDATE = "Update";
+ /** Action : update */
+ private static final String ACTION_UPDATE = "Update";
- /** Logger */
- private static final Log LOG = LogTools.getLog();
+ /** Logger */
+ private static final Log LOG = LogTools.getLog();
- /** Campagnes */
- private final List<Campagne> campagnes;
+ /** Campagnes */
+ private final List<Campagne> campagnes;
- /** Service : campagne */
- @SpringBean
- private CampagneService campagneService;
+ /** Service : campagne */
+ @SpringBean
+ private CampagneService campagneService;
- /** Modèle : lot */
- private final IModel<Lot> lotModel;
+ /** Modèle : lot */
+ private final IModel<Lot> lotModel;
- /** Service : lot */
- @SpringBean
- private LotService lotService;
+ /** Service : lot */
+ @SpringBean
+ private LotService lotService;
- /** Spécimens */
- private final List<Specimen> specimens;
+ /** Spécimens */
+ private final List<Specimen> specimens;
- /** Service : specimen */
- @SpringBean
- private SpecimenService specimenService;
+ /** Service : specimen */
+ @SpringBean
+ private SpecimenService specimenService;
- /** Model validateur */
- @SpringBean(name = "webModelValidator")
- private ModelValidator validator;
+ /** Model validateur */
+ @SpringBean(name = "webModelValidator")
+ private ModelValidator validator;
- /** Page appelante */
- private final CallerPage callerPage;
+ /** Page appelante */
+ private final CallerPage callerPage;
- /** Saisie multiple */
- private boolean multipleEntry;
+ /** Saisie multiple */
+ private boolean multipleEntry;
- /**
- * Constructeur (mode création)
- * @param callerPage Page appelante
- * @param multipleEntry Saisie multiple
- */
- public ManageLotPage(CallerPage callerPage, boolean multipleEntry) {
- this(null, null, callerPage, multipleEntry);
- }
+ /**
+ * Constructeur (mode création)
+ * @param callerPage Page appelante
+ * @param multipleEntry Saisie multiple
+ */
+ public ManageLotPage(CallerPage callerPage, boolean multipleEntry) {
+ this(null, null, callerPage, multipleEntry);
+ }
- /**
- * Constructeur (mode édition)
- * @param idLot ID lot
- * @param callerPage Page appelante
- */
- public ManageLotPage(Integer idLot, CallerPage callerPage) {
- this(idLot, null, callerPage, false);
- }
+ /**
+ * Constructeur (mode édition)
+ * @param idLot ID lot
+ * @param callerPage Page appelante
+ */
+ public ManageLotPage(Integer idLot, CallerPage callerPage) {
+ this(idLot, null, callerPage, false);
+ }
- /**
- * Constructeur (mode saisie du lot suivante)
- * @param lot Lot
- * @param callerPage Page appelante
- */
- public ManageLotPage(Lot lot, CallerPage callerPage) {
- this(null, lot, callerPage, true);
- }
+ /**
+ * Constructeur (mode saisie du lot suivante)
+ * @param lot Lot
+ * @param callerPage Page appelante
+ */
+ public ManageLotPage(Lot lot, CallerPage callerPage) {
+ this(null, lot, callerPage, true);
+ }
- /**
- * Constructeur. Si idLot et lot sont null, on créée un nouveau Lot. Si idLot est renseigné, on édite le lot
- * correspondant. Si lot est renseigné, on créée un nouveau lot à partir des informations qu'il contient.
- * @param idLot ID lot
- * @param lot Lot
- * @param callerPage Page appelante
- * @param multipleEntry Saisie multiple
- */
- private ManageLotPage(Integer idLot, Lot lot, final CallerPage callerPage, boolean multipleEntry) {
- super(ManageLotPage.class);
- assert idLot == null || lot == null;
- this.callerPage = callerPage;
- this.multipleEntry = multipleEntry;
+ /**
+ * Constructeur. Si idLot et lot sont null, on créée un nouveau Lot. Si idLot est renseigné, on édite le lot
+ * correspondant. Si lot est renseigné, on créée un nouveau lot à partir des informations qu'il contient.
+ * @param idLot ID lot
+ * @param lot Lot
+ * @param callerPage Page appelante
+ * @param multipleEntry Saisie multiple
+ */
+ private ManageLotPage(Integer idLot, Lot lot, final CallerPage callerPage, boolean multipleEntry) {
+ super(ManageLotPage.class);
+ assert idLot == null || lot == null;
+ this.callerPage = callerPage;
+ this.multipleEntry = multipleEntry;
- final CallerPage currentPage = new CallerPage(this);
+ final CallerPage currentPage = new CallerPage(this);
- // Initialisation du modèle
- try {
- lotModel = new Model<Lot>(idLot == null && lot == null ? new Lot() : lot != null ? lot
- : lotService.loadLot(idLot));
- } catch (DataNotFoundException e) {
- LOG.error(e.getMessage(), e);
- throw new UnexpectedException(e);
- }
+ // Initialisation du modèle
+ try {
+ lotModel = new Model<Lot>(idLot == null && lot == null ? new Lot() : lot != null ? lot
+ : lotService.loadLot(idLot));
+ } catch (DataNotFoundException e) {
+ LOG.error(e.getMessage(), e);
+ throw new UnexpectedException(e);
+ }
- boolean createMode = idLot == null;
- if (createMode) {
- lotModel.getObject().setCreateur(getSession().getUtilisateur());
- }
+ boolean createMode = idLot == null;
+ if (createMode) {
+ lotModel.getObject().setCreateur(getSession().getUtilisateur());
+ }
- // Initialisation des listes
- campagnes = campagneService.listCampagnes(getSession().getUtilisateur());
- specimens = specimenService.listSpecimens(getSession().getUtilisateur());
+ // Initialisation des listes
+ campagnes = campagneService.listCampagnes(getSession().getUtilisateur());
+ specimens = specimenService.listSpecimens(getSession().getUtilisateur());
- List<Partie> parties = lotService.listParties();
+ List<Partie> parties = lotService.listParties();
- if (lot != null) {
- // qd saisie multiple avec préremplissage, hack nécessaire afin d'avoir dans le model le même objet que
- // celui de la liste de choix (sinon comme les objets viennent de sessions hibernate différentes, on n'a pas
- // l'égalité entre les objets)
- lotModel.getObject().setCampagne(
- CollectionTools.findWithValue(campagnes, "idCampagne", AccessType.GETTER, lotModel.getObject()
- .getCampagne().getIdCampagne()));
- // normalement pas nul car un bean campagne (le modèle donné en l'occurence) bien formé comporte une
- // campagne de renseigné
- if (lotModel.getObject().getCampagne() != null) {
- List<Station> stations = lotModel.getObject().getCampagne().getStations();
- lotModel.getObject().setStation(
- CollectionTools.findWithValue(stations, "idStation", AccessType.GETTER, lotModel.getObject()
- .getStation().getIdStation()));
- }
- if (lotModel.getObject().getPartie() != null) {
- lotModel.getObject().setPartie(
- CollectionTools.findWithValue(parties, "idPartie", AccessType.GETTER, lotModel.getObject()
- .getPartie().getIdPartie()));
- }
- } else if (idLot != null) {
+ if (lot != null) {
+ // qd saisie multiple avec préremplissage, hack nécessaire afin d'avoir dans le model le même objet que
+ // celui de la liste de choix (sinon comme les objets viennent de sessions hibernate différentes, on n'a pas
+ // l'égalité entre les objets)
+ lotModel.getObject().setCampagne(
+ CollectionTools.findWithValue(campagnes, "idCampagne", AccessType.GETTER, lotModel.getObject()
+ .getCampagne().getIdCampagne()));
+ // normalement pas nul car un bean campagne (le modèle donné en l'occurence) bien formé comporte une
+ // campagne de renseigné
+ if (lotModel.getObject().getCampagne() != null) {
+ List<Station> stations = lotModel.getObject().getCampagne().getStations();
+ lotModel.getObject().setStation(
+ CollectionTools.findWithValue(stations, "idStation", AccessType.GETTER, lotModel.getObject()
+ .getStation().getIdStation()));
+ }
+ if (lotModel.getObject().getPartie() != null) {
+ lotModel.getObject().setPartie(
+ CollectionTools.findWithValue(parties, "idPartie", AccessType.GETTER, lotModel.getObject()
+ .getPartie().getIdPartie()));
+ }
+ } else if (idLot != null) {
- }
+ }
- final Form<Void> formView = new Form<Void>("Form");
- DropDownChoice<Campagne> campagnesInput = new DropDownChoice<Campagne>("Lot.campagne",
- new PropertyModel<Campagne>(lotModel, "campagne"), campagnes);
- campagnesInput.setNullValid(false);
- formView.add(campagnesInput);
+ final Form<Void> formView = new Form<Void>("Form");
+ DropDownChoice<Campagne> campagnesInput = new DropDownChoice<Campagne>("Lot.campagne",
+ new PropertyModel<Campagne>(lotModel, "campagne"), campagnes);
+ campagnesInput.setNullValid(false);
+ formView.add(campagnesInput);
- // Action : création d'une nouvelle campagne
- // ajaxSubmitLink permet de sauvegarder l'état du formulaire
- formView.add(new AjaxSubmitLink("NewCampagne") {
- @Override
- protected void onSubmit(AjaxRequestTarget arg0, Form<?> arg1) {
- setResponsePage(new ManageCampagnePage(currentPage, false));
- }
+ // Action : création d'une nouvelle campagne
+ // ajaxSubmitLink permet de sauvegarder l'état du formulaire
+ formView.add(new AjaxSubmitLink("NewCampagne") {
+ @Override
+ protected void onSubmit(AjaxRequestTarget arg0, Form<?> arg1) {
+ setResponsePage(new ManageCampagnePage(currentPage, false));
+ }
- // si erreur, le formulaire est également enregistré puis la redirection effectuée
- @Override
- protected void onError(AjaxRequestTarget target, Form<?> form) {
- setResponsePage(new ManageCampagnePage(currentPage, false));
- }
- });
+ // si erreur, le formulaire est également enregistré puis la redirection effectuée
+ @Override
+ protected void onError(AjaxRequestTarget target, Form<?> form) {
+ setResponsePage(new ManageCampagnePage(currentPage, false));
+ }
+ });
- final DropDownChoice<Station> stationsInput = new DropDownChoice<Station>("Lot.station",
- new PropertyModel<Station>(lotModel, "station"),
- lotModel.getObject().getCampagne() == null ? new ArrayList<Station>() : lotModel.getObject()
- .getCampagne().getStations());
- stationsInput.setOutputMarkupId(true);
- stationsInput.setNullValid(false);
- stationsInput.setEnabled(lotModel.getObject().getCampagne() != null);
- formView.add(stationsInput);
- formView.add(new SimpleTooltipPanel("Lot.station.info", new Model<String>(getString("Lot.station.info"))));
+ final DropDownChoice<Station> stationsInput = new DropDownChoice<Station>("Lot.station",
+ new PropertyModel<Station>(lotModel, "station"),
+ lotModel.getObject().getCampagne() == null ? new ArrayList<Station>() : lotModel.getObject()
+ .getCampagne().getStations());
+ stationsInput.setOutputMarkupId(true);
+ stationsInput.setNullValid(false);
+ stationsInput.setEnabled(lotModel.getObject().getCampagne() != null);
+ formView.add(stationsInput);
+ formView.add(new SimpleTooltipPanel("Lot.station.info", new Model<String>(getString("Lot.station.info"))));
- campagnesInput.add(new AjaxFormComponentUpdatingBehavior("onchange") {
- protected void onUpdate(AjaxRequestTarget target) {
- List<Station> stations = new ArrayList<Station>();
- if (lotModel.getObject().getCampagne() != null) {
- campagneService.refreshCampagne(lotModel.getObject().getCampagne());
- stations = lotModel.getObject().getCampagne().getSortedStations();
- }
- stationsInput.setChoices(stations);
- stationsInput.setEnabled(lotModel.getObject().getCampagne() != null);
- lotModel.getObject().setStation(null);
- // refresh the station choices component
- target.add(stationsInput);
- }
- });
+ campagnesInput.add(new AjaxFormComponentUpdatingBehavior("onchange") {
+ protected void onUpdate(AjaxRequestTarget target) {
+ List<Station> stations = new ArrayList<Station>();
+ if (lotModel.getObject().getCampagne() != null) {
+ campagneService.refreshCampagne(lotModel.getObject().getCampagne());
+ stations = lotModel.getObject().getCampagne().getSortedStations();
+ }
+ stationsInput.setChoices(stations);
+ stationsInput.setEnabled(lotModel.getObject().getCampagne() != null);
+ lotModel.getObject().setStation(null);
+ // refresh the station choices component
+ target.add(stationsInput);
+ }
+ });
- formView.add(new DateTextField("Lot.dateRecolte", new PropertyModel<Date>(lotModel, "dateRecolte"))
- .add(new DatePicker()));
- formView.add(new TextField<String>("Lot.ref", new PropertyModel<String>(lotModel, "ref")));
- formView.add(new DropDownChoice<Specimen>("Lot.specimenRef", new PropertyModel<Specimen>(lotModel,
- "specimenRef"), specimens).setNullValid(false));
+ formView.add(new DateTextField("Lot.dateRecolte", new PropertyModel<Date>(lotModel, "dateRecolte"))
+ .add(new DatePicker()));
+ formView.add(new TextField<String>("Lot.ref", new PropertyModel<String>(lotModel, "ref")));
+ formView.add(new DropDownChoice<Specimen>("Lot.specimenRef", new PropertyModel<Specimen>(lotModel,
+ "specimenRef"), specimens).setNullValid(false));
- // Action : création d'un nouveau spécimen
- // ajaxSubmitLink permet de sauvegarder l'état du formulaire
- formView.add(new AjaxSubmitLink("NewSpecimen") {
- @Override
- protected void onSubmit(AjaxRequestTarget arg0, Form<?> arg1) {
- setResponsePage(new ManageSpecimenPage(currentPage, false));
- }
+ // Action : création d'un nouveau spécimen
+ // ajaxSubmitLink permet de sauvegarder l'état du formulaire
+ formView.add(new AjaxSubmitLink("NewSpecimen") {
+ @Override
+ protected void onSubmit(AjaxRequestTarget arg0, Form<?> arg1) {
+ setResponsePage(new ManageSpecimenPage(currentPage, false));
+ }
- // si erreur, le formulaire est également enregistré puis la redirection effectuée
- @Override
- protected void onError(AjaxRequestTarget target, Form<?> form) {
- setResponsePage(new ManageSpecimenPage(currentPage, false));
- }
- });
- formView.add(new DropDownChoice<Partie>("Lot.partie", new PropertyModel<Partie>(lotModel, "partie"), parties)
- .setNullValid(true));
- formView.add(new TextField<BigDecimal>("Lot.masseFraiche", new PropertyModel<BigDecimal>(lotModel,
- "masseFraiche")));
- formView.add(new TextField<BigDecimal>("Lot.masseSeche", new PropertyModel<BigDecimal>(lotModel, "masseSeche")));
- formView.add(new CheckBox("Lot.echantillonColl", new PropertyModel<Boolean>(lotModel, "echantillonColl")));
- formView.add(new CheckBox("Lot.echantillonIdent", new PropertyModel<Boolean>(lotModel, "echantillonIdent")));
- formView.add(new CheckBox("Lot.echantillonPhylo", new PropertyModel<Boolean>(lotModel, "echantillonPhylo")));
- formView.add(new TextArea<String>("Lot.complement", new PropertyModel<String>(lotModel, "complement")));
+ // si erreur, le formulaire est également enregistré puis la redirection effectuée
+ @Override
+ protected void onError(AjaxRequestTarget target, Form<?> form) {
+ setResponsePage(new ManageSpecimenPage(currentPage, false));
+ }
+ });
+ formView.add(new DropDownChoice<Partie>("Lot.partie", new PropertyModel<Partie>(lotModel, "partie"), parties)
+ .setNullValid(true));
+ formView.add(new TextField<BigDecimal>("Lot.masseFraiche", new PropertyModel<BigDecimal>(lotModel,
+ "masseFraiche")));
+ formView.add(new TextField<BigDecimal>("Lot.masseSeche", new PropertyModel<BigDecimal>(lotModel, "masseSeche")));
+ formView.add(new CheckBox("Lot.echantillonColl", new PropertyModel<Boolean>(lotModel, "echantillonColl")));
+ formView.add(new CheckBox("Lot.echantillonIdent", new PropertyModel<Boolean>(lotModel, "echantillonIdent")));
+ formView.add(new CheckBox("Lot.echantillonPhylo", new PropertyModel<Boolean>(lotModel, "echantillonPhylo")));
+ formView.add(new TextArea<String>("Lot.complement", new PropertyModel<String>(lotModel, "complement")));
- // Créateur en lecture seule
- formView.add(new TextField<String>("Lot.createur", new PropertyModel<String>(lotModel, "createur"))
- .setEnabled(false));
+ // Créateur en lecture seule
+ formView.add(new TextField<String>("Lot.createur", new PropertyModel<String>(lotModel, "createur"))
+ .setEnabled(false));
- // Action : création du lot
- Button createButton = new SubmittableButton(ACTION_CREATE, new SubmittableButtonEvents() {
- @Override
- public void onProcess() throws DataConstraintException {
- lotService.createLot(lotModel.getObject());
- }
+ // Action : création du lot
+ Button createButton = new SubmittableButton(ACTION_CREATE, new SubmittableButtonEvents() {
+ @Override
+ public void onProcess() throws DataConstraintException {
+ lotService.createLot(lotModel.getObject());
+ }
- @Override
- public void onSuccess() {
- successNextPage(ACTION_CREATE);
- redirect();
- }
+ @Override
+ public void onSuccess() {
+ successNextPage(ACTION_CREATE);
+ redirect();
+ }
- @Override
- public void onValidate() {
- validateModel();
- }
- });
- createButton.setVisibilityAllowed(createMode);
- formView.add(createButton);
+ @Override
+ public void onValidate() {
+ validateModel();
+ }
+ });
+ createButton.setVisibilityAllowed(createMode);
+ formView.add(createButton);
- // Action : mise à jour du lot
- Button updateButton = new SubmittableButton(ACTION_UPDATE, new SubmittableButtonEvents() {
- @Override
- public void onProcess() throws DataConstraintException {
- lotService.updateLot(lotModel.getObject());
- }
+ // Action : mise à jour du lot
+ Button updateButton = new SubmittableButton(ACTION_UPDATE, new SubmittableButtonEvents() {
+ @Override
+ public void onProcess() throws DataConstraintException {
+ lotService.updateLot(lotModel.getObject());
+ }
- @Override
- public void onSuccess() {
- successNextPage(ACTION_UPDATE);
- callerPage.responsePage((TemplatePage) getPage());
- }
+ @Override
+ public void onSuccess() {
+ successNextPage(ACTION_UPDATE);
+ callerPage.responsePage((TemplatePage) getPage());
+ }
- @Override
- public void onValidate() {
- validateModel();
- }
- });
- updateButton.setVisibilityAllowed(!createMode
- && lotService.updateOrdeleteLotEnabled(lotModel.getObject(), getSession().getUtilisateur()));
- formView.add(updateButton);
+ @Override
+ public void onValidate() {
+ validateModel();
+ }
+ });
+ updateButton.setVisibilityAllowed(!createMode
+ && lotService.updateOrdeleteLotEnabled(lotModel.getObject(), getSession().getUtilisateur()));
+ formView.add(updateButton);
- // Action : suppression du lot
- Button deleteButton = new SubmittableButton(ACTION_DELETE, new SubmittableButtonEvents() {
- @Override
- public void onProcess() throws DataConstraintException {
- lotService.deleteLot(lotModel.getObject());
- }
+ // Action : suppression du lot
+ Button deleteButton = new SubmittableButton(ACTION_DELETE, new SubmittableButtonEvents() {
+ @Override
+ public void onProcess() throws DataConstraintException {
+ lotService.deleteLot(lotModel.getObject());
+ }
- @Override
- public void onSuccess() {
- successNextPage(ACTION_DELETE);
- callerPage.responsePage((TemplatePage) getPage());
- }
- });
- deleteButton.setVisibilityAllowed(!createMode
- && lotService.updateOrdeleteLotEnabled(lotModel.getObject(), getSession().getUtilisateur()));
- deleteButton.add(new JSConfirmationBehavior(getString("Confirm")));
- deleteButton.setDefaultFormProcessing(false);
- formView.add(deleteButton);
+ @Override
+ public void onSuccess() {
+ successNextPage(ACTION_DELETE);
+ callerPage.responsePage((TemplatePage) getPage());
+ }
+ });
+ deleteButton.setVisibilityAllowed(!createMode
+ && lotService.updateOrdeleteLotEnabled(lotModel.getObject(), getSession().getUtilisateur()));
+ deleteButton.add(new JSConfirmationBehavior(getString("Confirm")));
+ deleteButton.setDefaultFormProcessing(false);
+ formView.add(deleteButton);
- formView.add(new Link<Void>("Cancel") {
- // Cas où le formulaire est annulé
- @Override
- public void onClick() {
- callerPage.responsePage((TemplatePage) this.getPage());
- }
- });
+ formView.add(new Link<Void>("Cancel") {
+ // Cas où le formulaire est annulé
+ @Override
+ public void onClick() {
+ callerPage.responsePage((TemplatePage) this.getPage());
+ }
+ });
- add(formView);
- }
+ add(formView);
+ }
- /** {@inheritDoc} */
- @Override
- protected void onBeforeRender() {
- // On rafraichit le modèle lorsque la page est rechargée (par exemple après l'ajout d'une nouvelle entité
- // Station, Spécimen ou Campagne)
- refreshModel();
- super.onBeforeRender();
- }
+ /** {@inheritDoc} */
+ @Override
+ protected void onBeforeRender() {
+ // On rafraichit le modèle lorsque la page est rechargée (par exemple après l'ajout d'une nouvelle entité
+ // Station, Spécimen ou Campagne)
+ refreshModel();
+ super.onBeforeRender();
+ }
- /**
- * Redirection vers une autre page. Cas où le formulaire est validé
- */
- private void redirect() {
- if (multipleEntry) {
- // Redirection vers l'écran de saisie d'un nouveau lot, en fournissant déjà quelques données
- Lot nextLot = new Lot();
- nextLot.setCampagne(lotModel.getObject().getCampagne());
- nextLot.setStation(lotModel.getObject().getStation());
- nextLot.setDateRecolte(lotModel.getObject().getDateRecolte());
- nextLot.setPartie(lotModel.getObject().getPartie());
- setResponsePage(new ManageLotPage(nextLot, callerPage));
- } else if (callerPage != null) {
- // On passe l'id du lot associé à cette page, en paramètre de la prochaine page, pour lui permettre de
- // l'exploiter si besoin
- callerPage.addPageParameter(Lot.class.getSimpleName(), lotModel.getObject().getIdLot());
- callerPage.responsePage(this);
- }
- }
+ /**
+ * Redirection vers une autre page. Cas où le formulaire est validé
+ */
+ private void redirect() {
+ if (multipleEntry) {
+ // Redirection vers l'écran de saisie d'un nouveau lot, en fournissant déjà quelques données
+ Lot nextLot = new Lot();
+ nextLot.setCampagne(lotModel.getObject().getCampagne());
+ nextLot.setStation(lotModel.getObject().getStation());
+ nextLot.setDateRecolte(lotModel.getObject().getDateRecolte());
+ nextLot.setPartie(lotModel.getObject().getPartie());
+ setResponsePage(new ManageLotPage(nextLot, callerPage));
+ } else if (callerPage != null) {
+ // On passe l'id du lot associé à cette page, en paramètre de la prochaine page, pour lui permettre de
+ // l'exploiter si besoin
+ callerPage.addPageParameter(Lot.class.getSimpleName(), lotModel.getObject().getIdLot());
+ callerPage.responsePage(this);
+ }
+ }
- /**
- * Refresh model
- */
- private void refreshModel() {
+ /**
+ * Refresh model
+ */
+ private void refreshModel() {
- // Récupère (et supprime) les éventuels nouveaux objets créés dans les paramètres de la page.
- String key = Campagne.class.getSimpleName();
- if (getPageParameters().getNamedKeys().contains(key)) {
- CollectionTools.setter(campagnes, campagneService.listCampagnes(getSession().getUtilisateur()));
- try {
- Campagne createdCampagne = campagneService.loadCampagne(getPageParameters().get(key).toInt());
- lotModel.getObject().setCampagne(createdCampagne);
- } catch (StringValueConversionException e) {
- LOG.error(e.getMessage(), e);
- throw new UnexpectedException(e);
- } catch (DataNotFoundException e) {
- LOG.error(e.getMessage(), e);
- throw new UnexpectedException(e);
- }
- getPageParameters().remove(key);
- }
+ // Récupère (et supprime) les éventuels nouveaux objets créés dans les paramètres de la page.
+ String key = Campagne.class.getSimpleName();
+ if (getPageParameters().getNamedKeys().contains(key)) {
+ CollectionTools.setter(campagnes, campagneService.listCampagnes(getSession().getUtilisateur()));
+ try {
+ Campagne createdCampagne = campagneService.loadCampagne(getPageParameters().get(key).toInt());
+ lotModel.getObject().setCampagne(createdCampagne);
+ } catch (StringValueConversionException e) {
+ LOG.error(e.getMessage(), e);
+ throw new UnexpectedException(e);
+ } catch (DataNotFoundException e) {
+ LOG.error(e.getMessage(), e);
+ throw new UnexpectedException(e);
+ }
+ getPageParameters().remove(key);
+ }
- key = Specimen.class.getSimpleName();
- if (getPageParameters().getNamedKeys().contains(key)) {
- CollectionTools.setter(specimens, specimenService.listSpecimens(getSession().getUtilisateur()));
- try {
- Specimen createdSpecimen = specimenService.loadSpecimen(getPageParameters().get(key).toInt());
- lotModel.getObject().setSpecimenRef(createdSpecimen);
- } catch (StringValueConversionException e) {
- LOG.error(e.getMessage(), e);
- throw new UnexpectedException(e);
- } catch (DataNotFoundException e) {
- LOG.error(e.getMessage(), e);
- throw new UnexpectedException(e);
- }
- getPageParameters().remove(key);
- }
- }
+ key = Specimen.class.getSimpleName();
+ if (getPageParameters().getNamedKeys().contains(key)) {
+ CollectionTools.setter(specimens, specimenService.listSpecimens(getSession().getUtilisateur()));
+ try {
+ Specimen createdSpecimen = specimenService.loadSpecimen(getPageParameters().get(key).toInt());
+ lotModel.getObject().setSpecimenRef(createdSpecimen);
+ } catch (StringValueConversionException e) {
+ LOG.error(e.getMessage(), e);
+ throw new UnexpectedException(e);
+ } catch (DataNotFoundException e) {
+ LOG.error(e.getMessage(), e);
+ throw new UnexpectedException(e);
+ }
+ getPageParameters().remove(key);
+ }
+ }
- /**
- * Validate model
- */
- private void validateModel() {
- if (lotModel.getObject().getCreateur() == null) {
- lotModel.getObject().setCreateur(getSession().getUtilisateur());
- }
- addValidationErrors(validator.validate(lotModel.getObject(), getSession().getLocale()));
- }
+ /**
+ * Validate model
+ */
+ private void validateModel() {
+ if (lotModel.getObject().getCreateur() == null) {
+ lotModel.getObject().setCreateur(getSession().getUtilisateur());
+ }
+ addValidationErrors(validator.validate(lotModel.getObject(), getSession().getLocale()));
+ }
}
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/lot/ReadLotPage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/lot/ReadLotPage.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/lot/ReadLotPage.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -61,131 +61,131 @@
*/
public final class ReadLotPage extends TemplatePage {
- /** Action : delete */
- public static final String ACTION_DELETE = "Delete";
+ /** Action : delete */
+ public static final String ACTION_DELETE = "Delete";
- /** Logger */
- // private static final Log LOG = LogTools.getLog();
- /** Modèle : lot */
- private final IModel<Lot> lotModel;
+ /** Logger */
+ // private static final Log LOG = LogTools.getLog();
+ /** Modèle : lot */
+ private final IModel<Lot> lotModel;
- /** Service : lot */
- @SpringBean
- private LotService lotService;
+ /** Service : lot */
+ @SpringBean
+ private LotService lotService;
- /** Page appelante */
- private final CallerPage callerPage;
+ /** Page appelante */
+ private final CallerPage callerPage;
- /**
- * Constructeur
- * @param idLot ID lot
- * @param callerPage Page appelante
- */
- public ReadLotPage(Integer idLot, final CallerPage callerPage) {
- super(ReadLotPage.class);
- this.callerPage = callerPage;
- final CallerPage currentPage = new CallerPage(this);
+ /**
+ * Constructeur
+ * @param idLot ID lot
+ * @param callerPage Page appelante
+ */
+ public ReadLotPage(Integer idLot, final CallerPage callerPage) {
+ super(ReadLotPage.class);
+ this.callerPage = callerPage;
+ final CallerPage currentPage = new CallerPage(this);
- // Initialisation du modèle
- lotModel = new GenericLoadableDetachableModel<Lot>(Lot.class, idLot);
+ // Initialisation du modèle
+ lotModel = new GenericLoadableDetachableModel<Lot>(Lot.class, idLot);
- add(new PropertyLabelLinkPanel<Campagne>("Lot.campagne", new PropertyModel<Campagne>(lotModel, "campagne"),
- getString("Read")) {
- @Override
- public void onClick() {
- setResponsePage(new ReadCampagnePage(getModelObject().getIdCampagne(), currentPage));
- }
- });
+ add(new PropertyLabelLinkPanel<Campagne>("Lot.campagne", new PropertyModel<Campagne>(lotModel, "campagne"),
+ getString("Read")) {
+ @Override
+ public void onClick() {
+ setResponsePage(new ReadCampagnePage(getModelObject().getIdCampagne(), currentPage));
+ }
+ });
- add(new PropertyLabelLinkPanel<Station>("Lot.station", new PropertyModel<Station>(lotModel, "station"),
- getString("Read")) {
- @Override
- public void onClick() {
- setResponsePage(new ReadStationPage(getModelObject().getIdStation(), currentPage));
- }
- });
+ add(new PropertyLabelLinkPanel<Station>("Lot.station", new PropertyModel<Station>(lotModel, "station"),
+ getString("Read")) {
+ @Override
+ public void onClick() {
+ setResponsePage(new ReadStationPage(getModelObject().getIdStation(), currentPage));
+ }
+ });
- add(new Label("Lot.dateRecolte", new PropertyModel<String>(lotModel, "dateRecolte")) // formatShortDateValue(lotModel.getDateRecolte()))
- .add(new ReplaceEmptyLabelBehavior()));
- add(new Label("Lot.ref", new PropertyModel<String>(lotModel, "ref")).add(new ReplaceEmptyLabelBehavior()));
+ add(new Label("Lot.dateRecolte", new PropertyModel<String>(lotModel, "dateRecolte")) // formatShortDateValue(lotModel.getDateRecolte()))
+ .add(new ReplaceEmptyLabelBehavior()));
+ add(new Label("Lot.ref", new PropertyModel<String>(lotModel, "ref")).add(new ReplaceEmptyLabelBehavior()));
- add(new PropertyLabelLinkPanel<Specimen>("Lot.specimenRef",
- new PropertyModel<Specimen>(lotModel, "specimenRef"), getString("Read")) {
- @Override
- public void onClick() {
- setResponsePage(new ReadSpecimenPage(getModelObject().getIdSpecimen(), currentPage));
- }
- });
+ add(new PropertyLabelLinkPanel<Specimen>("Lot.specimenRef",
+ new PropertyModel<Specimen>(lotModel, "specimenRef"), getString("Read")) {
+ @Override
+ public void onClick() {
+ setResponsePage(new ReadSpecimenPage(getModelObject().getIdSpecimen(), currentPage));
+ }
+ });
- add(new Label("Lot.partie", new PropertyModel<String>(lotModel, "partie")).add(new ReplaceEmptyLabelBehavior()));
- add(new Label("Lot.masseFraiche", new DisplayDecimalPropertyModel(lotModel, "masseFraiche",
- DecimalDisplFormat.SMALL, getLocale())).add(new ReplaceEmptyLabelBehavior()));
- add(new Label("Lot.masseSeche", new DisplayDecimalPropertyModel(lotModel, "masseSeche",
- DecimalDisplFormat.SMALL, getLocale())).add(new ReplaceEmptyLabelBehavior()));
- add(new Label("Lot.echantillonColl", new DisplayBooleanPropertyModel(lotModel, "echantillonColl", this))
- .add(new ReplaceEmptyLabelBehavior()));
- add(new Label("Lot.echantillonIdent", new DisplayBooleanPropertyModel(lotModel, "echantillonIdent", this))
- .add(new ReplaceEmptyLabelBehavior()));
- add(new Label("Lot.echantillonPhylo", new DisplayBooleanPropertyModel(lotModel, "echantillonPhylo", this))
- .add(new ReplaceEmptyLabelBehavior()));
- add(new MultiLineLabel("Lot.complement", new PropertyModel<String>(lotModel, "complement"))
- .add(new ReplaceEmptyLabelBehavior()));
+ add(new Label("Lot.partie", new PropertyModel<String>(lotModel, "partie")).add(new ReplaceEmptyLabelBehavior()));
+ add(new Label("Lot.masseFraiche", new DisplayDecimalPropertyModel(lotModel, "masseFraiche",
+ DecimalDisplFormat.SMALL, getLocale())).add(new ReplaceEmptyLabelBehavior()));
+ add(new Label("Lot.masseSeche", new DisplayDecimalPropertyModel(lotModel, "masseSeche",
+ DecimalDisplFormat.SMALL, getLocale())).add(new ReplaceEmptyLabelBehavior()));
+ add(new Label("Lot.echantillonColl", new DisplayBooleanPropertyModel(lotModel, "echantillonColl", this))
+ .add(new ReplaceEmptyLabelBehavior()));
+ add(new Label("Lot.echantillonIdent", new DisplayBooleanPropertyModel(lotModel, "echantillonIdent", this))
+ .add(new ReplaceEmptyLabelBehavior()));
+ add(new Label("Lot.echantillonPhylo", new DisplayBooleanPropertyModel(lotModel, "echantillonPhylo", this))
+ .add(new ReplaceEmptyLabelBehavior()));
+ add(new MultiLineLabel("Lot.complement", new PropertyModel<String>(lotModel, "complement"))
+ .add(new ReplaceEmptyLabelBehavior()));
- add(new PropertyLabelLinkPanel<Personne>("Lot.createur", new PropertyModel<Personne>(lotModel, "createur"),
- getString("Read")) {
- @Override
- public void onClick() {
- setResponsePage(new ReadPersonnePage(getModelObject().getIdPersonne(), currentPage));
- }
- });
+ add(new PropertyLabelLinkPanel<Personne>("Lot.createur", new PropertyModel<Personne>(lotModel, "createur"),
+ getString("Read")) {
+ @Override
+ public void onClick() {
+ setResponsePage(new ReadPersonnePage(getModelObject().getIdPersonne(), currentPage));
+ }
+ });
- // Formulaire des actions
- final Form<Void> formView = new Form<Void>("Form");
+ // Formulaire des actions
+ final Form<Void> formView = new Form<Void>("Form");
- // Action : mise à jour (redirection vers le formulaire)
- Link<Lot> updateLink = new Link<Lot>(getResource() + ".Lot.Update", new Model<Lot>(lotModel.getObject())) {
- @Override
- public void onClick() {
- setResponsePage(new ManageLotPage(getModelObject().getIdLot(), currentPage));
- }
- };
- updateLink.setVisibilityAllowed(lotService.updateOrdeleteLotEnabled(lotModel.getObject(), getSession()
- .getUtilisateur()));
- formView.add(updateLink);
+ // Action : mise à jour (redirection vers le formulaire)
+ Link<Lot> updateLink = new Link<Lot>(getResource() + ".Lot.Update", new Model<Lot>(lotModel.getObject())) {
+ @Override
+ public void onClick() {
+ setResponsePage(new ManageLotPage(getModelObject().getIdLot(), currentPage));
+ }
+ };
+ updateLink.setVisibilityAllowed(lotService.updateOrdeleteLotEnabled(lotModel.getObject(), getSession()
+ .getUtilisateur()));
+ formView.add(updateLink);
- // Action : suppression
- Button deleteButton = new SubmittableButton(ACTION_DELETE, ManageLotPage.class, new SubmittableButtonEvents() {
- @Override
- public void onProcess() throws DataConstraintException {
- lotService.deleteLot(lotModel.getObject());
- }
+ // Action : suppression
+ Button deleteButton = new SubmittableButton(ACTION_DELETE, ManageLotPage.class, new SubmittableButtonEvents() {
+ @Override
+ public void onProcess() throws DataConstraintException {
+ lotService.deleteLot(lotModel.getObject());
+ }
- @Override
- public void onSuccess() {
- successNextPage(ManageLotPage.class, ACTION_DELETE);
- redirect();
- }
- });
- deleteButton.setVisibilityAllowed(lotService.updateOrdeleteLotEnabled(lotModel.getObject(), getSession()
- .getUtilisateur()));
- deleteButton.add(new JSConfirmationBehavior(getString("Confirm")));
- deleteButton.setDefaultFormProcessing(false);
- formView.add(deleteButton);
+ @Override
+ public void onSuccess() {
+ successNextPage(ManageLotPage.class, ACTION_DELETE);
+ redirect();
+ }
+ });
+ deleteButton.setVisibilityAllowed(lotService.updateOrdeleteLotEnabled(lotModel.getObject(), getSession()
+ .getUtilisateur()));
+ deleteButton.add(new JSConfirmationBehavior(getString("Confirm")));
+ deleteButton.setDefaultFormProcessing(false);
+ formView.add(deleteButton);
- // Action : retour
- formView.add(new Link<Void>(getResource() + ".Lot.Back") {
- @Override
- public void onClick() {
- callerPage.responsePage((TemplatePage) getPage());
- }
- });
- add(formView);
- }
+ // Action : retour
+ formView.add(new Link<Void>(getResource() + ".Lot.Back") {
+ @Override
+ public void onClick() {
+ callerPage.responsePage((TemplatePage) getPage());
+ }
+ });
+ add(formView);
+ }
- /**
- * Redirection vers une autre page
- */
- private void redirect() {
- callerPage.responsePage(this);
- }
+ /**
+ * Redirection vers une autre page
+ */
+ private void redirect() {
+ callerPage.responsePage(this);
+ }
}
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule/ManageMoleculePage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule/ManageMoleculePage.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule/ManageMoleculePage.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -93,118 +93,118 @@
@AuthRoles({ AuthRole.USER, AuthRole.ADMIN })
public final class ManageMoleculePage extends TemplatePage {
- /** Action : create */
- private static final String ACTION_CREATE = "Create";
+ /** Action : create */
+ private static final String ACTION_CREATE = "Create";
- /** Action : delete */
- public static final String ACTION_DELETE = "Delete";
+ /** Action : delete */
+ public static final String ACTION_DELETE = "Delete";
- /** Action : update */
- private static final String ACTION_UPDATE = "Update";
+ /** Action : update */
+ private static final String ACTION_UPDATE = "Update";
- /** Logger */
- private static final Log LOG = LogTools.getLog();
+ /** Logger */
+ private static final Log LOG = LogTools.getLog();
- /** Campagnes */
- private final List<Campagne> campagnes;
+ /** Campagnes */
+ private final List<Campagne> campagnes;
- /** Service : personne */
- @SpringBean
- private PersonneService personneService;
+ /** Service : personne */
+ @SpringBean
+ private PersonneService personneService;
- /** Service : campagne */
- @SpringBean
- private CampagneService campagneService;
+ /** Service : campagne */
+ @SpringBean
+ private CampagneService campagneService;
- /** Service : produit */
- @SpringBean
- private ProduitService produitService;
+ /** Service : produit */
+ @SpringBean
+ private ProduitService produitService;
- /** Modèle : molecule */
- private final IModel<Molecule> moleculeModel;
+ /** Modèle : molecule */
+ private final IModel<Molecule> moleculeModel;
- /** Modèle to add new provenance. */
- private Model<MoleculeProvenance> newProvenanceModel;
+ /** Modèle to add new provenance. */
+ private Model<MoleculeProvenance> newProvenanceModel;
- /** Service : molecule */
- @SpringBean
- private MoleculeService moleculeService;
+ /** Service : molecule */
+ @SpringBean
+ private MoleculeService moleculeService;
- /** Model validateur */
- @SpringBean(name = "webModelValidator")
- private ModelValidator validator;
+ /** Model validateur */
+ @SpringBean(name = "webModelValidator")
+ private ModelValidator validator;
- /** Page appelante */
- private final CallerPage callerPage;
-
- /** Bouton d'ajout d'une provenance **/
+ /** Page appelante */
+ private final CallerPage callerPage;
+
+ /** Bouton d'ajout d'une provenance **/
Button addProvenanceButton;
- /**
- * Constructeur (mode création)
- * @param callerPage Page appelante
- * @param multipleEntry Saisie multiple
- */
- public ManageMoleculePage(CallerPage callerPage) {
- this(null, callerPage);
- }
+ /**
+ * Constructeur (mode création)
+ * @param callerPage Page appelante
+ * @param multipleEntry Saisie multiple
+ */
+ public ManageMoleculePage(CallerPage callerPage) {
+ this(null, callerPage);
+ }
- /**
- * Constructeur. Si idMolecule est null, on créée une nouvelle Molecule. Si idMolecule est renseigné, on édite la molecule
- * correspondante.
- * @param idMolecule ID molecule
- * @param lot Lot
- * @param callerPage Page appelante
- * @param multipleEntry Saisie multiple
- */
- public ManageMoleculePage(Integer idMolecule, final CallerPage callerPage) {
- super(ManageMoleculePage.class);
- this.callerPage = callerPage;
+ /**
+ * Constructeur. Si idMolecule est null, on créée une nouvelle Molecule. Si idMolecule est renseigné, on édite la molecule
+ * correspondante.
+ * @param idMolecule ID molecule
+ * @param lot Lot
+ * @param callerPage Page appelante
+ * @param multipleEntry Saisie multiple
+ */
+ public ManageMoleculePage(Integer idMolecule, final CallerPage callerPage) {
+ super(ManageMoleculePage.class);
+ this.callerPage = callerPage;
- final CallerPage currentPage = new CallerPage(this);
+ final CallerPage currentPage = new CallerPage(this);
- newProvenanceModel = new Model<MoleculeProvenance>(new MoleculeProvenance());
+ newProvenanceModel = new Model<MoleculeProvenance>(new MoleculeProvenance());
- // Initialisation du modèle
- try {
- moleculeModel = new Model<Molecule>(idMolecule == null ? new Molecule() : moleculeService.loadMolecule(idMolecule));
- } catch (DataNotFoundException e) {
- LOG.error(e.getMessage(), e);
- throw new UnexpectedException(e);
- }
+ // Initialisation du modèle
+ try {
+ moleculeModel = new Model<Molecule>(idMolecule == null ? new Molecule() : moleculeService.loadMolecule(idMolecule));
+ } catch (DataNotFoundException e) {
+ LOG.error(e.getMessage(), e);
+ throw new UnexpectedException(e);
+ }
- boolean createMode = idMolecule == null;
- if (createMode) {
- moleculeModel.getObject().setCreateur(getSession().getUtilisateur());
- }
+ boolean createMode = idMolecule == null;
+ if (createMode) {
+ moleculeModel.getObject().setCreateur(getSession().getUtilisateur());
+ }
- // Initialisation des listes
- List<String> organismes = moleculeService.listMoleculeOrganisme();
- campagnes = campagneService.listCampagnes(getSession().getUtilisateur());
+ // Initialisation des listes
+ List<String> organismes = moleculeService.listMoleculeOrganisme();
+ campagnes = campagneService.listCampagnes(getSession().getUtilisateur());
- final Form<Void> formView = new Form<Void>("Form");
- initProvenanceFields(formView, currentPage);
-
- formView.add(new TextField<String>("Molecule.nomCommun", new PropertyModel<String>(moleculeModel, "nomCommun")));
- formView.add(new TextField<String>("Molecule.familleChimique", new PropertyModel<String>(moleculeModel, "familleChimique")));
- formView.add(new HiddenField<String>("Molecule.formuleDevMol", new PropertyModel<String>(moleculeModel, "formuleDevMol"))
+ final Form<Void> formView = new Form<Void>("Form");
+ initProvenanceFields(formView, currentPage);
+
+ formView.add(new TextField<String>("Molecule.nomCommun", new PropertyModel<String>(moleculeModel, "nomCommun")));
+ formView.add(new TextField<String>("Molecule.familleChimique", new PropertyModel<String>(moleculeModel, "familleChimique")));
+ formView.add(new HiddenField<String>("Molecule.formuleDevMol", new PropertyModel<String>(moleculeModel, "formuleDevMol"))
.add(new MoleculeEditorBehavior(new PropertyModel<String>(moleculeModel, "formuleDevMol")))); //moleculeModel.getObject().getFormuleDevMol())));
- formView.add(new TextField<String>("Molecule.nomIupca", new PropertyModel<String>(moleculeModel, "nomIupca")));
- formView.add(new TextField<String>("Molecule.formuleBrute", new PropertyModel<String>(moleculeModel, "formuleBrute")));
-
- TextField<String> masseMolaireField = new TextField<String>("Molecule.masseMolaire", new PropertyModel<String>(moleculeModel, "masseMolaire"));
- masseMolaireField.setRequired(true);
- formView.add(masseMolaireField);
-
+ formView.add(new TextField<String>("Molecule.nomIupca", new PropertyModel<String>(moleculeModel, "nomIupca")));
+ formView.add(new TextField<String>("Molecule.formuleBrute", new PropertyModel<String>(moleculeModel, "formuleBrute")));
+
+ TextField<String> masseMolaireField = new TextField<String>("Molecule.masseMolaire", new PropertyModel<String>(moleculeModel, "masseMolaire"));
+ masseMolaireField.setRequired(true);
+ formView.add(masseMolaireField);
+
- // div qui englobe les champs visible ssi nouvMolecul est coché
- final MarkupContainer nouvMoleculRefresh = new WebMarkupContainer("Molecule.nouvMolecul.Refresh");
- nouvMoleculRefresh.setOutputMarkupId(true);
- nouvMoleculRefresh.setVisible(moleculeModel.getObject().isNouvMolecul());
- formView.add(nouvMoleculRefresh);
+ // div qui englobe les champs visible ssi nouvMolecul est coché
+ final MarkupContainer nouvMoleculRefresh = new WebMarkupContainer("Molecule.nouvMolecul.Refresh");
+ nouvMoleculRefresh.setOutputMarkupId(true);
+ nouvMoleculRefresh.setVisible(moleculeModel.getObject().isNouvMolecul());
+ formView.add(nouvMoleculRefresh);
- // predéclaration des champs activé par la chec
- formView.add(new CheckBox("Molecule.nouvMolecul", new PropertyModel<Boolean>(moleculeModel, "nouvMolecul")) {
+ // predéclaration des champs activé par la chec
+ formView.add(new CheckBox("Molecule.nouvMolecul", new PropertyModel<Boolean>(moleculeModel, "nouvMolecul")) {
@Override
protected void onSelectionChanged(Boolean newSelection) {
nouvMoleculRefresh.setVisible(newSelection);
@@ -213,13 +213,13 @@
protected boolean wantOnSelectionChangedNotifications() {
return true;
}
- });
+ });
- AutoCompleteTextFieldString identifieeParInput = new AutoCompleteTextFieldString("Molecule.identifieePar",
- new PropertyModel<String>(moleculeModel, "identifieePar"), organismes, ComparisonMode.CONTAINS);
- nouvMoleculRefresh.add(identifieeParInput);
+ AutoCompleteTextFieldString identifieeParInput = new AutoCompleteTextFieldString("Molecule.identifieePar",
+ new PropertyModel<String>(moleculeModel, "identifieePar"), organismes, ComparisonMode.CONTAINS);
+ nouvMoleculRefresh.add(identifieeParInput);
- DropDownChoice<Campagne> campagnesInput = new DropDownChoice<Campagne>("Molecule.campagne",
+ DropDownChoice<Campagne> campagnesInput = new DropDownChoice<Campagne>("Molecule.campagne",
new PropertyModel<Campagne>(moleculeModel, "campagne"), campagnes);
//campagnesInput.setNullValid(false);
nouvMoleculRefresh.add(campagnesInput);
@@ -243,88 +243,88 @@
formView.add(new TextArea<String>("Molecule.complement", new PropertyModel<String>(moleculeModel, "complement")));
- // Créateur en lecture seule
- formView.add(new TextField<String>("Molecule.createur", new PropertyModel<String>(moleculeModel, "createur"))
- .setEnabled(false));
+ // Créateur en lecture seule
+ formView.add(new TextField<String>("Molecule.createur", new PropertyModel<String>(moleculeModel, "createur"))
+ .setEnabled(false));
- // Action : création du lot
- Button createButton = new SubmittableButton(ACTION_CREATE, new SubmittableButtonEvents() {
- @Override
- public void onProcess() throws DataConstraintException {
- moleculeService.createMolecule(moleculeModel.getObject());
- }
+ // Action : création du lot
+ Button createButton = new SubmittableButton(ACTION_CREATE, new SubmittableButtonEvents() {
+ @Override
+ public void onProcess() throws DataConstraintException {
+ moleculeService.createMolecule(moleculeModel.getObject());
+ }
- @Override
- public void onSuccess() {
- successNextPage(ACTION_CREATE);
- redirect();
- }
+ @Override
+ public void onSuccess() {
+ successNextPage(ACTION_CREATE);
+ redirect();
+ }
- @Override
- public void onValidate() {
- validateModel();
- }
- });
- createButton.setVisibilityAllowed(createMode);
- formView.add(createButton);
+ @Override
+ public void onValidate() {
+ validateModel();
+ }
+ });
+ createButton.setVisibilityAllowed(createMode);
+ formView.add(createButton);
- // Action : mise à jour du lot
- Button updateButton = new SubmittableButton(ACTION_UPDATE, new SubmittableButtonEvents() {
- @Override
- public void onProcess() throws DataConstraintException {
- moleculeService.updateMolecule(moleculeModel.getObject());
- }
+ // Action : mise à jour du lot
+ Button updateButton = new SubmittableButton(ACTION_UPDATE, new SubmittableButtonEvents() {
+ @Override
+ public void onProcess() throws DataConstraintException {
+ moleculeService.updateMolecule(moleculeModel.getObject());
+ }
- @Override
- public void onSuccess() {
- successNextPage(ACTION_UPDATE);
- callerPage.responsePage((TemplatePage) getPage());
- }
+ @Override
+ public void onSuccess() {
+ successNextPage(ACTION_UPDATE);
+ callerPage.responsePage((TemplatePage) getPage());
+ }
- @Override
- public void onValidate() {
- validateModel();
- }
- });
- updateButton.setVisibilityAllowed(!createMode);
- formView.add(updateButton);
+ @Override
+ public void onValidate() {
+ validateModel();
+ }
+ });
+ updateButton.setVisibilityAllowed(!createMode);
+ formView.add(updateButton);
- // Action : suppression du lot
- Button deleteButton = new SubmittableButton(ACTION_DELETE, new SubmittableButtonEvents() {
- @Override
- public void onProcess() throws DataConstraintException {
- moleculeService.deleteMolecule(moleculeModel.getObject());
- }
+ // Action : suppression du lot
+ Button deleteButton = new SubmittableButton(ACTION_DELETE, new SubmittableButtonEvents() {
+ @Override
+ public void onProcess() throws DataConstraintException {
+ moleculeService.deleteMolecule(moleculeModel.getObject());
+ }
- @Override
- public void onSuccess() {
- successNextPage(ACTION_DELETE);
- callerPage.responsePage((TemplatePage) getPage());
- }
- });
- deleteButton.setVisibilityAllowed(!createMode);
- deleteButton.add(new JSConfirmationBehavior(getString("Confirm")));
- deleteButton.setDefaultFormProcessing(false);
- formView.add(deleteButton);
+ @Override
+ public void onSuccess() {
+ successNextPage(ACTION_DELETE);
+ callerPage.responsePage((TemplatePage) getPage());
+ }
+ });
+ deleteButton.setVisibilityAllowed(!createMode);
+ deleteButton.add(new JSConfirmationBehavior(getString("Confirm")));
+ deleteButton.setDefaultFormProcessing(false);
+ formView.add(deleteButton);
- formView.add(new Link<Void>("Cancel") {
- // Cas où le formulaire est annulé
- @Override
- public void onClick() {
- callerPage.responsePage((TemplatePage) this.getPage());
- }
- });
+ formView.add(new Link<Void>("Cancel") {
+ // Cas où le formulaire est annulé
+ @Override
+ public void onClick() {
+ callerPage.responsePage((TemplatePage) this.getPage());
+ }
+ });
- add(formView);
- }
+ add(formView);
+ }
- /**
- * Init provenance table.
- *
- * @param formView
- */
- private void initProvenanceFields(final Form<Void> formView, final CallerPage currentPage) {
- // Déclaration tableau des provenances
+ /**
+ * Init provenance table.
+ *
+ * @param formView
+ */
+ private void initProvenanceFields(final Form<Void> formView, final CallerPage currentPage) {
+ // Déclaration tableau des provenances
final MarkupContainer provenanceTable = new WebMarkupContainer("Molecule.provenance.Table");
provenanceTable.setOutputMarkupId(true);
@@ -459,24 +459,24 @@
provenanceTable.add(addProvenanceButton);
formView.add(provenanceTable);
- }
+ }
- /**
- * Redirection vers une autre page. Cas où le formulaire est validé
- */
- private void redirect() {
- if (callerPage != null) {
- callerPage.responsePage(this);
- }
- }
+ /**
+ * Redirection vers une autre page. Cas où le formulaire est validé
+ */
+ private void redirect() {
+ if (callerPage != null) {
+ callerPage.responsePage(this);
+ }
+ }
- /**
- * Validate model
- */
- private void validateModel() {
- if (moleculeModel.getObject().getCreateur() == null) {
- moleculeModel.getObject().setCreateur(getSession().getUtilisateur());
- }
- addValidationErrors(validator.validate(moleculeModel.getObject(), getSession().getLocale()));
- }
+ /**
+ * Validate model
+ */
+ private void validateModel() {
+ if (moleculeModel.getObject().getCreateur() == null) {
+ moleculeModel.getObject().setCreateur(getSession().getUtilisateur());
+ }
+ addValidationErrors(validator.validate(moleculeModel.getObject(), getSession().getLocale()));
+ }
}
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/personne/ListPersonnesPage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/personne/ListPersonnesPage.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/personne/ListPersonnesPage.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -64,124 +64,124 @@
@AuthRoles( { AuthRole.ADMIN, AuthRole.USER })
public final class ListPersonnesPage extends TemplatePage {
- /** Logger */
- // private static final Log LOG = LogTools.getLog();
- /** Service : personne */
- @SpringBean
- private PersonneService personneService;
+ /** Logger */
+ // private static final Log LOG = LogTools.getLog();
+ /** Service : personne */
+ @SpringBean
+ private PersonneService personneService;
- /**
- * Constructeur
- */
- public ListPersonnesPage() {
- super(ListPersonnesPage.class);
+ /**
+ * Constructeur
+ */
+ public ListPersonnesPage() {
+ super(ListPersonnesPage.class);
- final CallerPage currentPage = new CallerPage(ListPersonnesPage.class);
+ final CallerPage currentPage = new CallerPage(ListPersonnesPage.class);
- // Lien pour créer une nouvelle personne
- add(new Link<Personne>(getResource() + ".NewPersonne") {
- @Override
- public void onClick() {
- setResponsePage(new ManagePersonnePage(currentPage, true));
- }
+ // Lien pour créer une nouvelle personne
+ add(new Link<Personne>(getResource() + ".NewPersonne") {
+ @Override
+ public void onClick() {
+ setResponsePage(new ManagePersonnePage(currentPage, true));
+ }
- });
+ });
- // On englobe le "DataView" dans un composant neutre que l'on pourra rafraichir quand la liste évoluera
- final MarkupContainer personnesRefresh = new WebMarkupContainer(getResource() + ".Personnes.Refresh");
- personnesRefresh.setOutputMarkupId(true);
- add(personnesRefresh);
+ // On englobe le "DataView" dans un composant neutre que l'on pourra rafraichir quand la liste évoluera
+ final MarkupContainer personnesRefresh = new WebMarkupContainer(getResource() + ".Personnes.Refresh");
+ personnesRefresh.setOutputMarkupId(true);
+ add(personnesRefresh);
- // Liste des personnes
- final List<Personne> personnes;
- if (getSession().getUtilisateur().getTypeDroit() == TypeDroit.ADMINISTRATEUR) {
- personnes = personneService.listPersonnesWithInvalidUsers();
- } else {
- personnes = personneService.listPersonnes();
- }
+ // Liste des personnes
+ final List<Personne> personnes;
+ if (getSession().getUtilisateur().getTypeDroit() == TypeDroit.ADMINISTRATEUR) {
+ personnes = personneService.listPersonnesWithInvalidUsers();
+ } else {
+ personnes = personneService.listPersonnes();
+ }
- final LoadableDetachableSortableListDataProvider<Personne> personnesDataProvider = new LoadableDetachableSortableListDataProvider<Personne>(
- personnes, getSession().getLocale());
+ final LoadableDetachableSortableListDataProvider<Personne> personnesDataProvider = new LoadableDetachableSortableListDataProvider<Personne>(
+ personnes, getSession().getLocale());
- List<IColumn<Personne>> columns = new ArrayList<IColumn<Personne>>();
+ List<IColumn<Personne>> columns = new ArrayList<IColumn<Personne>>();
- columns.add(new LinkableImagePropertyColumn<Personne>("images/read.png", getString("Read"), getString("Read")) {
- @Override
- public void onClick(Item<ICellPopulator<Personne>> item, String componentId, IModel<Personne> model) {
- if (model.getObject() instanceof Utilisateur) {
- setResponsePage(new ReadUtilisateurPage(model.getObject().getIdPersonne(), currentPage));
- } else { // sinon c'est une "Personne"
- assert (model.getObject() instanceof Personne);
- setResponsePage(new ReadPersonnePage(model.getObject().getIdPersonne(), currentPage));
- }
- }
- });
+ columns.add(new LinkableImagePropertyColumn<Personne>("images/read.png", getString("Read"), getString("Read")) {
+ @Override
+ public void onClick(Item<ICellPopulator<Personne>> item, String componentId, IModel<Personne> model) {
+ if (model.getObject() instanceof Utilisateur) {
+ setResponsePage(new ReadUtilisateurPage(model.getObject().getIdPersonne(), currentPage));
+ } else { // sinon c'est une "Personne"
+ assert (model.getObject() instanceof Personne);
+ setResponsePage(new ReadPersonnePage(model.getObject().getIdPersonne(), currentPage));
+ }
+ }
+ });
- columns.add(new PropertyColumn<Personne>(new Model<String>(getString("Personne.nom")), "nom", "nom"));
+ columns.add(new PropertyColumn<Personne>(new Model<String>(getString("Personne.nom")), "nom", "nom"));
- columns.add(new PropertyColumn<Personne>(new Model<String>(getString("Personne.prenom")), "prenom", "prenom"));
+ columns.add(new PropertyColumn<Personne>(new Model<String>(getString("Personne.prenom")), "prenom", "prenom"));
- columns.add(new LinkPropertyColumn<Personne>(new Model<String>(getString("Personne.courriel")), "courriel",
- "courriel", getString("Read")) {
- @Override
- public void onClick(Item<ICellPopulator<Personne>> item, String componentId, IModel<Personne> rowModel) {
- if (rowModel.getObject() instanceof Utilisateur) {
- setResponsePage(new ReadUtilisateurPage(rowModel.getObject().getIdPersonne(), currentPage));
- } else { // sinon c'est une "Personne"
- assert (rowModel.getObject() instanceof Personne);
- setResponsePage(new ReadPersonnePage(rowModel.getObject().getIdPersonne(), currentPage));
- }
- }
- });
+ columns.add(new LinkPropertyColumn<Personne>(new Model<String>(getString("Personne.courriel")), "courriel",
+ "courriel", getString("Read")) {
+ @Override
+ public void onClick(Item<ICellPopulator<Personne>> item, String componentId, IModel<Personne> rowModel) {
+ if (rowModel.getObject() instanceof Utilisateur) {
+ setResponsePage(new ReadUtilisateurPage(rowModel.getObject().getIdPersonne(), currentPage));
+ } else { // sinon c'est une "Personne"
+ assert (rowModel.getObject() instanceof Personne);
+ setResponsePage(new ReadPersonnePage(rowModel.getObject().getIdPersonne(), currentPage));
+ }
+ }
+ });
- columns.add(new AbstractColumn<Personne>(new Model<String>(getString("Utilisateur.typeDroit"))) {
- @Override
- public void populateItem(Item<ICellPopulator<Personne>> item, String componentId, IModel<Personne> rowModel) {
- String typeDroit;
- if (rowModel.getObject() instanceof Utilisateur) {
- Utilisateur util = (Utilisateur) rowModel.getObject();
- typeDroit = enumValueMessage(util.getTypeDroit())
- + (util.isValide() ? "" : " " + getString(getResource() + ".IsNotValid"));
- } else {
- typeDroit = getString(Personne.class.getSimpleName());
- }
- item.add(new Label(componentId, typeDroit));
- }
- });
+ columns.add(new AbstractColumn<Personne>(new Model<String>(getString("Utilisateur.typeDroit"))) {
+ @Override
+ public void populateItem(Item<ICellPopulator<Personne>> item, String componentId, IModel<Personne> rowModel) {
+ String typeDroit;
+ if (rowModel.getObject() instanceof Utilisateur) {
+ Utilisateur util = (Utilisateur) rowModel.getObject();
+ typeDroit = enumValueMessage(util.getTypeDroit())
+ + (util.isValide() ? "" : " " + getString(getResource() + ".IsNotValid"));
+ } else {
+ typeDroit = getString(Personne.class.getSimpleName());
+ }
+ item.add(new Label(componentId, typeDroit));
+ }
+ });
- columns.add(new LinkableImagePropertyColumn<Personne>("images/edit.png", getString("Update"),
- getString("Update")) {
+ columns.add(new LinkableImagePropertyColumn<Personne>("images/edit.png", getString("Update"),
+ getString("Update")) {
- // pas de lien d'édition si l'utilisateur n'a pas les droits
- @Override
- public void populateItem(Item<ICellPopulator<Personne>> item, String componentId, IModel<Personne> model) {
- if (personneService.updateOrDeletePersonneEnabled(model.getObject(), getSession().getUtilisateur())) {
- item.add(new LinkableImagePanel(item, componentId, model));
- } else {
- // label vide
- item.add(new Label(componentId));
- }
- }
+ // pas de lien d'édition si l'utilisateur n'a pas les droits
+ @Override
+ public void populateItem(Item<ICellPopulator<Personne>> item, String componentId, IModel<Personne> model) {
+ if (personneService.updateOrDeletePersonneEnabled(model.getObject(), getSession().getUtilisateur())) {
+ item.add(new LinkableImagePanel(item, componentId, model));
+ } else {
+ // label vide
+ item.add(new Label(componentId));
+ }
+ }
- @Override
- public void onClick(Item<ICellPopulator<Personne>> item, String componentId, IModel<Personne> model) {
- if (model.getObject() instanceof Utilisateur) {
- // Si l'utilisateur est l'utilisateur "courant", alors on le redirige vers la page de mise à
- // jour de son profil sinon vers la page de gestion d'un utilisateur
- setResponsePage(model.getObject().getIdPersonne().equals(
- getSession().getUtilisateur().getIdPersonne()) ? new UpdateUtilisateurPage(currentPage)
- : new ManageUtilisateurPage(model.getObject().getIdPersonne(), currentPage));
- } else { // sinon c'est une "Personne"
- assert (model.getObject() instanceof Personne);
- setResponsePage(new ManagePersonnePage(model.getObject().getIdPersonne(), currentPage));
- }
- }
- });
+ @Override
+ public void onClick(Item<ICellPopulator<Personne>> item, String componentId, IModel<Personne> model) {
+ if (model.getObject() instanceof Utilisateur) {
+ // Si l'utilisateur est l'utilisateur "courant", alors on le redirige vers la page de mise à
+ // jour de son profil sinon vers la page de gestion d'un utilisateur
+ setResponsePage(model.getObject().getIdPersonne().equals(
+ getSession().getUtilisateur().getIdPersonne()) ? new UpdateUtilisateurPage(currentPage)
+ : new ManageUtilisateurPage(model.getObject().getIdPersonne(), currentPage));
+ } else { // sinon c'est une "Personne"
+ assert (model.getObject() instanceof Personne);
+ setResponsePage(new ManagePersonnePage(model.getObject().getIdPersonne(), currentPage));
+ }
+ }
+ });
- final DataTable<Personne> personnesDataTable = new AjaxFallbackDefaultDataTable<Personne>(
- "ListPersonnesPage.Personnes", columns, personnesDataProvider, WebContext.ROWS_PER_PAGE);
+ final DataTable<Personne> personnesDataTable = new AjaxFallbackDefaultDataTable<Personne>(
+ "ListPersonnesPage.Personnes", columns, personnesDataProvider, WebContext.ROWS_PER_PAGE);
- personnesRefresh.add(personnesDataTable);
+ personnesRefresh.add(personnesDataTable);
- }
+ }
}
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/personne/ManagePersonnePage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/personne/ManagePersonnePage.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/personne/ManagePersonnePage.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -55,206 +55,206 @@
@AuthRoles({ AuthRole.ADMIN, AuthRole.USER })
public final class ManagePersonnePage extends TemplatePage {
- /** Action : create */
- private static final String ACTION_CREATE = "Create";
+ /** Action : create */
+ private static final String ACTION_CREATE = "Create";
- /** Action : create utilisateur */
- private static final String ACTION_CREATE_UTILISATEUR = "CreateUtilisateur";
+ /** Action : create utilisateur */
+ private static final String ACTION_CREATE_UTILISATEUR = "CreateUtilisateur";
- /** Action : delete */
- public static final String ACTION_DELETE = "Delete";
+ /** Action : delete */
+ public static final String ACTION_DELETE = "Delete";
- /** Action : update */
- private static final String ACTION_UPDATE = "Update";
+ /** Action : update */
+ private static final String ACTION_UPDATE = "Update";
- /** Logger */
- private static final Log LOG = LogTools.getLog();
+ /** Logger */
+ private static final Log LOG = LogTools.getLog();
- /** Page appelante */
- private final CallerPage callerPage;
+ /** Page appelante */
+ private final CallerPage callerPage;
- /** Saisie multiple */
- private boolean multipleEntry;
+ /** Saisie multiple */
+ private boolean multipleEntry;
- /** Modèle : personne */
- private final IModel<Personne> personneModel;
+ /** Modèle : personne */
+ private final IModel<Personne> personneModel;
- /** Service : personne */
- @SpringBean
- private PersonneService personneService;
+ /** Service : personne */
+ @SpringBean
+ private PersonneService personneService;
- /**
- * Constructeur (mode création)
- * @param callerPage Page appelante
- * @param multipleEntry Saisie multiple
- */
- public ManagePersonnePage(CallerPage callerPage, boolean multipleEntry) {
- this(null, null, callerPage, multipleEntry);
- }
+ /**
+ * Constructeur (mode création)
+ * @param callerPage Page appelante
+ * @param multipleEntry Saisie multiple
+ */
+ public ManagePersonnePage(CallerPage callerPage, boolean multipleEntry) {
+ this(null, null, callerPage, multipleEntry);
+ }
- /**
- * Constructeur (mode édition)
- * @param idPersonne ID lot
- * @param callerPage Page appelante
- */
- public ManagePersonnePage(Integer idPersonne, CallerPage callerPage) {
- this(idPersonne, null, callerPage, false);
- }
+ /**
+ * Constructeur (mode édition)
+ * @param idPersonne ID lot
+ * @param callerPage Page appelante
+ */
+ public ManagePersonnePage(Integer idPersonne, CallerPage callerPage) {
+ this(idPersonne, null, callerPage, false);
+ }
- /**
- * Constructeur (mode saisie de la personne suivante)
- * @param personne Personne
- * @param callerPage Page appelante
- */
- public ManagePersonnePage(Personne personne, CallerPage callerPage) {
- this(null, personne, callerPage, true);
- }
+ /**
+ * Constructeur (mode saisie de la personne suivante)
+ * @param personne Personne
+ * @param callerPage Page appelante
+ */
+ public ManagePersonnePage(Personne personne, CallerPage callerPage) {
+ this(null, personne, callerPage, true);
+ }
- /**
- * Constructeur. Si idPersonne et personne sont null, on créée une nouveau personne. Si idPersonne est renseigné, on
- * édite la personne correspondante. Si personne est renseignée, on créée une nouvelle personne à partir des
- * informations qu'elle contient.
- * @param idPersonne ID personne
- * @param personne Personne
- * @param callerPage Page appelante
- * @param multipleEntry Saisie multiple
- */
- private ManagePersonnePage(Integer idPersonne, Personne personne, final CallerPage callerPage, boolean multipleEntry) {
- super(ManagePersonnePage.class);
- assert idPersonne == null || personne == null;
- this.callerPage = callerPage;
- this.multipleEntry = multipleEntry;
+ /**
+ * Constructeur. Si idPersonne et personne sont null, on créée une nouveau personne. Si idPersonne est renseigné, on
+ * édite la personne correspondante. Si personne est renseignée, on créée une nouvelle personne à partir des
+ * informations qu'elle contient.
+ * @param idPersonne ID personne
+ * @param personne Personne
+ * @param callerPage Page appelante
+ * @param multipleEntry Saisie multiple
+ */
+ private ManagePersonnePage(Integer idPersonne, Personne personne, final CallerPage callerPage, boolean multipleEntry) {
+ super(ManagePersonnePage.class);
+ assert idPersonne == null || personne == null;
+ this.callerPage = callerPage;
+ this.multipleEntry = multipleEntry;
- // Initialisation du modèle
- try {
- personneModel = new Model<Personne>(idPersonne == null && personne == null ? new Personne()
- : personne != null ? personne : personneService.loadPersonne(idPersonne));
- } catch (DataNotFoundException e) {
- LOG.error(e.getMessage(), e);
- throw new UnexpectedException(e);
- }
+ // Initialisation du modèle
+ try {
+ personneModel = new Model<Personne>(idPersonne == null && personne == null ? new Personne()
+ : personne != null ? personne : personneService.loadPersonne(idPersonne));
+ } catch (DataNotFoundException e) {
+ LOG.error(e.getMessage(), e);
+ throw new UnexpectedException(e);
+ }
- boolean createMode = idPersonne == null;
- final Form<Personne> formView = new Form<Personne>("Form", personneModel);
+ boolean createMode = idPersonne == null;
+ final Form<Personne> formView = new Form<Personne>("Form", personneModel);
- final ManagePersonnePanel personnePanel = new ManagePersonnePanel("ManagePersonnePanel", personneModel);
- formView.add(personnePanel);
+ final ManagePersonnePanel personnePanel = new ManagePersonnePanel("ManagePersonnePanel", personneModel);
+ formView.add(personnePanel);
- // Action : création de la personne
- Button createButton = new SubmittableButton(ACTION_CREATE, new SubmittableButtonEvents() {
- @Override
- public void onProcess() throws DataConstraintException {
- personneService.createPersonne(personneModel.getObject());
- }
+ // Action : création de la personne
+ Button createButton = new SubmittableButton(ACTION_CREATE, new SubmittableButtonEvents() {
+ @Override
+ public void onProcess() throws DataConstraintException {
+ personneService.createPersonne(personneModel.getObject());
+ }
- @Override
- public void onSuccess() {
- successNextPage(ACTION_CREATE);
- redirect();
- }
+ @Override
+ public void onSuccess() {
+ successNextPage(ACTION_CREATE);
+ redirect();
+ }
- @Override
- public void onValidate() {
- personnePanel.validate();
- }
- });
- createButton.setVisibilityAllowed(createMode);
- formView.add(createButton);
+ @Override
+ public void onValidate() {
+ personnePanel.validate();
+ }
+ });
+ createButton.setVisibilityAllowed(createMode);
+ formView.add(createButton);
- // Action : mise à jour de la personne
- Button updateButton = new SubmittableButton(ACTION_UPDATE, new SubmittableButtonEvents() {
- @Override
- public void onProcess() throws DataConstraintException {
- personneService.updatePersonne(personneModel.getObject());
- }
+ // Action : mise à jour de la personne
+ Button updateButton = new SubmittableButton(ACTION_UPDATE, new SubmittableButtonEvents() {
+ @Override
+ public void onProcess() throws DataConstraintException {
+ personneService.updatePersonne(personneModel.getObject());
+ }
- @Override
- public void onSuccess() {
- successNextPage(ACTION_UPDATE);
- redirect();
- }
+ @Override
+ public void onSuccess() {
+ successNextPage(ACTION_UPDATE);
+ redirect();
+ }
- @Override
- public void onValidate() {
- personnePanel.validate();
- }
- });
- updateButton.setVisibilityAllowed(!createMode);
- formView.add(updateButton);
+ @Override
+ public void onValidate() {
+ personnePanel.validate();
+ }
+ });
+ updateButton.setVisibilityAllowed(!createMode);
+ formView.add(updateButton);
- // Action : transformation de la personne en utilisateur
- Button createUtilisateurButton = new SubmittableButton(ACTION_CREATE_UTILISATEUR,
- new SubmittableButtonEvents() {
- @Override
- public void onProcess() throws EmailException, DataConstraintException {
- personneService.updateAndCreateUtilisateur(personneModel.getObject());
- }
+ // Action : transformation de la personne en utilisateur
+ Button createUtilisateurButton = new SubmittableButton(ACTION_CREATE_UTILISATEUR,
+ new SubmittableButtonEvents() {
+ @Override
+ public void onProcess() throws EmailException, DataConstraintException {
+ personneService.updateAndCreateUtilisateur(personneModel.getObject());
+ }
- @Override
- public void onSuccess() {
- successNextPage(ACTION_CREATE_UTILISATEUR);
- // redirect all the time to ReadUtilisateur
- }
+ @Override
+ public void onSuccess() {
+ successNextPage(ACTION_CREATE_UTILISATEUR);
+ // redirect all the time to ReadUtilisateur
+ }
- @Override
- public void onValidate() {
- personnePanel.validate();
- }
- });
- createUtilisateurButton.setVisibilityAllowed(!createMode
- && getSession().getUtilisateur().getTypeDroit() == TypeDroit.ADMINISTRATEUR);
- formView.add(createUtilisateurButton);
+ @Override
+ public void onValidate() {
+ personnePanel.validate();
+ }
+ });
+ createUtilisateurButton.setVisibilityAllowed(!createMode
+ && getSession().getUtilisateur().getTypeDroit() == TypeDroit.ADMINISTRATEUR);
+ formView.add(createUtilisateurButton);
- // Action : suppression de la personne
- Button deleteButton = new SubmittableButton(ACTION_DELETE, new SubmittableButtonEvents() {
- @Override
- public void onProcess() throws DataConstraintException {
- personneService.deletePersonne(personneModel.getObject());
- }
+ // Action : suppression de la personne
+ Button deleteButton = new SubmittableButton(ACTION_DELETE, new SubmittableButtonEvents() {
+ @Override
+ public void onProcess() throws DataConstraintException {
+ personneService.deletePersonne(personneModel.getObject());
+ }
- @Override
- public void onSuccess() {
- successNextPage(ACTION_DELETE);
- redirect();
- }
- });
- deleteButton.setVisibilityAllowed(!createMode);
- deleteButton.setDefaultFormProcessing(false);
- deleteButton.add(new JSConfirmationBehavior(getString("Confirm")));
- formView.add(deleteButton);
+ @Override
+ public void onSuccess() {
+ successNextPage(ACTION_DELETE);
+ redirect();
+ }
+ });
+ deleteButton.setVisibilityAllowed(!createMode);
+ deleteButton.setDefaultFormProcessing(false);
+ deleteButton.add(new JSConfirmationBehavior(getString("Confirm")));
+ formView.add(deleteButton);
- formView.add(new Link<Void>("Cancel") {
- // Cas où le formulaire est annulé
- @Override
- public void onClick() {
- if (callerPage != null) {
- callerPage.responsePage((TemplatePage) this.getPage());
- }
- }
- });
+ formView.add(new Link<Void>("Cancel") {
+ // Cas où le formulaire est annulé
+ @Override
+ public void onClick() {
+ if (callerPage != null) {
+ callerPage.responsePage((TemplatePage) this.getPage());
+ }
+ }
+ });
- add(formView);
- }
+ add(formView);
+ }
- /**
- * Redirection vers une autre page. Cas où le formulaire est validé
- */
- private void redirect() {
- if (multipleEntry) {
- // Redirection vers l'écran de saisie d'un nouveau lot, en fournissant déjà quelques données
- Personne nextPersonne = new Personne();
- nextPersonne.setOrganisme(personneModel.getObject().getOrganisme());
- nextPersonne.setAdressePostale(personneModel.getObject().getAdressePostale());
- nextPersonne.setCodePostal(personneModel.getObject().getCodePostal());
- nextPersonne.setVille(personneModel.getObject().getVille());
- nextPersonne.setCodePays(personneModel.getObject().getCodePays());
- setResponsePage(new ManagePersonnePage(nextPersonne, callerPage));
- } else if (callerPage != null) {
- // On passe l'id de la personne associée à cette page, en paramètre de la prochaine page, pour lui permettre
- // de
- // l'exploiter si besoin
- callerPage.addPageParameter(Personne.class.getSimpleName(), personneModel.getObject().getIdPersonne());
- callerPage.responsePage(this);
- }
- }
+ /**
+ * Redirection vers une autre page. Cas où le formulaire est validé
+ */
+ private void redirect() {
+ if (multipleEntry) {
+ // Redirection vers l'écran de saisie d'un nouveau lot, en fournissant déjà quelques données
+ Personne nextPersonne = new Personne();
+ nextPersonne.setOrganisme(personneModel.getObject().getOrganisme());
+ nextPersonne.setAdressePostale(personneModel.getObject().getAdressePostale());
+ nextPersonne.setCodePostal(personneModel.getObject().getCodePostal());
+ nextPersonne.setVille(personneModel.getObject().getVille());
+ nextPersonne.setCodePays(personneModel.getObject().getCodePays());
+ setResponsePage(new ManagePersonnePage(nextPersonne, callerPage));
+ } else if (callerPage != null) {
+ // On passe l'id de la personne associée à cette page, en paramètre de la prochaine page, pour lui permettre
+ // de
+ // l'exploiter si besoin
+ callerPage.addPageParameter(Personne.class.getSimpleName(), personneModel.getObject().getIdPersonne());
+ callerPage.responsePage(this);
+ }
+ }
}
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/personne/ReadPersonnePage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/personne/ReadPersonnePage.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/personne/ReadPersonnePage.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -46,92 +46,92 @@
*/
public final class ReadPersonnePage extends TemplatePage {
- /** Action : delete */
- public static final String ACTION_DELETE = "Delete";
+ /** Action : delete */
+ public static final String ACTION_DELETE = "Delete";
- /** Logger */
- // private static final Log LOG = LogTools.getLog();
- /** Page appelante */
- private final CallerPage callerPage;
+ /** Logger */
+ // private static final Log LOG = LogTools.getLog();
+ /** Page appelante */
+ private final CallerPage callerPage;
- /** Modèle : personne */
- private final IModel<Personne> personneModel;
+ /** Modèle : personne */
+ private final IModel<Personne> personneModel;
- /** Service : personne */
- @SpringBean
- private PersonneService personneService;
+ /** Service : personne */
+ @SpringBean
+ private PersonneService personneService;
- /**
- * Constructeur
- * @param idPersonne ID personne
- * @param callerPage Page appelante
- */
- public ReadPersonnePage(Integer idPersonne, CallerPage callerPage) {
- super(ReadPersonnePage.class);
+ /**
+ * Constructeur
+ * @param idPersonne ID personne
+ * @param callerPage Page appelante
+ */
+ public ReadPersonnePage(Integer idPersonne, CallerPage callerPage) {
+ super(ReadPersonnePage.class);
- final CallerPage currentPage = new CallerPage((TemplatePage) getPage());
- this.callerPage = callerPage;
+ final CallerPage currentPage = new CallerPage((TemplatePage) getPage());
+ this.callerPage = callerPage;
- // Initialisation du modèle
- personneModel = new GenericLoadableDetachableModel<Personne>(Personne.class, idPersonne);
+ // Initialisation du modèle
+ personneModel = new GenericLoadableDetachableModel<Personne>(Personne.class, idPersonne);
- final Personne personne = personneModel.getObject();
+ final Personne personne = personneModel.getObject();
- // Ajout du formulaire pour les actions
- final Form<Personne> formView = new Form<Personne>("Form", personneModel);
+ // Ajout du formulaire pour les actions
+ final Form<Personne> formView = new Form<Personne>("Form", personneModel);
- // Ajout du panel ReadPersonnePanel
- final ReadPersonnePanel personnePanel = new ReadPersonnePanel("ReadPersonnePanel", personneModel);
- add(personnePanel);
+ // Ajout du panel ReadPersonnePanel
+ final ReadPersonnePanel personnePanel = new ReadPersonnePanel("ReadPersonnePanel", personneModel);
+ add(personnePanel);
- // Action : mise à jour (redirection vers le formulaire)
- Link<Personne> updateLink = new Link<Personne>(getResource() + ".Personne.Update",
- new Model<Personne>(personne)) {
- @Override
- public void onClick() {
- setResponsePage(new ManagePersonnePage(getModelObject().getIdPersonne(), currentPage));
- }
- };
- updateLink.setVisibilityAllowed(personneService.updateOrDeletePersonneEnabled(personne, getSession()
- .getUtilisateur()));
- formView.add(updateLink);
+ // Action : mise à jour (redirection vers le formulaire)
+ Link<Personne> updateLink = new Link<Personne>(getResource() + ".Personne.Update",
+ new Model<Personne>(personne)) {
+ @Override
+ public void onClick() {
+ setResponsePage(new ManagePersonnePage(getModelObject().getIdPersonne(), currentPage));
+ }
+ };
+ updateLink.setVisibilityAllowed(personneService.updateOrDeletePersonneEnabled(personne, getSession()
+ .getUtilisateur()));
+ formView.add(updateLink);
- // Action : retour à la page précédente
- formView.add(new Link<Void>(getResource() + ".Personne.Back") {
- @Override
- public void onClick() {
- redirect();
- }
- });
+ // Action : retour à la page précédente
+ formView.add(new Link<Void>(getResource() + ".Personne.Back") {
+ @Override
+ public void onClick() {
+ redirect();
+ }
+ });
- // Action : suppression de la personne
- Button deleteButton = new SubmittableButton(ACTION_DELETE, ManagePersonnePage.class,
- new SubmittableButtonEvents() {
- @Override
- public void onProcess() throws DataConstraintException {
- personneService.deletePersonne(personne);
- }
+ // Action : suppression de la personne
+ Button deleteButton = new SubmittableButton(ACTION_DELETE, ManagePersonnePage.class,
+ new SubmittableButtonEvents() {
+ @Override
+ public void onProcess() throws DataConstraintException {
+ personneService.deletePersonne(personne);
+ }
- @Override
- public void onSuccess() {
- successNextPage(ManagePersonnePage.class, ACTION_DELETE);
- redirect();
- }
- });
- deleteButton.setVisibilityAllowed(personneService.updateOrDeletePersonneEnabled(personne, getSession()
- .getUtilisateur()));
- deleteButton.add(new JSConfirmationBehavior(getString("Confirm")));
- formView.add(deleteButton);
- add(formView);
- }
+ @Override
+ public void onSuccess() {
+ successNextPage(ManagePersonnePage.class, ACTION_DELETE);
+ redirect();
+ }
+ });
+ deleteButton.setVisibilityAllowed(personneService.updateOrDeletePersonneEnabled(personne, getSession()
+ .getUtilisateur()));
+ deleteButton.add(new JSConfirmationBehavior(getString("Confirm")));
+ formView.add(deleteButton);
+ add(formView);
+ }
- /**
- * Redirection vers une autre page
- */
- private void redirect() {
- // On passe la personne associée à cette page, en paramètre de la prochaine page, pour lui permettre de
- // l'exploiter si besoin
- callerPage.addPageParameter(Personne.class.getSimpleName(), personneModel.getObject());
- callerPage.responsePage(this);
- }
+ /**
+ * Redirection vers une autre page
+ */
+ private void redirect() {
+ // On passe la personne associée à cette page, en paramètre de la prochaine page, pour lui permettre de
+ // l'exploiter si besoin
+ callerPage.addPageParameter(Personne.class.getSimpleName(), personneModel.getObject());
+ callerPage.responsePage(this);
+ }
}
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/personne/panels/ManagePersonnePanel.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/personne/panels/ManagePersonnePanel.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/personne/panels/ManagePersonnePanel.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -48,51 +48,51 @@
*/
public final class ManagePersonnePanel extends Panel {
- /** Model validateur */
- @SpringBean(name = "webModelValidator") private ModelValidator validator;
+ /** Model validateur */
+ @SpringBean(name = "webModelValidator") private ModelValidator validator;
- /** Services : personne */
- @SpringBean
- private PersonneService personneService;
+ /** Services : personne */
+ @SpringBean
+ private PersonneService personneService;
- /**
- * Constructeur
- * @param id ID
- * @param personneModel Modèle
- */
- public ManagePersonnePanel(String id, IModel<? extends Personne> personneModel) {
- super(id, personneModel);
+ /**
+ * Constructeur
+ * @param id ID
+ * @param personneModel Modèle
+ */
+ public ManagePersonnePanel(String id, IModel<? extends Personne> personneModel) {
+ super(id, personneModel);
- // liste des organismes suggérés à la saisie
- final List<String> organismes = personneService.listPersonneOrganismes();
+ // liste des organismes suggérés à la saisie
+ final List<String> organismes = personneService.listPersonneOrganismes();
- add(new TextField<String>("Personne.prenom", new PropertyModel<String>(personneModel, "prenom")));
- add(new TextField<String>("Personne.nom", new PropertyModel<String>(personneModel, "nom")));
- add(new AutoCompleteTextFieldString("Personne.organisme",
- new PropertyModel<String>(personneModel, "organisme"), organismes, ComparisonMode.CONTAINS));
- add(new TextField<String>("Personne.fonction", new PropertyModel<String>(personneModel, "fonction")));
- add(new TextField<String>("Personne.tel", new PropertyModel<String>(personneModel, "tel")));
- add(new TextField<String>("Personne.fax", new PropertyModel<String>(personneModel, "fax")));
- add(new TextField<String>("Personne.courriel", new PropertyModel<String>(personneModel, "courriel")));
- add(new TextArea<String>("Personne.adressePostale", new PropertyModel<String>(personneModel, "adressePostale")));
- add(new TextField<String>("Personne.codePostal", new PropertyModel<String>(personneModel, "codePostal")));
- add(new TextField<String>("Personne.ville", new PropertyModel<String>(personneModel, "ville")));
- add(new DropDownChoice<String>("Personne.codePays", new PropertyModel<String>(personneModel, "codePays"),
- WebContext.COUNTRY_CODES.get(getSession().getLocale()), new MapChoiceRenderer<String, String>(
- WebContext.COUNTRIES.get(getSession().getLocale()))));
- if (personneModel.getObject().getCodePays() == null) {
- personneModel.getObject().setCodePays(
- WebContext.COUNTRIES.get(getSession().getLocale()).entrySet().iterator().next().getKey());
- }
+ add(new TextField<String>("Personne.prenom", new PropertyModel<String>(personneModel, "prenom")));
+ add(new TextField<String>("Personne.nom", new PropertyModel<String>(personneModel, "nom")));
+ add(new AutoCompleteTextFieldString("Personne.organisme",
+ new PropertyModel<String>(personneModel, "organisme"), organismes, ComparisonMode.CONTAINS));
+ add(new TextField<String>("Personne.fonction", new PropertyModel<String>(personneModel, "fonction")));
+ add(new TextField<String>("Personne.tel", new PropertyModel<String>(personneModel, "tel")));
+ add(new TextField<String>("Personne.fax", new PropertyModel<String>(personneModel, "fax")));
+ add(new TextField<String>("Personne.courriel", new PropertyModel<String>(personneModel, "courriel")));
+ add(new TextArea<String>("Personne.adressePostale", new PropertyModel<String>(personneModel, "adressePostale")));
+ add(new TextField<String>("Personne.codePostal", new PropertyModel<String>(personneModel, "codePostal")));
+ add(new TextField<String>("Personne.ville", new PropertyModel<String>(personneModel, "ville")));
+ add(new DropDownChoice<String>("Personne.codePays", new PropertyModel<String>(personneModel, "codePays"),
+ WebContext.COUNTRY_CODES.get(getSession().getLocale()), new MapChoiceRenderer<String, String>(
+ WebContext.COUNTRIES.get(getSession().getLocale()))));
+ if (personneModel.getObject().getCodePays() == null) {
+ personneModel.getObject().setCodePays(
+ WebContext.COUNTRIES.get(getSession().getLocale()).entrySet().iterator().next().getKey());
+ }
- }
+ }
- /**
- * Validation
- */
- public void validate() {
- ((TemplatePage) getPage()).addValidationErrors(validator.validate((Personne) getDefaultModelObject(),
- getSession().getLocale(), "prenom", "nom", "organisme", "fonction", "tel", "fax", "courriel",
- "adressePostale", "codePostal", "ville", "codePays"));
- }
+ /**
+ * Validation
+ */
+ public void validate() {
+ ((TemplatePage) getPage()).addValidationErrors(validator.validate((Personne) getDefaultModelObject(),
+ getSession().getLocale(), "prenom", "nom", "organisme", "fonction", "tel", "fax", "courriel",
+ "adressePostale", "codePostal", "ville", "codePays"));
+ }
}
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/personne/panels/ReadPersonnePanel.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/personne/panels/ReadPersonnePanel.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/personne/panels/ReadPersonnePanel.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -39,34 +39,34 @@
*/
public final class ReadPersonnePanel extends Panel {
- /**
- * Constructeur
- * @param id ID
- * @param personneModel Modèle
- */
- public ReadPersonnePanel(String id, IModel<? extends Personne> personneModel) {
- super(id, personneModel);
- add(new Label("Personne.prenom", new PropertyModel<String>(personneModel, "prenom"))
- .add(new ReplaceEmptyLabelBehavior()));
- add(new Label("Personne.nom", new PropertyModel<String>(personneModel, "nom"))
- .add(new ReplaceEmptyLabelBehavior()));
- add(new Label("Personne.organisme", new PropertyModel<String>(personneModel, "organisme"))
- .add(new ReplaceEmptyLabelBehavior()));
- add(new Label("Personne.fonction", new PropertyModel<String>(personneModel, "fonction"))
- .add(new ReplaceEmptyLabelBehavior()));
- add(new Label("Personne.tel", new PropertyModel<String>(personneModel, "tel"))
- .add(new ReplaceEmptyLabelBehavior()));
- add(new Label("Personne.fax", new PropertyModel<String>(personneModel, "fax"))
- .add(new ReplaceEmptyLabelBehavior()));
- add(new Label("Personne.courriel", new PropertyModel<String>(personneModel, "courriel"))
- .add(new ReplaceEmptyLabelBehavior()));
- add(new MultiLineLabel("Personne.adressePostale", new PropertyModel<String>(personneModel, "adressePostale"))
- .add(new ReplaceEmptyLabelBehavior()));
- add(new Label("Personne.codePostal", new PropertyModel<String>(personneModel, "codePostal"))
- .add(new ReplaceEmptyLabelBehavior()));
- add(new Label("Personne.ville", new PropertyModel<String>(personneModel, "ville"))
- .add(new ReplaceEmptyLabelBehavior()));
- add(new Label("Personne.codePays", new DisplayMapValuePropertyModel<String>(personneModel, "codePays",
- WebContext.COUNTRIES.get(getSession().getLocale()))).add(new ReplaceEmptyLabelBehavior()));
- }
+ /**
+ * Constructeur
+ * @param id ID
+ * @param personneModel Modèle
+ */
+ public ReadPersonnePanel(String id, IModel<? extends Personne> personneModel) {
+ super(id, personneModel);
+ add(new Label("Personne.prenom", new PropertyModel<String>(personneModel, "prenom"))
+ .add(new ReplaceEmptyLabelBehavior()));
+ add(new Label("Personne.nom", new PropertyModel<String>(personneModel, "nom"))
+ .add(new ReplaceEmptyLabelBehavior()));
+ add(new Label("Personne.organisme", new PropertyModel<String>(personneModel, "organisme"))
+ .add(new ReplaceEmptyLabelBehavior()));
+ add(new Label("Personne.fonction", new PropertyModel<String>(personneModel, "fonction"))
+ .add(new ReplaceEmptyLabelBehavior()));
+ add(new Label("Personne.tel", new PropertyModel<String>(personneModel, "tel"))
+ .add(new ReplaceEmptyLabelBehavior()));
+ add(new Label("Personne.fax", new PropertyModel<String>(personneModel, "fax"))
+ .add(new ReplaceEmptyLabelBehavior()));
+ add(new Label("Personne.courriel", new PropertyModel<String>(personneModel, "courriel"))
+ .add(new ReplaceEmptyLabelBehavior()));
+ add(new MultiLineLabel("Personne.adressePostale", new PropertyModel<String>(personneModel, "adressePostale"))
+ .add(new ReplaceEmptyLabelBehavior()));
+ add(new Label("Personne.codePostal", new PropertyModel<String>(personneModel, "codePostal"))
+ .add(new ReplaceEmptyLabelBehavior()));
+ add(new Label("Personne.ville", new PropertyModel<String>(personneModel, "ville"))
+ .add(new ReplaceEmptyLabelBehavior()));
+ add(new Label("Personne.codePays", new DisplayMapValuePropertyModel<String>(personneModel, "codePays",
+ WebContext.COUNTRIES.get(getSession().getLocale()))).add(new ReplaceEmptyLabelBehavior()));
+ }
}
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/purification/ListPurificationsPage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/purification/ListPurificationsPage.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/purification/ListPurificationsPage.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -64,116 +64,116 @@
@AuthRoles({ AuthRole.ADMIN, AuthRole.USER })
public final class ListPurificationsPage extends TemplatePage {
- /** Logger */
- // private static final Log LOG = LogTools.getLog();
- /** Service : manipPurification */
- @SpringBean
- private PurificationService purificationService;
+ /** Logger */
+ // private static final Log LOG = LogTools.getLog();
+ /** Service : manipPurification */
+ @SpringBean
+ private PurificationService purificationService;
- /**
- * Constructeur
- */
- public ListPurificationsPage() {
- super(ListPurificationsPage.class);
+ /**
+ * Constructeur
+ */
+ public ListPurificationsPage() {
+ super(ListPurificationsPage.class);
- final CallerPage currentPage = new CallerPage(ListPurificationsPage.class);
+ final CallerPage currentPage = new CallerPage(ListPurificationsPage.class);
- add(new Link<Void>(getResource() + ".NewPurification") {
- @Override
- public void onClick() {
- setResponsePage(new ManagePurificationPage(currentPage, true));
- }
- });
+ add(new Link<Void>(getResource() + ".NewPurification") {
+ @Override
+ public void onClick() {
+ setResponsePage(new ManagePurificationPage(currentPage, true));
+ }
+ });
- // On englobe le "DataView" dans un composant neutre que l'on pourra
- // rafraichir quand la liste évoluera
- final MarkupContainer purificationsRefresh = new WebMarkupContainer(getResource() + ".Purifications.Refresh");
- purificationsRefresh.setOutputMarkupId(true);
- add(purificationsRefresh);
+ // On englobe le "DataView" dans un composant neutre que l'on pourra
+ // rafraichir quand la liste évoluera
+ final MarkupContainer purificationsRefresh = new WebMarkupContainer(getResource() + ".Purifications.Refresh");
+ purificationsRefresh.setOutputMarkupId(true);
+ add(purificationsRefresh);
- // Liste des Purifications
- final List<Purification> purifications = purificationService.listPurifications(getSession().getUtilisateur());
- LoadableDetachableSortableListDataProvider<Purification> purificationsDataProvider = new LoadableDetachableSortableListDataProvider<Purification>(
- purifications, getSession().getLocale());
+ // Liste des Purifications
+ final List<Purification> purifications = purificationService.listPurifications(getSession().getUtilisateur());
+ LoadableDetachableSortableListDataProvider<Purification> purificationsDataProvider = new LoadableDetachableSortableListDataProvider<Purification>(
+ purifications, getSession().getLocale());
- List<IColumn<Purification>> columns = new ArrayList<IColumn<Purification>>();
+ List<IColumn<Purification>> columns = new ArrayList<IColumn<Purification>>();
- columns.add(new LinkableImagePropertyColumn<Purification>("images/read.png", getString("Read"),
- getString("Read")) {
- @Override
- public void onClick(Item<ICellPopulator<Purification>> item, String componentId, IModel<Purification> model) {
- setResponsePage(new ReadPurificationPage(model.getObject().getIdPurification(), currentPage));
- }
- });
+ columns.add(new LinkableImagePropertyColumn<Purification>("images/read.png", getString("Read"),
+ getString("Read")) {
+ @Override
+ public void onClick(Item<ICellPopulator<Purification>> item, String componentId, IModel<Purification> model) {
+ setResponsePage(new ReadPurificationPage(model.getObject().getIdPurification(), currentPage));
+ }
+ });
- columns.add(new LinkPropertyColumn<Purification>(new Model<String>(getString("Extraction.lot")), "lotSource",
- "lotSource", getString("Read")) {
- @Override
- public void onClick(Item<ICellPopulator<Purification>> item, String componentId, IModel<Purification> model) {
- setResponsePage(new ReadLotPage(model.getObject().getLotSource().getIdLot(), currentPage));
- }
- });
+ columns.add(new LinkPropertyColumn<Purification>(new Model<String>(getString("Extraction.lot")), "lotSource",
+ "lotSource", getString("Read")) {
+ @Override
+ public void onClick(Item<ICellPopulator<Purification>> item, String componentId, IModel<Purification> model) {
+ setResponsePage(new ReadLotPage(model.getObject().getLotSource().getIdLot(), currentPage));
+ }
+ });
- columns.add(new LinkProduitPropertyColumn<Purification>(
- new Model<String>(getString("ResultatTestBio.produit")), "produit", "produit", (TemplatePage) getPage()) {
- @Override
- public void onClickIfExtrait(Extrait extrait) {
- setResponsePage(new ReadExtractionPage(extrait.getExtraction().getIdExtraction(), currentPage));
- }
+ columns.add(new LinkProduitPropertyColumn<Purification>(
+ new Model<String>(getString("ResultatTestBio.produit")), "produit", "produit", (TemplatePage) getPage()) {
+ @Override
+ public void onClickIfExtrait(Extrait extrait) {
+ setResponsePage(new ReadExtractionPage(extrait.getExtraction().getIdExtraction(), currentPage));
+ }
- @Override
- public void onClickIfFraction(Fraction fraction) {
- setResponsePage(new ReadPurificationPage(fraction.getPurification().getIdPurification(), currentPage));
- }
- });
+ @Override
+ public void onClickIfFraction(Fraction fraction) {
+ setResponsePage(new ReadPurificationPage(fraction.getPurification().getIdPurification(), currentPage));
+ }
+ });
- columns.add(new LinkPropertyColumn<Purification>(new Model<String>(getString("Purification.ref")), "ref",
- "ref", getString("Read")) {
- @Override
- public void onClick(Item<ICellPopulator<Purification>> item, String componentId, IModel<Purification> model) {
- setResponsePage(new ReadPurificationPage(model.getObject().getIdPurification(), currentPage));
- }
- });
+ columns.add(new LinkPropertyColumn<Purification>(new Model<String>(getString("Purification.ref")), "ref",
+ "ref", getString("Read")) {
+ @Override
+ public void onClick(Item<ICellPopulator<Purification>> item, String componentId, IModel<Purification> model) {
+ setResponsePage(new ReadPurificationPage(model.getObject().getIdPurification(), currentPage));
+ }
+ });
- columns.add(new ShortDatePropertyColumn<Purification>(new Model<String>(getString("Purification.date")),
- "date", "date", getLocale()));
+ columns.add(new ShortDatePropertyColumn<Purification>(new Model<String>(getString("Purification.date")),
+ "date", "date", getLocale()));
- columns.add(new PropertyColumn<Purification>(new Model<String>(getString("Purification.methode2")), "methode",
- "methode"));
+ columns.add(new PropertyColumn<Purification>(new Model<String>(getString("Purification.methode2")), "methode",
+ "methode"));
- columns.add(new LinkPropertyColumn<Purification>(new Model<String>(getString("Campagne")),
- "lotSource.campagne", "lotSource.campagne", getString("Read")) {
- @Override
- public void onClick(Item<ICellPopulator<Purification>> item, String componentId, IModel<Purification> model) {
- setResponsePage(new ReadCampagnePage(model.getObject().getLotSource().getCampagne().getIdCampagne(),
- currentPage));
- }
- });
+ columns.add(new LinkPropertyColumn<Purification>(new Model<String>(getString("Campagne")),
+ "lotSource.campagne", "lotSource.campagne", getString("Read")) {
+ @Override
+ public void onClick(Item<ICellPopulator<Purification>> item, String componentId, IModel<Purification> model) {
+ setResponsePage(new ReadCampagnePage(model.getObject().getLotSource().getCampagne().getIdCampagne(),
+ currentPage));
+ }
+ });
- columns.add(new LinkableImagePropertyColumn<Purification>("images/edit.png", getString("Update"),
- getString("Update")) {
- // pas de lien d'édition si l'utilisateur n'a pas les droits
- @Override
- public void populateItem(Item<ICellPopulator<Purification>> item, String componentId,
- IModel<Purification> model) {
- if (purificationService.updateOrdeletePurificationEnabled(model.getObject(), getSession()
- .getUtilisateur())) {
- item.add(new LinkableImagePanel(item, componentId, model));
- } else {
- // label vide
- item.add(new Label(componentId));
- }
- }
+ columns.add(new LinkableImagePropertyColumn<Purification>("images/edit.png", getString("Update"),
+ getString("Update")) {
+ // pas de lien d'édition si l'utilisateur n'a pas les droits
+ @Override
+ public void populateItem(Item<ICellPopulator<Purification>> item, String componentId,
+ IModel<Purification> model) {
+ if (purificationService.updateOrdeletePurificationEnabled(model.getObject(), getSession()
+ .getUtilisateur())) {
+ item.add(new LinkableImagePanel(item, componentId, model));
+ } else {
+ // label vide
+ item.add(new Label(componentId));
+ }
+ }
- @Override
- public void onClick(Item<ICellPopulator<Purification>> item, String componentId, IModel<Purification> model) {
- setResponsePage(new ManagePurificationPage(model.getObject().getIdPurification(), currentPage));
- }
- });
+ @Override
+ public void onClick(Item<ICellPopulator<Purification>> item, String componentId, IModel<Purification> model) {
+ setResponsePage(new ManagePurificationPage(model.getObject().getIdPurification(), currentPage));
+ }
+ });
- final DataTable<Purification> purificationsDataTable = new AjaxFallbackDefaultDataTable<Purification>(
- "ListPurificationsPage.Purifications", columns, purificationsDataProvider, WebContext.ROWS_PER_PAGE);
- purificationsRefresh.add(purificationsDataTable);
+ final DataTable<Purification> purificationsDataTable = new AjaxFallbackDefaultDataTable<Purification>(
+ "ListPurificationsPage.Purifications", columns, purificationsDataProvider, WebContext.ROWS_PER_PAGE);
+ purificationsRefresh.add(purificationsDataTable);
- }
+ }
}
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/purification/ManagePurificationPage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/purification/ManagePurificationPage.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/purification/ManagePurificationPage.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -95,543 +95,543 @@
@AuthRoles({ AuthRole.ADMIN, AuthRole.USER })
public final class ManagePurificationPage extends TemplatePage {
- /** Logger */
- private static final Log LOG = LogTools.getLog();
+ /** Logger */
+ private static final Log LOG = LogTools.getLog();
- /** Action : create */
- private static final String ACTION_CREATE = "Create";
+ /** Action : create */
+ private static final String ACTION_CREATE = "Create";
- /** Action : update */
- private static final String ACTION_UPDATE = "Update";
+ /** Action : update */
+ private static final String ACTION_UPDATE = "Update";
- /** Action : delete */
- public static final String ACTION_DELETE = "Delete";
+ /** Action : delete */
+ public static final String ACTION_DELETE = "Delete";
- /** purification Model */
- private final IModel<Purification> purificationModel;
+ /** purification Model */
+ private final IModel<Purification> purificationModel;
- /** model for adding fraction */
- private Model<Fraction> newFractionModel;
+ /** model for adding fraction */
+ private Model<Fraction> newFractionModel;
- /** Service : purifications */
- @SpringBean
- private PurificationService purificationService;
+ /** Service : purifications */
+ @SpringBean
+ private PurificationService purificationService;
- /** Service : personnes */
- @SpringBean
- private PersonneService personneService;
+ /** Service : personnes */
+ @SpringBean
+ private PersonneService personneService;
- /** Service : produits */
- @SpringBean
- private ProduitService produitService;
+ /** Service : produits */
+ @SpringBean
+ private ProduitService produitService;
- /** Liste des personnes existantes */
- private final List<Personne> personnes;
+ /** Liste des personnes existantes */
+ private final List<Personne> personnes;
- /** Liste des méthodes de purification existantes */
- private final List<MethodePurification> methodes;
+ /** Liste des méthodes de purification existantes */
+ private final List<MethodePurification> methodes;
- /** Liste des produits existants */
- private final List<Produit> produits;
+ /** Liste des produits existants */
+ private final List<Produit> produits;
- /** Model validateur */
- @SpringBean(name = "webModelValidator")
- private ModelValidator validator;
+ /** Model validateur */
+ @SpringBean(name = "webModelValidator")
+ private ModelValidator validator;
- /** Page appelante */
- private final CallerPage callerPage;
+ /** Page appelante */
+ private final CallerPage callerPage;
- /** Saisie multiple */
- private boolean multipleEntry;
+ /** Saisie multiple */
+ private boolean multipleEntry;
- /** createMode true si le formulaire est en creation, false en édition **/
- private boolean createMode;
+ /** createMode true si le formulaire est en creation, false en édition **/
+ private boolean createMode;
- /**
- * Couple of <ref, id> in order to recuperate the id of the deleted type usefull in case of delete thus add of same
- * initial type
- */
- private HashMap<String, Integer> fractionsDeleted;
+ /**
+ * Couple of <ref, id> in order to recuperate the id of the deleted type usefull in case of delete thus add of same
+ * initial type
+ */
+ private HashMap<String, Integer> fractionsDeleted;
- /** Bouton d'ajout d'un purification **/
- Button addPurificationButton;
+ /** Bouton d'ajout d'un purification **/
+ Button addPurificationButton;
- /** Container pour l'affichage de la description de la méthode **/
- MarkupContainer descriptionMethoContainer;
+ /** Container pour l'affichage de la description de la méthode **/
+ MarkupContainer descriptionMethoContainer;
- /** Container pour l'affichage des paramètres de la méthode **/
- MarkupContainer paramsMethoContainer;
+ /** Container pour l'affichage des paramètres de la méthode **/
+ MarkupContainer paramsMethoContainer;
- /**
- * Constructeur (mode création)
- * @param callerPage Page appelante
- * @param multipleEntry Saisie multiple
- */
- public ManagePurificationPage(CallerPage callerPage, boolean multipleEntry) {
- this(null, null, callerPage, multipleEntry);
- }
+ /**
+ * Constructeur (mode création)
+ * @param callerPage Page appelante
+ * @param multipleEntry Saisie multiple
+ */
+ public ManagePurificationPage(CallerPage callerPage, boolean multipleEntry) {
+ this(null, null, callerPage, multipleEntry);
+ }
- /**
- * Constructeur (mode édition)
- * @param idManip Id de la manip d'purification
- * @param callerPage Page appelante
- */
- public ManagePurificationPage(Integer idManip, CallerPage callerPage) {
- this(idManip, null, callerPage, false);
- }
+ /**
+ * Constructeur (mode édition)
+ * @param idManip Id de la manip d'purification
+ * @param callerPage Page appelante
+ */
+ public ManagePurificationPage(Integer idManip, CallerPage callerPage) {
+ this(idManip, null, callerPage, false);
+ }
- /**
- * Constructeur (mode saisie de la manip suivante)
- * @param manip Manip d'purification
- * @param callerPage Page appelante
- */
- public ManagePurificationPage(Purification manip, CallerPage callerPage) {
- this(null, manip, callerPage, true);
- }
+ /**
+ * Constructeur (mode saisie de la manip suivante)
+ * @param manip Manip d'purification
+ * @param callerPage Page appelante
+ */
+ public ManagePurificationPage(Purification manip, CallerPage callerPage) {
+ this(null, manip, callerPage, true);
+ }
- /**
- * Constructeur. Si refManip et manip sont nuls, on créée une nouvelle manip d'purification. Si refManip est
- * renseignée, on édite la manip correspondante. Si manip est renseigné, on créée une nouvelle manipulation à partir
- * des informations qu'elle contient.
- * @param idManip Id de la manip d'purification
- * @param manip Manip d'purification
- * @param callerPage Page appelante
- * @param multipleEntry Saisie multiple
- */
- private ManagePurificationPage(Integer idManip, Purification manip, final CallerPage callerPage,
- boolean multipleEntry) {
- super(ManagePurificationPage.class);
- assert idManip == null || manip == null;
- this.callerPage = callerPage;
- this.multipleEntry = multipleEntry;
+ /**
+ * Constructeur. Si refManip et manip sont nuls, on créée une nouvelle manip d'purification. Si refManip est
+ * renseignée, on édite la manip correspondante. Si manip est renseigné, on créée une nouvelle manipulation à partir
+ * des informations qu'elle contient.
+ * @param idManip Id de la manip d'purification
+ * @param manip Manip d'purification
+ * @param callerPage Page appelante
+ * @param multipleEntry Saisie multiple
+ */
+ private ManagePurificationPage(Integer idManip, Purification manip, final CallerPage callerPage,
+ boolean multipleEntry) {
+ super(ManagePurificationPage.class);
+ assert idManip == null || manip == null;
+ this.callerPage = callerPage;
+ this.multipleEntry = multipleEntry;
- fractionsDeleted = new HashMap<String, Integer>();
- newFractionModel = new Model<Fraction>(new Fraction());
+ fractionsDeleted = new HashMap<String, Integer>();
+ newFractionModel = new Model<Fraction>(new Fraction());
- // Initialisation du modèle
- try {
- purificationModel = new Model<Purification>(idManip == null && manip == null ? new Purification()
- : manip != null ? manip : purificationService.loadPurification(idManip));
- } catch (DataNotFoundException e) {
- LOG.error(e.getMessage(), e);
- throw new UnexpectedException(e);
- }
+ // Initialisation du modèle
+ try {
+ purificationModel = new Model<Purification>(idManip == null && manip == null ? new Purification()
+ : manip != null ? manip : purificationService.loadPurification(idManip));
+ } catch (DataNotFoundException e) {
+ LOG.error(e.getMessage(), e);
+ throw new UnexpectedException(e);
+ }
- createMode = idManip == null;
- if (createMode) {
- purificationModel.getObject().setCreateur(getSession().getUtilisateur());
- }
+ createMode = idManip == null;
+ if (createMode) {
+ purificationModel.getObject().setCreateur(getSession().getUtilisateur());
+ }
- // Initialisation des listes (pour le dropDownChoice)
- personnes = personneService.listPersonnes();
- methodes = purificationService.listMethodesPurification();
- produits = produitService.listProduits(getSession().getUtilisateur());
+ // Initialisation des listes (pour le dropDownChoice)
+ personnes = personneService.listPersonnes();
+ methodes = purificationService.listMethodesPurification();
+ produits = produitService.listProduits(getSession().getUtilisateur());
- if (manip != null) {
- // qd saisie multiple avec préremplissage, hack nécessaire afin d'avoir dans le model le même objet que
- // celui de la liste de choix (sinon comme les objets viennent de sessions hibernate différentes, on n'a pas
- // l'égalité entre les objets)
- purificationModel.getObject().setManipulateur(
- CollectionTools.findWithValue(personnes, "idPersonne", AccessType.GETTER, purificationModel
- .getObject().getManipulateur().getIdPersonne()));
- }
+ if (manip != null) {
+ // qd saisie multiple avec préremplissage, hack nécessaire afin d'avoir dans le model le même objet que
+ // celui de la liste de choix (sinon comme les objets viennent de sessions hibernate différentes, on n'a pas
+ // l'égalité entre les objets)
+ purificationModel.getObject().setManipulateur(
+ CollectionTools.findWithValue(personnes, "idPersonne", AccessType.GETTER, purificationModel
+ .getObject().getManipulateur().getIdPersonne()));
+ }
- // bind with markup
- final Form<Void> formView = new Form<Void>("Form");
+ // bind with markup
+ final Form<Void> formView = new Form<Void>("Form");
- // initialisation du formulaire
- initPrincipalFields(formView);
- initMethodeFields(formView);
- initFractionsFields(formView);
+ // initialisation du formulaire
+ initPrincipalFields(formView);
+ initMethodeFields(formView);
+ initFractionsFields(formView);
- // Action : create the purification
- Button createButton = new SubmittableButton(ACTION_CREATE, new SubmittableButtonEvents() {
- @Override
- public void onProcess() throws DataConstraintException {
- purificationService.createPurification(purificationModel.getObject());
- }
+ // Action : create the purification
+ Button createButton = new SubmittableButton(ACTION_CREATE, new SubmittableButtonEvents() {
+ @Override
+ public void onProcess() throws DataConstraintException {
+ purificationService.createPurification(purificationModel.getObject());
+ }
- @Override
- public void onSuccess() {
- successNextPage(ACTION_CREATE);
- redirect();
- }
+ @Override
+ public void onSuccess() {
+ successNextPage(ACTION_CREATE);
+ redirect();
+ }
- @Override
- public void onValidate() {
- validateModel();
- }
- });
- createButton.setVisibilityAllowed(createMode);
- formView.add(createButton);
+ @Override
+ public void onValidate() {
+ validateModel();
+ }
+ });
+ createButton.setVisibilityAllowed(createMode);
+ formView.add(createButton);
- // Action : update the purification
- Button updateButton = new SubmittableButton(ACTION_UPDATE, new SubmittableButtonEvents() {
- @Override
- public void onProcess() throws DataConstraintException {
- purificationService.updatePurification(purificationModel.getObject());
- }
+ // Action : update the purification
+ Button updateButton = new SubmittableButton(ACTION_UPDATE, new SubmittableButtonEvents() {
+ @Override
+ public void onProcess() throws DataConstraintException {
+ purificationService.updatePurification(purificationModel.getObject());
+ }
- @Override
- public void onSuccess() {
- successNextPage(ACTION_UPDATE);
- callerPage.responsePage((TemplatePage) getPage());
- }
+ @Override
+ public void onSuccess() {
+ successNextPage(ACTION_UPDATE);
+ callerPage.responsePage((TemplatePage) getPage());
+ }
- @Override
- public void onValidate() {
- validateModel();
- }
- });
- updateButton.setVisibilityAllowed(!createMode);
- formView.add(updateButton);
+ @Override
+ public void onValidate() {
+ validateModel();
+ }
+ });
+ updateButton.setVisibilityAllowed(!createMode);
+ formView.add(updateButton);
- // Action : suppression
- Button deleteButton = new SubmittableButton(ACTION_DELETE, ManagePurificationPage.class,
- new SubmittableButtonEvents() {
- @Override
- public void onProcess() throws DataConstraintException {
- purificationService.deletePurification(purificationModel.getObject());
- }
+ // Action : suppression
+ Button deleteButton = new SubmittableButton(ACTION_DELETE, ManagePurificationPage.class,
+ new SubmittableButtonEvents() {
+ @Override
+ public void onProcess() throws DataConstraintException {
+ purificationService.deletePurification(purificationModel.getObject());
+ }
- @Override
- public void onSuccess() {
- successNextPage(ACTION_DELETE);
- callerPage.responsePage((TemplatePage) getPage());
- }
- });
- deleteButton.setVisibilityAllowed(!createMode);
- deleteButton.setDefaultFormProcessing(false);
- deleteButton.add(new JSConfirmationBehavior(getString("Confirm")));
- formView.add(deleteButton);
+ @Override
+ public void onSuccess() {
+ successNextPage(ACTION_DELETE);
+ callerPage.responsePage((TemplatePage) getPage());
+ }
+ });
+ deleteButton.setVisibilityAllowed(!createMode);
+ deleteButton.setDefaultFormProcessing(false);
+ deleteButton.add(new JSConfirmationBehavior(getString("Confirm")));
+ formView.add(deleteButton);
- formView.add(new Link<Void>("Cancel") {
- // Cas où le formulaire est annulé
- @Override
- public void onClick() {
- callerPage.responsePage((TemplatePage) getPage());
- }
- });
+ formView.add(new Link<Void>("Cancel") {
+ // Cas où le formulaire est annulé
+ @Override
+ public void onClick() {
+ callerPage.responsePage((TemplatePage) getPage());
+ }
+ });
- formView.setDefaultButton(addPurificationButton);
- add(formView);
+ formView.setDefaultButton(addPurificationButton);
+ add(formView);
- }
+ }
- /**
- * Initialise les champs principaux
- * @param formView le formulaire
- */
- private void initPrincipalFields(Form<Void> formView) {
- formView.add(new TextField<String>("Purification.ref", new PropertyModel<String>(purificationModel, "ref")));
+ /**
+ * Initialise les champs principaux
+ * @param formView le formulaire
+ */
+ private void initPrincipalFields(Form<Void> formView) {
+ formView.add(new TextField<String>("Purification.ref", new PropertyModel<String>(purificationModel, "ref")));
- formView.add(new DropDownChoice<Personne>("Purification.manipulateur", new PropertyModel<Personne>(
- purificationModel, "manipulateur"), personnes, new PersonneRenderer()).setNullValid(false));
- // Action : création d'une nouvelle personne
- // ajaxSubmitLink permet de sauvegarder l'état du formulaire
- formView.add(new AjaxSubmitLink("NewPersonne") {
- @Override
- protected void onSubmit(AjaxRequestTarget arg0, Form<?> arg1) {
- setResponsePage(new ManagePersonnePage(new CallerPage((TemplatePage) getPage()), false));
- }
+ formView.add(new DropDownChoice<Personne>("Purification.manipulateur", new PropertyModel<Personne>(
+ purificationModel, "manipulateur"), personnes, new PersonneRenderer()).setNullValid(false));
+ // Action : création d'une nouvelle personne
+ // ajaxSubmitLink permet de sauvegarder l'état du formulaire
+ formView.add(new AjaxSubmitLink("NewPersonne") {
+ @Override
+ protected void onSubmit(AjaxRequestTarget arg0, Form<?> arg1) {
+ setResponsePage(new ManagePersonnePage(new CallerPage((TemplatePage) getPage()), false));
+ }
- // si erreur, le formulaire est également enregistré puis la redirection effectuée
- @Override
- protected void onError(AjaxRequestTarget target, Form<?> form) {
- setResponsePage(new ManagePersonnePage(new CallerPage((TemplatePage) getPage()), false));
- }
- });
+ // si erreur, le formulaire est également enregistré puis la redirection effectuée
+ @Override
+ protected void onError(AjaxRequestTarget target, Form<?> form) {
+ setResponsePage(new ManagePersonnePage(new CallerPage((TemplatePage) getPage()), false));
+ }
+ });
- formView.add(new DateTextField("Purification.date", new PropertyModel<Date>(purificationModel, "date"))
- .add(new DatePicker()));
+ formView.add(new DateTextField("Purification.date", new PropertyModel<Date>(purificationModel, "date"))
+ .add(new DatePicker()));
- AbstractSingleSelectChoice<Produit> produitsChoice = new DropDownChoice<Produit>("Purification.produit",
- new PropertyModel<Produit>(purificationModel, "produit"), produits);
- produitsChoice.setNullValid(false);
- produitsChoice.setEnabled(createMode);
- formView.add(produitsChoice);
+ AbstractSingleSelectChoice<Produit> produitsChoice = new DropDownChoice<Produit>("Purification.produit",
+ new PropertyModel<Produit>(purificationModel, "produit"), produits);
+ produitsChoice.setNullValid(false);
+ produitsChoice.setEnabled(createMode);
+ formView.add(produitsChoice);
- TextField<BigDecimal> masseDepartInput = new TextField<BigDecimal>("Purification.masseDepart",
- new PropertyModel<BigDecimal>(purificationModel, "masseDepart"));
- masseDepartInput.add(new AjaxFormComponentUpdatingBehavior("onchange") {
- protected void onUpdate(AjaxRequestTarget target) {
- };
- });
- formView.add(masseDepartInput);
+ TextField<BigDecimal> masseDepartInput = new TextField<BigDecimal>("Purification.masseDepart",
+ new PropertyModel<BigDecimal>(purificationModel, "masseDepart"));
+ masseDepartInput.add(new AjaxFormComponentUpdatingBehavior("onchange") {
+ protected void onUpdate(AjaxRequestTarget target) {
+ };
+ });
+ formView.add(masseDepartInput);
- formView.add(new TextArea<String>("Purification.complement", new PropertyModel<String>(purificationModel,
- "complement")));
- // Créateur en lecture seule
- formView.add(new TextField<String>("Purification.createur", new PropertyModel<String>(purificationModel,
- "createur")).setEnabled(false));
- }
+ formView.add(new TextArea<String>("Purification.complement", new PropertyModel<String>(purificationModel,
+ "complement")));
+ // Créateur en lecture seule
+ formView.add(new TextField<String>("Purification.createur", new PropertyModel<String>(purificationModel,
+ "createur")).setEnabled(false));
+ }
- /**
- * Initialise les champs relatifs à la méthode
- * @param formView le formulaire
- */
- private void initMethodeFields(final Form<Void> formView) {
+ /**
+ * Initialise les champs relatifs à la méthode
+ * @param formView le formulaire
+ */
+ private void initMethodeFields(final Form<Void> formView) {
- final WebMarkupContainer methodeCont = new WebMarkupContainer("Purification.methode");
- methodeCont.setOutputMarkupId(true);
- formView.add(methodeCont);
+ final WebMarkupContainer methodeCont = new WebMarkupContainer("Purification.methode");
+ methodeCont.setOutputMarkupId(true);
+ formView.add(methodeCont);
- // Champs pour la méthode
- descriptionMethoContainer = new WebMarkupContainer("Purification.descriptionMethodeCont") {
- @Override
- public boolean isVisible() {
- // description cachée si pas de méthode sélectionnée
- return purificationModel.getObject().getMethode() != null;
- }
- };
- descriptionMethoContainer.setOutputMarkupId(true); // pour l'update Ajax
- descriptionMethoContainer.setOutputMarkupPlaceholderTag(true);
- methodeCont.add(descriptionMethoContainer);
- final MultiLineLabel methodeDesc = new MultiLineLabel("Purification.descriptionMethode",
- new PropertyModel<String>(purificationModel, "methode.description"));
- methodeDesc.setOutputMarkupId(true);
- descriptionMethoContainer.add(methodeDesc);
+ // Champs pour la méthode
+ descriptionMethoContainer = new WebMarkupContainer("Purification.descriptionMethodeCont") {
+ @Override
+ public boolean isVisible() {
+ // description cachée si pas de méthode sélectionnée
+ return purificationModel.getObject().getMethode() != null;
+ }
+ };
+ descriptionMethoContainer.setOutputMarkupId(true); // pour l'update Ajax
+ descriptionMethoContainer.setOutputMarkupPlaceholderTag(true);
+ methodeCont.add(descriptionMethoContainer);
+ final MultiLineLabel methodeDesc = new MultiLineLabel("Purification.descriptionMethode",
+ new PropertyModel<String>(purificationModel, "methode.description"));
+ methodeDesc.setOutputMarkupId(true);
+ descriptionMethoContainer.add(methodeDesc);
- // Déclaration du container des paramètres de la méthode
- paramsMethoContainer = new WebMarkupContainer("Purification.paramsMethode") {
- @Override
- public boolean isVisible() {
- // paramètres cachés si pas de méthode sélectionnée
- return purificationModel.getObject().getMethode() != null;
- }
- };
- final MarkupContainer paramsMethoTable = new WebMarkupContainer("Purification.paramsMethode.Table");
- paramsMethoContainer.add(paramsMethoTable);
- paramsMethoContainer.setOutputMarkupId(true);
- paramsMethoContainer.setOutputMarkupPlaceholderTag(true);
+ // Déclaration du container des paramètres de la méthode
+ paramsMethoContainer = new WebMarkupContainer("Purification.paramsMethode") {
+ @Override
+ public boolean isVisible() {
+ // paramètres cachés si pas de méthode sélectionnée
+ return purificationModel.getObject().getMethode() != null;
+ }
+ };
+ final MarkupContainer paramsMethoTable = new WebMarkupContainer("Purification.paramsMethode.Table");
+ paramsMethoContainer.add(paramsMethoTable);
+ paramsMethoContainer.setOutputMarkupId(true);
+ paramsMethoContainer.setOutputMarkupPlaceholderTag(true);
- paramsMethoTable.add(new ListView<ParamMethoPuriEffectif>("Purification.paramsMethode.List",
- new PropertyModel<List<ParamMethoPuriEffectif>>(purificationModel, "sortedParamsMetho")) {
- @Override
- protected void populateItem(ListItem<ParamMethoPuriEffectif> item) {
- if (item.getIndex() % 2 == 1) {
- item.add(new AttributeModifier("class", item.getIndex() % 2 == 0 ? "even" : "odd"));
- }
+ paramsMethoTable.add(new ListView<ParamMethoPuriEffectif>("Purification.paramsMethode.List",
+ new PropertyModel<List<ParamMethoPuriEffectif>>(purificationModel, "sortedParamsMetho")) {
+ @Override
+ protected void populateItem(ListItem<ParamMethoPuriEffectif> item) {
+ if (item.getIndex() % 2 == 1) {
+ item.add(new AttributeModifier("class", item.getIndex() % 2 == 0 ? "even" : "odd"));
+ }
- final ParamMethoPuriEffectif param = item.getModelObject();
- // Colonnes
- item.add(new Label("Purification.paramsMethode.nom", new PropertyModel<String>(param, "param.nom")));
- item.add(new SimpleTooltipPanel("Purification.paramsMethode.nom.info", new PropertyModel<String>(param,
- "param.description")));
- item.add(new TextField<String>("Purification.paramsMethode.valeur", new PropertyModel<String>(param,
- "valeur")));
- }
- });
+ final ParamMethoPuriEffectif param = item.getModelObject();
+ // Colonnes
+ item.add(new Label("Purification.paramsMethode.nom", new PropertyModel<String>(param, "param.nom")));
+ item.add(new SimpleTooltipPanel("Purification.paramsMethode.nom.info", new PropertyModel<String>(param,
+ "param.description")));
+ item.add(new TextField<String>("Purification.paramsMethode.valeur", new PropertyModel<String>(param,
+ "valeur")));
+ }
+ });
- methodeCont.add(paramsMethoContainer);
+ methodeCont.add(paramsMethoContainer);
- final DropDownChoice<MethodePurification> methodeChoice = new DropDownChoice<MethodePurification>(
- "Purification.nomMethode", new PropertyModel<MethodePurification>(purificationModel, "methode"),
- methodes);
- methodeChoice.setNullValid(false);
- // mise à jour de la description de la méthode et des fractions lors de la sélection de la méthode
- methodeChoice.add(new AjaxFormComponentUpdatingBehavior("onchange") {
- protected void onUpdate(AjaxRequestTarget target) {
- // Intialisation des paramètres
- purificationService.initParamsMethoPuriEffectif(purificationModel.getObject());
- // mise à jour de la description et des paramètres
- target.add(methodeCont);
- }
- });
- methodeCont.add(methodeChoice);
- }
+ final DropDownChoice<MethodePurification> methodeChoice = new DropDownChoice<MethodePurification>(
+ "Purification.nomMethode", new PropertyModel<MethodePurification>(purificationModel, "methode"),
+ methodes);
+ methodeChoice.setNullValid(false);
+ // mise à jour de la description de la méthode et des fractions lors de la sélection de la méthode
+ methodeChoice.add(new AjaxFormComponentUpdatingBehavior("onchange") {
+ protected void onUpdate(AjaxRequestTarget target) {
+ // Intialisation des paramètres
+ purificationService.initParamsMethoPuriEffectif(purificationModel.getObject());
+ // mise à jour de la description et des paramètres
+ target.add(methodeCont);
+ }
+ });
+ methodeCont.add(methodeChoice);
+ }
- /**
- * Initialise les champs relatifs aux fractions
- * @param formView Le formulaire
- */
- private void initFractionsFields(final Form<Void> formView) {
+ /**
+ * Initialise les champs relatifs aux fractions
+ * @param formView Le formulaire
+ */
+ private void initFractionsFields(final Form<Void> formView) {
- // Déclaration tableau des fractions
- final MarkupContainer purificationsTable = new WebMarkupContainer("Purification.fractions.Table");
- purificationsTable.setOutputMarkupId(true);
+ // Déclaration tableau des fractions
+ final MarkupContainer purificationsTable = new WebMarkupContainer("Purification.fractions.Table");
+ purificationsTable.setOutputMarkupId(true);
- // Contenu tableaux fractions
- purificationsTable.add(new ListView<Fraction>("Purification.fractions.List", new PropertyModel<List<Fraction>>(
- purificationModel, "sortedFractions")) {
- @Override
- protected void populateItem(ListItem<Fraction> item) {
- if (item.getIndex() % 2 == 1) {
- item.add(new AttributeModifier("class", item.getIndex() % 2 == 0 ? "even" : "odd"));
- }
+ // Contenu tableaux fractions
+ purificationsTable.add(new ListView<Fraction>("Purification.fractions.List", new PropertyModel<List<Fraction>>(
+ purificationModel, "sortedFractions")) {
+ @Override
+ protected void populateItem(ListItem<Fraction> item) {
+ if (item.getIndex() % 2 == 1) {
+ item.add(new AttributeModifier("class", item.getIndex() % 2 == 0 ? "even" : "odd"));
+ }
- final Fraction fraction = item.getModelObject();
- // Colonnes
- item.add(new Label("Purification.fractions.List.indice", new PropertyModel<String>(fraction, "indice")));
- item.add(new Label("Purification.fractions.List.ref", new PropertyModel<String>(fraction, "ref")));
- item.add(new Label("Purification.fractions.List.masseObtenue", new DisplayDecimalPropertyModel(
- fraction, "masseObtenue", DecimalDisplFormat.LARGE, getLocale())));
+ final Fraction fraction = item.getModelObject();
+ // Colonnes
+ item.add(new Label("Purification.fractions.List.indice", new PropertyModel<String>(fraction, "indice")));
+ item.add(new Label("Purification.fractions.List.ref", new PropertyModel<String>(fraction, "ref")));
+ item.add(new Label("Purification.fractions.List.masseObtenue", new DisplayDecimalPropertyModel(
+ fraction, "masseObtenue", DecimalDisplFormat.LARGE, getLocale())));
- item.add(new Label("Purification.fractions.List.rendement", new DisplayPercentPropertyModel(fraction,
- "rendement", getLocale())).add(new ReplaceEmptyLabelBehavior()));
+ item.add(new Label("Purification.fractions.List.rendement", new DisplayPercentPropertyModel(fraction,
+ "rendement", getLocale())).add(new ReplaceEmptyLabelBehavior()));
- // Action : suppression d'une fraction
- Button deleteButton = new AjaxFallbackButton("Purification.fractions.List.Delete", formView) {
- @Override
- protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
- // vérification si des données liées existe
- if (produitService.isProduitReferenced(fraction)) {
- getPage().error(getString("Fraction.isReferenced"));
- } else {
- // Suppression
- purificationModel.getObject().getFractions().remove(fraction);
- // keep the id of the deleted 'fraction' for the case of a new one with the same 'ref'
- fractionsDeleted.put(fraction.getRef(), fraction.getId());
- }
- if (target != null) {
- target.add(purificationsTable);
- refreshFeedbackPage(target);
- }
- }
+ // Action : suppression d'une fraction
+ Button deleteButton = new AjaxFallbackButton("Purification.fractions.List.Delete", formView) {
+ @Override
+ protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
+ // vérification si des données liées existe
+ if (produitService.isProduitReferenced(fraction)) {
+ getPage().error(getString("Fraction.isReferenced"));
+ } else {
+ // Suppression
+ purificationModel.getObject().getFractions().remove(fraction);
+ // keep the id of the deleted 'fraction' for the case of a new one with the same 'ref'
+ fractionsDeleted.put(fraction.getRef(), fraction.getId());
+ }
+ if (target != null) {
+ target.add(purificationsTable);
+ refreshFeedbackPage(target);
+ }
+ }
- @Override
- protected void onError(AjaxRequestTarget target, Form<?> form) {
- // never called
- }
+ @Override
+ protected void onError(AjaxRequestTarget target, Form<?> form) {
+ // never called
+ }
- };
- deleteButton.setDefaultFormProcessing(false);
- item.add(deleteButton);
- }
- });
+ };
+ deleteButton.setDefaultFormProcessing(false);
+ item.add(deleteButton);
+ }
+ });
- final FormComponent<String> indiceInput = new TextField<String>("Purification.fractions.indice",
- new PropertyModel<String>(newFractionModel, "indice"));
- purificationsTable.add(indiceInput);
+ final FormComponent<String> indiceInput = new TextField<String>("Purification.fractions.indice",
+ new PropertyModel<String>(newFractionModel, "indice"));
+ purificationsTable.add(indiceInput);
- final FormComponent<String> refInput = new TextField<String>("Purification.fractions.ref",
- new PropertyModel<String>(newFractionModel, "ref"));
- purificationsTable.add(refInput);
+ final FormComponent<String> refInput = new TextField<String>("Purification.fractions.ref",
+ new PropertyModel<String>(newFractionModel, "ref"));
+ purificationsTable.add(refInput);
- final FormComponent<BigDecimal> masseObtenueInput = new TextField<BigDecimal>(
- "Purification.fractions.masseObtenue", new PropertyModel<BigDecimal>(newFractionModel, "masseObtenue"));
- purificationsTable.add(masseObtenueInput);
+ final FormComponent<BigDecimal> masseObtenueInput = new TextField<BigDecimal>(
+ "Purification.fractions.masseObtenue", new PropertyModel<BigDecimal>(newFractionModel, "masseObtenue"));
+ purificationsTable.add(masseObtenueInput);
- // Bouton AJAX pour ajouter une fraction
- addPurificationButton = new AjaxFallbackButton("Purification.fractions.Add", formView) {
- @Override
- protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
- try {
- // normalisation de la fraction
- newFractionModel.getObject().setRef(
- Normalizer.normalize(UniqueFieldNormalizer.class, newFractionModel.getObject().getRef()));
- // ajout du type purification
- newFractionModel.getObject().setPurification(purificationModel.getObject());
- // recuperate the id if an just deleted type
- newFractionModel.getObject().setId(fractionsDeleted.get(newFractionModel.getObject().getRef()));
+ // Bouton AJAX pour ajouter une fraction
+ addPurificationButton = new AjaxFallbackButton("Purification.fractions.Add", formView) {
+ @Override
+ protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
+ try {
+ // normalisation de la fraction
+ newFractionModel.getObject().setRef(
+ Normalizer.normalize(UniqueFieldNormalizer.class, newFractionModel.getObject().getRef()));
+ // ajout du type purification
+ newFractionModel.getObject().setPurification(purificationModel.getObject());
+ // recuperate the id if an just deleted type
+ newFractionModel.getObject().setId(fractionsDeleted.get(newFractionModel.getObject().getRef()));
- // ajout à la liste
- Fraction fractionAdded = newFractionModel.getObject().clone();
- purificationModel.getObject().getFractions().add(fractionAdded);
+ // ajout à la liste
+ Fraction fractionAdded = newFractionModel.getObject().clone();
+ purificationModel.getObject().getFractions().add(fractionAdded);
- List<String> errors = validator.validate(newFractionModel.getObject(), getSession().getLocale());
- // test si unicité dans la base
- // erreur si non unique dans la base ET extrait de même réf non supprimé de la liste (dans ce
- // dernier cas, ajout avec son ancien id) ET non pris en compte par la validation de
- // CollectionUniqueFieldValidator
- if (!purificationService.isFractionUnique(fractionAdded)
- && fractionAdded.getRef() != null
- && fractionsDeleted.get(fractionAdded.getRef()) == null
- && CollectionTools.countWithValue(fractionAdded.getPurification().getFractions(), "ref",
- AccessType.GETTER, fractionAdded.getRef()) == 1) {
- errors.add(getString("Fraction.notUnique"));
- }
+ List<String> errors = validator.validate(newFractionModel.getObject(), getSession().getLocale());
+ // test si unicité dans la base
+ // erreur si non unique dans la base ET extrait de même réf non supprimé de la liste (dans ce
+ // dernier cas, ajout avec son ancien id) ET non pris en compte par la validation de
+ // CollectionUniqueFieldValidator
+ if (!purificationService.isFractionUnique(fractionAdded)
+ && fractionAdded.getRef() != null
+ && fractionsDeleted.get(fractionAdded.getRef()) == null
+ && CollectionTools.countWithValue(fractionAdded.getPurification().getFractions(), "ref",
+ AccessType.GETTER, fractionAdded.getRef()) == 1) {
+ errors.add(getString("Fraction.notUnique"));
+ }
- if (errors.isEmpty()) {
- // réinit du champ ajout
- newFractionModel.getObject().setIndice(null);
- newFractionModel.getObject().setRef(null);
- newFractionModel.getObject().setMasseObtenue(null);
- } else {
- purificationModel.getObject().getFractions().remove(fractionAdded);
- addValidationErrors(errors);
- }
- } catch (CloneNotSupportedException e) {
- LOG.error(e.getMessage(), e);
- throw new UnexpectedException(e);
- }
+ if (errors.isEmpty()) {
+ // réinit du champ ajout
+ newFractionModel.getObject().setIndice(null);
+ newFractionModel.getObject().setRef(null);
+ newFractionModel.getObject().setMasseObtenue(null);
+ } else {
+ purificationModel.getObject().getFractions().remove(fractionAdded);
+ addValidationErrors(errors);
+ }
+ } catch (CloneNotSupportedException e) {
+ LOG.error(e.getMessage(), e);
+ throw new UnexpectedException(e);
+ }
- if (target != null) {
- target.add(purificationsTable);
- refreshFeedbackPage(target);
- }
- }
+ if (target != null) {
+ target.add(purificationsTable);
+ refreshFeedbackPage(target);
+ }
+ }
- @Override
- protected void onError(AjaxRequestTarget target, Form<?> form) {
- refreshFeedbackPage(target);
- }
+ @Override
+ protected void onError(AjaxRequestTarget target, Form<?> form) {
+ refreshFeedbackPage(target);
+ }
- };
- purificationsTable.add(addPurificationButton);
+ };
+ purificationsTable.add(addPurificationButton);
- formView.add(purificationsTable);
- }
+ formView.add(purificationsTable);
+ }
- /** {@inheritDoc} */
- @Override
- protected void onBeforeRender() {
- // On rafraichit le modèle lorsque la page est rechargée (par exemple après l'ajout d'une nouvelle entité
- // Personne ou Lot)
- refreshModel();
+ /** {@inheritDoc} */
+ @Override
+ protected void onBeforeRender() {
+ // On rafraichit le modèle lorsque la page est rechargée (par exemple après l'ajout d'une nouvelle entité
+ // Personne ou Lot)
+ refreshModel();
- super.onBeforeRender();
- }
+ super.onBeforeRender();
+ }
- /**
- * Redirection vers une autre page. CAs où le formulaire est validé
- */
- private void redirect() {
- if (multipleEntry) {
- // Redirection de nouveau vers l'écran de saisie d'une nouvelle purification
- Purification nextManip = new Purification();
- nextManip.setManipulateur(purificationModel.getObject().getManipulateur());
- setResponsePage(new ManagePurificationPage(nextManip, callerPage));
- } else if (callerPage != null) {
- // On passe l'id de la purification associée à cette page, en paramètre de la prochaine page, pour lui
- // permettre de
- // l'exploiter si besoin
- callerPage.addPageParameter(Purification.class.getSimpleName(), purificationModel.getObject()
- .getIdPurification());
- callerPage.responsePage(this);
- }
- }
+ /**
+ * Redirection vers une autre page. CAs où le formulaire est validé
+ */
+ private void redirect() {
+ if (multipleEntry) {
+ // Redirection de nouveau vers l'écran de saisie d'une nouvelle purification
+ Purification nextManip = new Purification();
+ nextManip.setManipulateur(purificationModel.getObject().getManipulateur());
+ setResponsePage(new ManagePurificationPage(nextManip, callerPage));
+ } else if (callerPage != null) {
+ // On passe l'id de la purification associée à cette page, en paramètre de la prochaine page, pour lui
+ // permettre de
+ // l'exploiter si besoin
+ callerPage.addPageParameter(Purification.class.getSimpleName(), purificationModel.getObject()
+ .getIdPurification());
+ callerPage.responsePage(this);
+ }
+ }
- /**
- * Refresh model, appelé au rechargement de la page
- */
- private void refreshModel() {
+ /**
+ * Refresh model, appelé au rechargement de la page
+ */
+ private void refreshModel() {
- // Récupère (et supprime) les éventuels nouveaux objets créés dans les paramètres de la page.
- String key = Personne.class.getSimpleName();
- if (getPageParameters().getNamedKeys().contains(key)) {
- CollectionTools.setter(personnes, personneService.listPersonnes());
- try {
- Personne createdPersonne = personneService.loadPersonne(getPageParameters().get(key).toInt());
- purificationModel.getObject().setManipulateur(createdPersonne);
- } catch (StringValueConversionException e) {
- LOG.error(e.getMessage(), e);
- throw new UnexpectedException(e);
- } catch (DataNotFoundException e) {
- LOG.error(e.getMessage(), e);
- throw new UnexpectedException(e);
- }
- getPageParameters().remove(key);
- }
- }
+ // Récupère (et supprime) les éventuels nouveaux objets créés dans les paramètres de la page.
+ String key = Personne.class.getSimpleName();
+ if (getPageParameters().getNamedKeys().contains(key)) {
+ CollectionTools.setter(personnes, personneService.listPersonnes());
+ try {
+ Personne createdPersonne = personneService.loadPersonne(getPageParameters().get(key).toInt());
+ purificationModel.getObject().setManipulateur(createdPersonne);
+ } catch (StringValueConversionException e) {
+ LOG.error(e.getMessage(), e);
+ throw new UnexpectedException(e);
+ } catch (DataNotFoundException e) {
+ LOG.error(e.getMessage(), e);
+ throw new UnexpectedException(e);
+ }
+ getPageParameters().remove(key);
+ }
+ }
- /**
- * Validate model
- */
- private void validateModel() {
- addValidationErrors(validator.validate(purificationModel.getObject(), getSession().getLocale()));
- if (!purificationService.isPurificationUnique(purificationModel.getObject())) {
- error(getString("Purification.notUnique"));
- }
- }
+ /**
+ * Validate model
+ */
+ private void validateModel() {
+ addValidationErrors(validator.validate(purificationModel.getObject(), getSession().getLocale()));
+ if (!purificationService.isPurificationUnique(purificationModel.getObject())) {
+ error(getString("Purification.notUnique"));
+ }
+ }
}
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/purification/ReadPurificationPage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/purification/ReadPurificationPage.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/purification/ReadPurificationPage.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -72,214 +72,214 @@
*/
public final class ReadPurificationPage extends TemplatePage {
- /** Logger */
- // private static final Log LOG = LogTools.getLog();
- /** Action : delete */
- public static final String ACTION_DELETE = "Delete";
+ /** Logger */
+ // private static final Log LOG = LogTools.getLog();
+ /** Action : delete */
+ public static final String ACTION_DELETE = "Delete";
- /** purification Model */
- private final IModel<Purification> purificationModel;
+ /** purification Model */
+ private final IModel<Purification> purificationModel;
- /** Service : purifications */
- @SpringBean
- private PurificationService purificationService;
+ /** Service : purifications */
+ @SpringBean
+ private PurificationService purificationService;
- /** Container pour l'affichage de la description de la méthode */
- MarkupContainer descriptionMethoContainer;
+ /** Container pour l'affichage de la description de la méthode */
+ MarkupContainer descriptionMethoContainer;
- /** Container pour l'affichage des paramètres de la méthode */
- MarkupContainer paramsMethoContainer;
+ /** Container pour l'affichage des paramètres de la méthode */
+ MarkupContainer paramsMethoContainer;
- /** Page appelante */
- private final CallerPage callerPage;
+ /** Page appelante */
+ private final CallerPage callerPage;
- /**
- * Constructeur
- * @param idPurification identifiant de la manip
- * @param callerPage Page appelante
- */
- public ReadPurificationPage(Integer idPurification, final CallerPage callerPage) {
- super(ReadPurificationPage.class);
- this.callerPage = callerPage;
- final CallerPage currentPage = new CallerPage((TemplatePage) getPage());
+ /**
+ * Constructeur
+ * @param idPurification identifiant de la manip
+ * @param callerPage Page appelante
+ */
+ public ReadPurificationPage(Integer idPurification, final CallerPage callerPage) {
+ super(ReadPurificationPage.class);
+ this.callerPage = callerPage;
+ final CallerPage currentPage = new CallerPage((TemplatePage) getPage());
- // Initialisation du modèle
- purificationModel = new GenericLoadableDetachableModel<Purification>(Purification.class, idPurification);
+ // Initialisation du modèle
+ purificationModel = new GenericLoadableDetachableModel<Purification>(Purification.class, idPurification);
- add(new Label("Purification.ref", new PropertyModel<String>(purificationModel, "ref"))
- .add(new ReplaceEmptyLabelBehavior()));
- add(new Label("Purification.manipulateur", new PropertyModel<Personne>(purificationModel, "manipulateur"))
- .add(new ReplaceEmptyLabelBehavior()));
- add(new Label("Purification.date", new PropertyModel<Date>(purificationModel, "date"))
- .add(new ReplaceEmptyLabelBehavior()));
+ add(new Label("Purification.ref", new PropertyModel<String>(purificationModel, "ref"))
+ .add(new ReplaceEmptyLabelBehavior()));
+ add(new Label("Purification.manipulateur", new PropertyModel<Personne>(purificationModel, "manipulateur"))
+ .add(new ReplaceEmptyLabelBehavior()));
+ add(new Label("Purification.date", new PropertyModel<Date>(purificationModel, "date"))
+ .add(new ReplaceEmptyLabelBehavior()));
- add(new PropertyLabelLinkProduitPanel("Purification.produit", new PropertyModel<Produit>(purificationModel,
- "produit"), (TemplatePage) getPage()) {
- @Override
- public void onClickIfExtrait(Extrait extrait) {
- setResponsePage(new ReadExtractionPage(extrait.getExtraction().getIdExtraction(), currentPage));
- }
+ add(new PropertyLabelLinkProduitPanel("Purification.produit", new PropertyModel<Produit>(purificationModel,
+ "produit"), (TemplatePage) getPage()) {
+ @Override
+ public void onClickIfExtrait(Extrait extrait) {
+ setResponsePage(new ReadExtractionPage(extrait.getExtraction().getIdExtraction(), currentPage));
+ }
- @Override
- public void onClickIfFraction(Fraction fraction) {
- setResponsePage(new ReadPurificationPage(fraction.getPurification().getIdPurification(), currentPage));
- }
- });
+ @Override
+ public void onClickIfFraction(Fraction fraction) {
+ setResponsePage(new ReadPurificationPage(fraction.getPurification().getIdPurification(), currentPage));
+ }
+ });
- add(new Label("Purification.masseDepart", new PropertyModel<BigInteger>(purificationModel, "masseDepart"))
- .add(new ReplaceEmptyLabelBehavior()));
- add(new MultiLineLabel("Purification.complement", new PropertyModel<String>(purificationModel, "complement"))
- .add(new ReplaceEmptyLabelBehavior()));
- add(new PropertyLabelLinkPanel<Personne>("Purification.createur", new PropertyModel<Personne>(
- purificationModel, "createur"), getString("Read")) {
- @Override
- public void onClick() {
- setResponsePage(new ReadPersonnePage(getModelObject().getIdPersonne(), currentPage));
- }
- });
- // Méthode purification
- final WebMarkupContainer methodeCont = new WebMarkupContainer("Purification.methode");
- methodeCont.add(new Label("Purification.nomMethode", new PropertyModel<MethodePurification>(purificationModel,
- "methode")));
- methodeCont.setOutputMarkupId(true);
- add(methodeCont);
+ add(new Label("Purification.masseDepart", new PropertyModel<BigInteger>(purificationModel, "masseDepart"))
+ .add(new ReplaceEmptyLabelBehavior()));
+ add(new MultiLineLabel("Purification.complement", new PropertyModel<String>(purificationModel, "complement"))
+ .add(new ReplaceEmptyLabelBehavior()));
+ add(new PropertyLabelLinkPanel<Personne>("Purification.createur", new PropertyModel<Personne>(
+ purificationModel, "createur"), getString("Read")) {
+ @Override
+ public void onClick() {
+ setResponsePage(new ReadPersonnePage(getModelObject().getIdPersonne(), currentPage));
+ }
+ });
+ // Méthode purification
+ final WebMarkupContainer methodeCont = new WebMarkupContainer("Purification.methode");
+ methodeCont.add(new Label("Purification.nomMethode", new PropertyModel<MethodePurification>(purificationModel,
+ "methode")));
+ methodeCont.setOutputMarkupId(true);
+ add(methodeCont);
- // Champs pour la méthode
- descriptionMethoContainer = new WebMarkupContainer("Purification.descriptionMethodeCont") {
- @Override
- public boolean isVisible() {
- // description cachée si pas de méthode sélectionnée
- return purificationModel.getObject().getMethode() != null;
- }
- };
- methodeCont.add(descriptionMethoContainer);
- final MultiLineLabel methodeDesc = new MultiLineLabel("Purification.descriptionMethode",
- new PropertyModel<String>(purificationModel, "methode.description"));
- methodeDesc.setOutputMarkupId(true);
- descriptionMethoContainer.add(methodeDesc);
+ // Champs pour la méthode
+ descriptionMethoContainer = new WebMarkupContainer("Purification.descriptionMethodeCont") {
+ @Override
+ public boolean isVisible() {
+ // description cachée si pas de méthode sélectionnée
+ return purificationModel.getObject().getMethode() != null;
+ }
+ };
+ methodeCont.add(descriptionMethoContainer);
+ final MultiLineLabel methodeDesc = new MultiLineLabel("Purification.descriptionMethode",
+ new PropertyModel<String>(purificationModel, "methode.description"));
+ methodeDesc.setOutputMarkupId(true);
+ descriptionMethoContainer.add(methodeDesc);
- // Déclaration du container des paramètres de la méthode
- paramsMethoContainer = new WebMarkupContainer("Purification.paramsMethode") {
- @Override
- public boolean isVisible() {
- // paramètres cachés si pas de méthode sélectionnée
- return purificationModel.getObject().getMethode() != null;
- }
- };
- final MarkupContainer paramsMethoTable = new WebMarkupContainer("Purification.paramsMethode.Table");
- paramsMethoContainer.add(paramsMethoTable);
+ // Déclaration du container des paramètres de la méthode
+ paramsMethoContainer = new WebMarkupContainer("Purification.paramsMethode") {
+ @Override
+ public boolean isVisible() {
+ // paramètres cachés si pas de méthode sélectionnée
+ return purificationModel.getObject().getMethode() != null;
+ }
+ };
+ final MarkupContainer paramsMethoTable = new WebMarkupContainer("Purification.paramsMethode.Table");
+ paramsMethoContainer.add(paramsMethoTable);
- ListView<ParamMethoPuriEffectif> paramMethodes = new ListView<ParamMethoPuriEffectif>(
- "Purification.paramsMethode.List", new PropertyModel<List<ParamMethoPuriEffectif>>(purificationModel,
- "sortedParamsMetho")) {
- @Override
- protected void populateItem(ListItem<ParamMethoPuriEffectif> item) {
- if (item.getIndex() % 2 == 1) {
- item.add(new AttributeModifier("class", item.getIndex() % 2 == 0 ? "even" : "odd"));
- }
+ ListView<ParamMethoPuriEffectif> paramMethodes = new ListView<ParamMethoPuriEffectif>(
+ "Purification.paramsMethode.List", new PropertyModel<List<ParamMethoPuriEffectif>>(purificationModel,
+ "sortedParamsMetho")) {
+ @Override
+ protected void populateItem(ListItem<ParamMethoPuriEffectif> item) {
+ if (item.getIndex() % 2 == 1) {
+ item.add(new AttributeModifier("class", item.getIndex() % 2 == 0 ? "even" : "odd"));
+ }
- final ParamMethoPuriEffectif param = item.getModelObject();
- // Colonnes
- item.add(new Label("Purification.paramsMethode.nom", new PropertyModel<String>(param, "param.nom")));
- item.add(new SimpleTooltipPanel("Purification.paramsMethode.nom.info", new PropertyModel<String>(param,
- "param.description")));
- item.add(new Label("Purification.paramsMethode.valeur", new PropertyModel<String>(param, "valeur"))
- .add(new ReplaceEmptyLabelBehavior()));
- }
- };
- paramsMethoTable.add(paramMethodes);
- methodeCont.add(paramsMethoContainer);
+ final ParamMethoPuriEffectif param = item.getModelObject();
+ // Colonnes
+ item.add(new Label("Purification.paramsMethode.nom", new PropertyModel<String>(param, "param.nom")));
+ item.add(new SimpleTooltipPanel("Purification.paramsMethode.nom.info", new PropertyModel<String>(param,
+ "param.description")));
+ item.add(new Label("Purification.paramsMethode.valeur", new PropertyModel<String>(param, "valeur"))
+ .add(new ReplaceEmptyLabelBehavior()));
+ }
+ };
+ paramsMethoTable.add(paramMethodes);
+ methodeCont.add(paramsMethoContainer);
- add(methodeCont);
+ add(methodeCont);
- // Fractions
- // Déclaration tableau des fractions
- final MarkupContainer purificationsTable = new WebMarkupContainer("Purification.fractions.Table") {
- @Override
- public boolean isVisible() {
- return purificationModel.getObject().getFractions().size() > 0;
- }
- };
- purificationsTable.setOutputMarkupId(true);
+ // Fractions
+ // Déclaration tableau des fractions
+ final MarkupContainer purificationsTable = new WebMarkupContainer("Purification.fractions.Table") {
+ @Override
+ public boolean isVisible() {
+ return purificationModel.getObject().getFractions().size() > 0;
+ }
+ };
+ purificationsTable.setOutputMarkupId(true);
- // Contenu tableaux fractions
- purificationsTable.add(new ListView<Fraction>("Purification.fractions.List", new PropertyModel<List<Fraction>>(
- purificationModel, "sortedFractions")) {
- @Override
- protected void populateItem(ListItem<Fraction> item) {
- if (item.getIndex() % 2 == 1) {
- item.add(new AttributeModifier("class", item.getIndex() % 2 == 0 ? "even" : "odd"));
- }
+ // Contenu tableaux fractions
+ purificationsTable.add(new ListView<Fraction>("Purification.fractions.List", new PropertyModel<List<Fraction>>(
+ purificationModel, "sortedFractions")) {
+ @Override
+ protected void populateItem(ListItem<Fraction> item) {
+ if (item.getIndex() % 2 == 1) {
+ item.add(new AttributeModifier("class", item.getIndex() % 2 == 0 ? "even" : "odd"));
+ }
- final Fraction fraction = item.getModelObject();
- // Colonnes
- item.add(new Label("Purification.fractions.List.indice", new PropertyModel<String>(fraction, "indice")));
- item.add(new Label("Purification.fractions.List.ref", new PropertyModel<String>(fraction, "ref")));
- item.add(new Label("Purification.fractions.List.masseObtenue", new DisplayDecimalPropertyModel(item
- .getModel(), "masseObtenue", DecimalDisplFormat.LARGE, getLocale())));
- item.add(new Label("Purification.fractions.List.rendement", new DisplayPercentPropertyModel(item
- .getModel(), "rendement", getLocale())).add(new ReplaceEmptyLabelBehavior()));
- }
- });
- add(purificationsTable);
+ final Fraction fraction = item.getModelObject();
+ // Colonnes
+ item.add(new Label("Purification.fractions.List.indice", new PropertyModel<String>(fraction, "indice")));
+ item.add(new Label("Purification.fractions.List.ref", new PropertyModel<String>(fraction, "ref")));
+ item.add(new Label("Purification.fractions.List.masseObtenue", new DisplayDecimalPropertyModel(item
+ .getModel(), "masseObtenue", DecimalDisplFormat.LARGE, getLocale())));
+ item.add(new Label("Purification.fractions.List.rendement", new DisplayPercentPropertyModel(item
+ .getModel(), "rendement", getLocale())).add(new ReplaceEmptyLabelBehavior()));
+ }
+ });
+ add(purificationsTable);
- // Selon la non existence d'elements dans la liste on affiche le span
- add(new WebMarkupContainer("Purification.fractions.noTable") {
- @Override
- public boolean isVisible() {
- return !purificationsTable.isVisible();
- }
- });
+ // Selon la non existence d'elements dans la liste on affiche le span
+ add(new WebMarkupContainer("Purification.fractions.noTable") {
+ @Override
+ public boolean isVisible() {
+ return !purificationsTable.isVisible();
+ }
+ });
- // Formulaire des actions
- final Form<Void> formView = new Form<Void>("Form");
+ // Formulaire des actions
+ final Form<Void> formView = new Form<Void>("Form");
- // Action : mise à jour (redirection vers le formulaire)
- Link<Purification> updateLink = new Link<Purification>(getResource() + ".Purification.Update",
- new Model<Purification>(purificationModel.getObject())) {
- @Override
- public void onClick() {
- setResponsePage(new ManagePurificationPage(getModelObject().getIdPurification(), currentPage));
- }
- };
- updateLink.setVisibilityAllowed(purificationService.updateOrdeletePurificationEnabled(
- purificationModel.getObject(), getSession().getUtilisateur()));
- formView.add(updateLink);
+ // Action : mise à jour (redirection vers le formulaire)
+ Link<Purification> updateLink = new Link<Purification>(getResource() + ".Purification.Update",
+ new Model<Purification>(purificationModel.getObject())) {
+ @Override
+ public void onClick() {
+ setResponsePage(new ManagePurificationPage(getModelObject().getIdPurification(), currentPage));
+ }
+ };
+ updateLink.setVisibilityAllowed(purificationService.updateOrdeletePurificationEnabled(
+ purificationModel.getObject(), getSession().getUtilisateur()));
+ formView.add(updateLink);
- // Action : suppression
- Button deleteButton = new SubmittableButton(ACTION_DELETE, ManagePurificationPage.class,
- new SubmittableButtonEvents() {
- @Override
- public void onProcess() throws DataConstraintException {
- purificationService.deletePurification(purificationModel.getObject());
- }
+ // Action : suppression
+ Button deleteButton = new SubmittableButton(ACTION_DELETE, ManagePurificationPage.class,
+ new SubmittableButtonEvents() {
+ @Override
+ public void onProcess() throws DataConstraintException {
+ purificationService.deletePurification(purificationModel.getObject());
+ }
- @Override
- public void onSuccess() {
- successNextPage(ManagePurificationPage.class, ACTION_DELETE);
- redirect();
- }
- });
- deleteButton.setVisibilityAllowed(purificationService.updateOrdeletePurificationEnabled(
- purificationModel.getObject(), getSession().getUtilisateur()));
- deleteButton.add(new JSConfirmationBehavior(getString("Confirm")));
- deleteButton.setDefaultFormProcessing(false);
- formView.add(deleteButton);
+ @Override
+ public void onSuccess() {
+ successNextPage(ManagePurificationPage.class, ACTION_DELETE);
+ redirect();
+ }
+ });
+ deleteButton.setVisibilityAllowed(purificationService.updateOrdeletePurificationEnabled(
+ purificationModel.getObject(), getSession().getUtilisateur()));
+ deleteButton.add(new JSConfirmationBehavior(getString("Confirm")));
+ deleteButton.setDefaultFormProcessing(false);
+ formView.add(deleteButton);
- // Action : retour
- formView.add(new Link<Void>(getResource() + ".Purification.Back") {
- @Override
- public void onClick() {
- callerPage.responsePage((TemplatePage) getPage());
- }
- });
- add(formView);
- }
+ // Action : retour
+ formView.add(new Link<Void>(getResource() + ".Purification.Back") {
+ @Override
+ public void onClick() {
+ callerPage.responsePage((TemplatePage) getPage());
+ }
+ });
+ add(formView);
+ }
- /**
- * Redirection vers une autre page
- */
- private void redirect() {
- callerPage.responsePage(this);
- }
+ /**
+ * Redirection vers une autre page
+ */
+ private void redirect() {
+ callerPage.responsePage(this);
+ }
}
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/specimen/ListSpecimensPage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/specimen/ListSpecimensPage.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/specimen/ListSpecimensPage.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -61,102 +61,102 @@
@AuthRoles({ AuthRole.ADMIN, AuthRole.USER })
public final class ListSpecimensPage extends TemplatePage {
- /** Service : specimen */
- @SpringBean
- private SpecimenService specimenService;
+ /** Service : specimen */
+ @SpringBean
+ private SpecimenService specimenService;
- /**
- * Constructeur
- */
- public ListSpecimensPage() {
- super(ListSpecimensPage.class);
+ /**
+ * Constructeur
+ */
+ public ListSpecimensPage() {
+ super(ListSpecimensPage.class);
- final CallerPage currentPage = new CallerPage(ListSpecimensPage.class);
+ final CallerPage currentPage = new CallerPage(ListSpecimensPage.class);
- add(new Link<Void>(getResource() + ".NewSpecimen") {
- @Override
- public void onClick() {
- setResponsePage(new ManageSpecimenPage(currentPage, true));
- }
- });
+ add(new Link<Void>(getResource() + ".NewSpecimen") {
+ @Override
+ public void onClick() {
+ setResponsePage(new ManageSpecimenPage(currentPage, true));
+ }
+ });
- // On englobe le "DataView" dans un composant neutre que l'on pourra
- // rafraichir quand la liste évoluera
- final MarkupContainer specimensRefresh = new WebMarkupContainer(getResource() + ".Specimens.Refresh");
- specimensRefresh.setOutputMarkupId(true);
- add(specimensRefresh);
+ // On englobe le "DataView" dans un composant neutre que l'on pourra
+ // rafraichir quand la liste évoluera
+ final MarkupContainer specimensRefresh = new WebMarkupContainer(getResource() + ".Specimens.Refresh");
+ specimensRefresh.setOutputMarkupId(true);
+ add(specimensRefresh);
- // Liste des Specimens
- final List<Specimen> specimens = specimenService.listSpecimens(getSession().getUtilisateur());
- LoadableDetachableSortableListDataProvider<Specimen> specimensDataProvider = new LoadableDetachableSortableListDataProvider<Specimen>(
- specimens, getSession().getLocale());
+ // Liste des Specimens
+ final List<Specimen> specimens = specimenService.listSpecimens(getSession().getUtilisateur());
+ LoadableDetachableSortableListDataProvider<Specimen> specimensDataProvider = new LoadableDetachableSortableListDataProvider<Specimen>(
+ specimens, getSession().getLocale());
- List<IColumn<Specimen>> columns = new ArrayList<IColumn<Specimen>>();
+ List<IColumn<Specimen>> columns = new ArrayList<IColumn<Specimen>>();
- columns.add(new LinkableImagePropertyColumn<Specimen>("images/read.png", getString("Read"), getString("Read")) {
- @Override
- public void onClick(Item<ICellPopulator<Specimen>> item, String componentId, IModel<Specimen> model) {
- setResponsePage(new ReadSpecimenPage(model.getObject().getIdSpecimen(), currentPage));
- }
- });
+ columns.add(new LinkableImagePropertyColumn<Specimen>("images/read.png", getString("Read"), getString("Read")) {
+ @Override
+ public void onClick(Item<ICellPopulator<Specimen>> item, String componentId, IModel<Specimen> model) {
+ setResponsePage(new ReadSpecimenPage(model.getObject().getIdSpecimen(), currentPage));
+ }
+ });
- columns.add(new LinkPropertyColumn<Specimen>(new Model<String>(getString("Specimen.ref")), "ref", "ref",
- getString("Read")) {
- @Override
- public void onClick(Item<ICellPopulator<Specimen>> item, String componentId, IModel<Specimen> model) {
- setResponsePage(new ReadSpecimenPage(model.getObject().getIdSpecimen(), currentPage));
- }
- });
+ columns.add(new LinkPropertyColumn<Specimen>(new Model<String>(getString("Specimen.ref")), "ref", "ref",
+ getString("Read")) {
+ @Override
+ public void onClick(Item<ICellPopulator<Specimen>> item, String componentId, IModel<Specimen> model) {
+ setResponsePage(new ReadSpecimenPage(model.getObject().getIdSpecimen(), currentPage));
+ }
+ });
- columns.add(new EnumPropertyColumn<Specimen>(new Model<String>(getString("Specimen.typeOrganisme")),
- "typeOrganisme", "typeOrganisme", ListSpecimensPage.this));
+ columns.add(new EnumPropertyColumn<Specimen>(new Model<String>(getString("Specimen.typeOrganisme")),
+ "typeOrganisme", "typeOrganisme", ListSpecimensPage.this));
- columns.add(new TaxonomyPropertyColumn<Specimen>(new Model<String>(getString("Specimen.embranchement")),
- "embranchement", "embranchement"));
+ columns.add(new TaxonomyPropertyColumn<Specimen>(new Model<String>(getString("Specimen.embranchement")),
+ "embranchement", "embranchement"));
- columns.add(new TaxonomyPropertyColumn<Specimen>(new Model<String>(getString("Specimen.famille")), "famille",
- "famille"));
+ columns.add(new TaxonomyPropertyColumn<Specimen>(new Model<String>(getString("Specimen.famille")), "famille",
+ "famille"));
- columns.add(new TaxonomyPropertyColumn<Specimen>(new Model<String>(getString("Specimen.genre")), "genre",
- "genre"));
+ columns.add(new TaxonomyPropertyColumn<Specimen>(new Model<String>(getString("Specimen.genre")), "genre",
+ "genre"));
- columns.add(new TaxonomyPropertyColumn<Specimen>(new Model<String>(getString("Specimen.espece")), "espece",
- "espece"));
+ columns.add(new TaxonomyPropertyColumn<Specimen>(new Model<String>(getString("Specimen.espece")), "espece",
+ "espece"));
- columns.add(new LinkPropertyColumn<Specimen>(new Model<String>(getString("Specimen.station2")), "station",
- "station", getString("Read")) {
- @Override
- public void onClick(Item<ICellPopulator<Specimen>> item, String componentId, IModel<Specimen> model) {
- setResponsePage(new ReadStationPage(model.getObject().getStation().getIdStation(), currentPage));
- }
- });
+ columns.add(new LinkPropertyColumn<Specimen>(new Model<String>(getString("Specimen.station2")), "station",
+ "station", getString("Read")) {
+ @Override
+ public void onClick(Item<ICellPopulator<Specimen>> item, String componentId, IModel<Specimen> model) {
+ setResponsePage(new ReadStationPage(model.getObject().getStation().getIdStation(), currentPage));
+ }
+ });
- columns.add(new LinkableImagePropertyColumn<Specimen>("images/edit.png", getString("Update"),
- getString("Update")) {
- // pas de lien d'édition si l'utilisateur n'a pas les droits
- @Override
- public void populateItem(Item<ICellPopulator<Specimen>> item, String componentId, IModel<Specimen> model) {
- if (item.getIndex() % 2 == 1) {
- item.add(new AttributeModifier("class", item.getIndex() % 2 == 0 ? "even" : "odd"));
- }
+ columns.add(new LinkableImagePropertyColumn<Specimen>("images/edit.png", getString("Update"),
+ getString("Update")) {
+ // pas de lien d'édition si l'utilisateur n'a pas les droits
+ @Override
+ public void populateItem(Item<ICellPopulator<Specimen>> item, String componentId, IModel<Specimen> model) {
+ if (item.getIndex() % 2 == 1) {
+ item.add(new AttributeModifier("class", item.getIndex() % 2 == 0 ? "even" : "odd"));
+ }
- if (specimenService.updateOrdeleteSpecimenEnabled(model.getObject(), getSession().getUtilisateur())) {
- item.add(new LinkableImagePanel(item, componentId, model));
- } else {
- // label vide
- item.add(new Label(componentId));
- }
- }
+ if (specimenService.updateOrdeleteSpecimenEnabled(model.getObject(), getSession().getUtilisateur())) {
+ item.add(new LinkableImagePanel(item, componentId, model));
+ } else {
+ // label vide
+ item.add(new Label(componentId));
+ }
+ }
- @Override
- public void onClick(Item<ICellPopulator<Specimen>> item, String componentId, IModel<Specimen> model) {
- setResponsePage(new ManageSpecimenPage(model.getObject().getIdSpecimen(), currentPage));
- }
- });
+ @Override
+ public void onClick(Item<ICellPopulator<Specimen>> item, String componentId, IModel<Specimen> model) {
+ setResponsePage(new ManageSpecimenPage(model.getObject().getIdSpecimen(), currentPage));
+ }
+ });
- final DataTable<Specimen> specimensDataTable = new AjaxFallbackDefaultDataTable<Specimen>(
- "ListSpecimensPage.Specimens", columns, specimensDataProvider, WebContext.ROWS_PER_PAGE);
+ final DataTable<Specimen> specimensDataTable = new AjaxFallbackDefaultDataTable<Specimen>(
+ "ListSpecimensPage.Specimens", columns, specimensDataProvider, WebContext.ROWS_PER_PAGE);
- specimensRefresh.add(specimensDataTable);
- }
+ specimensRefresh.add(specimensDataTable);
+ }
}
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/specimen/ManageSpecimenPage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/specimen/ManageSpecimenPage.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/specimen/ManageSpecimenPage.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -79,353 +79,353 @@
@AuthRoles({ AuthRole.USER, AuthRole.ADMIN })
public final class ManageSpecimenPage extends TemplatePage {
- /** Action : create */
- private static final String ACTION_CREATE = "Create";
+ /** Action : create */
+ private static final String ACTION_CREATE = "Create";
- /** Action : delete */
- public static final String ACTION_DELETE = "Delete";
+ /** Action : delete */
+ public static final String ACTION_DELETE = "Delete";
- /** Action : update */
- private static final String ACTION_UPDATE = "Update";
+ /** Action : update */
+ private static final String ACTION_UPDATE = "Update";
- /** Logger */
- private static final Log LOG = LogTools.getLog();
+ /** Logger */
+ private static final Log LOG = LogTools.getLog();
- /** Modèle : specimen */
- private final IModel<Specimen> specimenModel;
+ /** Modèle : specimen */
+ private final IModel<Specimen> specimenModel;
- /** Service : specimen */
- @SpringBean
- private SpecimenService specimenService;
+ /** Service : specimen */
+ @SpringBean
+ private SpecimenService specimenService;
- /** Liste des personnes existantes */
- private final List<Personne> personnes;
+ /** Liste des personnes existantes */
+ private final List<Personne> personnes;
- /** Liste des stations existantes */
- private final List<Station> stations;
+ /** Liste des stations existantes */
+ private final List<Station> stations;
- /** Service : personne */
- @SpringBean
- private PersonneService personneService;
+ /** Service : personne */
+ @SpringBean
+ private PersonneService personneService;
- /** Service : station */
- @SpringBean
- private StationService stationService;
+ /** Service : station */
+ @SpringBean
+ private StationService stationService;
- /** Model validateur */
- @SpringBean(name = "webModelValidator")
- private ModelValidator validator;
+ /** Model validateur */
+ @SpringBean(name = "webModelValidator")
+ private ModelValidator validator;
- /** Page appelante */
- private final CallerPage callerPage;
+ /** Page appelante */
+ private final CallerPage callerPage;
- /** Saisie multiple */
- private boolean multipleEntry;
+ /** Saisie multiple */
+ private boolean multipleEntry;
- /**
- * Constructeur (mode création)
- * @param callerPage Page appelante
- * @param multipleEntry Saisie multiple
- */
- public ManageSpecimenPage(CallerPage callerPage, boolean multipleEntry) {
- this(null, null, callerPage, multipleEntry);
- }
+ /**
+ * Constructeur (mode création)
+ * @param callerPage Page appelante
+ * @param multipleEntry Saisie multiple
+ */
+ public ManageSpecimenPage(CallerPage callerPage, boolean multipleEntry) {
+ this(null, null, callerPage, multipleEntry);
+ }
- /**
- * Constructeur (mode édition)
- * @param idSpecimen Id du specimen
- * @param callerPage Page appelante
- */
- public ManageSpecimenPage(Integer idSpecimen, CallerPage callerPage) {
- this(idSpecimen, null, callerPage, false);
- }
+ /**
+ * Constructeur (mode édition)
+ * @param idSpecimen Id du specimen
+ * @param callerPage Page appelante
+ */
+ public ManageSpecimenPage(Integer idSpecimen, CallerPage callerPage) {
+ this(idSpecimen, null, callerPage, false);
+ }
- /**
- * Constructeur (mode saisie du specimen suivant)
- * @param specimen Specimen
- * @param callerPage Page appelante
- */
- public ManageSpecimenPage(Specimen specimen, CallerPage callerPage) {
- this(null, specimen, callerPage, true);
- }
+ /**
+ * Constructeur (mode saisie du specimen suivant)
+ * @param specimen Specimen
+ * @param callerPage Page appelante
+ */
+ public ManageSpecimenPage(Specimen specimen, CallerPage callerPage) {
+ this(null, specimen, callerPage, true);
+ }
- /**
- * Constructeur. Si refSpecimen et specimen sont nuls, on créée un nouveau Specimen. Si refSpecimen est renseigné,
- * on édite le specimen correspondant. Si specimen est renseigné, on créée un nouveau specimen à partir des
- * informations qu'il contient.
- * @param idSpecimen Id du specimen
- * @param specimen Specimen
- * @param callerPage Page appelante
- * @param multipleEntry Saisie multiple
- */
- private ManageSpecimenPage(Integer idSpecimen, Specimen specimen, final CallerPage callerPage, boolean multipleEntry) {
- super(ManageSpecimenPage.class);
- assert idSpecimen == null || specimen == null;
- this.callerPage = callerPage;
- this.multipleEntry = multipleEntry;
+ /**
+ * Constructeur. Si refSpecimen et specimen sont nuls, on créée un nouveau Specimen. Si refSpecimen est renseigné,
+ * on édite le specimen correspondant. Si specimen est renseigné, on créée un nouveau specimen à partir des
+ * informations qu'il contient.
+ * @param idSpecimen Id du specimen
+ * @param specimen Specimen
+ * @param callerPage Page appelante
+ * @param multipleEntry Saisie multiple
+ */
+ private ManageSpecimenPage(Integer idSpecimen, Specimen specimen, final CallerPage callerPage, boolean multipleEntry) {
+ super(ManageSpecimenPage.class);
+ assert idSpecimen == null || specimen == null;
+ this.callerPage = callerPage;
+ this.multipleEntry = multipleEntry;
- final CallerPage currentPage = new CallerPage(this);
+ final CallerPage currentPage = new CallerPage(this);
- // Initialisation du modèle
- try {
- specimenModel = new Model<Specimen>(idSpecimen == null && specimen == null ? new Specimen()
- : specimen != null ? specimen : specimenService.loadSpecimen(idSpecimen));
- } catch (DataNotFoundException e) {
- LOG.error(e.getMessage(), e);
- throw new UnexpectedException(e);
- }
- boolean createMode = idSpecimen == null;
- if (createMode) {
- specimenModel.getObject().setCreateur(getSession().getUtilisateur());
- }
+ // Initialisation du modèle
+ try {
+ specimenModel = new Model<Specimen>(idSpecimen == null && specimen == null ? new Specimen()
+ : specimen != null ? specimen : specimenService.loadSpecimen(idSpecimen));
+ } catch (DataNotFoundException e) {
+ LOG.error(e.getMessage(), e);
+ throw new UnexpectedException(e);
+ }
+ boolean createMode = idSpecimen == null;
+ if (createMode) {
+ specimenModel.getObject().setCreateur(getSession().getUtilisateur());
+ }
- // Initialisation des listes (pour le dropDownChoice)
- personnes = personneService.listPersonnes();
- stations = stationService.listStations(getSession().getUtilisateur());
+ // Initialisation des listes (pour le dropDownChoice)
+ personnes = personneService.listPersonnes();
+ stations = stationService.listStations(getSession().getUtilisateur());
- // Initialisation des listes (pour le AutoCompleteTextField)
- // liste des valeurs déjà existantes pour la propriété correspondante
- List<String> embranchements = specimenService.listSpecimenEmbranchements();
- List<String> familles = specimenService.listSpecimenFamilles();
- List<String> genres = specimenService.listSpecimenGenres();
- List<String> especes = specimenService.listSpecimenEspeces();
- List<String> sousEspeces = specimenService.listSpecimenSousEspeces();
- List<String> varietes = specimenService.listSpecimenVarietes();
- List<String> lieuxDepot = specimenService.listLieuxDepot();
+ // Initialisation des listes (pour le AutoCompleteTextField)
+ // liste des valeurs déjà existantes pour la propriété correspondante
+ List<String> embranchements = specimenService.listSpecimenEmbranchements();
+ List<String> familles = specimenService.listSpecimenFamilles();
+ List<String> genres = specimenService.listSpecimenGenres();
+ List<String> especes = specimenService.listSpecimenEspeces();
+ List<String> sousEspeces = specimenService.listSpecimenSousEspeces();
+ List<String> varietes = specimenService.listSpecimenVarietes();
+ List<String> lieuxDepot = specimenService.listLieuxDepot();
- if (specimen != null) {
- // qd saisie multiple avec préremplissage, hack nécessaire afin d'avoir dans le model le même objet que
- // celui de la liste de choix (sinon comme les objets viennent de sessions hibernate différentes, on n'a pas
- // l'égalité entre les objets)
- if (specimenModel.getObject().getIdentificateur() != null) {
- specimenModel.getObject().setIdentificateur(
- CollectionTools.findWithValue(personnes, "idPersonne", AccessType.GETTER, specimenModel
- .getObject().getIdentificateur().getIdPersonne()));
- }
- if (specimenModel.getObject().getStation() != null) {
- specimenModel.getObject().setStation(
- CollectionTools.findWithValue(stations, "idStation", AccessType.GETTER, specimenModel
- .getObject().getStation().getIdStation()));
- }
- }
+ if (specimen != null) {
+ // qd saisie multiple avec préremplissage, hack nécessaire afin d'avoir dans le model le même objet que
+ // celui de la liste de choix (sinon comme les objets viennent de sessions hibernate différentes, on n'a pas
+ // l'égalité entre les objets)
+ if (specimenModel.getObject().getIdentificateur() != null) {
+ specimenModel.getObject().setIdentificateur(
+ CollectionTools.findWithValue(personnes, "idPersonne", AccessType.GETTER, specimenModel
+ .getObject().getIdentificateur().getIdPersonne()));
+ }
+ if (specimenModel.getObject().getStation() != null) {
+ specimenModel.getObject().setStation(
+ CollectionTools.findWithValue(stations, "idStation", AccessType.GETTER, specimenModel
+ .getObject().getStation().getIdStation()));
+ }
+ }
- final Form<Void> formView = new Form<Void>("Form");
+ final Form<Void> formView = new Form<Void>("Form");
- formView.add(new TextField<String>("Specimen.ref", new PropertyModel<String>(specimenModel, "ref")));
- formView.add(new AutoCompleteTextFieldString("Specimen.embranchement", new PropertyModel<String>(specimenModel,
- "embranchement"), embranchements, ComparisonMode.CONTAINS));
- formView.add(new AutoCompleteTextFieldString("Specimen.famille", new PropertyModel<String>(specimenModel,
- "famille"), familles, ComparisonMode.CONTAINS));
- formView.add(new AutoCompleteTextFieldString("Specimen.genre",
- new PropertyModel<String>(specimenModel, "genre"), genres, ComparisonMode.CONTAINS));
- formView.add(new AutoCompleteTextFieldString("Specimen.espece", new PropertyModel<String>(specimenModel,
- "espece"), especes, ComparisonMode.CONTAINS));
- formView.add(new AutoCompleteTextFieldString("Specimen.sousEspece", new PropertyModel<String>(specimenModel,
- "sousEspece"), sousEspeces, ComparisonMode.CONTAINS));
- formView.add(new AutoCompleteTextFieldString("Specimen.variete", new PropertyModel<String>(specimenModel,
- "variete"), varietes, ComparisonMode.CONTAINS));
+ formView.add(new TextField<String>("Specimen.ref", new PropertyModel<String>(specimenModel, "ref")));
+ formView.add(new AutoCompleteTextFieldString("Specimen.embranchement", new PropertyModel<String>(specimenModel,
+ "embranchement"), embranchements, ComparisonMode.CONTAINS));
+ formView.add(new AutoCompleteTextFieldString("Specimen.famille", new PropertyModel<String>(specimenModel,
+ "famille"), familles, ComparisonMode.CONTAINS));
+ formView.add(new AutoCompleteTextFieldString("Specimen.genre",
+ new PropertyModel<String>(specimenModel, "genre"), genres, ComparisonMode.CONTAINS));
+ formView.add(new AutoCompleteTextFieldString("Specimen.espece", new PropertyModel<String>(specimenModel,
+ "espece"), especes, ComparisonMode.CONTAINS));
+ formView.add(new AutoCompleteTextFieldString("Specimen.sousEspece", new PropertyModel<String>(specimenModel,
+ "sousEspece"), sousEspeces, ComparisonMode.CONTAINS));
+ formView.add(new AutoCompleteTextFieldString("Specimen.variete", new PropertyModel<String>(specimenModel,
+ "variete"), varietes, ComparisonMode.CONTAINS));
- DropDownChoice<TypeOrganisme> typeOrganismeInput = new DropDownChoice<TypeOrganisme>("Specimen.typeOrganisme",
- new PropertyModel<TypeOrganisme>(specimenModel, "typeOrganisme"),
- Arrays.asList(TypeOrganisme.values()), new EnumChoiceRenderer<TypeOrganisme>(this));
- typeOrganismeInput.setNullValid(false);
- formView.add(typeOrganismeInput);
+ DropDownChoice<TypeOrganisme> typeOrganismeInput = new DropDownChoice<TypeOrganisme>("Specimen.typeOrganisme",
+ new PropertyModel<TypeOrganisme>(specimenModel, "typeOrganisme"),
+ Arrays.asList(TypeOrganisme.values()), new EnumChoiceRenderer<TypeOrganisme>(this));
+ typeOrganismeInput.setNullValid(false);
+ formView.add(typeOrganismeInput);
- formView.add(new DropDownChoice<Personne>("Specimen.identificateur", new PropertyModel<Personne>(specimenModel,
- "identificateur"), personnes, new PersonneRenderer()).setNullValid(true));
- // Action : création d'une nouvelle personne
- // ajaxSubmitLink permet de sauvegarder l'état du formulaire
- formView.add(new AjaxSubmitLink("NewPersonne") {
- @Override
- protected void onSubmit(AjaxRequestTarget arg0, Form<?> arg1) {
- setResponsePage(new ManagePersonnePage(currentPage, false));
- }
+ formView.add(new DropDownChoice<Personne>("Specimen.identificateur", new PropertyModel<Personne>(specimenModel,
+ "identificateur"), personnes, new PersonneRenderer()).setNullValid(true));
+ // Action : création d'une nouvelle personne
+ // ajaxSubmitLink permet de sauvegarder l'état du formulaire
+ formView.add(new AjaxSubmitLink("NewPersonne") {
+ @Override
+ protected void onSubmit(AjaxRequestTarget arg0, Form<?> arg1) {
+ setResponsePage(new ManagePersonnePage(currentPage, false));
+ }
- // si erreur, le formulaire est également enregistré puis la redirection effectuée
- @Override
- protected void onError(AjaxRequestTarget target, Form<?> form) {
- setResponsePage(new ManagePersonnePage(currentPage, false));
- }
- });
+ // si erreur, le formulaire est également enregistré puis la redirection effectuée
+ @Override
+ protected void onError(AjaxRequestTarget target, Form<?> form) {
+ setResponsePage(new ManagePersonnePage(currentPage, false));
+ }
+ });
- formView.add(new DropDownChoice<Station>("Specimen.station", new PropertyModel<Station>(specimenModel,
- "station"), stations).setNullValid(true));
+ formView.add(new DropDownChoice<Station>("Specimen.station", new PropertyModel<Station>(specimenModel,
+ "station"), stations).setNullValid(true));
- // Action : création d'une nouvelle station
- // ajaxSubmitLink permet de sauvegarder l'état du formulaire
- formView.add(new AjaxSubmitLink("NewStation") {
- @Override
- protected void onSubmit(AjaxRequestTarget arg0, Form<?> arg1) {
- setResponsePage(new ManageStationPage(currentPage, false));
- }
+ // Action : création d'une nouvelle station
+ // ajaxSubmitLink permet de sauvegarder l'état du formulaire
+ formView.add(new AjaxSubmitLink("NewStation") {
+ @Override
+ protected void onSubmit(AjaxRequestTarget arg0, Form<?> arg1) {
+ setResponsePage(new ManageStationPage(currentPage, false));
+ }
- // si erreur, le formulaire est également enregistré puis la redirection effectuée
- @Override
- protected void onError(AjaxRequestTarget target, Form<?> form) {
- setResponsePage(new ManageStationPage(currentPage, false));
- }
- });
+ // si erreur, le formulaire est également enregistré puis la redirection effectuée
+ @Override
+ protected void onError(AjaxRequestTarget target, Form<?> form) {
+ setResponsePage(new ManageStationPage(currentPage, false));
+ }
+ });
- formView.add(new TextArea<String>("Specimen.complement", new PropertyModel<String>(specimenModel, "complement")));
- // Créateur en lecture seule
- formView.add(new TextField<String>("Specimen.createur", new PropertyModel<String>(specimenModel, "createur"))
- .setEnabled(false));
+ formView.add(new TextArea<String>("Specimen.complement", new PropertyModel<String>(specimenModel, "complement")));
+ // Créateur en lecture seule
+ formView.add(new TextField<String>("Specimen.createur", new PropertyModel<String>(specimenModel, "createur"))
+ .setEnabled(false));
- // champs dépôt
- formView.add(new TextField<String>("Specimen.numDepot", new PropertyModel<String>(specimenModel, "numDepot")));
- formView.add(new DateTextField("Specimen.dateDepot", new PropertyModel<Date>(specimenModel, "dateDepot"))
- .add(new DatePicker()));
- formView.add(new AutoCompleteTextFieldString("Specimen.lieuDepot", new PropertyModel<String>(specimenModel,
- "lieuDepot"), lieuxDepot, ComparisonMode.CONTAINS));
+ // champs dépôt
+ formView.add(new TextField<String>("Specimen.numDepot", new PropertyModel<String>(specimenModel, "numDepot")));
+ formView.add(new DateTextField("Specimen.dateDepot", new PropertyModel<Date>(specimenModel, "dateDepot"))
+ .add(new DatePicker()));
+ formView.add(new AutoCompleteTextFieldString("Specimen.lieuDepot", new PropertyModel<String>(specimenModel,
+ "lieuDepot"), lieuxDepot, ComparisonMode.CONTAINS));
- // Action : création du specimen
- Button createButton = new SubmittableButton(ACTION_CREATE, new SubmittableButtonEvents() {
- @Override
- public void onProcess() throws DataConstraintException {
- specimenService.createSpecimen(specimenModel.getObject());
- }
+ // Action : création du specimen
+ Button createButton = new SubmittableButton(ACTION_CREATE, new SubmittableButtonEvents() {
+ @Override
+ public void onProcess() throws DataConstraintException {
+ specimenService.createSpecimen(specimenModel.getObject());
+ }
- @Override
- public void onSuccess() {
- successNextPage(ACTION_CREATE);
- redirect();
- }
+ @Override
+ public void onSuccess() {
+ successNextPage(ACTION_CREATE);
+ redirect();
+ }
- @Override
- public void onValidate() {
- validateModel();
- }
- });
- createButton.setVisibilityAllowed(createMode);
- formView.add(createButton);
+ @Override
+ public void onValidate() {
+ validateModel();
+ }
+ });
+ createButton.setVisibilityAllowed(createMode);
+ formView.add(createButton);
- // Action : mise à jour du specimen
- Button updateButton = new SubmittableButton(ACTION_UPDATE, new SubmittableButtonEvents() {
- @Override
- public void onProcess() throws DataConstraintException {
- specimenService.updateSpecimen(specimenModel.getObject());
- }
+ // Action : mise à jour du specimen
+ Button updateButton = new SubmittableButton(ACTION_UPDATE, new SubmittableButtonEvents() {
+ @Override
+ public void onProcess() throws DataConstraintException {
+ specimenService.updateSpecimen(specimenModel.getObject());
+ }
- @Override
- public void onSuccess() {
- successNextPage(ACTION_UPDATE);
- callerPage.responsePage((TemplatePage) getPage());
- }
+ @Override
+ public void onSuccess() {
+ successNextPage(ACTION_UPDATE);
+ callerPage.responsePage((TemplatePage) getPage());
+ }
- @Override
- public void onValidate() {
- validateModel();
- }
- });
- updateButton.setVisibilityAllowed(!createMode
- && specimenService.updateOrdeleteSpecimenEnabled(specimenModel.getObject(), getSession()
- .getUtilisateur()));
- formView.add(updateButton);
+ @Override
+ public void onValidate() {
+ validateModel();
+ }
+ });
+ updateButton.setVisibilityAllowed(!createMode
+ && specimenService.updateOrdeleteSpecimenEnabled(specimenModel.getObject(), getSession()
+ .getUtilisateur()));
+ formView.add(updateButton);
- // Action : suppression du specimen
- Button deleteButton = new SubmittableButton(ACTION_DELETE, new SubmittableButtonEvents() {
- @Override
- public void onProcess() throws DataConstraintException {
- specimenService.deleteSpecimen(specimenModel.getObject());
- }
+ // Action : suppression du specimen
+ Button deleteButton = new SubmittableButton(ACTION_DELETE, new SubmittableButtonEvents() {
+ @Override
+ public void onProcess() throws DataConstraintException {
+ specimenService.deleteSpecimen(specimenModel.getObject());
+ }
- @Override
- public void onSuccess() {
- successNextPage(ACTION_DELETE);
- callerPage.responsePage((TemplatePage) getPage());
- }
- });
- deleteButton.setVisibilityAllowed(!createMode
- && specimenService.updateOrdeleteSpecimenEnabled(specimenModel.getObject(), getSession()
- .getUtilisateur()));
- deleteButton.add(new JSConfirmationBehavior(getString("Confirm")));
- deleteButton.setDefaultFormProcessing(false);
- formView.add(deleteButton);
+ @Override
+ public void onSuccess() {
+ successNextPage(ACTION_DELETE);
+ callerPage.responsePage((TemplatePage) getPage());
+ }
+ });
+ deleteButton.setVisibilityAllowed(!createMode
+ && specimenService.updateOrdeleteSpecimenEnabled(specimenModel.getObject(), getSession()
+ .getUtilisateur()));
+ deleteButton.add(new JSConfirmationBehavior(getString("Confirm")));
+ deleteButton.setDefaultFormProcessing(false);
+ formView.add(deleteButton);
- formView.add(new Link<Void>("Cancel") {
- // Cas où le formulaire est annulé
- @Override
- public void onClick() {
- callerPage.responsePage((TemplatePage) getPage());
- }
- });
+ formView.add(new Link<Void>("Cancel") {
+ // Cas où le formulaire est annulé
+ @Override
+ public void onClick() {
+ callerPage.responsePage((TemplatePage) getPage());
+ }
+ });
- add(formView);
- }
+ add(formView);
+ }
- /** {@inheritDoc} */
- @Override
- protected void onBeforeRender() {
- // On rafraichit le modèle lorsque la page est rechargée (par exemple après l'ajout d'une nouvelle entité
- // Station, Spécimen ou Campagne)
- refreshModel();
- super.onBeforeRender();
- }
+ /** {@inheritDoc} */
+ @Override
+ protected void onBeforeRender() {
+ // On rafraichit le modèle lorsque la page est rechargée (par exemple après l'ajout d'une nouvelle entité
+ // Station, Spécimen ou Campagne)
+ refreshModel();
+ super.onBeforeRender();
+ }
- /**
- * Redirection vers une autre page. Cas où le formulaire est validé
- */
- private void redirect() {
- if (multipleEntry) {
- // Redirection de nouveau vers l'écran de saisie d'un nouveau spécimen
- Specimen nextSpecimen = new Specimen();
- nextSpecimen.setTypeOrganisme(specimenModel.getObject().getTypeOrganisme());
- nextSpecimen.setEmbranchement(specimenModel.getObject().getEmbranchement());
- nextSpecimen.setIdentificateur(specimenModel.getObject().getIdentificateur());
- nextSpecimen.setStation(specimenModel.getObject().getStation());
- nextSpecimen.setLieuDepot(specimenModel.getObject().getLieuDepot());
+ /**
+ * Redirection vers une autre page. Cas où le formulaire est validé
+ */
+ private void redirect() {
+ if (multipleEntry) {
+ // Redirection de nouveau vers l'écran de saisie d'un nouveau spécimen
+ Specimen nextSpecimen = new Specimen();
+ nextSpecimen.setTypeOrganisme(specimenModel.getObject().getTypeOrganisme());
+ nextSpecimen.setEmbranchement(specimenModel.getObject().getEmbranchement());
+ nextSpecimen.setIdentificateur(specimenModel.getObject().getIdentificateur());
+ nextSpecimen.setStation(specimenModel.getObject().getStation());
+ nextSpecimen.setLieuDepot(specimenModel.getObject().getLieuDepot());
- setResponsePage(new ManageSpecimenPage(nextSpecimen, callerPage));
- } else if (callerPage != null) {
- // On passe l'id du specimen associée à cette page, en paramètre de la prochaine page, pour lui permettre de
- // l'exploiter si besoin
- callerPage.addPageParameter(Specimen.class.getSimpleName(), specimenModel.getObject().getIdSpecimen());
- callerPage.responsePage(this);
- }
- }
+ setResponsePage(new ManageSpecimenPage(nextSpecimen, callerPage));
+ } else if (callerPage != null) {
+ // On passe l'id du specimen associée à cette page, en paramètre de la prochaine page, pour lui permettre de
+ // l'exploiter si besoin
+ callerPage.addPageParameter(Specimen.class.getSimpleName(), specimenModel.getObject().getIdSpecimen());
+ callerPage.responsePage(this);
+ }
+ }
- /**
- * Refresh model
- */
- private void refreshModel() {
+ /**
+ * Refresh model
+ */
+ private void refreshModel() {
- // Récupère (et supprime) les éventuels nouveaux objets créés dans les paramètres de la page.
- String key = Personne.class.getSimpleName();
- if (getPageParameters().getNamedKeys().contains(key)) {
- CollectionTools.setter(personnes, personneService.listPersonnes());
- try {
- Personne createdPersonne = personneService.loadPersonne(getPageParameters().get(key).toInt());
- specimenModel.getObject().setIdentificateur(createdPersonne);
- } catch (StringValueConversionException e) {
- LOG.error(e.getMessage(), e);
- throw new UnexpectedException(e);
- } catch (DataNotFoundException e) {
- LOG.error(e.getMessage(), e);
- throw new UnexpectedException(e);
- }
- getPageParameters().remove(key);
- }
- key = Station.class.getSimpleName();
- if (getPageParameters().getNamedKeys().contains(key)) {
- CollectionTools.setter(stations, stationService.listStations(getSession().getUtilisateur()));
- try {
- Station createdStation = stationService.loadStation(getPageParameters().get(key).toInt());
- specimenModel.getObject().setStation(createdStation);
- } catch (StringValueConversionException e) {
- LOG.error(e.getMessage(), e);
- throw new UnexpectedException(e);
- } catch (DataNotFoundException e) {
- LOG.error(e.getMessage(), e);
- throw new UnexpectedException(e);
- }
- getPageParameters().remove(key);
- }
- }
+ // Récupère (et supprime) les éventuels nouveaux objets créés dans les paramètres de la page.
+ String key = Personne.class.getSimpleName();
+ if (getPageParameters().getNamedKeys().contains(key)) {
+ CollectionTools.setter(personnes, personneService.listPersonnes());
+ try {
+ Personne createdPersonne = personneService.loadPersonne(getPageParameters().get(key).toInt());
+ specimenModel.getObject().setIdentificateur(createdPersonne);
+ } catch (StringValueConversionException e) {
+ LOG.error(e.getMessage(), e);
+ throw new UnexpectedException(e);
+ } catch (DataNotFoundException e) {
+ LOG.error(e.getMessage(), e);
+ throw new UnexpectedException(e);
+ }
+ getPageParameters().remove(key);
+ }
+ key = Station.class.getSimpleName();
+ if (getPageParameters().getNamedKeys().contains(key)) {
+ CollectionTools.setter(stations, stationService.listStations(getSession().getUtilisateur()));
+ try {
+ Station createdStation = stationService.loadStation(getPageParameters().get(key).toInt());
+ specimenModel.getObject().setStation(createdStation);
+ } catch (StringValueConversionException e) {
+ LOG.error(e.getMessage(), e);
+ throw new UnexpectedException(e);
+ } catch (DataNotFoundException e) {
+ LOG.error(e.getMessage(), e);
+ throw new UnexpectedException(e);
+ }
+ getPageParameters().remove(key);
+ }
+ }
- /**
- * Validate model
- */
- private void validateModel() {
- addValidationErrors(validator.validate(specimenModel.getObject(), getSession().getLocale()));
- }
+ /**
+ * Validate model
+ */
+ private void validateModel() {
+ addValidationErrors(validator.validate(specimenModel.getObject(), getSession().getLocale()));
+ }
}
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/specimen/ReadSpecimenPage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/specimen/ReadSpecimenPage.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/specimen/ReadSpecimenPage.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -57,142 +57,142 @@
*/
public final class ReadSpecimenPage extends TemplatePage {
- /** Action : delete */
- public static final String ACTION_DELETE = "Delete";
+ /** Action : delete */
+ public static final String ACTION_DELETE = "Delete";
- /** Logger */
- // private static final Log LOG = LogTools.getLog();
- /** Modèle : specimen */
- private final IModel<Specimen> specimenModel;
+ /** Logger */
+ // private static final Log LOG = LogTools.getLog();
+ /** Modèle : specimen */
+ private final IModel<Specimen> specimenModel;
- /** Service : specimen */
- @SpringBean
- private SpecimenService specimenService;
+ /** Service : specimen */
+ @SpringBean
+ private SpecimenService specimenService;
- /** Page appelante */
- private final CallerPage callerPage;
+ /** Page appelante */
+ private final CallerPage callerPage;
- /**
- * Constructeur
- * @param idSpecimen identifiant du spécimen
- * @param callerPage Page appelante
- */
- public ReadSpecimenPage(Integer idSpecimen, final CallerPage callerPage) {
- super(ReadSpecimenPage.class);
- final CallerPage currentPage = new CallerPage((TemplatePage) getPage());
- this.callerPage = callerPage;
+ /**
+ * Constructeur
+ * @param idSpecimen identifiant du spécimen
+ * @param callerPage Page appelante
+ */
+ public ReadSpecimenPage(Integer idSpecimen, final CallerPage callerPage) {
+ super(ReadSpecimenPage.class);
+ final CallerPage currentPage = new CallerPage((TemplatePage) getPage());
+ this.callerPage = callerPage;
- // Initialisation du modèle
- specimenModel = new GenericLoadableDetachableModel<Specimen>(Specimen.class, idSpecimen);
+ // Initialisation du modèle
+ specimenModel = new GenericLoadableDetachableModel<Specimen>(Specimen.class, idSpecimen);
- boolean createMode = idSpecimen == null;
- if (createMode) {
- specimenModel.getObject().setCreateur(getSession().getUtilisateur());
- }
- final Specimen specimen = specimenModel.getObject();
+ boolean createMode = idSpecimen == null;
+ if (createMode) {
+ specimenModel.getObject().setCreateur(getSession().getUtilisateur());
+ }
+ final Specimen specimen = specimenModel.getObject();
- // Mapping
- add(new Label("Specimen.ref", new PropertyModel<String>(specimenModel, "ref"))
- .add(new ReplaceEmptyLabelBehavior()));
- add(new Label("Specimen.embranchement", new PropertyModel<String>(specimenModel, "embranchement"))
- .add(new ReplaceEmptyLabelBehavior()));
- add(new Label("Specimen.famille", new PropertyModel<String>(specimenModel, "famille"))
- .add(new ReplaceEmptyLabelBehavior()));
- add(new Label("Specimen.genre", new PropertyModel<String>(specimenModel, "genre"))
- .add(new ReplaceEmptyLabelBehavior()));
- add(new Label("Specimen.espece", new PropertyModel<String>(specimenModel, "espece"))
- .add(new ReplaceEmptyLabelBehavior()));
- add(new Label("Specimen.sousEspece", new PropertyModel<String>(specimenModel, "sousEspece"))
- .add(new ReplaceEmptyLabelBehavior()));
- add(new Label("Specimen.variete", new PropertyModel<String>(specimenModel, "variete"))
- .add(new ReplaceEmptyLabelBehavior()));
- add(new Label("Specimen.typeOrganisme", new DisplayEnumPropertyModel(specimenModel, "typeOrganisme", this)));
+ // Mapping
+ add(new Label("Specimen.ref", new PropertyModel<String>(specimenModel, "ref"))
+ .add(new ReplaceEmptyLabelBehavior()));
+ add(new Label("Specimen.embranchement", new PropertyModel<String>(specimenModel, "embranchement"))
+ .add(new ReplaceEmptyLabelBehavior()));
+ add(new Label("Specimen.famille", new PropertyModel<String>(specimenModel, "famille"))
+ .add(new ReplaceEmptyLabelBehavior()));
+ add(new Label("Specimen.genre", new PropertyModel<String>(specimenModel, "genre"))
+ .add(new ReplaceEmptyLabelBehavior()));
+ add(new Label("Specimen.espece", new PropertyModel<String>(specimenModel, "espece"))
+ .add(new ReplaceEmptyLabelBehavior()));
+ add(new Label("Specimen.sousEspece", new PropertyModel<String>(specimenModel, "sousEspece"))
+ .add(new ReplaceEmptyLabelBehavior()));
+ add(new Label("Specimen.variete", new PropertyModel<String>(specimenModel, "variete"))
+ .add(new ReplaceEmptyLabelBehavior()));
+ add(new Label("Specimen.typeOrganisme", new DisplayEnumPropertyModel(specimenModel, "typeOrganisme", this)));
- add(new PropertyLabelLinkPanel<Personne>("Specimen.identificateur", new PropertyModel<Personne>(specimenModel,
- "identificateur"), getString("Read")) {
- @Override
- public void onClick() {
- setResponsePage(new ReadPersonnePage(getModelObject().getIdPersonne(), currentPage));
- }
- });
+ add(new PropertyLabelLinkPanel<Personne>("Specimen.identificateur", new PropertyModel<Personne>(specimenModel,
+ "identificateur"), getString("Read")) {
+ @Override
+ public void onClick() {
+ setResponsePage(new ReadPersonnePage(getModelObject().getIdPersonne(), currentPage));
+ }
+ });
- add(new PropertyLabelLinkPanel<Station>("Specimen.station",
- new PropertyModel<Station>(specimenModel, "station"), getString("Read")) {
- @Override
- public void onClick() {
- setResponsePage(new ReadStationPage(getModelObject().getIdStation(), currentPage));
- }
- }.add(new ReplaceEmptyLabelBehavior()));
+ add(new PropertyLabelLinkPanel<Station>("Specimen.station",
+ new PropertyModel<Station>(specimenModel, "station"), getString("Read")) {
+ @Override
+ public void onClick() {
+ setResponsePage(new ReadStationPage(getModelObject().getIdStation(), currentPage));
+ }
+ }.add(new ReplaceEmptyLabelBehavior()));
- add(new MultiLineLabel("Specimen.complement", new PropertyModel<String>(specimenModel, "complement"))
- .add(new ReplaceEmptyLabelBehavior()));
+ add(new MultiLineLabel("Specimen.complement", new PropertyModel<String>(specimenModel, "complement"))
+ .add(new ReplaceEmptyLabelBehavior()));
- add(new PropertyLabelLinkPanel<Personne>("Specimen.createur", new PropertyModel<Personne>(specimenModel,
- "createur"), getString("Read")) {
- @Override
- public void onClick() {
- setResponsePage(new ReadPersonnePage(getModelObject().getIdPersonne(), currentPage));
- }
- });
+ add(new PropertyLabelLinkPanel<Personne>("Specimen.createur", new PropertyModel<Personne>(specimenModel,
+ "createur"), getString("Read")) {
+ @Override
+ public void onClick() {
+ setResponsePage(new ReadPersonnePage(getModelObject().getIdPersonne(), currentPage));
+ }
+ });
- // champs dépôt
- add(new Label("Specimen.numDepot", new PropertyModel<String>(specimenModel, "numDepot"))
- .add(new ReplaceEmptyLabelBehavior()));
- add(new Label("Specimen.dateDepot", new PropertyModel<Date>(specimenModel, "dateDepot"))
- .add(new ReplaceEmptyLabelBehavior()));
- add(new Label("Specimen.lieuDepot", new PropertyModel<String>(specimenModel, "lieuDepot"))
- .add(new ReplaceEmptyLabelBehavior()));
+ // champs dépôt
+ add(new Label("Specimen.numDepot", new PropertyModel<String>(specimenModel, "numDepot"))
+ .add(new ReplaceEmptyLabelBehavior()));
+ add(new Label("Specimen.dateDepot", new PropertyModel<Date>(specimenModel, "dateDepot"))
+ .add(new ReplaceEmptyLabelBehavior()));
+ add(new Label("Specimen.lieuDepot", new PropertyModel<String>(specimenModel, "lieuDepot"))
+ .add(new ReplaceEmptyLabelBehavior()));
- final Form<Void> formView = new Form<Void>("Form");
+ final Form<Void> formView = new Form<Void>("Form");
- // Action : mise à jour
- Link<Specimen> updateLink = new Link<Specimen>(getResource() + ".Specimen.Update",
- new Model<Specimen>(specimen)) {
- @Override
- public void onClick() {
- setResponsePage(new ManageSpecimenPage(getModelObject().getIdSpecimen(), currentPage));
- }
- };
- updateLink.setVisibilityAllowed(specimenService.updateOrdeleteSpecimenEnabled(specimen, getSession()
- .getUtilisateur()));
- formView.add(updateLink);
+ // Action : mise à jour
+ Link<Specimen> updateLink = new Link<Specimen>(getResource() + ".Specimen.Update",
+ new Model<Specimen>(specimen)) {
+ @Override
+ public void onClick() {
+ setResponsePage(new ManageSpecimenPage(getModelObject().getIdSpecimen(), currentPage));
+ }
+ };
+ updateLink.setVisibilityAllowed(specimenService.updateOrdeleteSpecimenEnabled(specimen, getSession()
+ .getUtilisateur()));
+ formView.add(updateLink);
- // Action : suppression du specimen
- Button deleteButton = new SubmittableButton(ACTION_DELETE, ManageSpecimenPage.class,
- new SubmittableButtonEvents() {
- @Override
- public void onProcess() throws DataConstraintException {
- specimenService.deleteSpecimen(specimenModel.getObject());
- }
+ // Action : suppression du specimen
+ Button deleteButton = new SubmittableButton(ACTION_DELETE, ManageSpecimenPage.class,
+ new SubmittableButtonEvents() {
+ @Override
+ public void onProcess() throws DataConstraintException {
+ specimenService.deleteSpecimen(specimenModel.getObject());
+ }
- @Override
- public void onSuccess() {
- successNextPage(ManageSpecimenPage.class, ACTION_DELETE);
- redirect();
- }
- });
- deleteButton.setVisibilityAllowed(!createMode
- && specimenService.updateOrdeleteSpecimenEnabled(specimenModel.getObject(), getSession()
- .getUtilisateur()));
- deleteButton.add(new JSConfirmationBehavior(getString("Confirm")));
- deleteButton.setDefaultFormProcessing(false);
- formView.add(deleteButton);
+ @Override
+ public void onSuccess() {
+ successNextPage(ManageSpecimenPage.class, ACTION_DELETE);
+ redirect();
+ }
+ });
+ deleteButton.setVisibilityAllowed(!createMode
+ && specimenService.updateOrdeleteSpecimenEnabled(specimenModel.getObject(), getSession()
+ .getUtilisateur()));
+ deleteButton.add(new JSConfirmationBehavior(getString("Confirm")));
+ deleteButton.setDefaultFormProcessing(false);
+ formView.add(deleteButton);
- // Action : retour
- formView.add(new Link<Void>(getResource() + ".Specimen.Back") {
- @Override
- public void onClick() {
- callerPage.responsePage((TemplatePage) getPage());
- }
- });
+ // Action : retour
+ formView.add(new Link<Void>(getResource() + ".Specimen.Back") {
+ @Override
+ public void onClick() {
+ callerPage.responsePage((TemplatePage) getPage());
+ }
+ });
- add(formView);
- }
+ add(formView);
+ }
- /**
- * Redirection vers une autre page
- */
- private void redirect() {
- callerPage.responsePage(this);
- }
+ /**
+ * Redirection vers une autre page
+ */
+ private void redirect() {
+ callerPage.responsePage(this);
+ }
}
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/station/ListStationsPage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/station/ListStationsPage.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/station/ListStationsPage.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -60,92 +60,92 @@
@AuthRoles({ AuthRole.ADMIN, AuthRole.USER })
public final class ListStationsPage extends TemplatePage {
- /** Service : station */
- @SpringBean
- private StationService stationService;
+ /** Service : station */
+ @SpringBean
+ private StationService stationService;
- /**
- * Constructeur
- */
- public ListStationsPage() {
- super(ListStationsPage.class);
+ /**
+ * Constructeur
+ */
+ public ListStationsPage() {
+ super(ListStationsPage.class);
- final CallerPage currentPage = new CallerPage(ListStationsPage.class);
+ final CallerPage currentPage = new CallerPage(ListStationsPage.class);
- // Lien pour ajouter une nouvelle station
- add(new Link<Station>(getResource() + ".NewStation") {
- @Override
- public void onClick() {
- setResponsePage(new ManageStationPage(currentPage, true));
- }
- });
+ // Lien pour ajouter une nouvelle station
+ add(new Link<Station>(getResource() + ".NewStation") {
+ @Override
+ public void onClick() {
+ setResponsePage(new ManageStationPage(currentPage, true));
+ }
+ });
- // On englobe le "DataView" dans un composant neutre que l'on pourra
- // rafraichir quand la liste évoluera
- final MarkupContainer stationsRefresh = new WebMarkupContainer(getResource() + ".Stations.Refresh");
- stationsRefresh.setOutputMarkupId(true);
- add(stationsRefresh);
+ // On englobe le "DataView" dans un composant neutre que l'on pourra
+ // rafraichir quand la liste évoluera
+ final MarkupContainer stationsRefresh = new WebMarkupContainer(getResource() + ".Stations.Refresh");
+ stationsRefresh.setOutputMarkupId(true);
+ add(stationsRefresh);
- // Liste des stations
- final List<Station> stations = stationService.listStations(getSession().getUtilisateur());
- LoadableDetachableSortableListDataProvider<Station> stationsDataProvider = new LoadableDetachableSortableListDataProvider<Station>(
- stations, getSession().getLocale());
+ // Liste des stations
+ final List<Station> stations = stationService.listStations(getSession().getUtilisateur());
+ LoadableDetachableSortableListDataProvider<Station> stationsDataProvider = new LoadableDetachableSortableListDataProvider<Station>(
+ stations, getSession().getLocale());
- List<IColumn<Station>> columns = new ArrayList<IColumn<Station>>();
+ List<IColumn<Station>> columns = new ArrayList<IColumn<Station>>();
- columns.add(new LinkableImagePropertyColumn<Station>("images/read.png", getString("Read"), getString("Read")) {
- @Override
- public void onClick(Item<ICellPopulator<Station>> item, String componentId, IModel<Station> model) {
- setResponsePage(new ReadStationPage(model.getObject().getIdStation(), currentPage));
- }
- });
+ columns.add(new LinkableImagePropertyColumn<Station>("images/read.png", getString("Read"), getString("Read")) {
+ @Override
+ public void onClick(Item<ICellPopulator<Station>> item, String componentId, IModel<Station> model) {
+ setResponsePage(new ReadStationPage(model.getObject().getIdStation(), currentPage));
+ }
+ });
- columns.add(new LinkPropertyColumn<Station>(new Model<String>(getString("Station.nom")), "nom", "nom",
- getString("Read")) {
- @Override
- public void onClick(Item<ICellPopulator<Station>> item, String componentId, IModel<Station> model) {
- setResponsePage(new ReadStationPage(model.getObject().getIdStation(), currentPage));
- }
- });
+ columns.add(new LinkPropertyColumn<Station>(new Model<String>(getString("Station.nom")), "nom", "nom",
+ getString("Read")) {
+ @Override
+ public void onClick(Item<ICellPopulator<Station>> item, String componentId, IModel<Station> model) {
+ setResponsePage(new ReadStationPage(model.getObject().getIdStation(), currentPage));
+ }
+ });
- columns.add(new MapValuePropertyColumn<Station, String>(new Model<String>(getString("Station.codePays")),
- "codePays", "codePays", WebContext.COUNTRIES.get(getSession().getLocale())));
+ columns.add(new MapValuePropertyColumn<Station, String>(new Model<String>(getString("Station.codePays")),
+ "codePays", "codePays", WebContext.COUNTRIES.get(getSession().getLocale())));
- columns.add(new PropertyColumn<Station>(new Model<String>(getString("Station.localite")), "localite",
- "localite"));
+ columns.add(new PropertyColumn<Station>(new Model<String>(getString("Station.localite")), "localite",
+ "localite"));
- columns.add(new PropertyColumn<Station>(new Model<String>(getString("Station.latitude")), "latitude",
- "latitude"));
+ columns.add(new PropertyColumn<Station>(new Model<String>(getString("Station.latitude")), "latitude",
+ "latitude"));
- columns.add(new PropertyColumn<Station>(new Model<String>(getString("Station.longitude")), "longitude",
- "longitude"));
+ columns.add(new PropertyColumn<Station>(new Model<String>(getString("Station.longitude")), "longitude",
+ "longitude"));
- columns.add(new LinkableImagePropertyColumn<Station>("images/edit.png", getString("Update"),
- getString("Update")) {
- // pas de lien d'édition si l'utilisateur n'a pas les droits
- @Override
- public void populateItem(Item<ICellPopulator<Station>> item, String componentId, IModel<Station> model) {
- if (item.getIndex() % 2 == 1) {
- item.add(new AttributeModifier("class", item.getIndex() % 2 == 0 ? "even" : "odd"));
- }
+ columns.add(new LinkableImagePropertyColumn<Station>("images/edit.png", getString("Update"),
+ getString("Update")) {
+ // pas de lien d'édition si l'utilisateur n'a pas les droits
+ @Override
+ public void populateItem(Item<ICellPopulator<Station>> item, String componentId, IModel<Station> model) {
+ if (item.getIndex() % 2 == 1) {
+ item.add(new AttributeModifier("class", item.getIndex() % 2 == 0 ? "even" : "odd"));
+ }
- if (stationService.updateOrdeleteStationEnabled(model.getObject(), getSession().getUtilisateur())) {
- item.add(new LinkableImagePanel(item, componentId, model));
- } else {
- // label vide
- item.add(new Label(componentId));
- }
- }
+ if (stationService.updateOrdeleteStationEnabled(model.getObject(), getSession().getUtilisateur())) {
+ item.add(new LinkableImagePanel(item, componentId, model));
+ } else {
+ // label vide
+ item.add(new Label(componentId));
+ }
+ }
- @Override
- public void onClick(Item<ICellPopulator<Station>> item, String componentId, IModel<Station> model) {
- setResponsePage(new ManageStationPage(model.getObject().getIdStation(), currentPage));
- }
- });
+ @Override
+ public void onClick(Item<ICellPopulator<Station>> item, String componentId, IModel<Station> model) {
+ setResponsePage(new ManageStationPage(model.getObject().getIdStation(), currentPage));
+ }
+ });
- final DataTable<Station> stationsDataTable = new AjaxFallbackDefaultDataTable<Station>(
- "ListStationsPage.Stations", columns, stationsDataProvider, WebContext.ROWS_PER_PAGE);
+ final DataTable<Station> stationsDataTable = new AjaxFallbackDefaultDataTable<Station>(
+ "ListStationsPage.Stations", columns, stationsDataProvider, WebContext.ROWS_PER_PAGE);
- stationsRefresh.add(stationsDataTable);
- }
+ stationsRefresh.add(stationsDataTable);
+ }
}
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/station/ManageStationPage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/station/ManageStationPage.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/station/ManageStationPage.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -69,335 +69,335 @@
@AuthRoles({ AuthRole.ADMIN, AuthRole.USER })
public final class ManageStationPage extends TemplatePage {
- /** Action : create */
- private static final String ACTION_CREATE = "Create";
+ /** Action : create */
+ private static final String ACTION_CREATE = "Create";
- /** Action : delete */
- public static final String ACTION_DELETE = "Delete";
+ /** Action : delete */
+ public static final String ACTION_DELETE = "Delete";
- /** Action : update */
- public static final String ACTION_UPDATE = "Update";
+ /** Action : update */
+ public static final String ACTION_UPDATE = "Update";
- /** Logger */
- private static final Log LOG = LogTools.getLog();
+ /** Logger */
+ private static final Log LOG = LogTools.getLog();
- /** Page appelante */
- private final CallerPage callerPage;
+ /** Page appelante */
+ private final CallerPage callerPage;
- /** Saisie multiple */
- private boolean multipleEntry;
+ /** Saisie multiple */
+ private boolean multipleEntry;
- /** Modèle : manage station */
- private final IModel<ManageStationModel> manageStationModel;
+ /** Modèle : manage station */
+ private final IModel<ManageStationModel> manageStationModel;
- /** Modèle : station */
- private final IModel<Station> stationModel;
+ /** Modèle : station */
+ private final IModel<Station> stationModel;
- /** Service : station */
- @SpringBean
- private StationService stationService;
+ /** Service : station */
+ @SpringBean
+ private StationService stationService;
- /** Validateur modèle */
- @SpringBean(name = "webModelValidator")
- private ModelValidator validator;
+ /** Validateur modèle */
+ @SpringBean(name = "webModelValidator")
+ private ModelValidator validator;
- /**
- * Constructor (mode création)
- * @param callerPage Page appelante
- * @param multipleEntry Saisie de stations multiples
- */
- public ManageStationPage(CallerPage callerPage, boolean multipleEntry) {
- this(null, null, callerPage, multipleEntry);
- }
+ /**
+ * Constructor (mode création)
+ * @param callerPage Page appelante
+ * @param multipleEntry Saisie de stations multiples
+ */
+ public ManageStationPage(CallerPage callerPage, boolean multipleEntry) {
+ this(null, null, callerPage, multipleEntry);
+ }
- /**
- * Constructeur (mode édition)
- * @param idStation ID station
- * @param callerPage Page appelante
- */
- public ManageStationPage(Integer idStation, CallerPage callerPage) {
- this(idStation, null, callerPage, false);
- }
+ /**
+ * Constructeur (mode édition)
+ * @param idStation ID station
+ * @param callerPage Page appelante
+ */
+ public ManageStationPage(Integer idStation, CallerPage callerPage) {
+ this(idStation, null, callerPage, false);
+ }
- /**
- * Constructeur (mode saisie de la station suivante)
- * @param station Station
- * @param callerPage Page appelante
- */
- public ManageStationPage(Station station, CallerPage callerPage) {
- this(null, station, callerPage, true);
- }
+ /**
+ * Constructeur (mode saisie de la station suivante)
+ * @param station Station
+ * @param callerPage Page appelante
+ */
+ public ManageStationPage(Station station, CallerPage callerPage) {
+ this(null, station, callerPage, true);
+ }
- /**
- * Constructeur. Si idStation et station sont null, on créée une nouvelle Station. Si idStation est renseigné, on
- * édite la station correspondante. Si station est renseigné, on créée une nouvelle station à partir des
- * informations qu'il contient.
- * @param idStation ID station
- * @param station Station
- * @param callerPage Page appelante
- * @param multipleEntry Saisie de stations multiples
- */
- private ManageStationPage(Integer idStation, Station station, final CallerPage callerPage,
- final boolean multipleEntry) {
- super(ManageStationPage.class);
- assert idStation == null || station == null;
- this.callerPage = callerPage;
- this.multipleEntry = multipleEntry;
+ /**
+ * Constructeur. Si idStation et station sont null, on créée une nouvelle Station. Si idStation est renseigné, on
+ * édite la station correspondante. Si station est renseigné, on créée une nouvelle station à partir des
+ * informations qu'il contient.
+ * @param idStation ID station
+ * @param station Station
+ * @param callerPage Page appelante
+ * @param multipleEntry Saisie de stations multiples
+ */
+ private ManageStationPage(Integer idStation, Station station, final CallerPage callerPage,
+ final boolean multipleEntry) {
+ super(ManageStationPage.class);
+ assert idStation == null || station == null;
+ this.callerPage = callerPage;
+ this.multipleEntry = multipleEntry;
- // Initialisation du modèle
- manageStationModel = new Model<ManageStationModel>(new ManageStationModel());
- try {
- stationModel = new Model<Station>(idStation == null && station == null ? new Station()
- : station != null ? station : stationService.loadStation(idStation));
- } catch (DataNotFoundException e) {
- LOG.error(e.getMessage(), e);
- throw new UnexpectedException(e);
- }
- boolean createMode = idStation == null;
- if (createMode) {
- stationModel.getObject().setCreateur(getSession().getUtilisateur());
- if (station != null) {
- // cas où édition d'une station à partir de champs préremplies de l'ancienne station
- // on met à jour le modèle intermédiaire pour les coordonnées (pas les minutes de longitude et latitude
- // par contre)
- manageStationModel.getObject().setLatitudeDegrees(
- CoordTools.latitudeDegrees(stationModel.getObject().getLatitude()));
- manageStationModel.getObject().setLatitudeOrientation(
- CoordTools.latitudeOrientation(stationModel.getObject().getLatitude()));
- manageStationModel.getObject().setLongitudeDegrees(
- CoordTools.longitudeDegrees(stationModel.getObject().getLongitude()));
- manageStationModel.getObject().setLongitudeOrientation(
- CoordTools.longitudeOrientation(stationModel.getObject().getLongitude()));
- }
- } else {
- // mode édition, mise à jour du modèle intermédiaire pour les coordonnées
- manageStationModel.getObject().setLatitudeDegrees(
- CoordTools.latitudeDegrees(stationModel.getObject().getLatitude()));
- manageStationModel.getObject().setLatitudeMinutes(
- CoordTools.latitudeMinutes(stationModel.getObject().getLatitude()));
- manageStationModel.getObject().setLatitudeOrientation(
- CoordTools.latitudeOrientation(stationModel.getObject().getLatitude()));
- manageStationModel.getObject().setLongitudeDegrees(
- CoordTools.longitudeDegrees(stationModel.getObject().getLongitude()));
- manageStationModel.getObject().setLongitudeMinutes(
- CoordTools.longitudeMinutes(stationModel.getObject().getLongitude()));
- manageStationModel.getObject().setLongitudeOrientation(
- CoordTools.longitudeOrientation(stationModel.getObject().getLongitude()));
- }
+ // Initialisation du modèle
+ manageStationModel = new Model<ManageStationModel>(new ManageStationModel());
+ try {
+ stationModel = new Model<Station>(idStation == null && station == null ? new Station()
+ : station != null ? station : stationService.loadStation(idStation));
+ } catch (DataNotFoundException e) {
+ LOG.error(e.getMessage(), e);
+ throw new UnexpectedException(e);
+ }
+ boolean createMode = idStation == null;
+ if (createMode) {
+ stationModel.getObject().setCreateur(getSession().getUtilisateur());
+ if (station != null) {
+ // cas où édition d'une station à partir de champs préremplies de l'ancienne station
+ // on met à jour le modèle intermédiaire pour les coordonnées (pas les minutes de longitude et latitude
+ // par contre)
+ manageStationModel.getObject().setLatitudeDegrees(
+ CoordTools.latitudeDegrees(stationModel.getObject().getLatitude()));
+ manageStationModel.getObject().setLatitudeOrientation(
+ CoordTools.latitudeOrientation(stationModel.getObject().getLatitude()));
+ manageStationModel.getObject().setLongitudeDegrees(
+ CoordTools.longitudeDegrees(stationModel.getObject().getLongitude()));
+ manageStationModel.getObject().setLongitudeOrientation(
+ CoordTools.longitudeOrientation(stationModel.getObject().getLongitude()));
+ }
+ } else {
+ // mode édition, mise à jour du modèle intermédiaire pour les coordonnées
+ manageStationModel.getObject().setLatitudeDegrees(
+ CoordTools.latitudeDegrees(stationModel.getObject().getLatitude()));
+ manageStationModel.getObject().setLatitudeMinutes(
+ CoordTools.latitudeMinutes(stationModel.getObject().getLatitude()));
+ manageStationModel.getObject().setLatitudeOrientation(
+ CoordTools.latitudeOrientation(stationModel.getObject().getLatitude()));
+ manageStationModel.getObject().setLongitudeDegrees(
+ CoordTools.longitudeDegrees(stationModel.getObject().getLongitude()));
+ manageStationModel.getObject().setLongitudeMinutes(
+ CoordTools.longitudeMinutes(stationModel.getObject().getLongitude()));
+ manageStationModel.getObject().setLongitudeOrientation(
+ CoordTools.longitudeOrientation(stationModel.getObject().getLongitude()));
+ }
- // Initialisation des listes
- List<String> localites = stationService.listStationLocalites();
- final Form<Void> formView = new Form<Void>("Form");
- formView.add(new TextField<String>("Station.nom", new PropertyModel<String>(stationModel, "nom")));
- formView.add(new DropDownChoice<String>("Station.codePays",
- new PropertyModel<String>(stationModel, "codePays"), WebContext.COUNTRY_CODES.get(getSession()
- .getLocale()), new MapChoiceRenderer<String, String>(WebContext.COUNTRIES.get(getSession()
- .getLocale()))));
- formView.add(new AutoCompleteTextFieldString("Station.localite", new PropertyModel<String>(stationModel,
- "localite"), localites, ComparisonMode.CONTAINS));
- formView.add(new TextArea<String>("Station.complement", new PropertyModel<String>(stationModel, "complement")));
+ // Initialisation des listes
+ List<String> localites = stationService.listStationLocalites();
+ final Form<Void> formView = new Form<Void>("Form");
+ formView.add(new TextField<String>("Station.nom", new PropertyModel<String>(stationModel, "nom")));
+ formView.add(new DropDownChoice<String>("Station.codePays",
+ new PropertyModel<String>(stationModel, "codePays"), WebContext.COUNTRY_CODES.get(getSession()
+ .getLocale()), new MapChoiceRenderer<String, String>(WebContext.COUNTRIES.get(getSession()
+ .getLocale()))));
+ formView.add(new AutoCompleteTextFieldString("Station.localite", new PropertyModel<String>(stationModel,
+ "localite"), localites, ComparisonMode.CONTAINS));
+ formView.add(new TextArea<String>("Station.complement", new PropertyModel<String>(stationModel, "complement")));
- // Créateur en lecture seule
- formView.add(new TextField<String>("Station.createur", new PropertyModel<String>(stationModel, "createur"))
- .setEnabled(false));
+ // Créateur en lecture seule
+ formView.add(new TextField<String>("Station.createur", new PropertyModel<String>(stationModel, "createur"))
+ .setEnabled(false));
- formView.add(new TextField<Integer>("ManageStationModel.latitudeDegrees", new PropertyModel<Integer>(
- manageStationModel, "latitudeDegrees")));
- formView.add(new Label("Coordonnate.degrees.latitude", String.valueOf(CoordTools.DEGREES)));
- formView.add(new TextField<BigDecimal>("ManageStationModel.latitudeMinutes", new PropertyModel<BigDecimal>(
- manageStationModel, "latitudeMinutes")));
- formView.add(new Label("Coordonnate.minutes.latitude", String.valueOf(CoordTools.MINUTES)));
- formView.add(new DropDownChoice<Character>("ManageStationModel.latitudeOrientation",
- new PropertyModel<Character>(manageStationModel, "latitudeOrientation"), Arrays
- .asList(CoordTools.LATITUDE_ORIENTATIONS)));
- formView.add(new TextField<Integer>("ManageStationModel.longitudeDegrees", new PropertyModel<Integer>(
- manageStationModel, "longitudeDegrees")));
- formView.add(new Label("Coordonnate.degrees.longitude", String.valueOf(CoordTools.DEGREES)));
- formView.add(new TextField<BigDecimal>("ManageStationModel.longitudeMinutes", new PropertyModel<BigDecimal>(
- manageStationModel, "longitudeMinutes")));
- formView.add(new Label("Coordonnate.minutes.longitude", String.valueOf(CoordTools.MINUTES)));
- formView.add(new DropDownChoice<Character>("ManageStationModel.longitudeOrientation",
- new PropertyModel<Character>(manageStationModel, "longitudeOrientation"), Arrays
- .asList(CoordTools.LONGITUDE_ORIENTATIONS)));
+ formView.add(new TextField<Integer>("ManageStationModel.latitudeDegrees", new PropertyModel<Integer>(
+ manageStationModel, "latitudeDegrees")));
+ formView.add(new Label("Coordonnate.degrees.latitude", String.valueOf(CoordTools.DEGREES)));
+ formView.add(new TextField<BigDecimal>("ManageStationModel.latitudeMinutes", new PropertyModel<BigDecimal>(
+ manageStationModel, "latitudeMinutes")));
+ formView.add(new Label("Coordonnate.minutes.latitude", String.valueOf(CoordTools.MINUTES)));
+ formView.add(new DropDownChoice<Character>("ManageStationModel.latitudeOrientation",
+ new PropertyModel<Character>(manageStationModel, "latitudeOrientation"), Arrays
+ .asList(CoordTools.LATITUDE_ORIENTATIONS)));
+ formView.add(new TextField<Integer>("ManageStationModel.longitudeDegrees", new PropertyModel<Integer>(
+ manageStationModel, "longitudeDegrees")));
+ formView.add(new Label("Coordonnate.degrees.longitude", String.valueOf(CoordTools.DEGREES)));
+ formView.add(new TextField<BigDecimal>("ManageStationModel.longitudeMinutes", new PropertyModel<BigDecimal>(
+ manageStationModel, "longitudeMinutes")));
+ formView.add(new Label("Coordonnate.minutes.longitude", String.valueOf(CoordTools.MINUTES)));
+ formView.add(new DropDownChoice<Character>("ManageStationModel.longitudeOrientation",
+ new PropertyModel<Character>(manageStationModel, "longitudeOrientation"), Arrays
+ .asList(CoordTools.LONGITUDE_ORIENTATIONS)));
- formView.add(new DropDownChoice<Integer>("Station.referentiel", new PropertyModel<Integer>(stationModel,
- "referentiel"), WebContext.REFERENTIEL_CODES, new MapChoiceRenderer<Integer, String>(
- DataContext.REFERENTIELS)));
+ formView.add(new DropDownChoice<Integer>("Station.referentiel", new PropertyModel<Integer>(stationModel,
+ "referentiel"), WebContext.REFERENTIEL_CODES, new MapChoiceRenderer<Integer, String>(
+ DataContext.REFERENTIELS)));
- Button createButton = new SubmittableButton(ACTION_CREATE, new SubmittableButtonEvents() {
- @Override
- public void onProcess() throws DataConstraintException {
- if (manageStationModel.getObject().getLatitudeDegrees() == null) {
- stationModel.getObject().setReferentiel(null);
- }
- stationService.createStation(stationModel.getObject());
- }
+ Button createButton = new SubmittableButton(ACTION_CREATE, new SubmittableButtonEvents() {
+ @Override
+ public void onProcess() throws DataConstraintException {
+ if (manageStationModel.getObject().getLatitudeDegrees() == null) {
+ stationModel.getObject().setReferentiel(null);
+ }
+ stationService.createStation(stationModel.getObject());
+ }
- @Override
- public void onSuccess() {
- successNextPage(ACTION_CREATE);
- redirect();
- }
+ @Override
+ public void onSuccess() {
+ successNextPage(ACTION_CREATE);
+ redirect();
+ }
- @Override
- public void onValidate() {
- validateModel();
- }
- });
- createButton.setVisibilityAllowed(createMode);
- formView.add(createButton);
+ @Override
+ public void onValidate() {
+ validateModel();
+ }
+ });
+ createButton.setVisibilityAllowed(createMode);
+ formView.add(createButton);
- Button updateButton = new SubmittableButton(ACTION_UPDATE, new SubmittableButtonEvents() {
- @Override
- public void onProcess() throws DataConstraintException {
- if (manageStationModel.getObject().getLatitudeDegrees() == null) {
- stationModel.getObject().setReferentiel(null);
- }
- stationService.updateStation(stationModel.getObject());
- }
+ Button updateButton = new SubmittableButton(ACTION_UPDATE, new SubmittableButtonEvents() {
+ @Override
+ public void onProcess() throws DataConstraintException {
+ if (manageStationModel.getObject().getLatitudeDegrees() == null) {
+ stationModel.getObject().setReferentiel(null);
+ }
+ stationService.updateStation(stationModel.getObject());
+ }
- @Override
- public void onSuccess() {
- successNextPage(ACTION_UPDATE);
- redirect();
- }
+ @Override
+ public void onSuccess() {
+ successNextPage(ACTION_UPDATE);
+ redirect();
+ }
- @Override
- public void onValidate() {
- validateModel();
- }
- });
- updateButton
- .setVisibilityAllowed(!createMode
- && stationService.updateOrdeleteStationEnabled(stationModel.getObject(), getSession()
- .getUtilisateur()));
- formView.add(updateButton);
+ @Override
+ public void onValidate() {
+ validateModel();
+ }
+ });
+ updateButton
+ .setVisibilityAllowed(!createMode
+ && stationService.updateOrdeleteStationEnabled(stationModel.getObject(), getSession()
+ .getUtilisateur()));
+ formView.add(updateButton);
- Button deleteButton = new SubmittableButton(ACTION_DELETE, new SubmittableButtonEvents() {
- @Override
- public void onProcess() throws DataConstraintException {
- stationService.deleteStation(stationModel.getObject());
- }
+ Button deleteButton = new SubmittableButton(ACTION_DELETE, new SubmittableButtonEvents() {
+ @Override
+ public void onProcess() throws DataConstraintException {
+ stationService.deleteStation(stationModel.getObject());
+ }
- @Override
- public void onSuccess() {
- successNextPage(ACTION_DELETE);
- redirect();
- }
- });
- deleteButton
- .setVisibilityAllowed(!createMode
- && stationService.updateOrdeleteStationEnabled(stationModel.getObject(), getSession()
- .getUtilisateur()));
- deleteButton.add(new JSConfirmationBehavior(getString("Confirm")));
- deleteButton.setDefaultFormProcessing(false);
- formView.add(deleteButton);
+ @Override
+ public void onSuccess() {
+ successNextPage(ACTION_DELETE);
+ redirect();
+ }
+ });
+ deleteButton
+ .setVisibilityAllowed(!createMode
+ && stationService.updateOrdeleteStationEnabled(stationModel.getObject(), getSession()
+ .getUtilisateur()));
+ deleteButton.add(new JSConfirmationBehavior(getString("Confirm")));
+ deleteButton.setDefaultFormProcessing(false);
+ formView.add(deleteButton);
- formView.add(new Link<Void>("Cancel") {
- // Cas où le formulaire est annulé
- @Override
- public void onClick() {
- callerPage.responsePage((TemplatePage) this.getPage());
- }
- });
+ formView.add(new Link<Void>("Cancel") {
+ // Cas où le formulaire est annulé
+ @Override
+ public void onClick() {
+ callerPage.responsePage((TemplatePage) this.getPage());
+ }
+ });
- if (createMode) {
- // Données par défaut du modèle
- if (stationModel.getObject().getCodePays() == null) {
- stationModel.getObject().setCodePays(
- WebContext.COUNTRIES.get(getSession().getLocale()).entrySet().iterator().next().getKey());
- }
- if (stationModel.getObject().getReferentiel() == null) {
- stationModel.getObject().setReferentiel(WebContext.REFERENTIEL_CODES.get(0));
- }
- // Données par défaut du modèle intermédiaire
- if (manageStationModel.getObject().getLatitudeOrientation() == null) {
- manageStationModel.getObject().setLatitudeOrientation(CoordTools.LATITUDE_ORIENTATIONS[1]);
- }
- if (manageStationModel.getObject().getLongitudeOrientation() == null) {
- manageStationModel.getObject().setLongitudeOrientation(CoordTools.LONGITUDE_ORIENTATIONS[0]);
- }
- }
+ if (createMode) {
+ // Données par défaut du modèle
+ if (stationModel.getObject().getCodePays() == null) {
+ stationModel.getObject().setCodePays(
+ WebContext.COUNTRIES.get(getSession().getLocale()).entrySet().iterator().next().getKey());
+ }
+ if (stationModel.getObject().getReferentiel() == null) {
+ stationModel.getObject().setReferentiel(WebContext.REFERENTIEL_CODES.get(0));
+ }
+ // Données par défaut du modèle intermédiaire
+ if (manageStationModel.getObject().getLatitudeOrientation() == null) {
+ manageStationModel.getObject().setLatitudeOrientation(CoordTools.LATITUDE_ORIENTATIONS[1]);
+ }
+ if (manageStationModel.getObject().getLongitudeOrientation() == null) {
+ manageStationModel.getObject().setLongitudeOrientation(CoordTools.LONGITUDE_ORIENTATIONS[0]);
+ }
+ }
- add(formView);
- }
+ add(formView);
+ }
- /**
- * Page redirection. Cas où le formulaire est validé
- */
- private void redirect() {
- if (multipleEntry) {
- // Redirection vers l'écran de saisie d'une nouvelle station, en fournissant déjà quelques données
- Station nextStation = new Station();
- nextStation.setCodePays(stationModel.getObject().getCodePays());
- if (manageStationModel.getObject().getLatitudeDegrees() != null) {
- nextStation.setLatitude(stationModel.getObject().getLatitude());
- nextStation.setLongitude(stationModel.getObject().getLongitude());
- nextStation.setReferentiel(stationModel.getObject().getReferentiel());
- }
- setResponsePage(new ManageStationPage(nextStation, callerPage));
- } else {
- // On passe l'id de la station associée à cette page, en paramètre de la prochaine page, pour lui permettre
- // de
- // l'exploiter si besoin
- callerPage.addPageParameter(Station.class.getSimpleName(), stationModel.getObject().getIdStation());
- callerPage.responsePage(this);
- }
- }
+ /**
+ * Page redirection. Cas où le formulaire est validé
+ */
+ private void redirect() {
+ if (multipleEntry) {
+ // Redirection vers l'écran de saisie d'une nouvelle station, en fournissant déjà quelques données
+ Station nextStation = new Station();
+ nextStation.setCodePays(stationModel.getObject().getCodePays());
+ if (manageStationModel.getObject().getLatitudeDegrees() != null) {
+ nextStation.setLatitude(stationModel.getObject().getLatitude());
+ nextStation.setLongitude(stationModel.getObject().getLongitude());
+ nextStation.setReferentiel(stationModel.getObject().getReferentiel());
+ }
+ setResponsePage(new ManageStationPage(nextStation, callerPage));
+ } else {
+ // On passe l'id de la station associée à cette page, en paramètre de la prochaine page, pour lui permettre
+ // de
+ // l'exploiter si besoin
+ callerPage.addPageParameter(Station.class.getSimpleName(), stationModel.getObject().getIdStation());
+ callerPage.responsePage(this);
+ }
+ }
- /**
- * Validate the campagne model (for update & create)
- */
- private void validateModel() {
- if (stationModel.getObject().getCreateur() == null) {
- stationModel.getObject().setCreateur(getSession().getUtilisateur());
- }
+ /**
+ * Validate the campagne model (for update & create)
+ */
+ private void validateModel() {
+ if (stationModel.getObject().getCreateur() == null) {
+ stationModel.getObject().setCreateur(getSession().getUtilisateur());
+ }
- List<String> referentielErrors = validator.validate(stationModel.getObject(), getSession().getLocale(),
- "referentiel");
- List<String> coordErrors = validator.validate(manageStationModel.getObject(), getSession().getLocale());
+ List<String> referentielErrors = validator.validate(stationModel.getObject(), getSession().getLocale(),
+ "referentiel");
+ List<String> coordErrors = validator.validate(manageStationModel.getObject(), getSession().getLocale());
- // On ne considère les coordonnées que si au moins un des champs a été renseigné
- if (manageStationModel.getObject().getLatitudeDegrees() != null
- || manageStationModel.getObject().getLatitudeMinutes() != null
- || manageStationModel.getObject().getLongitudeDegrees() != null
- || manageStationModel.getObject().getLongitudeMinutes() != null) {
- // Tous les champs doivent avoir été renseignées pour que les coordonnées soient valides
- if (manageStationModel.getObject().getLatitudeDegrees() != null
- && manageStationModel.getObject().getLatitudeMinutes() != null
- && manageStationModel.getObject().getLatitudeOrientation() != null
- && manageStationModel.getObject().getLongitudeDegrees() != null
- && manageStationModel.getObject().getLongitudeMinutes() != null
- && manageStationModel.getObject().getLongitudeOrientation() != null
- && stationModel.getObject().getReferentiel() != null) {
- // Construction des coordonnées
- if (referentielErrors.isEmpty() && coordErrors.isEmpty()) {
- stationModel.getObject().setLatitude(
- CoordTools.latitude(manageStationModel.getObject().getLatitudeDegrees(), manageStationModel
- .getObject().getLatitudeMinutes(), manageStationModel.getObject()
- .getLatitudeOrientation()));
- stationModel.getObject().setLongitude(
- CoordTools.longitude(manageStationModel.getObject().getLongitudeDegrees(),
- manageStationModel.getObject().getLongitudeMinutes(), manageStationModel
- .getObject().getLongitudeOrientation()));
- }
- } else {
- getPage().error(getString("Station.coordonnees.KO"));
- }
- } else {
- // si tous les champs sont vide, on met à null les coordonnées
- if (manageStationModel.getObject().getLatitudeDegrees() == null
- && manageStationModel.getObject().getLatitudeMinutes() == null
- && manageStationModel.getObject().getLongitudeDegrees() == null
- && manageStationModel.getObject().getLongitudeMinutes() == null) {
- stationModel.getObject().setLatitude(null);
- stationModel.getObject().setLongitude(null);
- }
- }
+ // On ne considère les coordonnées que si au moins un des champs a été renseigné
+ if (manageStationModel.getObject().getLatitudeDegrees() != null
+ || manageStationModel.getObject().getLatitudeMinutes() != null
+ || manageStationModel.getObject().getLongitudeDegrees() != null
+ || manageStationModel.getObject().getLongitudeMinutes() != null) {
+ // Tous les champs doivent avoir été renseignées pour que les coordonnées soient valides
+ if (manageStationModel.getObject().getLatitudeDegrees() != null
+ && manageStationModel.getObject().getLatitudeMinutes() != null
+ && manageStationModel.getObject().getLatitudeOrientation() != null
+ && manageStationModel.getObject().getLongitudeDegrees() != null
+ && manageStationModel.getObject().getLongitudeMinutes() != null
+ && manageStationModel.getObject().getLongitudeOrientation() != null
+ && stationModel.getObject().getReferentiel() != null) {
+ // Construction des coordonnées
+ if (referentielErrors.isEmpty() && coordErrors.isEmpty()) {
+ stationModel.getObject().setLatitude(
+ CoordTools.latitude(manageStationModel.getObject().getLatitudeDegrees(), manageStationModel
+ .getObject().getLatitudeMinutes(), manageStationModel.getObject()
+ .getLatitudeOrientation()));
+ stationModel.getObject().setLongitude(
+ CoordTools.longitude(manageStationModel.getObject().getLongitudeDegrees(),
+ manageStationModel.getObject().getLongitudeMinutes(), manageStationModel
+ .getObject().getLongitudeOrientation()));
+ }
+ } else {
+ getPage().error(getString("Station.coordonnees.KO"));
+ }
+ } else {
+ // si tous les champs sont vide, on met à null les coordonnées
+ if (manageStationModel.getObject().getLatitudeDegrees() == null
+ && manageStationModel.getObject().getLatitudeMinutes() == null
+ && manageStationModel.getObject().getLongitudeDegrees() == null
+ && manageStationModel.getObject().getLongitudeMinutes() == null) {
+ stationModel.getObject().setLatitude(null);
+ stationModel.getObject().setLongitude(null);
+ }
+ }
- addValidationErrors(validator.validate(stationModel.getObject(), getSession().getLocale(), "nom", "codePays",
- "localite", "complement", "createur", "latitude", "longitude"));
- addValidationErrors(referentielErrors);
- addValidationErrors(coordErrors);
- }
+ addValidationErrors(validator.validate(stationModel.getObject(), getSession().getLocale(), "nom", "codePays",
+ "localite", "complement", "createur", "latitude", "longitude"));
+ addValidationErrors(referentielErrors);
+ addValidationErrors(coordErrors);
+ }
}
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/station/ReadStationPage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/station/ReadStationPage.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/station/ReadStationPage.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -55,108 +55,108 @@
*/
public final class ReadStationPage extends TemplatePage {
- /** Logger */
- // private static final Log LOG = LogTools.getLog();
- /** Action : delete */
- public static final String ACTION_DELETE = "Delete";
+ /** Logger */
+ // private static final Log LOG = LogTools.getLog();
+ /** Action : delete */
+ public static final String ACTION_DELETE = "Delete";
- /** Page appelante */
- private final CallerPage callerPage;
+ /** Page appelante */
+ private final CallerPage callerPage;
- /** Modèle : campagne */
- private final IModel<Station> stationModel;
+ /** Modèle : campagne */
+ private final IModel<Station> stationModel;
- /** Service : station */
- @SpringBean
- private StationService stationService;
+ /** Service : station */
+ @SpringBean
+ private StationService stationService;
- /**
- * Constructeur
- * @param idStation ID station
- * @param callerPage Page appelante
- */
- public ReadStationPage(Integer idStation, CallerPage callerPage) {
- super(ReadStationPage.class);
- final CallerPage currentPage = new CallerPage((TemplatePage) getPage());
- this.callerPage = callerPage;
+ /**
+ * Constructeur
+ * @param idStation ID station
+ * @param callerPage Page appelante
+ */
+ public ReadStationPage(Integer idStation, CallerPage callerPage) {
+ super(ReadStationPage.class);
+ final CallerPage currentPage = new CallerPage((TemplatePage) getPage());
+ this.callerPage = callerPage;
- // Initialisation des modèles
- stationModel = new GenericLoadableDetachableModel<Station>(Station.class, idStation);
+ // Initialisation des modèles
+ stationModel = new GenericLoadableDetachableModel<Station>(Station.class, idStation);
- final Station station = stationModel.getObject();
+ final Station station = stationModel.getObject();
- // Mapping des champs du modèle
- add(new Label("Station.nom", new PropertyModel<String>(stationModel, "nom"))
- .add(new ReplaceEmptyLabelBehavior()));
- add(new Label("Station.codePays", new DisplayMapValuePropertyModel<String>(stationModel, "codePays",
- WebContext.COUNTRIES.get(getSession().getLocale()))).add(new ReplaceEmptyLabelBehavior()));
- add(new Label("Station.localite", new PropertyModel<String>(stationModel, "localite"))
- .add(new ReplaceEmptyLabelBehavior()));
- add(new PropertyLabelLinkPanel<Personne>("Station.createur", new PropertyModel<Personne>(stationModel,
- "createur"), getString("Read")) {
- @Override
- public void onClick() {
- setResponsePage(new ReadPersonnePage(getModelObject().getIdPersonne(), currentPage));
- }
- });
- add(new MultiLineLabel("Station.complement", new PropertyModel<String>(stationModel, "complement"))
- .add(new ReplaceEmptyLabelBehavior()));
- add(new Label("Station.latitude", new PropertyModel<String>(stationModel, "latitude"))
- .add(new ReplaceEmptyLabelBehavior()));
- add(new Label("Station.longitude", new PropertyModel<String>(stationModel, "longitude"))
- .add(new ReplaceEmptyLabelBehavior()));
- add(new Label("Station.referentiel", new DisplayMapValuePropertyModel<Integer>(stationModel, "referentiel",
- DataContext.REFERENTIELS)).add(new ReplaceEmptyLabelBehavior()));
+ // Mapping des champs du modèle
+ add(new Label("Station.nom", new PropertyModel<String>(stationModel, "nom"))
+ .add(new ReplaceEmptyLabelBehavior()));
+ add(new Label("Station.codePays", new DisplayMapValuePropertyModel<String>(stationModel, "codePays",
+ WebContext.COUNTRIES.get(getSession().getLocale()))).add(new ReplaceEmptyLabelBehavior()));
+ add(new Label("Station.localite", new PropertyModel<String>(stationModel, "localite"))
+ .add(new ReplaceEmptyLabelBehavior()));
+ add(new PropertyLabelLinkPanel<Personne>("Station.createur", new PropertyModel<Personne>(stationModel,
+ "createur"), getString("Read")) {
+ @Override
+ public void onClick() {
+ setResponsePage(new ReadPersonnePage(getModelObject().getIdPersonne(), currentPage));
+ }
+ });
+ add(new MultiLineLabel("Station.complement", new PropertyModel<String>(stationModel, "complement"))
+ .add(new ReplaceEmptyLabelBehavior()));
+ add(new Label("Station.latitude", new PropertyModel<String>(stationModel, "latitude"))
+ .add(new ReplaceEmptyLabelBehavior()));
+ add(new Label("Station.longitude", new PropertyModel<String>(stationModel, "longitude"))
+ .add(new ReplaceEmptyLabelBehavior()));
+ add(new Label("Station.referentiel", new DisplayMapValuePropertyModel<Integer>(stationModel, "referentiel",
+ DataContext.REFERENTIELS)).add(new ReplaceEmptyLabelBehavior()));
- // Ajout du formulaire pour les actions
- Form<Void> formView = new Form<Void>("Form");
+ // Ajout du formulaire pour les actions
+ Form<Void> formView = new Form<Void>("Form");
- // Action : mise à jour (redirection vers le formulaire)
- Link<Station> updateLink = new Link<Station>(getResource() + ".Station.Update", new Model<Station>(station)) {
- @Override
- public void onClick() {
- setResponsePage(new ManageStationPage(getModelObject().getIdStation(), currentPage));
- }
- };
- updateLink.setVisibilityAllowed(stationService.updateOrdeleteStationEnabled(station, getSession()
- .getUtilisateur()));
- formView.add(updateLink);
+ // Action : mise à jour (redirection vers le formulaire)
+ Link<Station> updateLink = new Link<Station>(getResource() + ".Station.Update", new Model<Station>(station)) {
+ @Override
+ public void onClick() {
+ setResponsePage(new ManageStationPage(getModelObject().getIdStation(), currentPage));
+ }
+ };
+ updateLink.setVisibilityAllowed(stationService.updateOrdeleteStationEnabled(station, getSession()
+ .getUtilisateur()));
+ formView.add(updateLink);
- // Action : retour à la page précédente
- formView.add(new Link<Void>(getResource() + ".Station.Back") {
- @Override
- public void onClick() {
- redirect();
- }
- });
+ // Action : retour à la page précédente
+ formView.add(new Link<Void>(getResource() + ".Station.Back") {
+ @Override
+ public void onClick() {
+ redirect();
+ }
+ });
- // Action : suppression de la station
- Button deleteButton = new SubmittableButton(ACTION_DELETE, ManageStationPage.class,
- new SubmittableButtonEvents() {
+ // Action : suppression de la station
+ Button deleteButton = new SubmittableButton(ACTION_DELETE, ManageStationPage.class,
+ new SubmittableButtonEvents() {
- @Override
- public void onProcess() throws DataConstraintException {
- stationService.deleteStation(station);
- }
+ @Override
+ public void onProcess() throws DataConstraintException {
+ stationService.deleteStation(station);
+ }
- @Override
- public void onSuccess() {
- successNextPage(ManageStationPage.class, ACTION_DELETE);
- redirect();
- }
- });
- deleteButton.setVisibilityAllowed(stationService.updateOrdeleteStationEnabled(station, getSession()
- .getUtilisateur()));
- deleteButton.add(new JSConfirmationBehavior(getString("Confirm")));
- formView.add(deleteButton);
- add(formView);
- }
+ @Override
+ public void onSuccess() {
+ successNextPage(ManageStationPage.class, ACTION_DELETE);
+ redirect();
+ }
+ });
+ deleteButton.setVisibilityAllowed(stationService.updateOrdeleteStationEnabled(station, getSession()
+ .getUtilisateur()));
+ deleteButton.add(new JSConfirmationBehavior(getString("Confirm")));
+ formView.add(deleteButton);
+ add(formView);
+ }
- /**
- * Redirection vers une autre page
- */
- private void redirect() {
- callerPage.responsePage(this);
- }
+ /**
+ * Redirection vers une autre page
+ */
+ private void redirect() {
+ callerPage.responsePage(this);
+ }
}
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/testBio/ListTestsBioPage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/testBio/ListTestsBioPage.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/testBio/ListTestsBioPage.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -69,145 +69,145 @@
@AuthRoles({ AuthRole.ADMIN, AuthRole.USER })
public final class ListTestsBioPage extends TemplatePage {
- /** Service : test biologique */
- @SpringBean
- private TestBioService testBioService;
+ /** Service : test biologique */
+ @SpringBean
+ private TestBioService testBioService;
- /**
- * Constructeur
- */
- public ListTestsBioPage() {
- super(ListTestsBioPage.class);
+ /**
+ * Constructeur
+ */
+ public ListTestsBioPage() {
+ super(ListTestsBioPage.class);
- final CallerPage currentPage = new CallerPage(ListTestsBioPage.class);
+ final CallerPage currentPage = new CallerPage(ListTestsBioPage.class);
- add(new Link<Void>("ListTestsBioPage.NewTestBio") {
- @Override
- public void onClick() {
- setResponsePage(new ManageTestBioPage(currentPage, true));
- }
- });
+ add(new Link<Void>("ListTestsBioPage.NewTestBio") {
+ @Override
+ public void onClick() {
+ setResponsePage(new ManageTestBioPage(currentPage, true));
+ }
+ });
- // On englobe le "DataView" dans un composant neutre que l'on pourra
- // rafraichir quand la liste évoluera
- final MarkupContainer resTestsBiosRefresh = new WebMarkupContainer("ListTestsBioPage.ResultatsTestsBio.Refresh");
- resTestsBiosRefresh.setOutputMarkupId(true);
- add(resTestsBiosRefresh);
+ // On englobe le "DataView" dans un composant neutre que l'on pourra
+ // rafraichir quand la liste évoluera
+ final MarkupContainer resTestsBiosRefresh = new WebMarkupContainer("ListTestsBioPage.ResultatsTestsBio.Refresh");
+ resTestsBiosRefresh.setOutputMarkupId(true);
+ add(resTestsBiosRefresh);
- // Liste des résultats de tests biologiques
- final List<ResultatTestBio> resTestsBios = testBioService.listResultatsTestBio(getSession().getUtilisateur());
+ // Liste des résultats de tests biologiques
+ final List<ResultatTestBio> resTestsBios = testBioService.listResultatsTestBio(getSession().getUtilisateur());
- LoadableDetachableSortableListDataProvider<ResultatTestBio> resTestBiosDataProvider = new LoadableDetachableSortableListDataProvider<ResultatTestBio>(
- resTestsBios, getSession().getLocale());
+ LoadableDetachableSortableListDataProvider<ResultatTestBio> resTestBiosDataProvider = new LoadableDetachableSortableListDataProvider<ResultatTestBio>(
+ resTestsBios, getSession().getLocale());
- List<IColumn<ResultatTestBio>> columns = new ArrayList<IColumn<ResultatTestBio>>();
+ List<IColumn<ResultatTestBio>> columns = new ArrayList<IColumn<ResultatTestBio>>();
- columns.add(new LinkableImagePropertyColumn<ResultatTestBio>("images/read.png", getString("Read"),
- getString("Read")) {
- @Override
- public void onClick(Item<ICellPopulator<ResultatTestBio>> item, String componentId,
- IModel<ResultatTestBio> model) {
- setResponsePage(new ReadTestBioPage(model.getObject().getTestBio().getIdTestBio(), currentPage));
- }
- });
+ columns.add(new LinkableImagePropertyColumn<ResultatTestBio>("images/read.png", getString("Read"),
+ getString("Read")) {
+ @Override
+ public void onClick(Item<ICellPopulator<ResultatTestBio>> item, String componentId,
+ IModel<ResultatTestBio> model) {
+ setResponsePage(new ReadTestBioPage(model.getObject().getTestBio().getIdTestBio(), currentPage));
+ }
+ });
- columns.add(new TextFilteredPropertyColumn<ResultatTestBio, String>(new Model<String>(
- getString("MethodeTestBio.cible2")), "testBio.methode.cible", "testBio.methode.cible"));
+ columns.add(new TextFilteredPropertyColumn<ResultatTestBio, String>(new Model<String>(
+ getString("MethodeTestBio.cible2")), "testBio.methode.cible", "testBio.methode.cible"));
- columns.add(new DecimalPropertyColumn<ResultatTestBio>(new Model<String>(
- getString("ResultatTestBio.concMasse2")), "concMasse", "concMasse", DecimalDisplFormat.SMALL,
- getLocale()));
+ columns.add(new DecimalPropertyColumn<ResultatTestBio>(new Model<String>(
+ getString("ResultatTestBio.concMasse2")), "concMasse", "concMasse", DecimalDisplFormat.SMALL,
+ getLocale()));
- columns.add(new EnumPropertyColumn<ResultatTestBio>(new Model<String>(getString("TestBio.uniteConcMasse2")),
- "uniteConcMasse", "uniteConcMasse", (TemplatePage) getPage()));
+ columns.add(new EnumPropertyColumn<ResultatTestBio>(new Model<String>(getString("TestBio.uniteConcMasse2")),
+ "uniteConcMasse", "uniteConcMasse", (TemplatePage) getPage()));
- columns.add(new LinkProduitPropertyColumn<ResultatTestBio>(new Model<String>(
- getString("ResultatTestBio.produit")), "produit", "produit", (TemplatePage) getPage()) {
- @Override
- public void onClickIfExtrait(Extrait extrait) {
- setResponsePage(new ReadExtractionPage(extrait.getExtraction().getIdExtraction(), currentPage));
- }
+ columns.add(new LinkProduitPropertyColumn<ResultatTestBio>(new Model<String>(
+ getString("ResultatTestBio.produit")), "produit", "produit", (TemplatePage) getPage()) {
+ @Override
+ public void onClickIfExtrait(Extrait extrait) {
+ setResponsePage(new ReadExtractionPage(extrait.getExtraction().getIdExtraction(), currentPage));
+ }
- @Override
- public void onClickIfFraction(Fraction fraction) {
- setResponsePage(new ReadPurificationPage(fraction.getPurification().getIdPurification(), currentPage));
- }
- });
+ @Override
+ public void onClickIfFraction(Fraction fraction) {
+ setResponsePage(new ReadPurificationPage(fraction.getPurification().getIdPurification(), currentPage));
+ }
+ });
- columns.add(new DecimalPropertyColumn<ResultatTestBio>(new Model<String>(getString("ResultatTestBio.valeur")),
- "valeur", "valeur", DecimalDisplFormat.SMALL, getLocale()));
+ columns.add(new DecimalPropertyColumn<ResultatTestBio>(new Model<String>(getString("ResultatTestBio.valeur")),
+ "valeur", "valeur", DecimalDisplFormat.SMALL, getLocale()));
- columns.add(new PropertyColumn<ResultatTestBio>(new Model<String>(getString("MethodeTestBio.uniteResultat2")),
- "testBio.methode.uniteResultat", "testBio.methode.uniteResultat"));
+ columns.add(new PropertyColumn<ResultatTestBio>(new Model<String>(getString("MethodeTestBio.uniteResultat2")),
+ "testBio.methode.uniteResultat", "testBio.methode.uniteResultat"));
- columns.add(new PropertyColumn<ResultatTestBio>(new Model<String>(getString("Extrait.typeExtrait2")),
- "typeExtraitSource", "typeExtraitSource"));
+ columns.add(new PropertyColumn<ResultatTestBio>(new Model<String>(getString("Extrait.typeExtrait2")),
+ "typeExtraitSource", "typeExtraitSource"));
- columns.add(new BooleanPropertyColumn<ResultatTestBio>(new Model<String>(getString("ResultatTestBio.actif")),
- "actif", "actif", (TemplatePage) getPage()));
+ columns.add(new BooleanPropertyColumn<ResultatTestBio>(new Model<String>(getString("ResultatTestBio.actif")),
+ "actif", "actif", (TemplatePage) getPage()));
- columns.add(new TaxonomyPropertyColumn<ResultatTestBio>(new Model<String>(getString("Specimen.famille")),
- "lotSource.specimenRef.famille", "lotSource.specimenRef.famille"));
+ columns.add(new TaxonomyPropertyColumn<ResultatTestBio>(new Model<String>(getString("Specimen.famille")),
+ "lotSource.specimenRef.famille", "lotSource.specimenRef.famille"));
- columns.add(new TaxonomyPropertyColumn<ResultatTestBio>(new Model<String>(getString("Specimen.genre")),
- "lotSource.specimenRef.genre", "lotSource.specimenRef.genre"));
+ columns.add(new TaxonomyPropertyColumn<ResultatTestBio>(new Model<String>(getString("Specimen.genre")),
+ "lotSource.specimenRef.genre", "lotSource.specimenRef.genre"));
- columns.add(new TaxonomyPropertyColumn<ResultatTestBio>(new Model<String>(getString("Specimen.espece")),
- "lotSource.specimenRef.espece", "lotSource.specimenRef.espece"));
+ columns.add(new TaxonomyPropertyColumn<ResultatTestBio>(new Model<String>(getString("Specimen.espece")),
+ "lotSource.specimenRef.espece", "lotSource.specimenRef.espece"));
- columns.add(new MapValuePropertyColumn<ResultatTestBio, String>(new Model<String>(
- getString("Campagne.codePays")), "lotSource.campagne.codePays", "lotSource.campagne.codePays",
- WebContext.COUNTRIES.get(getSession().getLocale())));
+ columns.add(new MapValuePropertyColumn<ResultatTestBio, String>(new Model<String>(
+ getString("Campagne.codePays")), "lotSource.campagne.codePays", "lotSource.campagne.codePays",
+ WebContext.COUNTRIES.get(getSession().getLocale())));
- columns.add(new PropertyColumn<ResultatTestBio>(new Model<String>(getString("ResultatTestBio.repere")),
- "repere", "repere"));
+ columns.add(new PropertyColumn<ResultatTestBio>(new Model<String>(getString("ResultatTestBio.repere")),
+ "repere", "repere"));
- columns.add(new LinkPropertyColumn<ResultatTestBio>(new Model<String>(getString("TestBio.ref")), "testBio.ref",
- "testBio.ref", getString("Read")) {
- @Override
- public void onClick(Item<ICellPopulator<ResultatTestBio>> item, String componentId,
- IModel<ResultatTestBio> model) {
- setResponsePage(new ReadTestBioPage(model.getObject().getTestBio().getIdTestBio(), currentPage));
- }
- });
+ columns.add(new LinkPropertyColumn<ResultatTestBio>(new Model<String>(getString("TestBio.ref")), "testBio.ref",
+ "testBio.ref", getString("Read")) {
+ @Override
+ public void onClick(Item<ICellPopulator<ResultatTestBio>> item, String componentId,
+ IModel<ResultatTestBio> model) {
+ setResponsePage(new ReadTestBioPage(model.getObject().getTestBio().getIdTestBio(), currentPage));
+ }
+ });
- columns.add(new LinkableImagePropertyColumn<ResultatTestBio>("images/edit.png", getString("Update"),
- getString("Update")) {
- // pas de lien d'édition si l'utilisateur n'a pas les droits
- @Override
- public void populateItem(Item<ICellPopulator<ResultatTestBio>> item, String componentId,
- IModel<ResultatTestBio> model) {
- if (testBioService.updateOrdeleteTestBioEnabled(model.getObject().getTestBio(), getSession()
- .getUtilisateur())) {
- item.add(new LinkableImagePanel(item, componentId, model));
- } else {
- // label vide
- item.add(new Label(componentId));
- }
- }
+ columns.add(new LinkableImagePropertyColumn<ResultatTestBio>("images/edit.png", getString("Update"),
+ getString("Update")) {
+ // pas de lien d'édition si l'utilisateur n'a pas les droits
+ @Override
+ public void populateItem(Item<ICellPopulator<ResultatTestBio>> item, String componentId,
+ IModel<ResultatTestBio> model) {
+ if (testBioService.updateOrdeleteTestBioEnabled(model.getObject().getTestBio(), getSession()
+ .getUtilisateur())) {
+ item.add(new LinkableImagePanel(item, componentId, model));
+ } else {
+ // label vide
+ item.add(new Label(componentId));
+ }
+ }
- @Override
- public void onClick(Item<ICellPopulator<ResultatTestBio>> item, String componentId,
- IModel<ResultatTestBio> model) {
- setResponsePage(new ManageTestBioPage(model.getObject().getTestBio().getIdTestBio(), currentPage));
- }
- });
+ @Override
+ public void onClick(Item<ICellPopulator<ResultatTestBio>> item, String componentId,
+ IModel<ResultatTestBio> model) {
+ setResponsePage(new ManageTestBioPage(model.getObject().getTestBio().getIdTestBio(), currentPage));
+ }
+ });
- final DataTable<ResultatTestBio> resTestBiosDataTable = new AjaxFallbackDefaultDataTable<ResultatTestBio>(
- "ListTestsBioPage.ResultatsTestsBio", columns, resTestBiosDataProvider, WebContext.ROWS_PER_PAGE);
+ final DataTable<ResultatTestBio> resTestBiosDataTable = new AjaxFallbackDefaultDataTable<ResultatTestBio>(
+ "ListTestsBioPage.ResultatsTestsBio", columns, resTestBiosDataProvider, WebContext.ROWS_PER_PAGE);
- // DRAFT FOR FILTER TABLE
- // resTestBiosDataTable.addTopToolbar(new NavigationToolbar(resTestBiosDataTable));
- // resTestBiosDataTable.addTopToolbar(new HeadersToolbar(resTestBiosDataTable, resTestBiosDataProvider));
+ // DRAFT FOR FILTER TABLE
+ // resTestBiosDataTable.addTopToolbar(new NavigationToolbar(resTestBiosDataTable));
+ // resTestBiosDataTable.addTopToolbar(new HeadersToolbar(resTestBiosDataTable, resTestBiosDataProvider));
- // create the form used to contain all filter components
- /*
- * final FilterForm filterForm = new FilterForm("filter-form", resTestBiosDataProvider) { private static final
- * long serialVersionUID = 1L;
- * @Override protected void onSubmit() { resTestBiosDataTable.setCurrentPage(0); } }; resTestBiosDataTable
- * .addTopToolbar(new FilterToolbar(resTestBiosDataTable, filterForm, resTestBiosDataProvider));
- */
- resTestsBiosRefresh.add(resTestBiosDataTable);
+ // create the form used to contain all filter components
+ /*
+ * final FilterForm filterForm = new FilterForm("filter-form", resTestBiosDataProvider) { private static final
+ * long serialVersionUID = 1L;
+ * @Override protected void onSubmit() { resTestBiosDataTable.setCurrentPage(0); } }; resTestBiosDataTable
+ * .addTopToolbar(new FilterToolbar(resTestBiosDataTable, filterForm, resTestBiosDataProvider));
+ */
+ resTestsBiosRefresh.add(resTestBiosDataTable);
- }
+ }
}
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/testBio/ManageTestBioPage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/testBio/ManageTestBioPage.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/testBio/ManageTestBioPage.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -106,886 +106,886 @@
@AuthRoles({ AuthRole.ADMIN, AuthRole.USER })
public final class ManageTestBioPage extends TemplatePage {
- /** Logger */
- private static final Log LOG = LogTools.getLog();
+ /** Logger */
+ private static final Log LOG = LogTools.getLog();
- /** Action : create */
- private static final String ACTION_CREATE = "Create";
+ /** Action : create */
+ private static final String ACTION_CREATE = "Create";
- /** Action : update */
- private static final String ACTION_UPDATE = "Update";
+ /** Action : update */
+ private static final String ACTION_UPDATE = "Update";
- /** Action : delete */
- public static final String ACTION_DELETE = "Delete";
+ /** Action : delete */
+ public static final String ACTION_DELETE = "Delete";
- /** testBio Model */
- private final IModel<TestBio> testBioModel;
+ /** testBio Model */
+ private final IModel<TestBio> testBioModel;
- /** model for adding resultat */
- private Model<ResultatTestBio> newResultatModel;
+ /** model for adding resultat */
+ private Model<ResultatTestBio> newResultatModel;
- /** Service : testBios */
- @SpringBean
- private TestBioService testBioService;
+ /** Service : testBios */
+ @SpringBean
+ private TestBioService testBioService;
- /** Service : personnes */
- @SpringBean
- private PersonneService personneService;
+ /** Service : personnes */
+ @SpringBean
+ private PersonneService personneService;
- /** Service : produits */
- @SpringBean
- private ProduitService produitService;
+ /** Service : produits */
+ @SpringBean
+ private ProduitService produitService;
- /** Liste des personnes existantes */
- private final List<Personne> personnes;
+ /** Liste des personnes existantes */
+ private final List<Personne> personnes;
- /** Liste des méthodes de testBio existantes */
- private final List<MethodeTestBio> methodes;
+ /** Liste des méthodes de testBio existantes */
+ private final List<MethodeTestBio> methodes;
- /** Liste des organismes testeurs déjà renseignés pour les personnes */
- private final List<String> organismes;
+ /** Liste des organismes testeurs déjà renseignés pour les personnes */
+ private final List<String> organismes;
- /** Liste des produits témoins testeurs déjà renseignés pour résultats de test */
- private final List<String> produitsTemoins;
+ /** Liste des produits témoins testeurs déjà renseignés pour résultats de test */
+ private final List<String> produitsTemoins;
- /** Liste des produits existants */
- private final List<Produit> produits;
+ /** Liste des produits existants */
+ private final List<Produit> produits;
- /** Liste des erreurs de test existantes */
- private final List<ErreurTestBio> erreurs;
+ /** Liste des erreurs de test existantes */
+ private final List<ErreurTestBio> erreurs;
- /** Model validateur */
- @SpringBean(name = "webModelValidator")
- private ModelValidator validator;
+ /** Model validateur */
+ @SpringBean(name = "webModelValidator")
+ private ModelValidator validator;
- /** Page appelante */
- private final CallerPage callerPage;
+ /** Page appelante */
+ private final CallerPage callerPage;
- /** Saisie multiple */
- private boolean multipleEntry;
+ /** Saisie multiple */
+ private boolean multipleEntry;
- /** Bouton d'ajout d'un résultat de test bio **/
- Button addResultatButton;
+ /** Bouton d'ajout d'un résultat de test bio **/
+ Button addResultatButton;
- /** Container pour l'affichage de la description de la méthode **/
- MarkupContainer descriptionMethoContainer;
+ /** Container pour l'affichage de la description de la méthode **/
+ MarkupContainer descriptionMethoContainer;
- /** Container pour l'affichage des paramètres de la méthode **/
- MarkupContainer paramsMethoContainer;
+ /** Container pour l'affichage des paramètres de la méthode **/
+ MarkupContainer paramsMethoContainer;
- /** Input du conc./masse par défaut du test bio **/
- TextField<BigDecimal> concMasseDefautInput;
+ /** Input du conc./masse par défaut du test bio **/
+ TextField<BigDecimal> concMasseDefautInput;
- /** Input pour l'unité de conc./masse par défaut du test bio **/
- DropDownChoice<UniteConcMasse> uniteConcMasseDefautInput;
+ /** Input pour l'unité de conc./masse par défaut du test bio **/
+ DropDownChoice<UniteConcMasse> uniteConcMasseDefautInput;
- /** Input du conc./masse du résultat courant **/
- TextField<BigInteger> concMasseInput;
+ /** Input du conc./masse du résultat courant **/
+ TextField<BigInteger> concMasseInput;
- /** Input pour l'unité de conc./masse du résultat courant **/
- DropDownChoice<UniteConcMasse> uniteConcMasseInput;
+ /** Input pour l'unité de conc./masse du résultat courant **/
+ DropDownChoice<UniteConcMasse> uniteConcMasseInput;
- /** Input pour le stade du résultat courant **/
- DropDownChoice<Stade> stadeInput;
+ /** Input pour le stade du résultat courant **/
+ DropDownChoice<Stade> stadeInput;
- /**
- * Constructeur (mode création)
- * @param callerPage Page appelante
- * @param multipleEntry Saisie multiple
- */
- public ManageTestBioPage(CallerPage callerPage, boolean multipleEntry) {
- this(null, null, callerPage, multipleEntry);
- }
+ /**
+ * Constructeur (mode création)
+ * @param callerPage Page appelante
+ * @param multipleEntry Saisie multiple
+ */
+ public ManageTestBioPage(CallerPage callerPage, boolean multipleEntry) {
+ this(null, null, callerPage, multipleEntry);
+ }
- /**
- * Constructeur (mode édition)
- * @param idManip Id de la manip d'testBio
- * @param callerPage Page appelante
- */
- public ManageTestBioPage(Integer idManip, CallerPage callerPage) {
- this(idManip, null, callerPage, false);
- }
+ /**
+ * Constructeur (mode édition)
+ * @param idManip Id de la manip d'testBio
+ * @param callerPage Page appelante
+ */
+ public ManageTestBioPage(Integer idManip, CallerPage callerPage) {
+ this(idManip, null, callerPage, false);
+ }
- /**
- * Constructeur (mode saisie de la manip suivante)
- * @param manip Manip d'testBio
- * @param callerPage Page appelante
- */
- public ManageTestBioPage(TestBio manip, CallerPage callerPage) {
- this(null, manip, callerPage, true);
- }
+ /**
+ * Constructeur (mode saisie de la manip suivante)
+ * @param manip Manip d'testBio
+ * @param callerPage Page appelante
+ */
+ public ManageTestBioPage(TestBio manip, CallerPage callerPage) {
+ this(null, manip, callerPage, true);
+ }
- /**
- * Constructeur. Si refManip et manip sont nuls, on créée une nouvelle manip d'testBio. Si refManip est renseignée,
- * on édite la manip correspondante. Si manip est renseigné, on créée une nouvelle manipulation à partir des
- * informations qu'elle contient.
- * @param idManip Id de la manip d'testBio
- * @param manip Manip d'testBio
- * @param callerPage Page appelante
- * @param multipleEntry Saisie multiple
- */
- private ManageTestBioPage(Integer idManip, TestBio manip, final CallerPage callerPage, boolean multipleEntry) {
- super(ManageTestBioPage.class);
- assert idManip == null || manip == null;
- this.callerPage = callerPage;
- this.multipleEntry = multipleEntry;
+ /**
+ * Constructeur. Si refManip et manip sont nuls, on créée une nouvelle manip d'testBio. Si refManip est renseignée,
+ * on édite la manip correspondante. Si manip est renseigné, on créée une nouvelle manipulation à partir des
+ * informations qu'elle contient.
+ * @param idManip Id de la manip d'testBio
+ * @param manip Manip d'testBio
+ * @param callerPage Page appelante
+ * @param multipleEntry Saisie multiple
+ */
+ private ManageTestBioPage(Integer idManip, TestBio manip, final CallerPage callerPage, boolean multipleEntry) {
+ super(ManageTestBioPage.class);
+ assert idManip == null || manip == null;
+ this.callerPage = callerPage;
+ this.multipleEntry = multipleEntry;
- newResultatModel = new Model<ResultatTestBio>(new ResultatTestBio());
+ newResultatModel = new Model<ResultatTestBio>(new ResultatTestBio());
- // Initialisation du modèle
- try {
- testBioModel = new Model<TestBio>(idManip == null && manip == null ? new TestBio() : manip != null ? manip
- : testBioService.loadTestBio(idManip));
- } catch (DataNotFoundException e) {
- LOG.error(e.getMessage(), e);
- throw new UnexpectedException(e);
- }
- boolean createMode = idManip == null;
- if (createMode) {
- testBioModel.getObject().setCreateur(getSession().getUtilisateur());
- }
+ // Initialisation du modèle
+ try {
+ testBioModel = new Model<TestBio>(idManip == null && manip == null ? new TestBio() : manip != null ? manip
+ : testBioService.loadTestBio(idManip));
+ } catch (DataNotFoundException e) {
+ LOG.error(e.getMessage(), e);
+ throw new UnexpectedException(e);
+ }
+ boolean createMode = idManip == null;
+ if (createMode) {
+ testBioModel.getObject().setCreateur(getSession().getUtilisateur());
+ }
- // Initialisation des listes (pour le dropDownChoice)
- personnes = personneService.listPersonnes();
- methodes = testBioService.listMethodesTestBio();
- produits = produitService.listProduits((Utilisateur) getSession().getUtilisateur());
- erreurs = testBioService.listErreursTestBio();
+ // Initialisation des listes (pour le dropDownChoice)
+ personnes = personneService.listPersonnes();
+ methodes = testBioService.listMethodesTestBio();
+ produits = produitService.listProduits((Utilisateur) getSession().getUtilisateur());
+ erreurs = testBioService.listErreursTestBio();
- if (manip != null) {
- // qd saisie multiple avec préremplissage, hack nécessaire afin d'avoir dans le model le même objet que
- // celui de la liste de choix (sinon comme les objets viennent de sessions hibernate différentes, on n'a pas
- // l'égalité entre les objets)
- testBioModel.getObject().setManipulateur(
- CollectionTools.findWithValue(personnes, "idPersonne", AccessType.GETTER, testBioModel.getObject()
- .getManipulateur().getIdPersonne()));
- testBioModel.getObject().setMethode(
- CollectionTools.findWithValue(methodes, "idMethodeTest", AccessType.GETTER, testBioModel
- .getObject().getMethode().getIdMethodeTest()));
- }
+ if (manip != null) {
+ // qd saisie multiple avec préremplissage, hack nécessaire afin d'avoir dans le model le même objet que
+ // celui de la liste de choix (sinon comme les objets viennent de sessions hibernate différentes, on n'a pas
+ // l'égalité entre les objets)
+ testBioModel.getObject().setManipulateur(
+ CollectionTools.findWithValue(personnes, "idPersonne", AccessType.GETTER, testBioModel.getObject()
+ .getManipulateur().getIdPersonne()));
+ testBioModel.getObject().setMethode(
+ CollectionTools.findWithValue(methodes, "idMethodeTest", AccessType.GETTER, testBioModel
+ .getObject().getMethode().getIdMethodeTest()));
+ }
- // liste des organismes suggérés à la saisie
- organismes = personneService.listPersonneOrganismes();
- produitsTemoins = testBioService.listProduitsTemoins();
+ // liste des organismes suggérés à la saisie
+ organismes = personneService.listPersonneOrganismes();
+ produitsTemoins = testBioService.listProduitsTemoins();
- // bind with markup
- final Form<Void> formView = new Form<Void>("Form");
+ // bind with markup
+ final Form<Void> formView = new Form<Void>("Form");
- // initialisation du formulaire
- initPrincipalFields(formView);
- initMethodeFields(formView);
- initResultatsFields(formView);
+ // initialisation du formulaire
+ initPrincipalFields(formView);
+ initMethodeFields(formView);
+ initResultatsFields(formView);
- // Action : create the testBio
- Button createButton = new SubmittableButton(ACTION_CREATE, new SubmittableButtonEvents() {
- @Override
- public void onProcess() throws DataConstraintException {
- testBioService.createTestBio(testBioModel.getObject());
- }
+ // Action : create the testBio
+ Button createButton = new SubmittableButton(ACTION_CREATE, new SubmittableButtonEvents() {
+ @Override
+ public void onProcess() throws DataConstraintException {
+ testBioService.createTestBio(testBioModel.getObject());
+ }
- @Override
- public void onSuccess() {
- successNextPage(ACTION_CREATE);
- redirect();
- }
+ @Override
+ public void onSuccess() {
+ successNextPage(ACTION_CREATE);
+ redirect();
+ }
- @Override
- public void onValidate() {
- validateModel();
- }
- });
- createButton.setVisibilityAllowed(createMode);
- formView.add(createButton);
+ @Override
+ public void onValidate() {
+ validateModel();
+ }
+ });
+ createButton.setVisibilityAllowed(createMode);
+ formView.add(createButton);
- // Action : update the testBio
- Button updateButton = new SubmittableButton(ACTION_UPDATE, new SubmittableButtonEvents() {
- @Override
- public void onProcess() throws DataConstraintException {
- testBioService.updateTestBio(testBioModel.getObject());
- }
+ // Action : update the testBio
+ Button updateButton = new SubmittableButton(ACTION_UPDATE, new SubmittableButtonEvents() {
+ @Override
+ public void onProcess() throws DataConstraintException {
+ testBioService.updateTestBio(testBioModel.getObject());
+ }
- @Override
- public void onSuccess() {
- successNextPage(ACTION_UPDATE);
- callerPage.responsePage((TemplatePage) getPage());
- }
+ @Override
+ public void onSuccess() {
+ successNextPage(ACTION_UPDATE);
+ callerPage.responsePage((TemplatePage) getPage());
+ }
- @Override
- public void onValidate() {
- validateModel();
- }
- });
- updateButton.setVisibilityAllowed(!createMode);
- formView.add(updateButton);
+ @Override
+ public void onValidate() {
+ validateModel();
+ }
+ });
+ updateButton.setVisibilityAllowed(!createMode);
+ formView.add(updateButton);
- // Action : suppression
- Button deleteButton = new SubmittableButton(ACTION_DELETE, new SubmittableButtonEvents() {
- @Override
- public void onProcess() throws DataConstraintException {
- testBioService.deleteTestBio(testBioModel.getObject());
- }
+ // Action : suppression
+ Button deleteButton = new SubmittableButton(ACTION_DELETE, new SubmittableButtonEvents() {
+ @Override
+ public void onProcess() throws DataConstraintException {
+ testBioService.deleteTestBio(testBioModel.getObject());
+ }
- @Override
- public void onSuccess() {
- successNextPage(ACTION_DELETE);
- callerPage.responsePage((TemplatePage) getPage());
- }
- });
- deleteButton.setVisibilityAllowed(!createMode);
- deleteButton.setDefaultFormProcessing(false);
- deleteButton.add(new JSConfirmationBehavior(getString("Confirm")));
- formView.add(deleteButton);
+ @Override
+ public void onSuccess() {
+ successNextPage(ACTION_DELETE);
+ callerPage.responsePage((TemplatePage) getPage());
+ }
+ });
+ deleteButton.setVisibilityAllowed(!createMode);
+ deleteButton.setDefaultFormProcessing(false);
+ deleteButton.add(new JSConfirmationBehavior(getString("Confirm")));
+ formView.add(deleteButton);
- formView.add(new Link<Void>("Cancel") {
- // Cas où le formulaire est annulé
- @Override
- public void onClick() {
- callerPage.responsePage((TemplatePage) getPage());
- }
- });
+ formView.add(new Link<Void>("Cancel") {
+ // Cas où le formulaire est annulé
+ @Override
+ public void onClick() {
+ callerPage.responsePage((TemplatePage) getPage());
+ }
+ });
- formView.setDefaultButton(addResultatButton);
- add(formView);
+ formView.setDefaultButton(addResultatButton);
+ add(formView);
- }
+ }
- /**
- * Initialise les champs principaux
- * @param formView le formulaire
- */
- private void initPrincipalFields(Form<Void> formView) {
- formView.add(new TextField<String>("TestBio.ref", new PropertyModel<String>(testBioModel, "ref")));
+ /**
+ * Initialise les champs principaux
+ * @param formView le formulaire
+ */
+ private void initPrincipalFields(Form<Void> formView) {
+ formView.add(new TextField<String>("TestBio.ref", new PropertyModel<String>(testBioModel, "ref")));
- formView.add(new DropDownChoice<Personne>("TestBio.manipulateur", new PropertyModel<Personne>(testBioModel,
- "manipulateur"), personnes, new PersonneRenderer()).setNullValid(false));
+ formView.add(new DropDownChoice<Personne>("TestBio.manipulateur", new PropertyModel<Personne>(testBioModel,
+ "manipulateur"), personnes, new PersonneRenderer()).setNullValid(false));
- // Action : création d'une nouvelle personne
- // ajaxSubmitLink permet de sauvegarder l'état du formulaire
- formView.add(new AjaxSubmitLink("NewPersonne") {
- @Override
- protected void onSubmit(AjaxRequestTarget arg0, Form<?> arg1) {
- setResponsePage(new ManagePersonnePage(new CallerPage((TemplatePage) getPage()), false));
- }
+ // Action : création d'une nouvelle personne
+ // ajaxSubmitLink permet de sauvegarder l'état du formulaire
+ formView.add(new AjaxSubmitLink("NewPersonne") {
+ @Override
+ protected void onSubmit(AjaxRequestTarget arg0, Form<?> arg1) {
+ setResponsePage(new ManagePersonnePage(new CallerPage((TemplatePage) getPage()), false));
+ }
- // si erreur, le formulaire est également enregistré puis la redirection effectuée
- @Override
- protected void onError(AjaxRequestTarget target, Form<?> form) {
- setResponsePage(new ManagePersonnePage(new CallerPage((TemplatePage) getPage()), false));
- }
- });
+ // si erreur, le formulaire est également enregistré puis la redirection effectuée
+ @Override
+ protected void onError(AjaxRequestTarget target, Form<?> form) {
+ setResponsePage(new ManagePersonnePage(new CallerPage((TemplatePage) getPage()), false));
+ }
+ });
- formView.add(new AutoCompleteTextFieldString("TestBio.organismeTesteur", new PropertyModel<String>(
- testBioModel, "organismeTesteur"), organismes, ComparisonMode.CONTAINS));
+ formView.add(new AutoCompleteTextFieldString("TestBio.organismeTesteur", new PropertyModel<String>(
+ testBioModel, "organismeTesteur"), organismes, ComparisonMode.CONTAINS));
- formView.add(new DateTextField("TestBio.date", new PropertyModel<Date>(testBioModel, "date"))
- .add(new DatePicker()));
+ formView.add(new DateTextField("TestBio.date", new PropertyModel<Date>(testBioModel, "date"))
+ .add(new DatePicker()));
- concMasseDefautInput = new TextField<BigDecimal>("TestBio.concMasseDefaut", new PropertyModel<BigDecimal>(
- testBioModel, "concMasseDefaut"));
- concMasseDefautInput.add(new AjaxFormComponentUpdatingBehavior("onchange") {
- protected void onUpdate(AjaxRequestTarget target) {
- // maj du champ concMasse du résultat si résultat de type produit ou témoin
- if (newResultatModel.getObject().getTypeResultat() == TypeResultat.PRODUIT
- || newResultatModel.getObject().getTypeResultat() == TypeResultat.TEMOIN) {
- newResultatModel.getObject().setConcMasse(concMasseDefautInput.getModelObject());
- target.add(concMasseInput);
- }
- };
- });
- formView.add(concMasseDefautInput);
+ concMasseDefautInput = new TextField<BigDecimal>("TestBio.concMasseDefaut", new PropertyModel<BigDecimal>(
+ testBioModel, "concMasseDefaut"));
+ concMasseDefautInput.add(new AjaxFormComponentUpdatingBehavior("onchange") {
+ protected void onUpdate(AjaxRequestTarget target) {
+ // maj du champ concMasse du résultat si résultat de type produit ou témoin
+ if (newResultatModel.getObject().getTypeResultat() == TypeResultat.PRODUIT
+ || newResultatModel.getObject().getTypeResultat() == TypeResultat.TEMOIN) {
+ newResultatModel.getObject().setConcMasse(concMasseDefautInput.getModelObject());
+ target.add(concMasseInput);
+ }
+ };
+ });
+ formView.add(concMasseDefautInput);
- uniteConcMasseDefautInput = new DropDownChoice<UniteConcMasse>("TestBio.uniteConcMasseDefaut",
- new PropertyModel<UniteConcMasse>(testBioModel, "uniteConcMasseDefaut"), Arrays.asList(UniteConcMasse
- .values()), new EnumChoiceRenderer<UniteConcMasse>(this));
- uniteConcMasseDefautInput.setNullValid(true);
+ uniteConcMasseDefautInput = new DropDownChoice<UniteConcMasse>("TestBio.uniteConcMasseDefaut",
+ new PropertyModel<UniteConcMasse>(testBioModel, "uniteConcMasseDefaut"), Arrays.asList(UniteConcMasse
+ .values()), new EnumChoiceRenderer<UniteConcMasse>(this));
+ uniteConcMasseDefautInput.setNullValid(true);
- uniteConcMasseDefautInput.add(new AjaxFormComponentUpdatingBehavior("onchange") {
- protected void onUpdate(AjaxRequestTarget target) {
- // maj du champ uniteConcMasse du résultat si résultat de type produit
- if (newResultatModel.getObject().getTypeResultat() == TypeResultat.PRODUIT
- || newResultatModel.getObject().getTypeResultat() == TypeResultat.TEMOIN) {
- newResultatModel.getObject().setUniteConcMasse(uniteConcMasseDefautInput.getModelObject());
- target.add(uniteConcMasseInput);
- }
- }
- });
- formView.add(uniteConcMasseDefautInput);
+ uniteConcMasseDefautInput.add(new AjaxFormComponentUpdatingBehavior("onchange") {
+ protected void onUpdate(AjaxRequestTarget target) {
+ // maj du champ uniteConcMasse du résultat si résultat de type produit
+ if (newResultatModel.getObject().getTypeResultat() == TypeResultat.PRODUIT
+ || newResultatModel.getObject().getTypeResultat() == TypeResultat.TEMOIN) {
+ newResultatModel.getObject().setUniteConcMasse(uniteConcMasseDefautInput.getModelObject());
+ target.add(uniteConcMasseInput);
+ }
+ }
+ });
+ formView.add(uniteConcMasseDefautInput);
- final AbstractSingleSelectChoice<Stade> stadeDefautInput = new DropDownChoice<Stade>("TestBio.stadeDefaut",
- new PropertyModel<Stade>(testBioModel, "stadeDefaut"), Arrays.asList(Stade.values()),
- new EnumChoiceRenderer<Stade>(this));
- stadeDefautInput.setNullValid(true);
+ final AbstractSingleSelectChoice<Stade> stadeDefautInput = new DropDownChoice<Stade>("TestBio.stadeDefaut",
+ new PropertyModel<Stade>(testBioModel, "stadeDefaut"), Arrays.asList(Stade.values()),
+ new EnumChoiceRenderer<Stade>(this));
+ stadeDefautInput.setNullValid(true);
- stadeDefautInput.add(new AjaxFormComponentUpdatingBehavior("onchange") {
- protected void onUpdate(AjaxRequestTarget target) {
- // maj du champ stade du résultat si résultat de type produit
- if (newResultatModel.getObject().getTypeResultat() == TypeResultat.PRODUIT
- || newResultatModel.getObject().getTypeResultat() == TypeResultat.TEMOIN) {
- newResultatModel.getObject().setStade(stadeDefautInput.getModelObject());
- target.add(stadeInput);
- }
- }
- });
- formView.add(stadeDefautInput);
+ stadeDefautInput.add(new AjaxFormComponentUpdatingBehavior("onchange") {
+ protected void onUpdate(AjaxRequestTarget target) {
+ // maj du champ stade du résultat si résultat de type produit
+ if (newResultatModel.getObject().getTypeResultat() == TypeResultat.PRODUIT
+ || newResultatModel.getObject().getTypeResultat() == TypeResultat.TEMOIN) {
+ newResultatModel.getObject().setStade(stadeDefautInput.getModelObject());
+ target.add(stadeInput);
+ }
+ }
+ });
+ formView.add(stadeDefautInput);
- formView.add(new TextArea<String>("TestBio.complement", new PropertyModel<String>(testBioModel, "complement")));
- // Créateur en lecture seule
- formView.add(new TextField<String>("TestBio.createur", new PropertyModel<String>(testBioModel, "createur"))
- .setEnabled(false));
- }
+ formView.add(new TextArea<String>("TestBio.complement", new PropertyModel<String>(testBioModel, "complement")));
+ // Créateur en lecture seule
+ formView.add(new TextField<String>("TestBio.createur", new PropertyModel<String>(testBioModel, "createur"))
+ .setEnabled(false));
+ }
- /**
- * Initialise les champs relatifs à la méthode
- * @param formView le formulaire
- */
- private void initMethodeFields(final Form<Void> formView) {
+ /**
+ * Initialise les champs relatifs à la méthode
+ * @param formView le formulaire
+ */
+ private void initMethodeFields(final Form<Void> formView) {
- final WebMarkupContainer methodeCont = new WebMarkupContainer("TestBio.methode");
- methodeCont.setOutputMarkupId(true);
- formView.add(methodeCont);
+ final WebMarkupContainer methodeCont = new WebMarkupContainer("TestBio.methode");
+ methodeCont.setOutputMarkupId(true);
+ formView.add(methodeCont);
- // Champs pour la méthode
- descriptionMethoContainer = new WebMarkupContainer("TestBio.descriptionMethodeCont") {
- @Override
- public boolean isVisible() {
- // description cachée si pas de méthode sélectionnée
- return testBioModel.getObject().getMethode() != null;
- }
- };
- descriptionMethoContainer.setOutputMarkupId(true); // pour l'update Ajax
- descriptionMethoContainer.setOutputMarkupPlaceholderTag(true); // pour accéder à l'élement html qd son état est
- // non visible
- methodeCont.add(descriptionMethoContainer);
+ // Champs pour la méthode
+ descriptionMethoContainer = new WebMarkupContainer("TestBio.descriptionMethodeCont") {
+ @Override
+ public boolean isVisible() {
+ // description cachée si pas de méthode sélectionnée
+ return testBioModel.getObject().getMethode() != null;
+ }
+ };
+ descriptionMethoContainer.setOutputMarkupId(true); // pour l'update Ajax
+ descriptionMethoContainer.setOutputMarkupPlaceholderTag(true); // pour accéder à l'élement html qd son état est
+ // non visible
+ methodeCont.add(descriptionMethoContainer);
- Label methodeCible = new Label("TestBio.cibleMethode", new PropertyModel<String>(testBioModel, "methode.cible"));
- descriptionMethoContainer.add(methodeCible);
+ Label methodeCible = new Label("TestBio.cibleMethode", new PropertyModel<String>(testBioModel, "methode.cible"));
+ descriptionMethoContainer.add(methodeCible);
- Label methodeDomaine = new Label("TestBio.domaineMethode", new PropertyModel<String>(testBioModel,
- "methode.domaine"));
- descriptionMethoContainer.add(methodeDomaine);
+ Label methodeDomaine = new Label("TestBio.domaineMethode", new PropertyModel<String>(testBioModel,
+ "methode.domaine"));
+ descriptionMethoContainer.add(methodeDomaine);
- MultiLineLabel methodeDesc = new MultiLineLabel("TestBio.descriptionMethode", new PropertyModel<String>(
- testBioModel, "methode.description"));
- descriptionMethoContainer.add(methodeDesc);
+ MultiLineLabel methodeDesc = new MultiLineLabel("TestBio.descriptionMethode", new PropertyModel<String>(
+ testBioModel, "methode.description"));
+ descriptionMethoContainer.add(methodeDesc);
- Label methodeValeurMesuree = new Label("TestBio.valeurMesureeMethode", new PropertyModel<String>(testBioModel,
- "methode.valeurMesuree"));
- descriptionMethoContainer.add(methodeValeurMesuree);
+ Label methodeValeurMesuree = new Label("TestBio.valeurMesureeMethode", new PropertyModel<String>(testBioModel,
+ "methode.valeurMesuree"));
+ descriptionMethoContainer.add(methodeValeurMesuree);
- Label methodeCritereActivite = new Label("TestBio.critereActiviteMethode", new PropertyModel<String>(
- testBioModel, "methode.critereActivite"));
- descriptionMethoContainer.add(methodeCritereActivite);
+ Label methodeCritereActivite = new Label("TestBio.critereActiviteMethode", new PropertyModel<String>(
+ testBioModel, "methode.critereActivite"));
+ descriptionMethoContainer.add(methodeCritereActivite);
- Label methodeUniteResultat = new Label("TestBio.uniteResultatMethode", new PropertyModel<String>(testBioModel,
- "methode.uniteResultat"));
- descriptionMethoContainer.add(methodeUniteResultat);
+ Label methodeUniteResultat = new Label("TestBio.uniteResultatMethode", new PropertyModel<String>(testBioModel,
+ "methode.uniteResultat"));
+ descriptionMethoContainer.add(methodeUniteResultat);
- final DropDownChoice<MethodeTestBio> methodeChoice = new DropDownChoice<MethodeTestBio>("TestBio.nomMethode",
- new PropertyModel<MethodeTestBio>(testBioModel, "methode"), methodes);
- methodeChoice.setNullValid(false);
- // mise à jour de la description de la méthode et des fractions lors de la sélection de la méthode
- methodeChoice.add(new AjaxFormComponentUpdatingBehavior("onchange") {
- protected void onUpdate(AjaxRequestTarget target) {
- // mise à jour de la description et des paramètres
- target.add(methodeCont);
- }
- });
- methodeCont.add(methodeChoice);
- }
+ final DropDownChoice<MethodeTestBio> methodeChoice = new DropDownChoice<MethodeTestBio>("TestBio.nomMethode",
+ new PropertyModel<MethodeTestBio>(testBioModel, "methode"), methodes);
+ methodeChoice.setNullValid(false);
+ // mise à jour de la description de la méthode et des fractions lors de la sélection de la méthode
+ methodeChoice.add(new AjaxFormComponentUpdatingBehavior("onchange") {
+ protected void onUpdate(AjaxRequestTarget target) {
+ // mise à jour de la description et des paramètres
+ target.add(methodeCont);
+ }
+ });
+ methodeCont.add(methodeChoice);
+ }
- /**
- * Initialise les champs relatifs aux résultats de test
- * @param formView Le formulaire
- */
- private void initResultatsFields(final Form<Void> formView) {
+ /**
+ * Initialise les champs relatifs aux résultats de test
+ * @param formView Le formulaire
+ */
+ private void initResultatsFields(final Form<Void> formView) {
- // Déclaration tableau des resultats
- final MarkupContainer testsBioTable = new WebMarkupContainer("TestBio.resultats.Table");
- testsBioTable.setOutputMarkupId(true);
+ // Déclaration tableau des resultats
+ final MarkupContainer testsBioTable = new WebMarkupContainer("TestBio.resultats.Table");
+ testsBioTable.setOutputMarkupId(true);
- // Contenu tableaux resultats
- testsBioTable.add(new ListView<ResultatTestBio>("TestBio.resultats.List",
- new PropertyModel<List<ResultatTestBio>>(testBioModel, "sortedResultats")) {
- @Override
- protected void populateItem(ListItem<ResultatTestBio> item) {
- if (item.getIndex() % 2 == 1) {
- item.add(new AttributeModifier("class", item.getIndex() % 2 == 0 ? "even" : "odd"));
- }
+ // Contenu tableaux resultats
+ testsBioTable.add(new ListView<ResultatTestBio>("TestBio.resultats.List",
+ new PropertyModel<List<ResultatTestBio>>(testBioModel, "sortedResultats")) {
+ @Override
+ protected void populateItem(ListItem<ResultatTestBio> item) {
+ if (item.getIndex() % 2 == 1) {
+ item.add(new AttributeModifier("class", item.getIndex() % 2 == 0 ? "even" : "odd"));
+ }
- final IModel<ResultatTestBio> resultatModel = item.getModel();
- final ResultatTestBio resultat = item.getModelObject();
+ final IModel<ResultatTestBio> resultatModel = item.getModel();
+ final ResultatTestBio resultat = item.getModelObject();
- // Colonnes
- item.add(new Label("TestBio.resultats.List.repere", new PropertyModel<String>(resultat, "repere")));
- item.add(new Label("TestBio.resultats.List.typeResultat", new DisplayEnumPropertyModel(resultat,
- "typeResultat", (TemplatePage) this.getPage())));
- item.add(new Label("TestBio.resultats.List.produit", new PropertyModel<String>(resultat, "produit.ref")));
+ // Colonnes
+ item.add(new Label("TestBio.resultats.List.repere", new PropertyModel<String>(resultat, "repere")));
+ item.add(new Label("TestBio.resultats.List.typeResultat", new DisplayEnumPropertyModel(resultat,
+ "typeResultat", (TemplatePage) this.getPage())));
+ item.add(new Label("TestBio.resultats.List.produit", new PropertyModel<String>(resultat, "produit.ref")));
- item.add(new Label("TestBio.resultats.List.produitTemoin", new PropertyModel<String>(resultat,
- "produitTemoin")));
+ item.add(new Label("TestBio.resultats.List.produitTemoin", new PropertyModel<String>(resultat,
+ "produitTemoin")));
- // concatenation de concMasse et de uniteConcMasse
- item.add(new Label("TestBio.resultats.List.concMasse", new Model<Serializable>(resultat) {
+ // concatenation de concMasse et de uniteConcMasse
+ item.add(new Label("TestBio.resultats.List.concMasse", new Model<Serializable>(resultat) {
- /** {@inheritDoc} */
- @Override
- public String getObject() {
- String masse = (String) new DisplayDecimalPropertyModel(super.getObject(), "concMasse",
- DecimalDisplFormat.SMALL, getLocale()).getObject();
- if (masse == null) {
- masse = "";
- }
+ /** {@inheritDoc} */
+ @Override
+ public String getObject() {
+ String masse = (String) new DisplayDecimalPropertyModel(super.getObject(), "concMasse",
+ DecimalDisplFormat.SMALL, getLocale()).getObject();
+ if (masse == null) {
+ masse = "";
+ }
- String unite = (String) new DisplayEnumPropertyModel(super.getObject(), "uniteConcMasse",
- (TemplatePage) getPage()).getObject();
- if (unite == null) {
- unite = "";
- }
- return masse + " " + unite;
- }
- }));
+ String unite = (String) new DisplayEnumPropertyModel(super.getObject(), "uniteConcMasse",
+ (TemplatePage) getPage()).getObject();
+ if (unite == null) {
+ unite = "";
+ }
+ return masse + " " + unite;
+ }
+ }));
- item.add(new Label("TestBio.resultats.List.stade", new DisplayEnumPropertyModel(resultat, "stade",
- (TemplatePage) this.getPage())));
- item.add(new Label("TestBio.resultats.List.valeur", new DisplayDecimalPropertyModel(resultat, "valeur",
- DecimalDisplFormat.SMALL, getSession().getLocale())));
- item.add(new Label("TestBio.resultats.List.actif", new DisplayBooleanPropertyModel(resultatModel,
- "estActif", (TemplatePage) this.getPage())).add(new ReplaceEmptyLabelBehavior()));
+ item.add(new Label("TestBio.resultats.List.stade", new DisplayEnumPropertyModel(resultat, "stade",
+ (TemplatePage) this.getPage())));
+ item.add(new Label("TestBio.resultats.List.valeur", new DisplayDecimalPropertyModel(resultat, "valeur",
+ DecimalDisplFormat.SMALL, getSession().getLocale())));
+ item.add(new Label("TestBio.resultats.List.actif", new DisplayBooleanPropertyModel(resultatModel,
+ "estActif", (TemplatePage) this.getPage())).add(new ReplaceEmptyLabelBehavior()));
- item.add(new Label("TestBio.resultats.List.erreur", new PropertyModel<String>(resultat, "erreur.nom")));
- // info-bulle comprenant la description de l'erreur
- item.add(new SimpleTooltipPanel("TestBio.resultats.List.erreur.info", new PropertyModel<String>(
- resultat, "erreur.description")) {
- /** {@inheritDoc} */
- @Override
- public boolean isVisible() {
- return resultat.getErreur() != null;
- }
- });
+ item.add(new Label("TestBio.resultats.List.erreur", new PropertyModel<String>(resultat, "erreur.nom")));
+ // info-bulle comprenant la description de l'erreur
+ item.add(new SimpleTooltipPanel("TestBio.resultats.List.erreur.info", new PropertyModel<String>(
+ resultat, "erreur.description")) {
+ /** {@inheritDoc} */
+ @Override
+ public boolean isVisible() {
+ return resultat.getErreur() != null;
+ }
+ });
- // Action : suppression d'un résultat de test
- Button deleteButton = new AjaxFallbackButton("TestBio.resultats.List.Delete", formView) {
- @Override
- protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
- // Suppression
- testBioModel.getObject().getResultats().remove(resultat);
+ // Action : suppression d'un résultat de test
+ Button deleteButton = new AjaxFallbackButton("TestBio.resultats.List.Delete", formView) {
+ @Override
+ protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
+ // Suppression
+ testBioModel.getObject().getResultats().remove(resultat);
- if (target != null) {
- target.add(testsBioTable);
- refreshFeedbackPage(target);
- }
- }
+ if (target != null) {
+ target.add(testsBioTable);
+ refreshFeedbackPage(target);
+ }
+ }
- @Override
- protected void onError(AjaxRequestTarget target, Form<?> form) {
- // never called
- }
+ @Override
+ protected void onError(AjaxRequestTarget target, Form<?> form) {
+ // never called
+ }
- };
- deleteButton.setDefaultFormProcessing(false);
- item.add(deleteButton);
- }
- });
+ };
+ deleteButton.setDefaultFormProcessing(false);
+ item.add(deleteButton);
+ }
+ });
- // champs d'input
- testsBioTable.add(new TextField<String>("TestBio.resultats.repere", new PropertyModel<String>(newResultatModel,
- "repere")) {
- @Override
- @SuppressWarnings("unchecked")
- public boolean isRequired() {
- // champs requis uniquement qd le bouton d'ajout de résultat est activé
- // de même pour les autres composants ci-dessous
- Form<Void> form = (Form<Void>) findParent(Form.class);
- return form.getRootForm().findSubmittingButton() == addResultatButton;
- }
- });
+ // champs d'input
+ testsBioTable.add(new TextField<String>("TestBio.resultats.repere", new PropertyModel<String>(newResultatModel,
+ "repere")) {
+ @Override
+ @SuppressWarnings("unchecked")
+ public boolean isRequired() {
+ // champs requis uniquement qd le bouton d'ajout de résultat est activé
+ // de même pour les autres composants ci-dessous
+ Form<Void> form = (Form<Void>) findParent(Form.class);
+ return form.getRootForm().findSubmittingButton() == addResultatButton;
+ }
+ });
- final DropDownChoice<TypeResultat> typeResultatChoice = new DropDownChoice<TypeResultat>(
- "TestBio.resultats.typeResultat", new PropertyModel<TypeResultat>(newResultatModel, "typeResultat"),
- Arrays.asList(TypeResultat.values()), new EnumChoiceRenderer<TypeResultat>(this)) {
- @Override
- @SuppressWarnings("unchecked")
- public boolean isRequired() {
- Form<Void> form = (Form<Void>) findParent(Form.class);
- return form.getRootForm().findSubmittingButton() == addResultatButton;
- }
- };
- typeResultatChoice.setNullValid(false);
- testsBioTable.add(typeResultatChoice);
+ final DropDownChoice<TypeResultat> typeResultatChoice = new DropDownChoice<TypeResultat>(
+ "TestBio.resultats.typeResultat", new PropertyModel<TypeResultat>(newResultatModel, "typeResultat"),
+ Arrays.asList(TypeResultat.values()), new EnumChoiceRenderer<TypeResultat>(this)) {
+ @Override
+ @SuppressWarnings("unchecked")
+ public boolean isRequired() {
+ Form<Void> form = (Form<Void>) findParent(Form.class);
+ return form.getRootForm().findSubmittingButton() == addResultatButton;
+ }
+ };
+ typeResultatChoice.setNullValid(false);
+ testsBioTable.add(typeResultatChoice);
- final DropDownChoice<Produit> produitChoice = new DropDownChoice<Produit>("TestBio.resultats.produit",
- new PropertyModel<Produit>(newResultatModel, "produit"), produits) {
- @Override
- @SuppressWarnings("unchecked")
- public boolean isRequired() {
- Form<Void> form = (Form<Void>) findParent(Form.class);
- return form.getRootForm().findSubmittingButton() == addResultatButton
- && typeResultatChoice.getModelObject() == TypeResultat.PRODUIT;
- }
- };
- produitChoice.setOutputMarkupId(true);
- produitChoice.setOutputMarkupPlaceholderTag(true);
- testsBioTable.add(produitChoice);
+ final DropDownChoice<Produit> produitChoice = new DropDownChoice<Produit>("TestBio.resultats.produit",
+ new PropertyModel<Produit>(newResultatModel, "produit"), produits) {
+ @Override
+ @SuppressWarnings("unchecked")
+ public boolean isRequired() {
+ Form<Void> form = (Form<Void>) findParent(Form.class);
+ return form.getRootForm().findSubmittingButton() == addResultatButton
+ && typeResultatChoice.getModelObject() == TypeResultat.PRODUIT;
+ }
+ };
+ produitChoice.setOutputMarkupId(true);
+ produitChoice.setOutputMarkupPlaceholderTag(true);
+ testsBioTable.add(produitChoice);
- final AutoCompleteTextFieldString produitTemoinInput = new AutoCompleteTextFieldString(
- "TestBio.resultats.produitTemoin", new PropertyModel<String>(newResultatModel, "produitTemoin"),
- produitsTemoins, ComparisonMode.CONTAINS) {
- @Override
- @SuppressWarnings("unchecked")
- public boolean isRequired() {
- Form<Void> form = (Form<Void>) findParent(Form.class);
- return form.getRootForm().findSubmittingButton() == addResultatButton
- && typeResultatChoice.getModelObject() == TypeResultat.TEMOIN;
- }
- };
- produitTemoinInput.setOutputMarkupId(true);
- produitTemoinInput.setOutputMarkupPlaceholderTag(true);
- testsBioTable.add(produitTemoinInput);
+ final AutoCompleteTextFieldString produitTemoinInput = new AutoCompleteTextFieldString(
+ "TestBio.resultats.produitTemoin", new PropertyModel<String>(newResultatModel, "produitTemoin"),
+ produitsTemoins, ComparisonMode.CONTAINS) {
+ @Override
+ @SuppressWarnings("unchecked")
+ public boolean isRequired() {
+ Form<Void> form = (Form<Void>) findParent(Form.class);
+ return form.getRootForm().findSubmittingButton() == addResultatButton
+ && typeResultatChoice.getModelObject() == TypeResultat.TEMOIN;
+ }
+ };
+ produitTemoinInput.setOutputMarkupId(true);
+ produitTemoinInput.setOutputMarkupPlaceholderTag(true);
+ testsBioTable.add(produitTemoinInput);
- concMasseInput = new TextField<BigInteger>("TestBio.resultats.concMasse", new PropertyModel<BigInteger>(
- newResultatModel, "concMasse"));
- concMasseInput.setOutputMarkupId(true);
- concMasseInput.setOutputMarkupPlaceholderTag(true);
- testsBioTable.add(concMasseInput);
+ concMasseInput = new TextField<BigInteger>("TestBio.resultats.concMasse", new PropertyModel<BigInteger>(
+ newResultatModel, "concMasse"));
+ concMasseInput.setOutputMarkupId(true);
+ concMasseInput.setOutputMarkupPlaceholderTag(true);
+ testsBioTable.add(concMasseInput);
- uniteConcMasseInput = new DropDownChoice<UniteConcMasse>("TestBio.resultats.uniteConcMasse",
- new PropertyModel<UniteConcMasse>(newResultatModel, "uniteConcMasse"), Arrays.asList(UniteConcMasse
- .values()), new EnumChoiceRenderer<UniteConcMasse>(this));
- uniteConcMasseInput.setOutputMarkupId(true);
- uniteConcMasseInput.setOutputMarkupPlaceholderTag(true);
- uniteConcMasseInput.setNullValid(true);
+ uniteConcMasseInput = new DropDownChoice<UniteConcMasse>("TestBio.resultats.uniteConcMasse",
+ new PropertyModel<UniteConcMasse>(newResultatModel, "uniteConcMasse"), Arrays.asList(UniteConcMasse
+ .values()), new EnumChoiceRenderer<UniteConcMasse>(this));
+ uniteConcMasseInput.setOutputMarkupId(true);
+ uniteConcMasseInput.setOutputMarkupPlaceholderTag(true);
+ uniteConcMasseInput.setNullValid(true);
- testsBioTable.add(uniteConcMasseInput);
+ testsBioTable.add(uniteConcMasseInput);
- stadeInput = new DropDownChoice<Stade>("TestBio.resultats.stade", new PropertyModel<Stade>(newResultatModel,
- "stade"), Arrays.asList(Stade.values()), new EnumChoiceRenderer<Stade>(this)) {
- @Override
- @SuppressWarnings("unchecked")
- public boolean isRequired() {
- Form<Void> form = (Form<Void>) findParent(Form.class);
- return form.getRootForm().findSubmittingButton() == addResultatButton
- && typeResultatChoice.getModelObject() == TypeResultat.PRODUIT;
- }
- };
- stadeInput.setOutputMarkupId(true);
- stadeInput.setOutputMarkupPlaceholderTag(true);
- testsBioTable.add(stadeInput);
+ stadeInput = new DropDownChoice<Stade>("TestBio.resultats.stade", new PropertyModel<Stade>(newResultatModel,
+ "stade"), Arrays.asList(Stade.values()), new EnumChoiceRenderer<Stade>(this)) {
+ @Override
+ @SuppressWarnings("unchecked")
+ public boolean isRequired() {
+ Form<Void> form = (Form<Void>) findParent(Form.class);
+ return form.getRootForm().findSubmittingButton() == addResultatButton
+ && typeResultatChoice.getModelObject() == TypeResultat.PRODUIT;
+ }
+ };
+ stadeInput.setOutputMarkupId(true);
+ stadeInput.setOutputMarkupPlaceholderTag(true);
+ testsBioTable.add(stadeInput);
- testsBioTable
- .add(new CheckBox("TestBio.resultats.actif", new PropertyModel<Boolean>(newResultatModel, "actif")));
+ testsBioTable
+ .add(new CheckBox("TestBio.resultats.actif", new PropertyModel<Boolean>(newResultatModel, "actif")));
- final DropDownChoice<ErreurTestBio> erreurChoice = new DropDownChoice<ErreurTestBio>(
- "TestBio.resultats.erreur", new PropertyModel<ErreurTestBio>(newResultatModel, "erreur"), erreurs);
- erreurChoice.setNullValid(true);
- testsBioTable.add(erreurChoice);
+ final DropDownChoice<ErreurTestBio> erreurChoice = new DropDownChoice<ErreurTestBio>(
+ "TestBio.resultats.erreur", new PropertyModel<ErreurTestBio>(newResultatModel, "erreur"), erreurs);
+ erreurChoice.setNullValid(true);
+ testsBioTable.add(erreurChoice);
- // info-bulle comprenant la description de l'erreur
- final SimpleTooltipPanel infoBulle = new SimpleTooltipPanel("TestBio.resultats.erreur.info",
- new PropertyModel<String>(newResultatModel, "erreur.description"));
- infoBulle.setVisibilityAllowed(false);
- // permet la mise en visibité ou non en Ajax
- infoBulle.setOutputMarkupId(true);
- infoBulle.setOutputMarkupPlaceholderTag(true);
- testsBioTable.add(infoBulle);
+ // info-bulle comprenant la description de l'erreur
+ final SimpleTooltipPanel infoBulle = new SimpleTooltipPanel("TestBio.resultats.erreur.info",
+ new PropertyModel<String>(newResultatModel, "erreur.description"));
+ infoBulle.setVisibilityAllowed(false);
+ // permet la mise en visibité ou non en Ajax
+ infoBulle.setOutputMarkupId(true);
+ infoBulle.setOutputMarkupPlaceholderTag(true);
+ testsBioTable.add(infoBulle);
- final TextField<BigDecimal> valeurInput = new TextField<BigDecimal>("TestBio.resultats.valeur",
- new PropertyModel<BigDecimal>(newResultatModel, "valeur")) {
- @Override
- @SuppressWarnings("unchecked")
- public boolean isRequired() {
- Form<Void> form = (Form<Void>) findParent(Form.class);
- return form.getRootForm().findSubmittingButton() == addResultatButton
- && erreurChoice.getModelObject() == null;
- }
- };
- valeurInput.setOutputMarkupId(true);
- valeurInput.setOutputMarkupPlaceholderTag(true);
- testsBioTable.add(valeurInput);
+ final TextField<BigDecimal> valeurInput = new TextField<BigDecimal>("TestBio.resultats.valeur",
+ new PropertyModel<BigDecimal>(newResultatModel, "valeur")) {
+ @Override
+ @SuppressWarnings("unchecked")
+ public boolean isRequired() {
+ Form<Void> form = (Form<Void>) findParent(Form.class);
+ return form.getRootForm().findSubmittingButton() == addResultatButton
+ && erreurChoice.getModelObject() == null;
+ }
+ };
+ valeurInput.setOutputMarkupId(true);
+ valeurInput.setOutputMarkupPlaceholderTag(true);
+ testsBioTable.add(valeurInput);
- // comportement dynamique sur les inputs
- typeResultatChoice.add(new AjaxFormComponentUpdatingBehavior("onchange") {
- protected void onUpdate(AjaxRequestTarget target) {
- if (typeResultatChoice.getModelObject() == TypeResultat.BLANC) {
- activeInputsForBlancType(produitChoice, produitTemoinInput, concMasseInput, uniteConcMasseInput,
- stadeInput, target);
- } else if (typeResultatChoice.getModelObject() == TypeResultat.TEMOIN) {
- activeInputsForTemoinType(produitChoice, produitTemoinInput, concMasseInput, uniteConcMasseInput,
- stadeInput, target);
- } else {
- activeInputsForProduitType(produitChoice, produitTemoinInput, concMasseInput, uniteConcMasseInput,
- stadeInput, true, target);
- }
- }
- });
+ // comportement dynamique sur les inputs
+ typeResultatChoice.add(new AjaxFormComponentUpdatingBehavior("onchange") {
+ protected void onUpdate(AjaxRequestTarget target) {
+ if (typeResultatChoice.getModelObject() == TypeResultat.BLANC) {
+ activeInputsForBlancType(produitChoice, produitTemoinInput, concMasseInput, uniteConcMasseInput,
+ stadeInput, target);
+ } else if (typeResultatChoice.getModelObject() == TypeResultat.TEMOIN) {
+ activeInputsForTemoinType(produitChoice, produitTemoinInput, concMasseInput, uniteConcMasseInput,
+ stadeInput, target);
+ } else {
+ activeInputsForProduitType(produitChoice, produitTemoinInput, concMasseInput, uniteConcMasseInput,
+ stadeInput, true, target);
+ }
+ }
+ });
- erreurChoice.add(new AjaxFormComponentUpdatingBehavior("onchange") {
- protected void onUpdate(AjaxRequestTarget target) {
- if (erreurChoice.getModelObject() != null) {
- // si une erreur est sélectionnée, le champ valeur est désactivé et l'info-bulle affichée
- valeurInput.setVisibilityAllowed(false);
- newResultatModel.getObject().setValeur(null);
- infoBulle.setVisibilityAllowed(true);
- } else {
- // si une erreur est sélectionnée, le champ valeur est désactivé et l'info-bulle désactivée
- valeurInput.setVisibilityAllowed(true);
- infoBulle.setVisibilityAllowed(false);
- }
- target.add(valeurInput, infoBulle);
- }
- });
+ erreurChoice.add(new AjaxFormComponentUpdatingBehavior("onchange") {
+ protected void onUpdate(AjaxRequestTarget target) {
+ if (erreurChoice.getModelObject() != null) {
+ // si une erreur est sélectionnée, le champ valeur est désactivé et l'info-bulle affichée
+ valeurInput.setVisibilityAllowed(false);
+ newResultatModel.getObject().setValeur(null);
+ infoBulle.setVisibilityAllowed(true);
+ } else {
+ // si une erreur est sélectionnée, le champ valeur est désactivé et l'info-bulle désactivée
+ valeurInput.setVisibilityAllowed(true);
+ infoBulle.setVisibilityAllowed(false);
+ }
+ target.add(valeurInput, infoBulle);
+ }
+ });
- // Bouton AJAX pour ajouter un résultat de test
- addResultatButton = new AjaxFallbackButton("TestBio.resultats.Add", formView) {
- @Override
- protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
- try {
- // normalisation du résultat
- newResultatModel.getObject()
- .setRepere(
- Normalizer.normalize(UniqueFieldNormalizer.class, newResultatModel.getObject()
- .getRepere()));
- // ajout du type testBio
- newResultatModel.getObject().setTestBio(testBioModel.getObject());
+ // Bouton AJAX pour ajouter un résultat de test
+ addResultatButton = new AjaxFallbackButton("TestBio.resultats.Add", formView) {
+ @Override
+ protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
+ try {
+ // normalisation du résultat
+ newResultatModel.getObject()
+ .setRepere(
+ Normalizer.normalize(UniqueFieldNormalizer.class, newResultatModel.getObject()
+ .getRepere()));
+ // ajout du type testBio
+ newResultatModel.getObject().setTestBio(testBioModel.getObject());
- // ajout à la liste
- ResultatTestBio resultatAdded = newResultatModel.getObject().clone();
- testBioModel.getObject().getResultats().add(resultatAdded);
+ // ajout à la liste
+ ResultatTestBio resultatAdded = newResultatModel.getObject().clone();
+ testBioModel.getObject().getResultats().add(resultatAdded);
- List<String> errors = validator.validate(newResultatModel.getObject(), getSession().getLocale());
+ List<String> errors = validator.validate(newResultatModel.getObject(), getSession().getLocale());
- // si une saisie existe pour concMasse, on s'assure que les deux composantes sont bien renseignées
- if ((newResultatModel.getObject().getConcMasse() != null && newResultatModel.getObject()
- .getUniteConcMasse() == null)
- || (newResultatModel.getObject().getConcMasse() == null && newResultatModel.getObject()
- .getUniteConcMasse() != null)) {
- errors.add(getString("TestBio.resultats.concMasse.KO"));
- }
+ // si une saisie existe pour concMasse, on s'assure que les deux composantes sont bien renseignées
+ if ((newResultatModel.getObject().getConcMasse() != null && newResultatModel.getObject()
+ .getUniteConcMasse() == null)
+ || (newResultatModel.getObject().getConcMasse() == null && newResultatModel.getObject()
+ .getUniteConcMasse() != null)) {
+ errors.add(getString("TestBio.resultats.concMasse.KO"));
+ }
- if (errors.isEmpty()) {
- // réinit des champs de la ligne "ajout"
- newResultatModel.getObject().setRepere(null);
- newResultatModel.getObject().setTypeResultat(TypeResultat.PRODUIT);
- activeInputsForProduitType(produitChoice, produitTemoinInput, concMasseInput,
- uniteConcMasseInput, stadeInput, true, target);
- newResultatModel.getObject().setProduit(null);
+ if (errors.isEmpty()) {
+ // réinit des champs de la ligne "ajout"
+ newResultatModel.getObject().setRepere(null);
+ newResultatModel.getObject().setTypeResultat(TypeResultat.PRODUIT);
+ activeInputsForProduitType(produitChoice, produitTemoinInput, concMasseInput,
+ uniteConcMasseInput, stadeInput, true, target);
+ newResultatModel.getObject().setProduit(null);
- // si non vide, ajout du témoin produit à la liste des propositions
- if (StringUtils.isNotEmpty(newResultatModel.getObject().getProduitTemoin())) {
- produitTemoinInput.addChoice(newResultatModel.getObject().getProduitTemoin());
- }
- newResultatModel.getObject().setProduitTemoin(null);
+ // si non vide, ajout du témoin produit à la liste des propositions
+ if (StringUtils.isNotEmpty(newResultatModel.getObject().getProduitTemoin())) {
+ produitTemoinInput.addChoice(newResultatModel.getObject().getProduitTemoin());
+ }
+ newResultatModel.getObject().setProduitTemoin(null);
- // concMasse et uniteConcMasse prennent les valeurs par défaut
- newResultatModel.getObject().setConcMasse(concMasseDefautInput.getModelObject());
- newResultatModel.getObject().setUniteConcMasse(uniteConcMasseDefautInput.getModelObject());
- newResultatModel.getObject().setStade(stadeInput.getModelObject());
- newResultatModel.getObject().setValeur(null);
- newResultatModel.getObject().setActif(null);
- newResultatModel.getObject().setErreur(null);
- // réactivation du champ valeur en cas d'ancienne sélection d'erreur
- valeurInput.setVisibilityAllowed(true);
- } else {
- testBioModel.getObject().getResultats().remove(resultatAdded);
- addValidationErrors(errors);
- }
- } catch (CloneNotSupportedException e) {
- LOG.error(e.getMessage(), e);
- throw new UnexpectedException(e);
- }
+ // concMasse et uniteConcMasse prennent les valeurs par défaut
+ newResultatModel.getObject().setConcMasse(concMasseDefautInput.getModelObject());
+ newResultatModel.getObject().setUniteConcMasse(uniteConcMasseDefautInput.getModelObject());
+ newResultatModel.getObject().setStade(stadeInput.getModelObject());
+ newResultatModel.getObject().setValeur(null);
+ newResultatModel.getObject().setActif(null);
+ newResultatModel.getObject().setErreur(null);
+ // réactivation du champ valeur en cas d'ancienne sélection d'erreur
+ valeurInput.setVisibilityAllowed(true);
+ } else {
+ testBioModel.getObject().getResultats().remove(resultatAdded);
+ addValidationErrors(errors);
+ }
+ } catch (CloneNotSupportedException e) {
+ LOG.error(e.getMessage(), e);
+ throw new UnexpectedException(e);
+ }
- if (target != null) {
- target.add(testsBioTable);
- refreshFeedbackPage(target);
- }
- }
+ if (target != null) {
+ target.add(testsBioTable);
+ refreshFeedbackPage(target);
+ }
+ }
- @Override
- protected void onError(AjaxRequestTarget target, Form<?> form) {
- refreshFeedbackPage(target);
- }
+ @Override
+ protected void onError(AjaxRequestTarget target, Form<?> form) {
+ refreshFeedbackPage(target);
+ }
- };
- testsBioTable.add(addResultatButton);
- formView.add(testsBioTable);
+ };
+ testsBioTable.add(addResultatButton);
+ formView.add(testsBioTable);
- // pre-initialisation of the value Produit for TypeProduit
- newResultatModel.getObject().setTypeResultat(TypeResultat.PRODUIT);
- activeInputsForProduitType(produitChoice, produitTemoinInput, concMasseInput, uniteConcMasseInput, stadeInput,
- false, null);
- }
+ // pre-initialisation of the value Produit for TypeProduit
+ newResultatModel.getObject().setTypeResultat(TypeResultat.PRODUIT);
+ activeInputsForProduitType(produitChoice, produitTemoinInput, concMasseInput, uniteConcMasseInput, stadeInput,
+ false, null);
+ }
- /** {@inheritDoc} */
- @Override
- protected void onBeforeRender() {
- // On rafraichit le modèle lorsque la page est rechargée (par exemple après l'ajout d'une nouvelle entité
- // Personne ou Lot)
- refreshModel();
+ /** {@inheritDoc} */
+ @Override
+ protected void onBeforeRender() {
+ // On rafraichit le modèle lorsque la page est rechargée (par exemple après l'ajout d'une nouvelle entité
+ // Personne ou Lot)
+ refreshModel();
- super.onBeforeRender();
- }
+ super.onBeforeRender();
+ }
- /**
- * Redirection vers une autre page. Cas où le formulaire est validé
- */
- private void redirect() {
- if (multipleEntry) {
- // Redirection de nouveau vers l'écran de saisie d'une nouvelle testBio
- TestBio nextManip = new TestBio();
- nextManip.setManipulateur(testBioModel.getObject().getManipulateur());
- nextManip.setOrganismeTesteur(testBioModel.getObject().getOrganismeTesteur());
- nextManip.setMethode(testBioModel.getObject().getMethode());
- setResponsePage(new ManageTestBioPage(nextManip, callerPage));
- } else if (callerPage != null) {
- // On passe l'id du testBio associée à cette page, en paramètre de la prochaine page, pour lui permettre de
- // l'exploiter si besoin
- callerPage.addPageParameter(TestBio.class.getSimpleName(), testBioModel.getObject());
- callerPage.responsePage(this);
- }
- }
+ /**
+ * Redirection vers une autre page. Cas où le formulaire est validé
+ */
+ private void redirect() {
+ if (multipleEntry) {
+ // Redirection de nouveau vers l'écran de saisie d'une nouvelle testBio
+ TestBio nextManip = new TestBio();
+ nextManip.setManipulateur(testBioModel.getObject().getManipulateur());
+ nextManip.setOrganismeTesteur(testBioModel.getObject().getOrganismeTesteur());
+ nextManip.setMethode(testBioModel.getObject().getMethode());
+ setResponsePage(new ManageTestBioPage(nextManip, callerPage));
+ } else if (callerPage != null) {
+ // On passe l'id du testBio associée à cette page, en paramètre de la prochaine page, pour lui permettre de
+ // l'exploiter si besoin
+ callerPage.addPageParameter(TestBio.class.getSimpleName(), testBioModel.getObject());
+ callerPage.responsePage(this);
+ }
+ }
- /**
- * Refresh model, appelé au rechargement de la page
- */
- private void refreshModel() {
+ /**
+ * Refresh model, appelé au rechargement de la page
+ */
+ private void refreshModel() {
- // Récupère (et supprime) les éventuels nouveaux objets créés dans les paramètres de la page.
- String key = Personne.class.getSimpleName();
- if (getPageParameters().getNamedKeys().contains(key)) {
- CollectionTools.setter(personnes, personneService.listPersonnes());
- try {
- Personne createdPersonne = personneService.loadPersonne(getPageParameters().get(key).toInt());
- testBioModel.getObject().setManipulateur(createdPersonne);
- } catch (StringValueConversionException e) {
- LOG.error(e.getMessage(), e);
- throw new UnexpectedException(e);
- } catch (DataNotFoundException e) {
- LOG.error(e.getMessage(), e);
- throw new UnexpectedException(e);
- }
- getPageParameters().remove(key);
- }
- }
+ // Récupère (et supprime) les éventuels nouveaux objets créés dans les paramètres de la page.
+ String key = Personne.class.getSimpleName();
+ if (getPageParameters().getNamedKeys().contains(key)) {
+ CollectionTools.setter(personnes, personneService.listPersonnes());
+ try {
+ Personne createdPersonne = personneService.loadPersonne(getPageParameters().get(key).toInt());
+ testBioModel.getObject().setManipulateur(createdPersonne);
+ } catch (StringValueConversionException e) {
+ LOG.error(e.getMessage(), e);
+ throw new UnexpectedException(e);
+ } catch (DataNotFoundException e) {
+ LOG.error(e.getMessage(), e);
+ throw new UnexpectedException(e);
+ }
+ getPageParameters().remove(key);
+ }
+ }
- /**
- * Initialise les champs produit, conc., unité conc.n stade pour un résultat de type "blanc"
- * @param produitChoice Liste des produits
- * @param produitTemoinInput Texte pour le produit témoin
- * @param concMasseInput Texte pour la conc./masse
- * @param uniteConcMasseChoice Liste pour l'unité de la conc./masse
- * @param stadeChoice Liste des stades
- * @param target Cible de la requête ajax
- */
- private void activeInputsForBlancType(final DropDownChoice<Produit> produitChoice,
- final TextField<String> produitTemoinInput, final TextField<BigInteger> concMasseInput,
- final DropDownChoice<UniteConcMasse> uniteConcMasseChoice, final DropDownChoice<Stade> stadeChoice,
- AjaxRequestTarget target) {
- // si blanc, aucune saisie pour produit, produit témoin, conc., unité conc., stade
- produitChoice.setNullValid(true);
- newResultatModel.getObject().setProduit(null);
- produitChoice.setVisibilityAllowed(false);
+ /**
+ * Initialise les champs produit, conc., unité conc.n stade pour un résultat de type "blanc"
+ * @param produitChoice Liste des produits
+ * @param produitTemoinInput Texte pour le produit témoin
+ * @param concMasseInput Texte pour la conc./masse
+ * @param uniteConcMasseChoice Liste pour l'unité de la conc./masse
+ * @param stadeChoice Liste des stades
+ * @param target Cible de la requête ajax
+ */
+ private void activeInputsForBlancType(final DropDownChoice<Produit> produitChoice,
+ final TextField<String> produitTemoinInput, final TextField<BigInteger> concMasseInput,
+ final DropDownChoice<UniteConcMasse> uniteConcMasseChoice, final DropDownChoice<Stade> stadeChoice,
+ AjaxRequestTarget target) {
+ // si blanc, aucune saisie pour produit, produit témoin, conc., unité conc., stade
+ produitChoice.setNullValid(true);
+ newResultatModel.getObject().setProduit(null);
+ produitChoice.setVisibilityAllowed(false);
- newResultatModel.getObject().setProduitTemoin(null);
- produitTemoinInput.setVisibilityAllowed(false);
+ newResultatModel.getObject().setProduitTemoin(null);
+ produitTemoinInput.setVisibilityAllowed(false);
- newResultatModel.getObject().setConcMasse(null);
- concMasseInput.setVisibilityAllowed(false);
+ newResultatModel.getObject().setConcMasse(null);
+ concMasseInput.setVisibilityAllowed(false);
- newResultatModel.getObject().setUniteConcMasse(null);
- uniteConcMasseChoice.setVisibilityAllowed(false);
+ newResultatModel.getObject().setUniteConcMasse(null);
+ uniteConcMasseChoice.setVisibilityAllowed(false);
- stadeChoice.setNullValid(true);
- newResultatModel.getObject().setStade(null);
- stadeChoice.setVisibilityAllowed(false);
+ stadeChoice.setNullValid(true);
+ newResultatModel.getObject().setStade(null);
+ stadeChoice.setVisibilityAllowed(false);
- target.add(produitChoice, produitTemoinInput, concMasseInput, uniteConcMasseChoice, stadeChoice);
- }
+ target.add(produitChoice, produitTemoinInput, concMasseInput, uniteConcMasseChoice, stadeChoice);
+ }
- /**
- * Initialise les champs produit, conc., unité conc.n stade pour un résultat de type "témoin"
- * @param produitChoice Liste des produits
- * @param produitTemoinInput Texte pour le produit témoin
- * @param concMasseInput Texte pour la conc./masse
- * @param uniteConcMasseChoice Liste pour l'unité de la conc./masse
- * @param stadeChoice Liste des stades
- * @param target Cible de la requête ajax
- */
- private void activeInputsForTemoinType(final DropDownChoice<Produit> produitChoice,
- final TextField<String> produitTemoinInput, final TextField<BigInteger> concMasseInput,
- final DropDownChoice<UniteConcMasse> uniteConcMasseChoice, final DropDownChoice<Stade> stadeChoice,
- AjaxRequestTarget target) {
- // si témoin, aucune saisie pour produit et stade
- produitChoice.setNullValid(true);
- newResultatModel.getObject().setProduit(null);
- produitChoice.setVisibilityAllowed(false);
+ /**
+ * Initialise les champs produit, conc., unité conc.n stade pour un résultat de type "témoin"
+ * @param produitChoice Liste des produits
+ * @param produitTemoinInput Texte pour le produit témoin
+ * @param concMasseInput Texte pour la conc./masse
+ * @param uniteConcMasseChoice Liste pour l'unité de la conc./masse
+ * @param stadeChoice Liste des stades
+ * @param target Cible de la requête ajax
+ */
+ private void activeInputsForTemoinType(final DropDownChoice<Produit> produitChoice,
+ final TextField<String> produitTemoinInput, final TextField<BigInteger> concMasseInput,
+ final DropDownChoice<UniteConcMasse> uniteConcMasseChoice, final DropDownChoice<Stade> stadeChoice,
+ AjaxRequestTarget target) {
+ // si témoin, aucune saisie pour produit et stade
+ produitChoice.setNullValid(true);
+ newResultatModel.getObject().setProduit(null);
+ produitChoice.setVisibilityAllowed(false);
- stadeChoice.setNullValid(true);
- newResultatModel.getObject().setStade(null);
- stadeChoice.setVisibilityAllowed(false);
+ stadeChoice.setNullValid(true);
+ newResultatModel.getObject().setStade(null);
+ stadeChoice.setVisibilityAllowed(false);
- // saisie pour le reste
- produitTemoinInput.setVisibilityAllowed(true);
+ // saisie pour le reste
+ produitTemoinInput.setVisibilityAllowed(true);
- // masse/conc. par défaut comme valeur
- newResultatModel.getObject().setConcMasse(concMasseDefautInput.getModelObject());
- concMasseInput.setVisibilityAllowed(true);
+ // masse/conc. par défaut comme valeur
+ newResultatModel.getObject().setConcMasse(concMasseDefautInput.getModelObject());
+ concMasseInput.setVisibilityAllowed(true);
- // unité masse/conc. par défaut comme valeur
- newResultatModel.getObject().setUniteConcMasse(testBioModel.getObject().getUniteConcMasseDefaut());
- uniteConcMasseChoice.setVisibilityAllowed(true);
+ // unité masse/conc. par défaut comme valeur
+ newResultatModel.getObject().setUniteConcMasse(testBioModel.getObject().getUniteConcMasseDefaut());
+ uniteConcMasseChoice.setVisibilityAllowed(true);
- target.add(produitChoice, produitTemoinInput, concMasseInput, uniteConcMasseChoice, stadeChoice);
- }
+ target.add(produitChoice, produitTemoinInput, concMasseInput, uniteConcMasseChoice, stadeChoice);
+ }
- /**
- * Initialise les champs produit, conc., unité conc.n stade pour un résultat de type "produit"
- * @param produitChoice Liste des produits
- * @param produitTemoinInput Texte pour le produit témoin
- * @param concMasseInput Texte pour la conc./masse
- * @param uniteConcMasseChoice Liste pour l'unité de la conc./masse
- * @param stadeChoice Liste des stades
- * @param isAjaxRequete Vrai si l'initialisation se fait via une requête ajax
- * @param target Cible de la requête ajax, null si non appelé par une requête ajax
- */
- private void activeInputsForProduitType(final DropDownChoice<Produit> produitChoice,
- final TextField<String> produitTemoinInput, final TextField<BigInteger> concMasseInput,
- final DropDownChoice<UniteConcMasse> uniteConcMasseChoice, final DropDownChoice<Stade> stadeChoice,
- boolean isAjaxRequete, AjaxRequestTarget target) {
- // cas où type est produit, produit témoin désactivé et produit, conc., unité conc., stade activés
- newResultatModel.getObject().setProduitTemoin(null);
- produitTemoinInput.setVisibilityAllowed(false);
+ /**
+ * Initialise les champs produit, conc., unité conc.n stade pour un résultat de type "produit"
+ * @param produitChoice Liste des produits
+ * @param produitTemoinInput Texte pour le produit témoin
+ * @param concMasseInput Texte pour la conc./masse
+ * @param uniteConcMasseChoice Liste pour l'unité de la conc./masse
+ * @param stadeChoice Liste des stades
+ * @param isAjaxRequete Vrai si l'initialisation se fait via une requête ajax
+ * @param target Cible de la requête ajax, null si non appelé par une requête ajax
+ */
+ private void activeInputsForProduitType(final DropDownChoice<Produit> produitChoice,
+ final TextField<String> produitTemoinInput, final TextField<BigInteger> concMasseInput,
+ final DropDownChoice<UniteConcMasse> uniteConcMasseChoice, final DropDownChoice<Stade> stadeChoice,
+ boolean isAjaxRequete, AjaxRequestTarget target) {
+ // cas où type est produit, produit témoin désactivé et produit, conc., unité conc., stade activés
+ newResultatModel.getObject().setProduitTemoin(null);
+ produitTemoinInput.setVisibilityAllowed(false);
- produitChoice.setNullValid(false);
- produitChoice.setVisibilityAllowed(true);
+ produitChoice.setNullValid(false);
+ produitChoice.setVisibilityAllowed(true);
- // masse/conc. par défaut comme valeur
- newResultatModel.getObject().setConcMasse(testBioModel.getObject().getConcMasseDefaut());
- concMasseInput.setVisibilityAllowed(true);
+ // masse/conc. par défaut comme valeur
+ newResultatModel.getObject().setConcMasse(testBioModel.getObject().getConcMasseDefaut());
+ concMasseInput.setVisibilityAllowed(true);
- // unité masse/conc. par défaut comme valeur
- newResultatModel.getObject().setUniteConcMasse(testBioModel.getObject().getUniteConcMasseDefaut());
- uniteConcMasseChoice.setVisibilityAllowed(true);
+ // unité masse/conc. par défaut comme valeur
+ newResultatModel.getObject().setUniteConcMasse(testBioModel.getObject().getUniteConcMasseDefaut());
+ uniteConcMasseChoice.setVisibilityAllowed(true);
- stadeChoice.setNullValid(false);
- // stade par défaut comme valeur
- newResultatModel.getObject().setStade(testBioModel.getObject().getStadeDefaut());
- stadeChoice.setVisibilityAllowed(true);
+ stadeChoice.setNullValid(false);
+ // stade par défaut comme valeur
+ newResultatModel.getObject().setStade(testBioModel.getObject().getStadeDefaut());
+ stadeChoice.setVisibilityAllowed(true);
- if (isAjaxRequete) {
- target.add(produitChoice, produitTemoinInput, concMasseInput, uniteConcMasseChoice, stadeChoice);
- }
- }
+ if (isAjaxRequete) {
+ target.add(produitChoice, produitTemoinInput, concMasseInput, uniteConcMasseChoice, stadeChoice);
+ }
+ }
- /**
- * Validate model
- */
- private void validateModel() {
- addValidationErrors(validator.validate(testBioModel.getObject(), getSession().getLocale()));
+ /**
+ * Validate model
+ */
+ private void validateModel() {
+ addValidationErrors(validator.validate(testBioModel.getObject(), getSession().getLocale()));
- if (!CollectionTools.containsWithValue(testBioModel.getObject().getResultats(), "typeResultat",
- AccessType.GETTER, TypeResultat.PRODUIT)) {
- error(getString("TestBio.resultats.noProduit"));
- }
- if (!testBioService.isTestBioUnique(testBioModel.getObject())) {
- error(getString("TestBio.notUnique"));
- }
- }
+ if (!CollectionTools.containsWithValue(testBioModel.getObject().getResultats(), "typeResultat",
+ AccessType.GETTER, TypeResultat.PRODUIT)) {
+ error(getString("TestBio.resultats.noProduit"));
+ }
+ if (!testBioService.isTestBioUnique(testBioModel.getObject())) {
+ error(getString("TestBio.notUnique"));
+ }
+ }
}
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/testBio/ReadTestBioPage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/testBio/ReadTestBioPage.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/testBio/ReadTestBioPage.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -77,310 +77,310 @@
*/
public final class ReadTestBioPage extends TemplatePage {
- /** Logger */
- // private static final Log LOG = LogTools.getLog();
- /** Action : update */
- private static final String ACTION_DELETE = "Delete";
+ /** Logger */
+ // private static final Log LOG = LogTools.getLog();
+ /** Action : update */
+ private static final String ACTION_DELETE = "Delete";
- /** testBio Model */
- private IModel<TestBio> testBioModel;
+ /** testBio Model */
+ private IModel<TestBio> testBioModel;
- /** Service : testBios */
- @SpringBean
- private TestBioService testBioService;
+ /** Service : testBios */
+ @SpringBean
+ private TestBioService testBioService;
- /** Page appelante */
- private final CallerPage callerPage;
+ /** Page appelante */
+ private final CallerPage callerPage;
- /** Bouton d'ajout d'un résultat de test bio **/
- Button addResultatButton;
+ /** Bouton d'ajout d'un résultat de test bio **/
+ Button addResultatButton;
- /** Container pour l'affichage des paramètres de la méthode **/
- MarkupContainer paramsMethoContainer;
+ /** Container pour l'affichage des paramètres de la méthode **/
+ MarkupContainer paramsMethoContainer;
- /**
- * Constructeur
- * @param idTestBio identifiant de la manip
- * @param callerPage Page appelante
- */
- public ReadTestBioPage(Integer idTestBio, CallerPage callerPage) {
- super(ReadTestBioPage.class);
- final CallerPage currentPage = new CallerPage((TemplatePage) getPage());
- this.callerPage = callerPage;
+ /**
+ * Constructeur
+ * @param idTestBio identifiant de la manip
+ * @param callerPage Page appelante
+ */
+ public ReadTestBioPage(Integer idTestBio, CallerPage callerPage) {
+ super(ReadTestBioPage.class);
+ final CallerPage currentPage = new CallerPage((TemplatePage) getPage());
+ this.callerPage = callerPage;
- // Initialisation du modèle
- testBioModel = new GenericLoadableDetachableModel<TestBio>(TestBio.class, idTestBio);
+ // Initialisation du modèle
+ testBioModel = new GenericLoadableDetachableModel<TestBio>(TestBio.class, idTestBio);
- final TestBio testBio = testBioModel.getObject();
+ final TestBio testBio = testBioModel.getObject();
- initPrincipalFields(testBioModel, currentPage);
- initTestMethodFields(idTestBio);
- initResultsFields(idTestBio, currentPage);
+ initPrincipalFields(testBioModel, currentPage);
+ initTestMethodFields(idTestBio);
+ initResultsFields(idTestBio, currentPage);
- // Ajout du formulaire pour les actions
- Form<Void> formView = new Form<Void>("Form");
+ // Ajout du formulaire pour les actions
+ Form<Void> formView = new Form<Void>("Form");
- // Action : mise à jour (redirection vers le formulaire)
- Link<TestBio> updateLink = new Link<TestBio>(getResource() + ".TestBio.Update", new Model<TestBio>(testBio)) {
- @Override
- public void onClick() {
- setResponsePage(new ManageTestBioPage(getModelObject().getIdTestBio(), currentPage));
- }
- };
- updateLink.setVisibilityAllowed(testBioService.updateOrdeleteTestBioEnabled(testBio, getSession()
- .getUtilisateur()));
- formView.add(updateLink);
+ // Action : mise à jour (redirection vers le formulaire)
+ Link<TestBio> updateLink = new Link<TestBio>(getResource() + ".TestBio.Update", new Model<TestBio>(testBio)) {
+ @Override
+ public void onClick() {
+ setResponsePage(new ManageTestBioPage(getModelObject().getIdTestBio(), currentPage));
+ }
+ };
+ updateLink.setVisibilityAllowed(testBioService.updateOrdeleteTestBioEnabled(testBio, getSession()
+ .getUtilisateur()));
+ formView.add(updateLink);
- // Action : retour à la page précédente
- formView.add(new Link<Void>(getResource() + ".TestBio.Back") {
- @Override
- public void onClick() {
- redirect();
- }
- });
+ // Action : retour à la page précédente
+ formView.add(new Link<Void>(getResource() + ".TestBio.Back") {
+ @Override
+ public void onClick() {
+ redirect();
+ }
+ });
- // Action : suppression de la testBio
- Button deleteButton = new SubmittableButton(ACTION_DELETE, ManageTestBioPage.class,
- new SubmittableButtonEvents() {
+ // Action : suppression de la testBio
+ Button deleteButton = new SubmittableButton(ACTION_DELETE, ManageTestBioPage.class,
+ new SubmittableButtonEvents() {
- @Override
- public void onProcess() throws DataConstraintException {
- testBioService.deleteTestBio(testBio);
- }
+ @Override
+ public void onProcess() throws DataConstraintException {
+ testBioService.deleteTestBio(testBio);
+ }
- @Override
- public void onSuccess() {
- successNextPage(ManageTestBioPage.class, ACTION_DELETE);
- redirect();
- }
- });
- deleteButton.setVisibilityAllowed(testBioService.updateOrdeleteTestBioEnabled(testBio, getSession()
- .getUtilisateur()));
- deleteButton.add(new JSConfirmationBehavior(getString("Confirm")));
- formView.add(deleteButton);
- add(formView);
- }
+ @Override
+ public void onSuccess() {
+ successNextPage(ManageTestBioPage.class, ACTION_DELETE);
+ redirect();
+ }
+ });
+ deleteButton.setVisibilityAllowed(testBioService.updateOrdeleteTestBioEnabled(testBio, getSession()
+ .getUtilisateur()));
+ deleteButton.add(new JSConfirmationBehavior(getString("Confirm")));
+ formView.add(deleteButton);
+ add(formView);
+ }
- /**
- * Bind principal data to the markup
- * @param testBioModel tbm
- * @param currentPage currentPage
- */
- private void initPrincipalFields(IModel<TestBio> testBioModel, final CallerPage currentPage) {
+ /**
+ * Bind principal data to the markup
+ * @param testBioModel tbm
+ * @param currentPage currentPage
+ */
+ private void initPrincipalFields(IModel<TestBio> testBioModel, final CallerPage currentPage) {
- add(new Label("TestBio.ref", new PropertyModel<String>(testBioModel, "ref"))
- .add(new ReplaceEmptyLabelBehavior()));
+ add(new Label("TestBio.ref", new PropertyModel<String>(testBioModel, "ref"))
+ .add(new ReplaceEmptyLabelBehavior()));
- add(new PropertyLabelLinkPanel<Personne>("TestBio.manipulateur", new PropertyModel<Personne>(testBioModel,
- "manipulateur"), getString("Read")) {
- @Override
- public void onClick() {
- setResponsePage(new ReadPersonnePage(getModelObject().getIdPersonne(), currentPage));
- }
- });
+ add(new PropertyLabelLinkPanel<Personne>("TestBio.manipulateur", new PropertyModel<Personne>(testBioModel,
+ "manipulateur"), getString("Read")) {
+ @Override
+ public void onClick() {
+ setResponsePage(new ReadPersonnePage(getModelObject().getIdPersonne(), currentPage));
+ }
+ });
- add(new Label("TestBio.organismeTesteur", new PropertyModel<String>(testBioModel, "organismeTesteur"))
- .add(new ReplaceEmptyLabelBehavior()));
- add(new Label("TestBio.date", new DisplayShortDatePropertyModel(testBioModel, "date", getLocale()))
- .add(new ReplaceEmptyLabelBehavior()));
+ add(new Label("TestBio.organismeTesteur", new PropertyModel<String>(testBioModel, "organismeTesteur"))
+ .add(new ReplaceEmptyLabelBehavior()));
+ add(new Label("TestBio.date", new DisplayShortDatePropertyModel(testBioModel, "date", getLocale()))
+ .add(new ReplaceEmptyLabelBehavior()));
- // concatenation de concMasse par défaut et de uniteConcMasse par défaut
- add(new Label("TestBio.concMasseDefaut", new Model<Serializable>(testBioModel) {
- /** {@inheritDoc} */
- @Override
- public String getObject() {
- String masse = (String) new DisplayDecimalPropertyModel(super.getObject(), "concMasseDefaut",
- DecimalDisplFormat.SMALL, getLocale()).getObject();
+ // concatenation de concMasse par défaut et de uniteConcMasse par défaut
+ add(new Label("TestBio.concMasseDefaut", new Model<Serializable>(testBioModel) {
+ /** {@inheritDoc} */
+ @Override
+ public String getObject() {
+ String masse = (String) new DisplayDecimalPropertyModel(super.getObject(), "concMasseDefaut",
+ DecimalDisplFormat.SMALL, getLocale()).getObject();
- String unite = (String) new DisplayEnumPropertyModel(super.getObject(), "uniteConcMasseDefaut",
- (TemplatePage) getPage()).getObject();
+ String unite = (String) new DisplayEnumPropertyModel(super.getObject(), "uniteConcMasseDefaut",
+ (TemplatePage) getPage()).getObject();
- if (masse == null && unite == null) {
- return ReplaceEmptyLabelBehavior.NULL_PROPERTY;
- } else if (masse == null) {
- return ReplaceEmptyLabelBehavior.NULL_PROPERTY + unite;
- } else if (unite == null) {
- return masse + ReplaceEmptyLabelBehavior.NULL_PROPERTY;
- }
- return masse + " " + unite;
- }
- }));
+ if (masse == null && unite == null) {
+ return ReplaceEmptyLabelBehavior.NULL_PROPERTY;
+ } else if (masse == null) {
+ return ReplaceEmptyLabelBehavior.NULL_PROPERTY + unite;
+ } else if (unite == null) {
+ return masse + ReplaceEmptyLabelBehavior.NULL_PROPERTY;
+ }
+ return masse + " " + unite;
+ }
+ }));
- add(new Label("TestBio.stadeDefaut", new DisplayEnumPropertyModel(testBioModel, "stadeDefaut", this))
- .add(new ReplaceEmptyLabelBehavior()));
- add(new MultiLineLabel("TestBio.complement", new PropertyModel<String>(testBioModel, "complement"))
- .add(new ReplaceEmptyLabelBehavior()));
- add(new PropertyLabelLinkPanel<Personne>("TestBio.createur", new PropertyModel<Personne>(testBioModel,
- "createur"), getString("Read")) {
- @Override
- public void onClick() {
- setResponsePage(new ReadPersonnePage(getModelObject().getIdPersonne(), currentPage));
- }
- });
- }
+ add(new Label("TestBio.stadeDefaut", new DisplayEnumPropertyModel(testBioModel, "stadeDefaut", this))
+ .add(new ReplaceEmptyLabelBehavior()));
+ add(new MultiLineLabel("TestBio.complement", new PropertyModel<String>(testBioModel, "complement"))
+ .add(new ReplaceEmptyLabelBehavior()));
+ add(new PropertyLabelLinkPanel<Personne>("TestBio.createur", new PropertyModel<Personne>(testBioModel,
+ "createur"), getString("Read")) {
+ @Override
+ public void onClick() {
+ setResponsePage(new ReadPersonnePage(getModelObject().getIdPersonne(), currentPage));
+ }
+ });
+ }
- /**
- * Bind fields for test method to the markup
- * @param idTestBio itb
- */
- private void initTestMethodFields(Integer idTestBio) {
- WebMarkupContainer methodeCont = new WebMarkupContainer("TestBio.methode") {
- @Override
- public boolean isVisible() {
- // description cachée si pas de méthode sélectionnée
- return testBioModel.getObject().getMethode() != null;
- }
- };
- methodeCont.setOutputMarkupId(true);
- add(methodeCont);
+ /**
+ * Bind fields for test method to the markup
+ * @param idTestBio itb
+ */
+ private void initTestMethodFields(Integer idTestBio) {
+ WebMarkupContainer methodeCont = new WebMarkupContainer("TestBio.methode") {
+ @Override
+ public boolean isVisible() {
+ // description cachée si pas de méthode sélectionnée
+ return testBioModel.getObject().getMethode() != null;
+ }
+ };
+ methodeCont.setOutputMarkupId(true);
+ add(methodeCont);
- Label methodeCible = new Label("TestBio.cibleMethode", new PropertyModel<String>(testBioModel, "methode.cible"));
- methodeCont.add(methodeCible);
+ Label methodeCible = new Label("TestBio.cibleMethode", new PropertyModel<String>(testBioModel, "methode.cible"));
+ methodeCont.add(methodeCible);
- Label methodeDomaine = new Label("TestBio.domaineMethode", new PropertyModel<String>(testBioModel,
- "methode.domaine"));
- methodeCont.add(methodeDomaine);
+ Label methodeDomaine = new Label("TestBio.domaineMethode", new PropertyModel<String>(testBioModel,
+ "methode.domaine"));
+ methodeCont.add(methodeDomaine);
- MultiLineLabel methodeDesc = new MultiLineLabel("TestBio.descriptionMethode", new PropertyModel<String>(
- testBioModel, "methode.description"));
- methodeCont.add(methodeDesc);
+ MultiLineLabel methodeDesc = new MultiLineLabel("TestBio.descriptionMethode", new PropertyModel<String>(
+ testBioModel, "methode.description"));
+ methodeCont.add(methodeDesc);
- Label methodeValeurMesuree = new Label("TestBio.valeurMesureeMethode", new PropertyModel<String>(testBioModel,
- "methode.valeurMesuree"));
- methodeCont.add(methodeValeurMesuree);
+ Label methodeValeurMesuree = new Label("TestBio.valeurMesureeMethode", new PropertyModel<String>(testBioModel,
+ "methode.valeurMesuree"));
+ methodeCont.add(methodeValeurMesuree);
- Label methodeCritereActivite = new Label("TestBio.critereActiviteMethode", new PropertyModel<String>(
- testBioModel, "methode.critereActivite"));
- methodeCont.add(methodeCritereActivite);
+ Label methodeCritereActivite = new Label("TestBio.critereActiviteMethode", new PropertyModel<String>(
+ testBioModel, "methode.critereActivite"));
+ methodeCont.add(methodeCritereActivite);
- Label methodeUniteResultat = new Label("TestBio.uniteResultatMethode", new PropertyModel<String>(testBioModel,
- "methode.uniteResultat"));
- methodeCont.add(methodeUniteResultat);
+ Label methodeUniteResultat = new Label("TestBio.uniteResultatMethode", new PropertyModel<String>(testBioModel,
+ "methode.uniteResultat"));
+ methodeCont.add(methodeUniteResultat);
- Label nomMethode = new Label("TestBio.nomMethode", new PropertyModel<String>(testBioModel, "methode.nom"));
- methodeCont.add(nomMethode);
+ Label nomMethode = new Label("TestBio.nomMethode", new PropertyModel<String>(testBioModel, "methode.nom"));
+ methodeCont.add(nomMethode);
- }
+ }
- /**
- * Bind fields concerning results
- * @param idTestBio itb
- * @param currentPage currentPage
- */
- private void initResultsFields(Integer idTestBio, final CallerPage currentPage) {
- // Déclaration tableau des resultats
- // Pas de possibilité d'avoir le tableau vide car toujours au moins un résultat de type produit
- final MarkupContainer testsBioTable = new WebMarkupContainer("TestBio.resultats.Table");
- testsBioTable.setOutputMarkupId(true);
- add(testsBioTable);
+ /**
+ * Bind fields concerning results
+ * @param idTestBio itb
+ * @param currentPage currentPage
+ */
+ private void initResultsFields(Integer idTestBio, final CallerPage currentPage) {
+ // Déclaration tableau des resultats
+ // Pas de possibilité d'avoir le tableau vide car toujours au moins un résultat de type produit
+ final MarkupContainer testsBioTable = new WebMarkupContainer("TestBio.resultats.Table");
+ testsBioTable.setOutputMarkupId(true);
+ add(testsBioTable);
- final WebMarkupContainer resultNotAccessibleCont = new WebMarkupContainer(
- "TestBio.resultats.resultsNotAccessibles");
- resultNotAccessibleCont.setOutputMarkupPlaceholderTag(true);
- testsBioTable.add(resultNotAccessibleCont);
+ final WebMarkupContainer resultNotAccessibleCont = new WebMarkupContainer(
+ "TestBio.resultats.resultsNotAccessibles");
+ resultNotAccessibleCont.setOutputMarkupPlaceholderTag(true);
+ testsBioTable.add(resultNotAccessibleCont);
- // Model de liste des résultats
- final LoadableDetachableModel<List<ResultatTestBio>> listResultsModel = new LoadableDetachableModel<List<ResultatTestBio>>() {
- @Override
- protected List<ResultatTestBio> load() {
- boolean isOneResultNotAccessible = false;
+ // Model de liste des résultats
+ final LoadableDetachableModel<List<ResultatTestBio>> listResultsModel = new LoadableDetachableModel<List<ResultatTestBio>>() {
+ @Override
+ protected List<ResultatTestBio> load() {
+ boolean isOneResultNotAccessible = false;
- List<ResultatTestBio> listResults = new ArrayList<ResultatTestBio>();
+ List<ResultatTestBio> listResults = new ArrayList<ResultatTestBio>();
- for (ResultatTestBio res : testBioModel.getObject().getSortedResultats()) {
- // les résultats de type blanc ou témoin sont tjr accessibles
- if (res.getTypeResultat() != TypeResultat.PRODUIT
- || testBioService.isResultatTestBioAccessibleByUser(res, ((AuthSession) getPage()
- .getSession()).getUtilisateur())) {
- listResults.add(res);
- } else {
- isOneResultNotAccessible = true;
- }
- }
- // si un des résultats non accessible, on rend visible le message d'avertissement
- resultNotAccessibleCont.setVisibilityAllowed(isOneResultNotAccessible);
- return listResults;
- }
- };
+ for (ResultatTestBio res : testBioModel.getObject().getSortedResultats()) {
+ // les résultats de type blanc ou témoin sont tjr accessibles
+ if (res.getTypeResultat() != TypeResultat.PRODUIT
+ || testBioService.isResultatTestBioAccessibleByUser(res, ((AuthSession) getPage()
+ .getSession()).getUtilisateur())) {
+ listResults.add(res);
+ } else {
+ isOneResultNotAccessible = true;
+ }
+ }
+ // si un des résultats non accessible, on rend visible le message d'avertissement
+ resultNotAccessibleCont.setVisibilityAllowed(isOneResultNotAccessible);
+ return listResults;
+ }
+ };
- // Contenu tableaux resultats
- testsBioTable.add(new ListView<ResultatTestBio>("TestBio.resultats.List", listResultsModel) {
- @Override
- protected void populateItem(ListItem<ResultatTestBio> item) {
- if (item.getIndex() % 2 == 1) {
- item.add(new AttributeModifier("class", item.getIndex() % 2 == 0 ? "even" : "odd"));
- }
+ // Contenu tableaux resultats
+ testsBioTable.add(new ListView<ResultatTestBio>("TestBio.resultats.List", listResultsModel) {
+ @Override
+ protected void populateItem(ListItem<ResultatTestBio> item) {
+ if (item.getIndex() % 2 == 1) {
+ item.add(new AttributeModifier("class", item.getIndex() % 2 == 0 ? "even" : "odd"));
+ }
- final IModel<ResultatTestBio> resultatModel = item.getModel();
- final ResultatTestBio resultat = resultatModel.getObject();
- // Colonnes
- item.add(new Label("TestBio.resultats.List.repere", new PropertyModel<String>(resultat, "repere")));
- item.add(new Label("TestBio.resultats.List.typeResultat", new DisplayEnumPropertyModel(resultat,
- "typeResultat", (TemplatePage) this.getPage())));
+ final IModel<ResultatTestBio> resultatModel = item.getModel();
+ final ResultatTestBio resultat = resultatModel.getObject();
+ // Colonnes
+ item.add(new Label("TestBio.resultats.List.repere", new PropertyModel<String>(resultat, "repere")));
+ item.add(new Label("TestBio.resultats.List.typeResultat", new DisplayEnumPropertyModel(resultat,
+ "typeResultat", (TemplatePage) this.getPage())));
- item.add(new PropertyLabelLinkProduitPanel("TestBio.resultats.List.produit",
- new PropertyModel<Produit>(resultat, "produit"), (TemplatePage) getPage()) {
- @Override
- public void onClickIfExtrait(Extrait extrait) {
- setResponsePage(new ReadExtractionPage(extrait.getExtraction().getIdExtraction(), currentPage));
- }
+ item.add(new PropertyLabelLinkProduitPanel("TestBio.resultats.List.produit",
+ new PropertyModel<Produit>(resultat, "produit"), (TemplatePage) getPage()) {
+ @Override
+ public void onClickIfExtrait(Extrait extrait) {
+ setResponsePage(new ReadExtractionPage(extrait.getExtraction().getIdExtraction(), currentPage));
+ }
- @Override
- public void onClickIfFraction(Fraction fraction) {
- setResponsePage(new ReadPurificationPage(fraction.getPurification().getIdPurification(),
- currentPage));
- }
- });
+ @Override
+ public void onClickIfFraction(Fraction fraction) {
+ setResponsePage(new ReadPurificationPage(fraction.getPurification().getIdPurification(),
+ currentPage));
+ }
+ });
- item.add(new Label("TestBio.resultats.List.produitTemoin", new PropertyModel<String>(resultat,
- "produitTemoin")));
- // concaténation de concMasse et uniteMasse
- item.add(new Label("TestBio.resultats.List.concMasse", new Model<Serializable>(resultat) {
+ item.add(new Label("TestBio.resultats.List.produitTemoin", new PropertyModel<String>(resultat,
+ "produitTemoin")));
+ // concaténation de concMasse et uniteMasse
+ item.add(new Label("TestBio.resultats.List.concMasse", new Model<Serializable>(resultat) {
- /** {@inheritDoc} */
- @Override
- public String getObject() {
- String masse = (String) new DisplayDecimalPropertyModel(super.getObject(), "concMasse",
- DecimalDisplFormat.SMALL, getLocale()).getObject();
+ /** {@inheritDoc} */
+ @Override
+ public String getObject() {
+ String masse = (String) new DisplayDecimalPropertyModel(super.getObject(), "concMasse",
+ DecimalDisplFormat.SMALL, getLocale()).getObject();
- String unite = (String) new DisplayEnumPropertyModel(super.getObject(), "uniteConcMasse",
- (TemplatePage) getPage()).getObject();
+ String unite = (String) new DisplayEnumPropertyModel(super.getObject(), "uniteConcMasse",
+ (TemplatePage) getPage()).getObject();
- if (masse == null && unite == null) {
- return ReplaceEmptyLabelBehavior.NULL_PROPERTY;
- } else if (masse == null) {
- return ReplaceEmptyLabelBehavior.NULL_PROPERTY + unite;
- } else if (unite == null) {
- return masse + ReplaceEmptyLabelBehavior.NULL_PROPERTY;
- }
- return masse + " " + unite;
- }
- }));
+ if (masse == null && unite == null) {
+ return ReplaceEmptyLabelBehavior.NULL_PROPERTY;
+ } else if (masse == null) {
+ return ReplaceEmptyLabelBehavior.NULL_PROPERTY + unite;
+ } else if (unite == null) {
+ return masse + ReplaceEmptyLabelBehavior.NULL_PROPERTY;
+ }
+ return masse + " " + unite;
+ }
+ }));
- item.add(new Label("TestBio.resultats.List.stade", new DisplayEnumPropertyModel(resultat, "stade",
- (TemplatePage) this.getPage())));
- item.add(new Label("TestBio.resultats.List.valeur", new DisplayDecimalPropertyModel(resultat, "valeur",
- DecimalDisplFormat.SMALL, getSession().getLocale())));
- item.add(new Label("TestBio.resultats.List.actif", new DisplayBooleanPropertyModel(resultatModel,
- "estActif", (TemplatePage) this.getPage())).add(new ReplaceEmptyLabelBehavior()));
- item.add(new Label("TestBio.resultats.List.erreur", new PropertyModel<String>(resultat, "erreur.nom")));
- // info-bulle comprenant la description de l'erreur
- item.add(new SimpleTooltipPanel("TestBio.resultats.List.erreur.info", new PropertyModel<String>(
- resultat, "erreur.description")) {
- /** {@inheritDoc} */
- @Override
- public boolean isVisible() {
- return resultat.getErreur() != null;
- }
- });
- }
- });
- }
+ item.add(new Label("TestBio.resultats.List.stade", new DisplayEnumPropertyModel(resultat, "stade",
+ (TemplatePage) this.getPage())));
+ item.add(new Label("TestBio.resultats.List.valeur", new DisplayDecimalPropertyModel(resultat, "valeur",
+ DecimalDisplFormat.SMALL, getSession().getLocale())));
+ item.add(new Label("TestBio.resultats.List.actif", new DisplayBooleanPropertyModel(resultatModel,
+ "estActif", (TemplatePage) this.getPage())).add(new ReplaceEmptyLabelBehavior()));
+ item.add(new Label("TestBio.resultats.List.erreur", new PropertyModel<String>(resultat, "erreur.nom")));
+ // info-bulle comprenant la description de l'erreur
+ item.add(new SimpleTooltipPanel("TestBio.resultats.List.erreur.info", new PropertyModel<String>(
+ resultat, "erreur.description")) {
+ /** {@inheritDoc} */
+ @Override
+ public boolean isVisible() {
+ return resultat.getErreur() != null;
+ }
+ });
+ }
+ });
+ }
- /**
- * Redirection vers une autre page
- */
- private void redirect() {
- callerPage.responsePage(this);
- }
+ /**
+ * Redirection vers une autre page
+ */
+ private void redirect() {
+ callerPage.responsePage(this);
+ }
}
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/utilisateur/ManageUtilisateurPage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/utilisateur/ManageUtilisateurPage.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/utilisateur/ManageUtilisateurPage.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -85,410 +85,410 @@
@AuthRoles({ AuthRole.ADMIN })
public final class ManageUtilisateurPage extends TemplatePage {
- /** Action : delete */
- public static final String ACTION_DELETE = "Delete";
+ /** Action : delete */
+ public static final String ACTION_DELETE = "Delete";
- /** Action : reject */
- public static final String ACTION_REJECT = "Reject";
+ /** Action : reject */
+ public static final String ACTION_REJECT = "Reject";
- /** Action : update */
- private static final String ACTION_UPDATE = "Update";
+ /** Action : update */
+ private static final String ACTION_UPDATE = "Update";
- /** Action : validate */
- public static final String ACTION_VALID = "Valid";
+ /** Action : validate */
+ public static final String ACTION_VALID = "Valid";
- /** Logger */
- private static final Log LOG = LogTools.getLog();
+ /** Logger */
+ private static final Log LOG = LogTools.getLog();
- /** Ajout d'une autorisation sur une campagne ou un lot */
- private final Button addAuthorization;
+ /** Ajout d'une autorisation sur une campagne ou un lot */
+ private final Button addAuthorization;
- /** Campagnes disponibles pour ajouter des droits */
- private final AbstractSingleSelectChoice<Campagne> availableCampagnes;
+ /** Campagnes disponibles pour ajouter des droits */
+ private final AbstractSingleSelectChoice<Campagne> availableCampagnes;
- /** Lots disponibles pour ajouter des droits */
- private final AbstractSingleSelectChoice<Lot> availableLots;
+ /** Lots disponibles pour ajouter des droits */
+ private final AbstractSingleSelectChoice<Lot> availableLots;
- /** Modèle : droits sur une campagne, en cours de saisie */
- private final IModel<CampagnePersonneDroits> campagnePersonneDroitsModel;
+ /** Modèle : droits sur une campagne, en cours de saisie */
+ private final IModel<CampagnePersonneDroits> campagnePersonneDroitsModel;
- /** Campagnes */
- private final List<Campagne> campagnes;
+ /** Campagnes */
+ private final List<Campagne> campagnes;
- /** Service : campagne */
- @SpringBean
- private CampagneService campagneService;
+ /** Service : campagne */
+ @SpringBean
+ private CampagneService campagneService;
- /** Modèle : droits sur un lot, en cours de saisie */
- private final IModel<LotPersonneDroits> lotsPersonneDroitsModel;
+ /** Modèle : droits sur un lot, en cours de saisie */
+ private final IModel<LotPersonneDroits> lotsPersonneDroitsModel;
- /** Modèle : campagne en cours de sélection */
- private final IModel<ManageUtilisateurModel> manageUtilisateurModel;
+ /** Modèle : campagne en cours de sélection */
+ private final IModel<ManageUtilisateurModel> manageUtilisateurModel;
- /** Service : personne */
- @SpringBean
- private PersonneService personneService;
+ /** Service : personne */
+ @SpringBean
+ private PersonneService personneService;
- /** Modèle : utilisateur */
- private final IModel<Utilisateur> utilisateurModel;
+ /** Modèle : utilisateur */
+ private final IModel<Utilisateur> utilisateurModel;
- /** Validateur modèle */
- @SpringBean(name = "webModelValidator")
- private ModelValidator validator;
+ /** Validateur modèle */
+ @SpringBean(name = "webModelValidator")
+ private ModelValidator validator;
- /**
- * Constructeur
- * @param idPersonne Identifiant utilisateur
- * @param callerPage Page appelante (pour redirection)
- */
- public ManageUtilisateurPage(Integer idPersonne, final CallerPage callerPage) {
- super(ManageUtilisateurPage.class);
+ /**
+ * Constructeur
+ * @param idPersonne Identifiant utilisateur
+ * @param callerPage Page appelante (pour redirection)
+ */
+ public ManageUtilisateurPage(Integer idPersonne, final CallerPage callerPage) {
+ super(ManageUtilisateurPage.class);
- // Initialisation des modèles
- try {
- utilisateurModel = new Model<Utilisateur>(personneService.loadUtilisateur(idPersonne));
- } catch (DataNotFoundException e) {
- LOG.error(e.getMessage(), e);
- throw new UnexpectedException(e);
- }
- manageUtilisateurModel = new Model<ManageUtilisateurModel>(new ManageUtilisateurModel());
+ // Initialisation des modèles
+ try {
+ utilisateurModel = new Model<Utilisateur>(personneService.loadUtilisateur(idPersonne));
+ } catch (DataNotFoundException e) {
+ LOG.error(e.getMessage(), e);
+ throw new UnexpectedException(e);
+ }
+ manageUtilisateurModel = new Model<ManageUtilisateurModel>(new ManageUtilisateurModel());
- manageUtilisateurModel.getObject().setCampagnesDroits(utilisateurModel.getObject().getCampagnesDroits());
- manageUtilisateurModel.getObject().getCampagnes()
- .addAll(utilisateurModel.getObject().getCampagnesDroits().keySet());
- manageUtilisateurModel.getObject().setLotsDroits(utilisateurModel.getObject().getLotsDroits());
- manageUtilisateurModel.getObject().getLots().addAll(utilisateurModel.getObject().getLotsDroits().keySet());
+ manageUtilisateurModel.getObject().setCampagnesDroits(utilisateurModel.getObject().getCampagnesDroits());
+ manageUtilisateurModel.getObject().getCampagnes()
+ .addAll(utilisateurModel.getObject().getCampagnesDroits().keySet());
+ manageUtilisateurModel.getObject().setLotsDroits(utilisateurModel.getObject().getLotsDroits());
+ manageUtilisateurModel.getObject().getLots().addAll(utilisateurModel.getObject().getLotsDroits().keySet());
- campagnePersonneDroitsModel = new Model<CampagnePersonneDroits>(new CampagnePersonneDroits());
- campagnePersonneDroitsModel.getObject().getId().setPk2(utilisateurModel.getObject());
- campagnePersonneDroitsModel.getObject().getDroits().setDroitExtrait(Boolean.TRUE);
- campagnePersonneDroitsModel.getObject().getDroits().setDroitPuri(Boolean.TRUE);
- campagnePersonneDroitsModel.getObject().getDroits().setDroitRecolte(Boolean.TRUE);
- campagnePersonneDroitsModel.getObject().getDroits().setDroitTestBio(Boolean.TRUE);
- lotsPersonneDroitsModel = new Model<LotPersonneDroits>(new LotPersonneDroits());
- lotsPersonneDroitsModel.getObject().getId().setPk2(utilisateurModel.getObject());
- lotsPersonneDroitsModel.getObject().getDroits().setDroitExtrait(Boolean.TRUE);
- lotsPersonneDroitsModel.getObject().getDroits().setDroitPuri(Boolean.TRUE);
- lotsPersonneDroitsModel.getObject().getDroits().setDroitRecolte(Boolean.TRUE);
- lotsPersonneDroitsModel.getObject().getDroits().setDroitTestBio(Boolean.TRUE);
+ campagnePersonneDroitsModel = new Model<CampagnePersonneDroits>(new CampagnePersonneDroits());
+ campagnePersonneDroitsModel.getObject().getId().setPk2(utilisateurModel.getObject());
+ campagnePersonneDroitsModel.getObject().getDroits().setDroitExtrait(Boolean.TRUE);
+ campagnePersonneDroitsModel.getObject().getDroits().setDroitPuri(Boolean.TRUE);
+ campagnePersonneDroitsModel.getObject().getDroits().setDroitRecolte(Boolean.TRUE);
+ campagnePersonneDroitsModel.getObject().getDroits().setDroitTestBio(Boolean.TRUE);
+ lotsPersonneDroitsModel = new Model<LotPersonneDroits>(new LotPersonneDroits());
+ lotsPersonneDroitsModel.getObject().getId().setPk2(utilisateurModel.getObject());
+ lotsPersonneDroitsModel.getObject().getDroits().setDroitExtrait(Boolean.TRUE);
+ lotsPersonneDroitsModel.getObject().getDroits().setDroitPuri(Boolean.TRUE);
+ lotsPersonneDroitsModel.getObject().getDroits().setDroitRecolte(Boolean.TRUE);
+ lotsPersonneDroitsModel.getObject().getDroits().setDroitTestBio(Boolean.TRUE);
- // Initialisation des listes
- campagnes = Collections.unmodifiableList(campagneService.listCampagnes(getSession().getUtilisateur()));
+ // Initialisation des listes
+ campagnes = Collections.unmodifiableList(campagneService.listCampagnes(getSession().getUtilisateur()));
- final Form<Void> formView = new Form<Void>("Form");
+ final Form<Void> formView = new Form<Void>("Form");
- final ManagePersonnePanel personnePanel = new ManagePersonnePanel("ManagePersonnePanel", utilisateurModel);
- formView.add(personnePanel);
+ final ManagePersonnePanel personnePanel = new ManagePersonnePanel("ManagePersonnePanel", utilisateurModel);
+ formView.add(personnePanel);
- formView.add(new RadioChoice<TypeDroit>("Utilisateur.typeDroit", new PropertyModel<TypeDroit>(utilisateurModel,
- "typeDroit"), Arrays.asList(TypeDroit.values()), new EnumChoiceRenderer<TypeDroit>(this)));
+ formView.add(new RadioChoice<TypeDroit>("Utilisateur.typeDroit", new PropertyModel<TypeDroit>(utilisateurModel,
+ "typeDroit"), Arrays.asList(TypeDroit.values()), new EnumChoiceRenderer<TypeDroit>(this)));
- // Gestion des campagnes et lots autorisés
- final MarkupContainer campagnesContainer = new WebMarkupContainer(getResource()
- + ".Authorizations.Campagnes.Table");
- campagnesContainer.setOutputMarkupId(true);
+ // Gestion des campagnes et lots autorisés
+ final MarkupContainer campagnesContainer = new WebMarkupContainer(getResource()
+ + ".Authorizations.Campagnes.Table");
+ campagnesContainer.setOutputMarkupId(true);
- // Liste des campagnes autorisées
- campagnesContainer.add(new ListView<Campagne>(getResource() + ".Authorizations.Campagnes.List",
- manageUtilisateurModel.getObject().getCampagnes()) {
- @Override
- protected void populateItem(final ListItem<Campagne> item) {
- if (item.getIndex() % 2 == 1) {
- item.add(new AttributeModifier("class", item.getIndex() % 2 == 0 ? "even" : "odd"));
- }
+ // Liste des campagnes autorisées
+ campagnesContainer.add(new ListView<Campagne>(getResource() + ".Authorizations.Campagnes.List",
+ manageUtilisateurModel.getObject().getCampagnes()) {
+ @Override
+ protected void populateItem(final ListItem<Campagne> item) {
+ if (item.getIndex() % 2 == 1) {
+ item.add(new AttributeModifier("class", item.getIndex() % 2 == 0 ? "even" : "odd"));
+ }
- final Campagne campagne = item.getModelObject();
- item.add(new Label(getResource() + ".Authorizations.Campagnes.Campagne.nom", campagne.getNom()));
- // Bouton de suppression des droits sur une campagne
- AjaxFallbackButton deleteAuthorization = new AjaxFallbackButton(
- "ManageUtilisateurPage.Authorizations.Campagnes.Delete", formView) {
- @Override
- protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
- // Suppression
- manageUtilisateurModel.getObject().getCampagnesDroits().remove(campagne);
- // Mise à jour des listes
- updateAvailableCampagnes();
- if (target != null) {
- target.add(campagnesContainer);
- }
- }
+ final Campagne campagne = item.getModelObject();
+ item.add(new Label(getResource() + ".Authorizations.Campagnes.Campagne.nom", campagne.getNom()));
+ // Bouton de suppression des droits sur une campagne
+ AjaxFallbackButton deleteAuthorization = new AjaxFallbackButton(
+ "ManageUtilisateurPage.Authorizations.Campagnes.Delete", formView) {
+ @Override
+ protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
+ // Suppression
+ manageUtilisateurModel.getObject().getCampagnesDroits().remove(campagne);
+ // Mise à jour des listes
+ updateAvailableCampagnes();
+ if (target != null) {
+ target.add(campagnesContainer);
+ }
+ }
- @Override
- protected void onError(AjaxRequestTarget target, Form<?> form) {
- // never called
- }
+ @Override
+ protected void onError(AjaxRequestTarget target, Form<?> form) {
+ // never called
+ }
- };
- deleteAuthorization.setDefaultFormProcessing(false);
- item.add(deleteAuthorization);
- }
- });
+ };
+ deleteAuthorization.setDefaultFormProcessing(false);
+ item.add(deleteAuthorization);
+ }
+ });
- // Liste des lots autorisés
- campagnesContainer.add(new ListView<Lot>(getResource() + ".Authorizations.Lots.List", manageUtilisateurModel
- .getObject().getLots()) {
- @Override
- protected void populateItem(ListItem<Lot> item) {
- if (item.getIndex() % 2 == 1) {
- item.add(new AttributeModifier("class", item.getIndex() % 2 == 0 ? "even" : "odd"));
- }
+ // Liste des lots autorisés
+ campagnesContainer.add(new ListView<Lot>(getResource() + ".Authorizations.Lots.List", manageUtilisateurModel
+ .getObject().getLots()) {
+ @Override
+ protected void populateItem(ListItem<Lot> item) {
+ if (item.getIndex() % 2 == 1) {
+ item.add(new AttributeModifier("class", item.getIndex() % 2 == 0 ? "even" : "odd"));
+ }
- final Lot lot = item.getModelObject();
- item.add(new Label(getResource() + ".Authorizations.Lots.Campagne.nom", lot.getCampagne().getNom()));
- item.add(new Label(getResource() + ".Authorizations.Lots.Lot.ref", lot.getRef()));
- // Bouton de suppression des droits sur un lot
- AjaxFallbackButton deleteAuthorization = new AjaxFallbackButton(
- "ManageUtilisateurPage.Authorizations.Lots.Delete", formView) {
- @Override
- protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
- // Suppression
- manageUtilisateurModel.getObject().getLotsDroits().remove(lot);
- // Mise à jour des listes
- updateAvailableCampagnes();
- if (target != null) {
- target.add(campagnesContainer);
- }
- }
+ final Lot lot = item.getModelObject();
+ item.add(new Label(getResource() + ".Authorizations.Lots.Campagne.nom", lot.getCampagne().getNom()));
+ item.add(new Label(getResource() + ".Authorizations.Lots.Lot.ref", lot.getRef()));
+ // Bouton de suppression des droits sur un lot
+ AjaxFallbackButton deleteAuthorization = new AjaxFallbackButton(
+ "ManageUtilisateurPage.Authorizations.Lots.Delete", formView) {
+ @Override
+ protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
+ // Suppression
+ manageUtilisateurModel.getObject().getLotsDroits().remove(lot);
+ // Mise à jour des listes
+ updateAvailableCampagnes();
+ if (target != null) {
+ target.add(campagnesContainer);
+ }
+ }
- @Override
- protected void onError(AjaxRequestTarget target, Form<?> form) {
- // never called
- }
+ @Override
+ protected void onError(AjaxRequestTarget target, Form<?> form) {
+ // never called
+ }
- };
- deleteAuthorization.setDefaultFormProcessing(false);
- item.add(deleteAuthorization);
- }
- });
+ };
+ deleteAuthorization.setDefaultFormProcessing(false);
+ item.add(deleteAuthorization);
+ }
+ });
- // Liste des campagnes disponibles (pour ajouter les droits)
- availableCampagnes = new DropDownChoice<Campagne>(getResource() + ".Authorizations.Campagnes.Campagne",
- new PropertyModel<Campagne>(campagnePersonneDroitsModel, "id.pk1"), new ArrayList<Campagne>());
- availableCampagnes.add(new AjaxFormComponentUpdatingBehavior("onchange") {
- @Override
- protected void onUpdate(AjaxRequestTarget target) {
- // Mise à jour des listes lorsqu'une campagne a été sélectionnée
- updateAvailableCampagnes();
- target.add(availableLots);
- }
- });
- campagnesContainer.add(availableCampagnes);
+ // Liste des campagnes disponibles (pour ajouter les droits)
+ availableCampagnes = new DropDownChoice<Campagne>(getResource() + ".Authorizations.Campagnes.Campagne",
+ new PropertyModel<Campagne>(campagnePersonneDroitsModel, "id.pk1"), new ArrayList<Campagne>());
+ availableCampagnes.add(new AjaxFormComponentUpdatingBehavior("onchange") {
+ @Override
+ protected void onUpdate(AjaxRequestTarget target) {
+ // Mise à jour des listes lorsqu'une campagne a été sélectionnée
+ updateAvailableCampagnes();
+ target.add(availableLots);
+ }
+ });
+ campagnesContainer.add(availableCampagnes);
- // Liste des lots disponibles (pour ajouter les droits)
- availableLots = new DropDownChoice<Lot>(getResource() + ".Authorizations.Campagnes.Lot",
- new PropertyModel<Lot>(lotsPersonneDroitsModel, "id.pk1"), new ArrayList<Lot>());
- availableLots.setOutputMarkupId(true);
- campagnesContainer.add(availableLots);
+ // Liste des lots disponibles (pour ajouter les droits)
+ availableLots = new DropDownChoice<Lot>(getResource() + ".Authorizations.Campagnes.Lot",
+ new PropertyModel<Lot>(lotsPersonneDroitsModel, "id.pk1"), new ArrayList<Lot>());
+ availableLots.setOutputMarkupId(true);
+ campagnesContainer.add(availableLots);
- // Ajout de droits sur une campagne ou un lot
- addAuthorization = new AjaxFallbackButton(getResource() + ".Authorizations.Campagnes.Add", formView) {
- @Override
- protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
- if (campagnePersonneDroitsModel.getObject().getId().getPk1() != null) {
- if (lotsPersonneDroitsModel.getObject().getId().getPk1() == null) {
- // Ajout de droits sur une campagne
- CampagnePersonneDroits droits;
- try {
- droits = campagnePersonneDroitsModel.getObject().clone();
- } catch (CloneNotSupportedException e) {
- LOG.error(e.getMessage(), e);
- throw new UnexpectedException(e);
- }
- // Recharge la campagne pour éviter une LazyLoadingException
- campagneService.refreshCampagne(droits.getId().getPk1());
- manageUtilisateurModel.getObject().getCampagnesDroits().put(droits.getId().getPk1(), droits);
+ // Ajout de droits sur une campagne ou un lot
+ addAuthorization = new AjaxFallbackButton(getResource() + ".Authorizations.Campagnes.Add", formView) {
+ @Override
+ protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
+ if (campagnePersonneDroitsModel.getObject().getId().getPk1() != null) {
+ if (lotsPersonneDroitsModel.getObject().getId().getPk1() == null) {
+ // Ajout de droits sur une campagne
+ CampagnePersonneDroits droits;
+ try {
+ droits = campagnePersonneDroitsModel.getObject().clone();
+ } catch (CloneNotSupportedException e) {
+ LOG.error(e.getMessage(), e);
+ throw new UnexpectedException(e);
+ }
+ // Recharge la campagne pour éviter une LazyLoadingException
+ campagneService.refreshCampagne(droits.getId().getPk1());
+ manageUtilisateurModel.getObject().getCampagnesDroits().put(droits.getId().getPk1(), droits);
- // puisque droits sur Campagne-Tous, suppression des Campagne-Lot de cette campagne
- // Se base sur le réf de lot plutôt que l'objet pour être indépendant du contexte de persistance
- // d'où provient l'entité
- CollectionTools.removeAllWithValue(manageUtilisateurModel.getObject().getLotsDroits().keySet(),
- "ref", AccessType.GETTER, CollectionTools.valuesFromList(droits.getId().getPk1()
- .getLots(), "ref", AccessType.GETTER));
+ // puisque droits sur Campagne-Tous, suppression des Campagne-Lot de cette campagne
+ // Se base sur le réf de lot plutôt que l'objet pour être indépendant du contexte de persistance
+ // d'où provient l'entité
+ CollectionTools.removeAllWithValue(manageUtilisateurModel.getObject().getLotsDroits().keySet(),
+ "ref", AccessType.GETTER, CollectionTools.valuesFromList(droits.getId().getPk1()
+ .getLots(), "ref", AccessType.GETTER));
- } else {
- // Ajout de droits sur un lot
- LotPersonneDroits droits;
- try {
- droits = lotsPersonneDroitsModel.getObject().clone();
- } catch (CloneNotSupportedException e) {
- LOG.error(e.getMessage(), e);
- throw new UnexpectedException(e);
- }
- manageUtilisateurModel.getObject().getLotsDroits().put(droits.getId().getPk1(), droits);
- }
- // Mise à jour des listes
- updateAvailableCampagnes();
- if (target != null) {
- target.add(campagnesContainer);
- }
- }
- }
+ } else {
+ // Ajout de droits sur un lot
+ LotPersonneDroits droits;
+ try {
+ droits = lotsPersonneDroitsModel.getObject().clone();
+ } catch (CloneNotSupportedException e) {
+ LOG.error(e.getMessage(), e);
+ throw new UnexpectedException(e);
+ }
+ manageUtilisateurModel.getObject().getLotsDroits().put(droits.getId().getPk1(), droits);
+ }
+ // Mise à jour des listes
+ updateAvailableCampagnes();
+ if (target != null) {
+ target.add(campagnesContainer);
+ }
+ }
+ }
- @Override
- protected void onError(AjaxRequestTarget target, Form<?> form) {
- refreshFeedbackPage(target);
- }
+ @Override
+ protected void onError(AjaxRequestTarget target, Form<?> form) {
+ refreshFeedbackPage(target);
+ }
- };
- campagnesContainer.add(addAuthorization);
+ };
+ campagnesContainer.add(addAuthorization);
- updateAvailableCampagnes();
- formView.add(campagnesContainer);
+ updateAvailableCampagnes();
+ formView.add(campagnesContainer);
- // Action : mise à jour de l'utilisateur
- Button updateButton = new SubmittableButton(ACTION_UPDATE, new SubmittableButtonEvents() {
- @Override
- public void onProcess() throws DataConstraintException {
- personneService.updateUtilisateur(utilisateurModel.getObject(), true);
- }
+ // Action : mise à jour de l'utilisateur
+ Button updateButton = new SubmittableButton(ACTION_UPDATE, new SubmittableButtonEvents() {
+ @Override
+ public void onProcess() throws DataConstraintException {
+ personneService.updateUtilisateur(utilisateurModel.getObject(), true);
+ }
- @Override
- public void onSuccess() {
- successNextPage(ACTION_UPDATE);
- callerPage.responsePage((TemplatePage) getPage());
- }
+ @Override
+ public void onSuccess() {
+ successNextPage(ACTION_UPDATE);
+ callerPage.responsePage((TemplatePage) getPage());
+ }
- @Override
- public void onValidate() {
- utilisateurModel.getObject()
- .setCampagnesDroits(manageUtilisateurModel.getObject().getCampagnesDroits());
- utilisateurModel.getObject().setLotsDroits(manageUtilisateurModel.getObject().getLotsDroits());
- personnePanel.validate();
- validator.validate(utilisateurModel.getObject(), getSession().getLocale(), "typeDroit");
- }
- });
- updateButton.setVisibilityAllowed(utilisateurEstValide());
- formView.add(updateButton);
+ @Override
+ public void onValidate() {
+ utilisateurModel.getObject()
+ .setCampagnesDroits(manageUtilisateurModel.getObject().getCampagnesDroits());
+ utilisateurModel.getObject().setLotsDroits(manageUtilisateurModel.getObject().getLotsDroits());
+ personnePanel.validate();
+ validator.validate(utilisateurModel.getObject(), getSession().getLocale(), "typeDroit");
+ }
+ });
+ updateButton.setVisibilityAllowed(utilisateurEstValide());
+ formView.add(updateButton);
- // Action validation de l'utilisateur
- Button validButton = new SubmittableButton(ACTION_VALID, new SubmittableButtonEvents() {
- @Override
- public void onProcess() throws DataConstraintException {
- personneService.validAndUpdateUtilisateur(utilisateurModel.getObject());
- }
+ // Action validation de l'utilisateur
+ Button validButton = new SubmittableButton(ACTION_VALID, new SubmittableButtonEvents() {
+ @Override
+ public void onProcess() throws DataConstraintException {
+ personneService.validAndUpdateUtilisateur(utilisateurModel.getObject());
+ }
- @Override
- public void onSuccess() {
- successNextPage(ACTION_VALID);
- callerPage.responsePage((TemplatePage) getPage());
- }
+ @Override
+ public void onSuccess() {
+ successNextPage(ACTION_VALID);
+ callerPage.responsePage((TemplatePage) getPage());
+ }
- @Override
- public void onValidate() {
- utilisateurModel.getObject()
- .setCampagnesDroits(manageUtilisateurModel.getObject().getCampagnesDroits());
- utilisateurModel.getObject().setLotsDroits(manageUtilisateurModel.getObject().getLotsDroits());
- personnePanel.validate();
- validator.validate(utilisateurModel.getObject(), getSession().getLocale(), "typeDroit");
- }
- });
- validButton.setVisibilityAllowed(!utilisateurEstValide());
- formView.add(validButton);
+ @Override
+ public void onValidate() {
+ utilisateurModel.getObject()
+ .setCampagnesDroits(manageUtilisateurModel.getObject().getCampagnesDroits());
+ utilisateurModel.getObject().setLotsDroits(manageUtilisateurModel.getObject().getLotsDroits());
+ personnePanel.validate();
+ validator.validate(utilisateurModel.getObject(), getSession().getLocale(), "typeDroit");
+ }
+ });
+ validButton.setVisibilityAllowed(!utilisateurEstValide());
+ formView.add(validButton);
- // Action : suppression de l'utilisateur
- Button deleteButton = new SubmittableButton(ACTION_DELETE, new SubmittableButtonEvents() {
- @Override
- public void onProcess() throws DataConstraintException, EmailException {
- personneService.deleteUtilisateur(utilisateurModel.getObject());
- }
+ // Action : suppression de l'utilisateur
+ Button deleteButton = new SubmittableButton(ACTION_DELETE, new SubmittableButtonEvents() {
+ @Override
+ public void onProcess() throws DataConstraintException, EmailException {
+ personneService.deleteUtilisateur(utilisateurModel.getObject());
+ }
- @Override
- public void onSuccess() {
- successNextPage(ACTION_DELETE);
- callerPage.responsePage((TemplatePage) getPage());
- }
- });
- // impossible de supprimer son propre utilisateur
- deleteButton.setVisibilityAllowed(utilisateurEstValide()
- && getSession().getUtilisateur().getIdPersonne() != utilisateurModel.getObject().getIdPersonne());
- deleteButton.setDefaultFormProcessing(false);
- deleteButton.add(new JSConfirmationBehavior(getString("Confirm")));
- formView.add(deleteButton);
+ @Override
+ public void onSuccess() {
+ successNextPage(ACTION_DELETE);
+ callerPage.responsePage((TemplatePage) getPage());
+ }
+ });
+ // impossible de supprimer son propre utilisateur
+ deleteButton.setVisibilityAllowed(utilisateurEstValide()
+ && getSession().getUtilisateur().getIdPersonne() != utilisateurModel.getObject().getIdPersonne());
+ deleteButton.setDefaultFormProcessing(false);
+ deleteButton.add(new JSConfirmationBehavior(getString("Confirm")));
+ formView.add(deleteButton);
- // Action : rejet de l'utilisateur
- Button rejectButton = new SubmittableButton(ACTION_REJECT, new SubmittableButtonEvents() {
- @Override
- public void onProcess() throws DataConstraintException {
- personneService.rejectUtilisateur(utilisateurModel.getObject());
- }
+ // Action : rejet de l'utilisateur
+ Button rejectButton = new SubmittableButton(ACTION_REJECT, new SubmittableButtonEvents() {
+ @Override
+ public void onProcess() throws DataConstraintException {
+ personneService.rejectUtilisateur(utilisateurModel.getObject());
+ }
- @Override
- public void onSuccess() {
- successNextPage(ACTION_REJECT);
- callerPage.responsePage((TemplatePage) getPage());
- }
- });
- rejectButton.setVisibilityAllowed(!utilisateurEstValide());
- rejectButton.setDefaultFormProcessing(false);
- rejectButton.add(new JSConfirmationBehavior(getString("Confirm")));
- formView.add(rejectButton);
+ @Override
+ public void onSuccess() {
+ successNextPage(ACTION_REJECT);
+ callerPage.responsePage((TemplatePage) getPage());
+ }
+ });
+ rejectButton.setVisibilityAllowed(!utilisateurEstValide());
+ rejectButton.setDefaultFormProcessing(false);
+ rejectButton.add(new JSConfirmationBehavior(getString("Confirm")));
+ formView.add(rejectButton);
- // Action : annulation
- formView.add(new Link<Void>("Cancel") {
- @Override
- public void onClick() {
- callerPage.responsePage((TemplatePage) getPage());
- }
- });
+ // Action : annulation
+ formView.add(new Link<Void>("Cancel") {
+ @Override
+ public void onClick() {
+ callerPage.responsePage((TemplatePage) getPage());
+ }
+ });
- add(formView);
- }
+ add(formView);
+ }
- /**
- * Mets à jour les campagnes et lots disponibles
- */
- @SuppressWarnings("unchecked")
- private void updateAvailableCampagnes() {
- CollectionTools.setter(manageUtilisateurModel.getObject().getCampagnes(), manageUtilisateurModel.getObject()
- .getCampagnesDroits().keySet());
- // tri pour affichage
- Collections.sort(manageUtilisateurModel.getObject().getCampagnes(), BeanTools.createPropertyComparator("nom"));
+ /**
+ * Mets à jour les campagnes et lots disponibles
+ */
+ @SuppressWarnings("unchecked")
+ private void updateAvailableCampagnes() {
+ CollectionTools.setter(manageUtilisateurModel.getObject().getCampagnes(), manageUtilisateurModel.getObject()
+ .getCampagnesDroits().keySet());
+ // tri pour affichage
+ Collections.sort(manageUtilisateurModel.getObject().getCampagnes(), BeanTools.createPropertyComparator("nom"));
- CollectionTools.setter(manageUtilisateurModel.getObject().getLots(), manageUtilisateurModel.getObject()
- .getLotsDroits().keySet());
- // tri pour affichage
- ComparatorChain campagneComp = new ComparatorChain(BeanTools.createPropertyComparator("campagne.nom"));
- campagneComp.addComparator(BeanTools.createPropertyComparator("ref"));
- Collections.sort(manageUtilisateurModel.getObject().getLots(), campagneComp);
+ CollectionTools.setter(manageUtilisateurModel.getObject().getLots(), manageUtilisateurModel.getObject()
+ .getLotsDroits().keySet());
+ // tri pour affichage
+ ComparatorChain campagneComp = new ComparatorChain(BeanTools.createPropertyComparator("campagne.nom"));
+ campagneComp.addComparator(BeanTools.createPropertyComparator("ref"));
+ Collections.sort(manageUtilisateurModel.getObject().getLots(), campagneComp);
- // Campagnes
- List<Campagne> campagnesList = new ArrayList<Campagne>(campagnes);
- // Supprime les campagnes dont l'utilisateur a déjà les droits
- // Se base sur le nom de campagne plutôt que l'objet pour être indépendant du contexte de persistance d'où
- // provient l'entité
- CollectionTools.removeAllWithValue(campagnesList, "nom", AccessType.GETTER, CollectionTools.valuesFromList(
- manageUtilisateurModel.getObject().getCampagnes(), "nom", AccessType.GETTER));
- // campagnesList.removeAll(manageUtilisateurModel.getObject().getCampagnes());
- availableCampagnes.setChoices(campagnesList);
- campagnePersonneDroitsModel.getObject().getId()
- .setPk1(campagnesList.isEmpty() ? null : availableCampagnes.getModelObject());
- availableCampagnes.setEnabled(!campagnesList.isEmpty());
+ // Campagnes
+ List<Campagne> campagnesList = new ArrayList<Campagne>(campagnes);
+ // Supprime les campagnes dont l'utilisateur a déjà les droits
+ // Se base sur le nom de campagne plutôt que l'objet pour être indépendant du contexte de persistance d'où
+ // provient l'entité
+ CollectionTools.removeAllWithValue(campagnesList, "nom", AccessType.GETTER, CollectionTools.valuesFromList(
+ manageUtilisateurModel.getObject().getCampagnes(), "nom", AccessType.GETTER));
+ // campagnesList.removeAll(manageUtilisateurModel.getObject().getCampagnes());
+ availableCampagnes.setChoices(campagnesList);
+ campagnePersonneDroitsModel.getObject().getId()
+ .setPk1(campagnesList.isEmpty() ? null : availableCampagnes.getModelObject());
+ availableCampagnes.setEnabled(!campagnesList.isEmpty());
- // Lots
- List<Lot> lotsList = new ArrayList<Lot>();
- availableLots.setEnabled(campagnePersonneDroitsModel.getObject().getId().getPk1() != null);
- if (availableLots.isEnabled()) {
- // Evite une LazyLoadingException car la campagne n'est plus dans la session
- campagneService.refreshCampagne(campagnePersonneDroitsModel.getObject().getId().getPk1());
- lotsList.addAll(campagnePersonneDroitsModel.getObject().getId().getPk1().getLots());
- // Supprime les lots pour lequels l'utilisateur a déjà les droits
- // Se base sur le réf de lot plutôt que l'objet pour être indépendant du contexte de persistance d'où
- // provient l'entité
- CollectionTools.removeAllWithValue(lotsList, "ref", AccessType.GETTER, CollectionTools.valuesFromList(
- manageUtilisateurModel.getObject().getLots(), "ref", AccessType.GETTER));
+ // Lots
+ List<Lot> lotsList = new ArrayList<Lot>();
+ availableLots.setEnabled(campagnePersonneDroitsModel.getObject().getId().getPk1() != null);
+ if (availableLots.isEnabled()) {
+ // Evite une LazyLoadingException car la campagne n'est plus dans la session
+ campagneService.refreshCampagne(campagnePersonneDroitsModel.getObject().getId().getPk1());
+ lotsList.addAll(campagnePersonneDroitsModel.getObject().getId().getPk1().getLots());
+ // Supprime les lots pour lequels l'utilisateur a déjà les droits
+ // Se base sur le réf de lot plutôt que l'objet pour être indépendant du contexte de persistance d'où
+ // provient l'entité
+ CollectionTools.removeAllWithValue(lotsList, "ref", AccessType.GETTER, CollectionTools.valuesFromList(
+ manageUtilisateurModel.getObject().getLots(), "ref", AccessType.GETTER));
- availableLots.setChoices(lotsList);
- }
- lotsPersonneDroitsModel.getObject().getId().setPk1(null);
+ availableLots.setChoices(lotsList);
+ }
+ lotsPersonneDroitsModel.getObject().getId().setPk1(null);
- addAuthorization.setEnabled(!campagnesList.isEmpty());
- }
+ addAuthorization.setEnabled(!campagnesList.isEmpty());
+ }
- /**
- * L'utilisateur est-il valide?
- * @return Validité
- */
- private boolean utilisateurEstValide() {
- return utilisateurModel.getObject().isValide();
- }
+ /**
+ * L'utilisateur est-il valide?
+ * @return Validité
+ */
+ private boolean utilisateurEstValide() {
+ return utilisateurModel.getObject().isValide();
+ }
}
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/utilisateur/ReadUtilisateurPage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/utilisateur/ReadUtilisateurPage.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/utilisateur/ReadUtilisateurPage.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -52,107 +52,107 @@
*/
public final class ReadUtilisateurPage extends TemplatePage {
- /** Action : delete */
- public static final String ACTION_DELETE = "Delete";
+ /** Action : delete */
+ public static final String ACTION_DELETE = "Delete";
- /** Logger */
- // private static final Log LOG = LogTools.getLog();
- /** Page appelante */
- private final CallerPage callerPage;
+ /** Logger */
+ // private static final Log LOG = LogTools.getLog();
+ /** Page appelante */
+ private final CallerPage callerPage;
- /** Modèle : personne */
- private final IModel<Utilisateur> utilisateurModel;
+ /** Modèle : personne */
+ private final IModel<Utilisateur> utilisateurModel;
- /** Service : personne */
- @SpringBean
- private PersonneService personneService;
+ /** Service : personne */
+ @SpringBean
+ private PersonneService personneService;
- /**
- * Constructeur
- * @param idUtilisateur ID de l'utilisateur
- * @param callerPage Page appelante
- */
- public ReadUtilisateurPage(Integer idUtilisateur, CallerPage callerPage) {
- super(ReadUtilisateurPage.class);
+ /**
+ * Constructeur
+ * @param idUtilisateur ID de l'utilisateur
+ * @param callerPage Page appelante
+ */
+ public ReadUtilisateurPage(Integer idUtilisateur, CallerPage callerPage) {
+ super(ReadUtilisateurPage.class);
- final CallerPage currentPage = new CallerPage((TemplatePage) getPage());
- this.callerPage = callerPage;
+ final CallerPage currentPage = new CallerPage((TemplatePage) getPage());
+ this.callerPage = callerPage;
- // Initialisation du modèle
- utilisateurModel = new GenericLoadableDetachableModel<Utilisateur>(Utilisateur.class, idUtilisateur);
+ // Initialisation du modèle
+ utilisateurModel = new GenericLoadableDetachableModel<Utilisateur>(Utilisateur.class, idUtilisateur);
- // Ajout du panel ReadPersonnePanel
- add(new ReadPersonnePanel("ReadPersonnePanel", utilisateurModel));
+ // Ajout du panel ReadPersonnePanel
+ add(new ReadPersonnePanel("ReadPersonnePanel", utilisateurModel));
- add(new Label("Utilisateur.typeDroits", new DisplayEnumPropertyModel(utilisateurModel, "typeDroit", this)));
+ add(new Label("Utilisateur.typeDroits", new DisplayEnumPropertyModel(utilisateurModel, "typeDroit", this)));
- // Ajout du formulaire pour les actions
- final Form<Utilisateur> formView = new Form<Utilisateur>("Form", utilisateurModel);
+ // Ajout du formulaire pour les actions
+ final Form<Utilisateur> formView = new Form<Utilisateur>("Form", utilisateurModel);
- // Fieldset pour les droits de l'utilisateur (affiché uniquement si l'utilisateur est administrateur ou s'il
- // affiche son propre profil)
- MarkupContainer autorizationsFieldset = new WebMarkupContainer("ReadUtilisateurPage.AutorizationsFieldset") {
- /** {@inheritDoc} */
- @Override
- public boolean isVisible() {
- Utilisateur currentUser = ReadUtilisateurPage.this.getSession().getUtilisateur();
- return currentUser.getTypeDroit() == TypeDroit.ADMINISTRATEUR
- || currentUser.getIdPersonne().equals(utilisateurModel.getObject().getIdPersonne());
- }
- };
+ // Fieldset pour les droits de l'utilisateur (affiché uniquement si l'utilisateur est administrateur ou s'il
+ // affiche son propre profil)
+ MarkupContainer autorizationsFieldset = new WebMarkupContainer("ReadUtilisateurPage.AutorizationsFieldset") {
+ /** {@inheritDoc} */
+ @Override
+ public boolean isVisible() {
+ Utilisateur currentUser = ReadUtilisateurPage.this.getSession().getUtilisateur();
+ return currentUser.getTypeDroit() == TypeDroit.ADMINISTRATEUR
+ || currentUser.getIdPersonne().equals(utilisateurModel.getObject().getIdPersonne());
+ }
+ };
- autorizationsFieldset.add(new ReadDroitsUtilisateurPanel("ReadDroitsUtilisateurPanel", utilisateurModel));
- add(autorizationsFieldset);
+ autorizationsFieldset.add(new ReadDroitsUtilisateurPanel("ReadDroitsUtilisateurPanel", utilisateurModel));
+ add(autorizationsFieldset);
- // Action : mise à jour (redirection vers le formulaire)
- Link<Utilisateur> updateLink = new Link<Utilisateur>(getResource() + ".Personne.Update", utilisateurModel) {
- @Override
- public void onClick() {
- setResponsePage(new ManageUtilisateurPage(getModelObject().getIdPersonne(), currentPage));
- }
- };
- updateLink.setVisibilityAllowed(getSession().getUtilisateur().getIdPersonne() != utilisateurModel.getObject()
- .getIdPersonne()
- && personneService.updateOrDeletePersonneEnabled(utilisateurModel.getObject(), getSession()
- .getUtilisateur()));
- formView.add(updateLink);
+ // Action : mise à jour (redirection vers le formulaire)
+ Link<Utilisateur> updateLink = new Link<Utilisateur>(getResource() + ".Personne.Update", utilisateurModel) {
+ @Override
+ public void onClick() {
+ setResponsePage(new ManageUtilisateurPage(getModelObject().getIdPersonne(), currentPage));
+ }
+ };
+ updateLink.setVisibilityAllowed(getSession().getUtilisateur().getIdPersonne() != utilisateurModel.getObject()
+ .getIdPersonne()
+ && personneService.updateOrDeletePersonneEnabled(utilisateurModel.getObject(), getSession()
+ .getUtilisateur()));
+ formView.add(updateLink);
- // Action : retour à la page précédente
- formView.add(new Link<Void>(getResource() + ".Personne.Back") {
- @Override
- public void onClick() {
- redirect();
- }
- });
+ // Action : retour à la page précédente
+ formView.add(new Link<Void>(getResource() + ".Personne.Back") {
+ @Override
+ public void onClick() {
+ redirect();
+ }
+ });
- // Action : suppression de la personne
- Button deleteButton = new SubmittableButton(ACTION_DELETE, ManageUtilisateurPage.class,
- new SubmittableButtonEvents() {
- @Override
- public void onProcess() throws DataConstraintException {
- personneService.deletePersonne(utilisateurModel.getObject());
- }
+ // Action : suppression de la personne
+ Button deleteButton = new SubmittableButton(ACTION_DELETE, ManageUtilisateurPage.class,
+ new SubmittableButtonEvents() {
+ @Override
+ public void onProcess() throws DataConstraintException {
+ personneService.deletePersonne(utilisateurModel.getObject());
+ }
- @Override
- public void onSuccess() {
- successNextPage(ManageUtilisateurPage.class, ACTION_DELETE);
- redirect();
- }
- });
- deleteButton.setVisibilityAllowed(personneService.updateOrDeletePersonneEnabled(utilisateurModel.getObject(),
- getSession().getUtilisateur()));
- deleteButton.add(new JSConfirmationBehavior(getString("Confirm")));
- formView.add(deleteButton);
- add(formView);
- }
+ @Override
+ public void onSuccess() {
+ successNextPage(ManageUtilisateurPage.class, ACTION_DELETE);
+ redirect();
+ }
+ });
+ deleteButton.setVisibilityAllowed(personneService.updateOrDeletePersonneEnabled(utilisateurModel.getObject(),
+ getSession().getUtilisateur()));
+ deleteButton.add(new JSConfirmationBehavior(getString("Confirm")));
+ formView.add(deleteButton);
+ add(formView);
+ }
- /**
- * Redirection vers une autre page
- */
- private void redirect() {
- // On passe la personne associée à cette page, en paramètre de la prochaine page, pour lui permettre de
- // l'exploiter si besoin
- callerPage.addPageParameter(Personne.class.getSimpleName(), utilisateurModel.getObject());
- callerPage.responsePage(this);
- }
+ /**
+ * Redirection vers une autre page
+ */
+ private void redirect() {
+ // On passe la personne associée à cette page, en paramètre de la prochaine page, pour lui permettre de
+ // l'exploiter si besoin
+ callerPage.addPageParameter(Personne.class.getSimpleName(), utilisateurModel.getObject());
+ callerPage.responsePage(this);
+ }
}
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/utilisateur/RegisterPage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/utilisateur/RegisterPage.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/utilisateur/RegisterPage.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -58,88 +58,88 @@
@AuthRoles(AuthRole.VISITOR)
public final class RegisterPage extends TemplatePage {
- /** Service : personne */
- @SpringBean
- private PersonneService personneService;
+ /** Service : personne */
+ @SpringBean
+ private PersonneService personneService;
- /** Validateur modèle */
- @SpringBean(name = "webModelValidator") private ModelValidator validator;
+ /** Validateur modèle */
+ @SpringBean(name = "webModelValidator") private ModelValidator validator;
- /**
- * Constructeur
- */
- public RegisterPage() {
- super(RegisterPage.class);
+ /**
+ * Constructeur
+ */
+ public RegisterPage() {
+ super(RegisterPage.class);
- // Initialisation des modèles (registerModel, CaptchaModel, Utilisateur)
- final IModel<RegisterModel> registerModel = new Model<RegisterModel>(new RegisterModel());
- final IModel<CaptchaModel> captchaModel = new Model<CaptchaModel>(new CaptchaModel());
- captchaModel.getObject().setCaptchaTextGenerated(CaptchaTools.random());
- final IModel<Utilisateur> utilisateurModel = new Model<Utilisateur>(new Utilisateur());
+ // Initialisation des modèles (registerModel, CaptchaModel, Utilisateur)
+ final IModel<RegisterModel> registerModel = new Model<RegisterModel>(new RegisterModel());
+ final IModel<CaptchaModel> captchaModel = new Model<CaptchaModel>(new CaptchaModel());
+ captchaModel.getObject().setCaptchaTextGenerated(CaptchaTools.random());
+ final IModel<Utilisateur> utilisateurModel = new Model<Utilisateur>(new Utilisateur());
- // Formulaire
- final Form<Void> formView = new Form<Void>("Form");
- final ManagePersonnePanel personnePanel = new ManagePersonnePanel("ManagePersonnePanel", utilisateurModel);
- formView.add(personnePanel);
+ // Formulaire
+ final Form<Void> formView = new Form<Void>("Form");
+ final ManagePersonnePanel personnePanel = new ManagePersonnePanel("ManagePersonnePanel", utilisateurModel);
+ formView.add(personnePanel);
- // Champs n'apparaissant pas dans le "ManagePersonnePanel"
- formView.add(new PasswordTextField("RegisterModel.password", new PropertyModel<String>(registerModel,
- "password")).setRequired(false));
- final Component passwordConfirmationView = new PasswordTextField("RegisterModel.passwordConfirmation",
- new PropertyModel<String>(registerModel, "passwordConfirmation")).setRequired(false);
- formView.add(passwordConfirmationView);
- formView.add(new NonCachingImage("CaptchaModel.captchaImage", new CaptchaImageResource(captchaModel.getObject()
- .getCaptchaTextGenerated())));
- final Component captchaTextView = new TextField<String>("CaptchaModel.captchaText", new PropertyModel<String>(
- captchaModel, "captchaText"));
- formView.add(captchaTextView);
+ // Champs n'apparaissant pas dans le "ManagePersonnePanel"
+ formView.add(new PasswordTextField("RegisterModel.password", new PropertyModel<String>(registerModel,
+ "password")).setRequired(false));
+ final Component passwordConfirmationView = new PasswordTextField("RegisterModel.passwordConfirmation",
+ new PropertyModel<String>(registerModel, "passwordConfirmation")).setRequired(false);
+ formView.add(passwordConfirmationView);
+ formView.add(new NonCachingImage("CaptchaModel.captchaImage", new CaptchaImageResource(captchaModel.getObject()
+ .getCaptchaTextGenerated())));
+ final Component captchaTextView = new TextField<String>("CaptchaModel.captchaText", new PropertyModel<String>(
+ captchaModel, "captchaText"));
+ formView.add(captchaTextView);
- // Action : enregistrement de l'utilisateur
- formView.add(new SubmittableButton("Register", new SubmittableButtonEvents() {
- @Override
- public void onError() {
- // Remise à zéro de certains champs
- registerModel.getObject().setPassword(null);
- registerModel.getObject().setPasswordConfirmation(null);
- captchaModel.getObject().setCaptchaText(null);
- captchaModel.getObject().setCaptchaTextGenerated(CaptchaTools.random());
- formView.replace(new NonCachingImage("CaptchaModel.captchaImage", new CaptchaImageResource(captchaModel
- .getObject().getCaptchaTextGenerated())));
- }
+ // Action : enregistrement de l'utilisateur
+ formView.add(new SubmittableButton("Register", new SubmittableButtonEvents() {
+ @Override
+ public void onError() {
+ // Remise à zéro de certains champs
+ registerModel.getObject().setPassword(null);
+ registerModel.getObject().setPasswordConfirmation(null);
+ captchaModel.getObject().setCaptchaText(null);
+ captchaModel.getObject().setCaptchaTextGenerated(CaptchaTools.random());
+ formView.replace(new NonCachingImage("CaptchaModel.captchaImage", new CaptchaImageResource(captchaModel
+ .getObject().getCaptchaTextGenerated())));
+ }
- @Override
- public void onProcess() throws DataConstraintException {
- // Cryptage du mot de passe
- utilisateurModel.getObject().setPasswordHash(
- personneService.hashPassword(registerModel.getObject().getPassword()));
- // Mise à jour de l'utilisateur
- personneService.createUtilisateur(utilisateurModel.getObject());
- }
+ @Override
+ public void onProcess() throws DataConstraintException {
+ // Cryptage du mot de passe
+ utilisateurModel.getObject().setPasswordHash(
+ personneService.hashPassword(registerModel.getObject().getPassword()));
+ // Mise à jour de l'utilisateur
+ personneService.createUtilisateur(utilisateurModel.getObject());
+ }
- @Override
- public void onSuccess() {
- successNextPage("Register");
- setResponsePage(HomePage.class);
- }
+ @Override
+ public void onSuccess() {
+ successNextPage("Register");
+ setResponsePage(HomePage.class);
+ }
- @Override
- public void onValidate() {
- personnePanel.validate();
- List<String> passwordErrors = validator.validate(registerModel.getObject(), getSession().getLocale(),
- "password");
- if (passwordErrors.isEmpty()) {
- if (!registerModel.getObject().validate()) {
- errorCurrentPage(passwordConfirmationView);
- }
- } else {
- addValidationErrors(passwordErrors);
- }
- if (!captchaModel.getObject().validate()) {
- errorCurrentPage(captchaTextView);
- }
- }
- }));
+ @Override
+ public void onValidate() {
+ personnePanel.validate();
+ List<String> passwordErrors = validator.validate(registerModel.getObject(), getSession().getLocale(),
+ "password");
+ if (passwordErrors.isEmpty()) {
+ if (!registerModel.getObject().validate()) {
+ errorCurrentPage(passwordConfirmationView);
+ }
+ } else {
+ addValidationErrors(passwordErrors);
+ }
+ if (!captchaModel.getObject().validate()) {
+ errorCurrentPage(captchaTextView);
+ }
+ }
+ }));
- add(formView);
- }
+ add(formView);
+ }
}
\ No newline at end of file
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/utilisateur/ResetPasswordPage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/utilisateur/ResetPasswordPage.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/utilisateur/ResetPasswordPage.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -48,46 +48,46 @@
@AuthRoles(AuthRole.VISITOR)
public final class ResetPasswordPage extends TemplatePage {
- /** Service : personne */
- @SpringBean
- private PersonneService personneService;
+ /** Service : personne */
+ @SpringBean
+ private PersonneService personneService;
- /** Validateur modèle */
- @SpringBean(name = "webModelValidator") private ModelValidator validator;
+ /** Validateur modèle */
+ @SpringBean(name = "webModelValidator") private ModelValidator validator;
- /**
- * Constructeur
- */
- public ResetPasswordPage() {
- super(ResetPasswordPage.class);
- // Modèle
- final IModel<Utilisateur> utilisateurModel = new Model<Utilisateur>(new Utilisateur());
- // Formulaire
- Form<Utilisateur> formView = new Form<Utilisateur>("Form", utilisateurModel);
- formView
- .add(new TextField<String>("Personne.courriel", new PropertyModel<String>(utilisateurModel, "courriel")));
+ /**
+ * Constructeur
+ */
+ public ResetPasswordPage() {
+ super(ResetPasswordPage.class);
+ // Modèle
+ final IModel<Utilisateur> utilisateurModel = new Model<Utilisateur>(new Utilisateur());
+ // Formulaire
+ Form<Utilisateur> formView = new Form<Utilisateur>("Form", utilisateurModel);
+ formView
+ .add(new TextField<String>("Personne.courriel", new PropertyModel<String>(utilisateurModel, "courriel")));
- // Action : regénération du mot de passe
- formView.add(new SubmittableButton("Reset", new SubmittableButtonEvents() {
- @Override
- public void onProcess() throws DataNotFoundException, EmailException {
- personneService.resetPasswordUtilisateur(utilisateurModel.getObject().getCourriel());
- }
+ // Action : regénération du mot de passe
+ formView.add(new SubmittableButton("Reset", new SubmittableButtonEvents() {
+ @Override
+ public void onProcess() throws DataNotFoundException, EmailException {
+ personneService.resetPasswordUtilisateur(utilisateurModel.getObject().getCourriel());
+ }
- @Override
- public void onSuccess() {
- successNextPage("Reset");
+ @Override
+ public void onSuccess() {
+ successNextPage("Reset");
- setResponsePage(getApplication().getHomePage());
- }
+ setResponsePage(getApplication().getHomePage());
+ }
- @Override
- public void onValidate() {
- addValidationErrors(validator.validate(utilisateurModel.getObject(), getSession().getLocale(),
- "courriel"));
- }
- }));
+ @Override
+ public void onValidate() {
+ addValidationErrors(validator.validate(utilisateurModel.getObject(), getSession().getLocale(),
+ "courriel"));
+ }
+ }));
- add(formView);
- }
+ add(formView);
+ }
}
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/utilisateur/UpdateUtilisateurPage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/utilisateur/UpdateUtilisateurPage.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/utilisateur/UpdateUtilisateurPage.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -54,166 +54,166 @@
@AuthRoles( { AuthRole.USER, AuthRole.ADMIN })
public final class UpdateUtilisateurPage extends TemplatePage {
- /** Action : delete */
- public static final String ACTION_DELETE = "Delete";
+ /** Action : delete */
+ public static final String ACTION_DELETE = "Delete";
- /** Action : update password */
- private static final String ACTION_UPDATE_PASSWORD = "UpdatePassword";
+ /** Action : update password */
+ private static final String ACTION_UPDATE_PASSWORD = "UpdatePassword";
- /** Action : update profile */
- private static final String ACTION_UPDATE_PROFILE = "UpdateProfile";
+ /** Action : update profile */
+ private static final String ACTION_UPDATE_PROFILE = "UpdateProfile";
- /** Service : personne */
- @SpringBean
- private PersonneService personneService;
+ /** Service : personne */
+ @SpringBean
+ private PersonneService personneService;
- /** Validateur modèle */
- @SpringBean(name = "webModelValidator")
- private ModelValidator validator;
+ /** Validateur modèle */
+ @SpringBean(name = "webModelValidator")
+ private ModelValidator validator;
- /**
- * Constructeur
- */
- public UpdateUtilisateurPage() {
- this(null);
- }
+ /**
+ * Constructeur
+ */
+ public UpdateUtilisateurPage() {
+ this(null);
+ }
- /**
- * Constructeur
- * @param callerPage Page appelante (pour redirection)
- */
- public UpdateUtilisateurPage(final CallerPage callerPage) {
- super(UpdateUtilisateurPage.class);
+ /**
+ * Constructeur
+ * @param callerPage Page appelante (pour redirection)
+ */
+ public UpdateUtilisateurPage(final CallerPage callerPage) {
+ super(UpdateUtilisateurPage.class);
- // Initialisation du modèle (pour le profil)
- final IModel<Utilisateur> utilisateurProfileModel = new Model<Utilisateur>(getSession().getUtilisateur());
+ // Initialisation du modèle (pour le profil)
+ final IModel<Utilisateur> utilisateurProfileModel = new Model<Utilisateur>(getSession().getUtilisateur());
- // Initialisation du modèle supplémentaire
- final IModel<UpdateUtilisateurModel> utilisateurPasswordModel = new Model<UpdateUtilisateurModel>(
- new UpdateUtilisateurModel());
+ // Initialisation du modèle supplémentaire
+ final IModel<UpdateUtilisateurModel> utilisateurPasswordModel = new Model<UpdateUtilisateurModel>(
+ new UpdateUtilisateurModel());
- // Formulaire de mise à jour du profil
- final Form<Utilisateur> formProfileView = new Form<Utilisateur>("FormProfile", utilisateurProfileModel);
+ // Formulaire de mise à jour du profil
+ final Form<Utilisateur> formProfileView = new Form<Utilisateur>("FormProfile", utilisateurProfileModel);
- final ManagePersonnePanel personnePanel = new ManagePersonnePanel("ManagePersonnePanel",
- utilisateurProfileModel);
- formProfileView.add(personnePanel);
+ final ManagePersonnePanel personnePanel = new ManagePersonnePanel("ManagePersonnePanel",
+ utilisateurProfileModel);
+ formProfileView.add(personnePanel);
- // Action : mise à jour du profil
- formProfileView.add(new SubmittableButton(ACTION_UPDATE_PROFILE, new SubmittableButtonEvents() {
- @Override
- public void onError() {
- utilisateurPasswordModel.getObject().setPassword(null);
- }
+ // Action : mise à jour du profil
+ formProfileView.add(new SubmittableButton(ACTION_UPDATE_PROFILE, new SubmittableButtonEvents() {
+ @Override
+ public void onError() {
+ utilisateurPasswordModel.getObject().setPassword(null);
+ }
- @Override
- public void onProcess() throws DataConstraintException {
- personneService.updateUtilisateur(utilisateurProfileModel.getObject(), false);
- getSession().update(utilisateurProfileModel.getObject());
- }
+ @Override
+ public void onProcess() throws DataConstraintException {
+ personneService.updateUtilisateur(utilisateurProfileModel.getObject(), false);
+ getSession().update(utilisateurProfileModel.getObject());
+ }
- @Override
- public void onSuccess() {
- if (callerPage == null) {
- successCurrentPage(ACTION_UPDATE_PROFILE);
- } else {
- successNextPage(ACTION_UPDATE_PROFILE);
- callerPage.responsePage((TemplatePage) getPage());
- }
- }
+ @Override
+ public void onSuccess() {
+ if (callerPage == null) {
+ successCurrentPage(ACTION_UPDATE_PROFILE);
+ } else {
+ successNextPage(ACTION_UPDATE_PROFILE);
+ callerPage.responsePage((TemplatePage) getPage());
+ }
+ }
- @Override
- public void onValidate() {
- personnePanel.validate();
- }
- }));
+ @Override
+ public void onValidate() {
+ personnePanel.validate();
+ }
+ }));
- // Action : annulation
- Link<Void> cancelProfileLink = new Link<Void>("CancelProfile") {
- @Override
- public void onClick() {
- callerPage.responsePage((TemplatePage) getPage());
- }
- };
- cancelProfileLink.setVisibilityAllowed(callerPage != null);
- formProfileView.add(cancelProfileLink);
- add(formProfileView);
+ // Action : annulation
+ Link<Void> cancelProfileLink = new Link<Void>("CancelProfile") {
+ @Override
+ public void onClick() {
+ callerPage.responsePage((TemplatePage) getPage());
+ }
+ };
+ cancelProfileLink.setVisibilityAllowed(callerPage != null);
+ formProfileView.add(cancelProfileLink);
+ add(formProfileView);
- // Formulaire de mise à jour du mot de passe
- final Form<UpdateUtilisateurModel> formPasswordView = new Form<UpdateUtilisateurModel>("FormPassword",
- utilisateurPasswordModel);
+ // Formulaire de mise à jour du mot de passe
+ final Form<UpdateUtilisateurModel> formPasswordView = new Form<UpdateUtilisateurModel>("FormPassword",
+ utilisateurPasswordModel);
- final Component currentPasswordView = new PasswordTextField("UpdateUtilisateurModel.currentPassword",
- new PropertyModel<String>(utilisateurPasswordModel, "currentPassword")).setRequired(false);
- formPasswordView.add(currentPasswordView);
- formPasswordView.add(new PasswordTextField("UpdateUtilisateurModel.newPassword", new PropertyModel<String>(
- utilisateurPasswordModel, "newPassword")).setRequired(false));
- final Component newPasswordConfirmationView = new PasswordTextField(
- "UpdateUtilisateurModel.newPasswordConfirmation", new PropertyModel<String>(utilisateurPasswordModel,
- "newPasswordConfirmation")).setRequired(false);
- formPasswordView.add(newPasswordConfirmationView);
+ final Component currentPasswordView = new PasswordTextField("UpdateUtilisateurModel.currentPassword",
+ new PropertyModel<String>(utilisateurPasswordModel, "currentPassword")).setRequired(false);
+ formPasswordView.add(currentPasswordView);
+ formPasswordView.add(new PasswordTextField("UpdateUtilisateurModel.newPassword", new PropertyModel<String>(
+ utilisateurPasswordModel, "newPassword")).setRequired(false));
+ final Component newPasswordConfirmationView = new PasswordTextField(
+ "UpdateUtilisateurModel.newPasswordConfirmation", new PropertyModel<String>(utilisateurPasswordModel,
+ "newPasswordConfirmation")).setRequired(false);
+ formPasswordView.add(newPasswordConfirmationView);
- // Action : mise à jour du mot de passe
- formPasswordView.add(new SubmittableButton(ACTION_UPDATE_PASSWORD, new SubmittableButtonEvents() {
- @Override
- public void onError() {
- utilisateurPasswordModel.getObject().setCurrentPassword(null);
- utilisateurPasswordModel.getObject().setNewPassword(null);
- utilisateurPasswordModel.getObject().setNewPasswordConfirmation(null);
- }
+ // Action : mise à jour du mot de passe
+ formPasswordView.add(new SubmittableButton(ACTION_UPDATE_PASSWORD, new SubmittableButtonEvents() {
+ @Override
+ public void onError() {
+ utilisateurPasswordModel.getObject().setCurrentPassword(null);
+ utilisateurPasswordModel.getObject().setNewPassword(null);
+ utilisateurPasswordModel.getObject().setNewPasswordConfirmation(null);
+ }
- @Override
- public void onProcess() throws DataConstraintException {
- utilisateurProfileModel.getObject().setPasswordHash(
- personneService.hashPassword(utilisateurPasswordModel.getObject().getNewPassword()));
- personneService.updateUtilisateur(utilisateurProfileModel.getObject(), false);
- getSession().update(utilisateurProfileModel.getObject());
- }
+ @Override
+ public void onProcess() throws DataConstraintException {
+ utilisateurProfileModel.getObject().setPasswordHash(
+ personneService.hashPassword(utilisateurPasswordModel.getObject().getNewPassword()));
+ personneService.updateUtilisateur(utilisateurProfileModel.getObject(), false);
+ getSession().update(utilisateurProfileModel.getObject());
+ }
- @Override
- public void onSuccess() {
- if (callerPage == null) {
- successCurrentPage(ACTION_UPDATE_PASSWORD);
- } else {
- successNextPage(ACTION_UPDATE_PASSWORD);
- callerPage.responsePage((TemplatePage) getPage());
- }
- }
+ @Override
+ public void onSuccess() {
+ if (callerPage == null) {
+ successCurrentPage(ACTION_UPDATE_PASSWORD);
+ } else {
+ successNextPage(ACTION_UPDATE_PASSWORD);
+ callerPage.responsePage((TemplatePage) getPage());
+ }
+ }
- @Override
- public void onValidate() {
- // Erreurs mot de passe courant
- List<String> passwordErrors = validator.validate(utilisateurPasswordModel.getObject(), getSession()
- .getLocale(), "currentPassword");
- addValidationErrors(passwordErrors);
- if (passwordErrors.isEmpty()
- && !utilisateurProfileModel.getObject().getPasswordHash()
- .equals(
- personneService.hashPassword(utilisateurPasswordModel.getObject()
- .getCurrentPassword()))) {
- errorCurrentPage(currentPasswordView);
- }
- // Erreurs nouveau mot de passe
- passwordErrors = validator.validate(utilisateurPasswordModel.getObject(), getSession().getLocale(),
- "newPassword");
- addValidationErrors(passwordErrors);
- if (passwordErrors.isEmpty() && !utilisateurPasswordModel.getObject().validate()) {
- errorCurrentPage(newPasswordConfirmationView);
- }
- }
+ @Override
+ public void onValidate() {
+ // Erreurs mot de passe courant
+ List<String> passwordErrors = validator.validate(utilisateurPasswordModel.getObject(), getSession()
+ .getLocale(), "currentPassword");
+ addValidationErrors(passwordErrors);
+ if (passwordErrors.isEmpty()
+ && !utilisateurProfileModel.getObject().getPasswordHash()
+ .equals(
+ personneService.hashPassword(utilisateurPasswordModel.getObject()
+ .getCurrentPassword()))) {
+ errorCurrentPage(currentPasswordView);
+ }
+ // Erreurs nouveau mot de passe
+ passwordErrors = validator.validate(utilisateurPasswordModel.getObject(), getSession().getLocale(),
+ "newPassword");
+ addValidationErrors(passwordErrors);
+ if (passwordErrors.isEmpty() && !utilisateurPasswordModel.getObject().validate()) {
+ errorCurrentPage(newPasswordConfirmationView);
+ }
+ }
- }));
+ }));
- // Action : annulation
- Link<Void> cancelPasswordLink = new Link<Void>("CancelPassword") {
- @Override
- public void onClick() {
- callerPage.responsePage((TemplatePage) getPage());
- }
- };
- cancelPasswordLink.setVisibilityAllowed(callerPage != null);
- formPasswordView.add(cancelPasswordLink);
+ // Action : annulation
+ Link<Void> cancelPasswordLink = new Link<Void>("CancelPassword") {
+ @Override
+ public void onClick() {
+ callerPage.responsePage((TemplatePage) getPage());
+ }
+ };
+ cancelPasswordLink.setVisibilityAllowed(callerPage != null);
+ formPasswordView.add(cancelPasswordLink);
- add(formPasswordView);
- }
+ add(formPasswordView);
+ }
}
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/utilisateur/panels/ReadDroitsUtilisateurPanel.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/utilisateur/panels/ReadDroitsUtilisateurPanel.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/utilisateur/panels/ReadDroitsUtilisateurPanel.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -56,101 +56,101 @@
*/
public final class ReadDroitsUtilisateurPanel extends Panel {
- /**
- * Constructeur
- * @param id Id du composant
- * @param utilisateurModel Modèle de l'utilisateur concerné
- */
- public ReadDroitsUtilisateurPanel(String id, final IModel<? extends Utilisateur> utilisateurModel) {
- super(id, utilisateurModel);
+ /**
+ * Constructeur
+ * @param id Id du composant
+ * @param utilisateurModel Modèle de l'utilisateur concerné
+ */
+ public ReadDroitsUtilisateurPanel(String id, final IModel<? extends Utilisateur> utilisateurModel) {
+ super(id, utilisateurModel);
- // Gestion des campagnes et lots autorisés
- final MarkupContainer autorisationsContainer = new WebMarkupContainer("Authorizations.Table") {
- @Override
- public boolean isVisible() {
- return utilisateurModel.getObject().getCampagnesDroits().size() != 0
- || utilisateurModel.getObject().getLotsDroits().size() != 0;
- }
- };
- autorisationsContainer.setOutputMarkupId(true);
+ // Gestion des campagnes et lots autorisés
+ final MarkupContainer autorisationsContainer = new WebMarkupContainer("Authorizations.Table") {
+ @Override
+ public boolean isVisible() {
+ return utilisateurModel.getObject().getCampagnesDroits().size() != 0
+ || utilisateurModel.getObject().getLotsDroits().size() != 0;
+ }
+ };
+ autorisationsContainer.setOutputMarkupId(true);
- final LoadableDetachableModel<List<CampagnePersonneDroits>> campagnesModel = new LoadableDetachableModel<List<CampagnePersonneDroits>>() {
- @Override
- protected List<CampagnePersonneDroits> load() {
- List<CampagnePersonneDroits> listCampagnesDroits = new ArrayList<CampagnePersonneDroits>(
- utilisateurModel.getObject().getCampagnesDroits().values());
+ final LoadableDetachableModel<List<CampagnePersonneDroits>> campagnesModel = new LoadableDetachableModel<List<CampagnePersonneDroits>>() {
+ @Override
+ protected List<CampagnePersonneDroits> load() {
+ List<CampagnePersonneDroits> listCampagnesDroits = new ArrayList<CampagnePersonneDroits>(
+ utilisateurModel.getObject().getCampagnesDroits().values());
- // tri pour affichage
- Collections.sort(listCampagnesDroits, new CampagnePersonneDroitsComp());
- return listCampagnesDroits;
- }
- };
+ // tri pour affichage
+ Collections.sort(listCampagnesDroits, new CampagnePersonneDroitsComp());
+ return listCampagnesDroits;
+ }
+ };
- // Liste des campagnes autorisées
- autorisationsContainer
- .add(new ListView<CampagnePersonneDroits>("Authorizations.Campagnes.List", campagnesModel) {
- @Override
- protected void populateItem(final ListItem<CampagnePersonneDroits> item) {
- if (item.getIndex() % 2 == 1) {
- item.add(new AttributeModifier("class", item.getIndex() % 2 == 0 ? "even" : "odd"));
- }
+ // Liste des campagnes autorisées
+ autorisationsContainer
+ .add(new ListView<CampagnePersonneDroits>("Authorizations.Campagnes.List", campagnesModel) {
+ @Override
+ protected void populateItem(final ListItem<CampagnePersonneDroits> item) {
+ if (item.getIndex() % 2 == 1) {
+ item.add(new AttributeModifier("class", item.getIndex() % 2 == 0 ? "even" : "odd"));
+ }
- item.add(new PropertyLabelLinkPanel<Campagne>("Authorizations.Campagnes.Campagne.nom",
- new PropertyModel<Campagne>(item.getModel(), "id.pk1"), getString("Read")) {
- @Override
- public void onClick() {
- setResponsePage(new ReadCampagnePage(getModelObject().getIdCampagne(), new CallerPage(
- (TemplatePage) getPage())));
- }
- });
- }
- });
+ item.add(new PropertyLabelLinkPanel<Campagne>("Authorizations.Campagnes.Campagne.nom",
+ new PropertyModel<Campagne>(item.getModel(), "id.pk1"), getString("Read")) {
+ @Override
+ public void onClick() {
+ setResponsePage(new ReadCampagnePage(getModelObject().getIdCampagne(), new CallerPage(
+ (TemplatePage) getPage())));
+ }
+ });
+ }
+ });
- // Liste des lots autorisés
- final LoadableDetachableModel<List<LotPersonneDroits>> lotsModel = new LoadableDetachableModel<List<LotPersonneDroits>>() {
- protected List<LotPersonneDroits> load() {
- List<LotPersonneDroits> listLotsDroits = new ArrayList<LotPersonneDroits>(utilisateurModel.getObject()
- .getLotsDroits().values());
- // tri pour affichage
- Collections.sort(listLotsDroits, new LotPersonneDroitsComp());
- return listLotsDroits;
- }
- };
- autorisationsContainer.add(new ListView<LotPersonneDroits>("Authorizations.Lots.List", lotsModel) {
- @Override
- protected void populateItem(ListItem<LotPersonneDroits> item) {
- if (item.getIndex() % 2 == 1) {
- item.add(new AttributeModifier("class", item.getIndex() % 2 == 0 ? "even" : "odd"));
- }
+ // Liste des lots autorisés
+ final LoadableDetachableModel<List<LotPersonneDroits>> lotsModel = new LoadableDetachableModel<List<LotPersonneDroits>>() {
+ protected List<LotPersonneDroits> load() {
+ List<LotPersonneDroits> listLotsDroits = new ArrayList<LotPersonneDroits>(utilisateurModel.getObject()
+ .getLotsDroits().values());
+ // tri pour affichage
+ Collections.sort(listLotsDroits, new LotPersonneDroitsComp());
+ return listLotsDroits;
+ }
+ };
+ autorisationsContainer.add(new ListView<LotPersonneDroits>("Authorizations.Lots.List", lotsModel) {
+ @Override
+ protected void populateItem(ListItem<LotPersonneDroits> item) {
+ if (item.getIndex() % 2 == 1) {
+ item.add(new AttributeModifier("class", item.getIndex() % 2 == 0 ? "even" : "odd"));
+ }
- item.add(new PropertyLabelLinkPanel<Campagne>("Authorizations.Lots.Campagne.nom",
- new PropertyModel<Campagne>(item.getModel(), "id.pk1.campagne"), getString("Read")) {
- @Override
- public void onClick() {
- setResponsePage(new ReadCampagnePage(getModelObject().getIdCampagne(), new CallerPage(
- (TemplatePage) getPage())));
- }
- });
+ item.add(new PropertyLabelLinkPanel<Campagne>("Authorizations.Lots.Campagne.nom",
+ new PropertyModel<Campagne>(item.getModel(), "id.pk1.campagne"), getString("Read")) {
+ @Override
+ public void onClick() {
+ setResponsePage(new ReadCampagnePage(getModelObject().getIdCampagne(), new CallerPage(
+ (TemplatePage) getPage())));
+ }
+ });
- item.add(new PropertyLabelLinkPanel<Lot>("Authorizations.Lots.Lot.ref", new PropertyModel<Lot>(item
- .getModel(), "id.pk1"), getString("Read")) {
- @Override
- public void onClick() {
- setResponsePage(new ReadLotPage(getModelObject().getIdLot(), new CallerPage(
- (TemplatePage) getPage())));
- }
- });
- }
- });
- add(autorisationsContainer);
+ item.add(new PropertyLabelLinkPanel<Lot>("Authorizations.Lots.Lot.ref", new PropertyModel<Lot>(item
+ .getModel(), "id.pk1"), getString("Read")) {
+ @Override
+ public void onClick() {
+ setResponsePage(new ReadLotPage(getModelObject().getIdLot(), new CallerPage(
+ (TemplatePage) getPage())));
+ }
+ });
+ }
+ });
+ add(autorisationsContainer);
- // Selon la non existence d'elements dans la table on affiche le span pour remplacer
- MarkupContainer emptyCampagnesContainer = new WebMarkupContainer("Authorizations.emptyTable") {
- @Override
- public boolean isVisible() {
- return !autorisationsContainer.isVisible();
- }
- };
- add(emptyCampagnesContainer);
- }
+ // Selon la non existence d'elements dans la table on affiche le span pour remplacer
+ MarkupContainer emptyCampagnesContainer = new WebMarkupContainer("Authorizations.emptyTable") {
+ @Override
+ public boolean isVisible() {
+ return !autorisationsContainer.isVisible();
+ }
+ };
+ add(emptyCampagnesContainer);
+ }
}
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/errors/AccessDeniedPage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/errors/AccessDeniedPage.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/errors/AccessDeniedPage.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -27,5 +27,5 @@
* @author Mickael Tricot
*/
public final class AccessDeniedPage extends ErrorPage {
- //
+ //
}
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/errors/ErrorPage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/errors/ErrorPage.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/errors/ErrorPage.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -32,26 +32,26 @@
*/
public abstract class ErrorPage extends TemplatePage {
- /** Error message pattern: resource.classSimpleName */
- private static final String PATTERN_ERROR_MSG = "%s.%s";
+ /** Error message pattern: resource.classSimpleName */
+ private static final String PATTERN_ERROR_MSG = "%s.%s";
- /**
- * Constructor
- */
- public ErrorPage() {
- super(ErrorPage.class);
- String errorMsgKey = String.format(PATTERN_ERROR_MSG, getResource(), getClass().getSimpleName());
- try {
- errorMsgKey = getString(errorMsgKey);
- } catch (MissingResourceException e) {
- //
- }
- error(errorMsgKey);
- }
+ /**
+ * Constructor
+ */
+ public ErrorPage() {
+ super(ErrorPage.class);
+ String errorMsgKey = String.format(PATTERN_ERROR_MSG, getResource(), getClass().getSimpleName());
+ try {
+ errorMsgKey = getString(errorMsgKey);
+ } catch (MissingResourceException e) {
+ //
+ }
+ error(errorMsgKey);
+ }
- /** {@inheritDoc} */
- @Override
- public final boolean isErrorPage() {
- return true;
- }
+ /** {@inheritDoc} */
+ @Override
+ public final boolean isErrorPage() {
+ return true;
+ }
}
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/errors/InternalErrorPage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/errors/InternalErrorPage.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/errors/InternalErrorPage.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -27,5 +27,5 @@
* @author Mickael Tricot
*/
public final class InternalErrorPage extends ErrorPage {
- //
+ //
}
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/errors/PageExpiredErrorPage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/errors/PageExpiredErrorPage.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/errors/PageExpiredErrorPage.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -27,5 +27,5 @@
* @author Mickael Tricot
*/
public final class PageExpiredErrorPage extends ErrorPage {
- //
+ //
}
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/model/CaptchaModel.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/model/CaptchaModel.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/model/CaptchaModel.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -33,51 +33,51 @@
*/
public final class CaptchaModel implements Serializable {
- /** Texte captcha */
- @NotEmpty
- private String captchaText;
+ /** Texte captcha */
+ @NotEmpty
+ private String captchaText;
- /** Texte généré pour le captcha */
- private String captchaTextGenerated;
+ /** Texte généré pour le captcha */
+ private String captchaTextGenerated;
- /**
- * Validate the model
- * @return TRUE if it is valid
- */
- public boolean validate() {
- return !StringUtils.isEmpty(captchaText) && captchaTextGenerated.equals(captchaText);
- }
+ /**
+ * Validate the model
+ * @return TRUE if it is valid
+ */
+ public boolean validate() {
+ return !StringUtils.isEmpty(captchaText) && captchaTextGenerated.equals(captchaText);
+ }
- /**
- * captchaText getter
- * @return captchaText
- */
- public String getCaptchaText() {
- return captchaText;
- }
+ /**
+ * captchaText getter
+ * @return captchaText
+ */
+ public String getCaptchaText() {
+ return captchaText;
+ }
- /**
- * captchaText setter
- * @param captchaText captchaText
- */
- public void setCaptchaText(String captchaText) {
- this.captchaText = captchaText;
- }
+ /**
+ * captchaText setter
+ * @param captchaText captchaText
+ */
+ public void setCaptchaText(String captchaText) {
+ this.captchaText = captchaText;
+ }
- /**
- * captchaTextGenerated getter
- * @return captchaTextGenerated
- */
- public String getCaptchaTextGenerated() {
- return captchaTextGenerated;
- }
+ /**
+ * captchaTextGenerated getter
+ * @return captchaTextGenerated
+ */
+ public String getCaptchaTextGenerated() {
+ return captchaTextGenerated;
+ }
- /**
- * captchaTextGenerated setter
- * @param captchaTextGenerated captchaTextGenerated
- */
- public void setCaptchaTextGenerated(String captchaTextGenerated) {
- this.captchaTextGenerated = captchaTextGenerated;
- }
+ /**
+ * captchaTextGenerated setter
+ * @param captchaTextGenerated captchaTextGenerated
+ */
+ public void setCaptchaTextGenerated(String captchaTextGenerated) {
+ this.captchaTextGenerated = captchaTextGenerated;
+ }
}
\ No newline at end of file
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/model/ContactModel.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/model/ContactModel.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/model/ContactModel.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -33,64 +33,64 @@
*/
public class ContactModel implements Serializable {
- /** E-mail (from) */
- @NotEmpty
- @Email
- private String mail;
+ /** E-mail (from) */
+ @NotEmpty
+ @Email
+ private String mail;
- /** Message */
- @NotEmpty
- private String message;
+ /** Message */
+ @NotEmpty
+ private String message;
- /** Subject */
- @NotEmpty
- private String subject;
+ /** Subject */
+ @NotEmpty
+ private String subject;
- /**
- * mail getter
- * @return mail
- */
- public String getMail() {
- return mail;
- }
+ /**
+ * mail getter
+ * @return mail
+ */
+ public String getMail() {
+ return mail;
+ }
- /**
- * mail setter
- * @param mail mail
- */
- public void setMail(String mail) {
- this.mail = mail;
- }
+ /**
+ * mail setter
+ * @param mail mail
+ */
+ public void setMail(String mail) {
+ this.mail = mail;
+ }
- /**
- * message getter
- * @return message
- */
- public String getMessage() {
- return message;
- }
+ /**
+ * message getter
+ * @return message
+ */
+ public String getMessage() {
+ return message;
+ }
- /**
- * message setter
- * @param message message
- */
- public void setMessage(String message) {
- this.message = message;
- }
+ /**
+ * message setter
+ * @param message message
+ */
+ public void setMessage(String message) {
+ this.message = message;
+ }
- /**
- * subject getter
- * @return subject
- */
- public String getSubject() {
- return subject;
- }
+ /**
+ * subject getter
+ * @return subject
+ */
+ public String getSubject() {
+ return subject;
+ }
- /**
- * subject setter
- * @param subject subject
- */
- public void setSubject(String subject) {
- this.subject = subject;
- }
+ /**
+ * subject setter
+ * @param subject subject
+ */
+ public void setSubject(String subject) {
+ this.subject = subject;
+ }
}
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/model/LoginModel.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/model/LoginModel.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/model/LoginModel.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -34,44 +34,44 @@
*/
public final class LoginModel implements Serializable {
- /** Mot de passe */
- @NotEmpty
- private String password;
+ /** Mot de passe */
+ @NotEmpty
+ private String password;
- /** Se souvenir de moi */
- @NotNull
- private Boolean rememberMe;
+ /** Se souvenir de moi */
+ @NotNull
+ private Boolean rememberMe;
- /**
- * password getter
- * @return password
- */
- public String getPassword() {
- return password;
- }
+ /**
+ * password getter
+ * @return password
+ */
+ public String getPassword() {
+ return password;
+ }
- /**
- * password setter
- * @param password password
- */
- public void setPassword(String password) {
- this.password = password;
- }
+ /**
+ * password setter
+ * @param password password
+ */
+ public void setPassword(String password) {
+ this.password = password;
+ }
- /**
- * rememberMe getter
- * @return rememberMe
- */
- public Boolean getRememberMe() {
- return rememberMe;
- }
+ /**
+ * rememberMe getter
+ * @return rememberMe
+ */
+ public Boolean getRememberMe() {
+ return rememberMe;
+ }
- /**
- * rememberMe setter
- * @param rememberMe rememberMe
- */
- public void setRememberMe(Boolean rememberMe) {
- this.rememberMe = rememberMe;
- }
+ /**
+ * rememberMe setter
+ * @param rememberMe rememberMe
+ */
+ public void setRememberMe(Boolean rememberMe) {
+ this.rememberMe = rememberMe;
+ }
}
\ No newline at end of file
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/model/ManageCampagneModel.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/model/ManageCampagneModel.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/model/ManageCampagneModel.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -32,42 +32,42 @@
*/
public final class ManageCampagneModel implements Serializable {
- /** complement associé à la personne sélectionnée */
- private String complement;
+ /** complement associé à la personne sélectionnée */
+ private String complement;
- /** Personne sélectionnée */
- private Personne selectedPersonne;
+ /** Personne sélectionnée */
+ private Personne selectedPersonne;
- /**
- * complement getter
- * @return complement
- */
- public String getComplement() {
- return complement;
- }
+ /**
+ * complement getter
+ * @return complement
+ */
+ public String getComplement() {
+ return complement;
+ }
- /**
- * complement setter
- * @param complement complement
- */
- public void setComplement(String complement) {
- this.complement = complement;
- }
+ /**
+ * complement setter
+ * @param complement complement
+ */
+ public void setComplement(String complement) {
+ this.complement = complement;
+ }
- /**
- * selectedPersonne getter
- * @return selectedPersonne
- */
- public Personne getSelectedPersonne() {
- return selectedPersonne;
- }
+ /**
+ * selectedPersonne getter
+ * @return selectedPersonne
+ */
+ public Personne getSelectedPersonne() {
+ return selectedPersonne;
+ }
- /**
- * selectedPersonne setter
- * @param selectedPersonne selectedPersonne
- */
- public void setSelectedPersonne(Personne selectedPersonne) {
- this.selectedPersonne = selectedPersonne;
- }
+ /**
+ * selectedPersonne setter
+ * @param selectedPersonne selectedPersonne
+ */
+ public void setSelectedPersonne(Personne selectedPersonne) {
+ this.selectedPersonne = selectedPersonne;
+ }
}
\ No newline at end of file
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/model/ManageStationModel.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/model/ManageStationModel.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/model/ManageStationModel.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -40,126 +40,126 @@
*/
public final class ManageStationModel implements Serializable {
- /** Latitude : degrés */
- @Range(min = CoordTools.LATITUDE_MIN_DEGREES, max = CoordTools.LATITUDE_MAX_DEGREES)
- private Integer latitudeDegrees;
+ /** Latitude : degrés */
+ @Range(min = CoordTools.LATITUDE_MIN_DEGREES, max = CoordTools.LATITUDE_MAX_DEGREES)
+ private Integer latitudeDegrees;
- /** Latitude : minutes */
- @DecimalMin(CoordTools.LATITUDE_MIN_MINUTES_STRING)
- @DecimalMax(CoordTools.LATITUDE_MAX_MINUTES_STRING)
- private BigDecimal latitudeMinutes;
+ /** Latitude : minutes */
+ @DecimalMin(CoordTools.LATITUDE_MIN_MINUTES_STRING)
+ @DecimalMax(CoordTools.LATITUDE_MAX_MINUTES_STRING)
+ private BigDecimal latitudeMinutes;
- /** Latitude : orientation */
- @LatitudeOrientation
- private Character latitudeOrientation;
+ /** Latitude : orientation */
+ @LatitudeOrientation
+ private Character latitudeOrientation;
- /** Longitude : degrés */
- @Range(min = CoordTools.LONGITUDE_MIN_DEGREES, max = CoordTools.LONGITUDE_MAX_DEGREES)
- private Integer longitudeDegrees;
+ /** Longitude : degrés */
+ @Range(min = CoordTools.LONGITUDE_MIN_DEGREES, max = CoordTools.LONGITUDE_MAX_DEGREES)
+ private Integer longitudeDegrees;
- /** Longitude : minutes */
- @DecimalMin(CoordTools.LONGITUDE_MIN_MINUTES_STRING)
- @DecimalMax(CoordTools.LONGITUDE_MAX_MINUTES_STRING)
- private BigDecimal longitudeMinutes;
+ /** Longitude : minutes */
+ @DecimalMin(CoordTools.LONGITUDE_MIN_MINUTES_STRING)
+ @DecimalMax(CoordTools.LONGITUDE_MAX_MINUTES_STRING)
+ private BigDecimal longitudeMinutes;
- /** Longitude : orientation */
- @LongitudeOrientation
- private Character longitudeOrientation;
+ /** Longitude : orientation */
+ @LongitudeOrientation
+ private Character longitudeOrientation;
- /**
- * latitudeDegrees getter
- * @return latitudeDegrees
- */
- public Integer getLatitudeDegrees() {
- return latitudeDegrees;
- }
+ /**
+ * latitudeDegrees getter
+ * @return latitudeDegrees
+ */
+ public Integer getLatitudeDegrees() {
+ return latitudeDegrees;
+ }
- /**
- * latitudeDegrees setter
- * @param latitudeDegrees latitudeDegrees
- */
- public void setLatitudeDegrees(Integer latitudeDegrees) {
- this.latitudeDegrees = latitudeDegrees;
- }
+ /**
+ * latitudeDegrees setter
+ * @param latitudeDegrees latitudeDegrees
+ */
+ public void setLatitudeDegrees(Integer latitudeDegrees) {
+ this.latitudeDegrees = latitudeDegrees;
+ }
- /**
- * latitudeMinutes getter
- * @return latitudeMinutes
- */
- public BigDecimal getLatitudeMinutes() {
- return latitudeMinutes;
- }
+ /**
+ * latitudeMinutes getter
+ * @return latitudeMinutes
+ */
+ public BigDecimal getLatitudeMinutes() {
+ return latitudeMinutes;
+ }
- /**
- * latitudeMinutes setter
- * @param latitudeMinutes latitudeMinutes
- */
- public void setLatitudeMinutes(BigDecimal latitudeMinutes) {
- this.latitudeMinutes = latitudeMinutes;
- }
+ /**
+ * latitudeMinutes setter
+ * @param latitudeMinutes latitudeMinutes
+ */
+ public void setLatitudeMinutes(BigDecimal latitudeMinutes) {
+ this.latitudeMinutes = latitudeMinutes;
+ }
- /**
- * latitudeOrientation getter
- * @return latitudeOrientation
- */
- public Character getLatitudeOrientation() {
- return latitudeOrientation;
- }
+ /**
+ * latitudeOrientation getter
+ * @return latitudeOrientation
+ */
+ public Character getLatitudeOrientation() {
+ return latitudeOrientation;
+ }
- /**
- * latitudeOrientation setter
- * @param latitudeOrientation latitudeOrientation
- */
- public void setLatitudeOrientation(Character latitudeOrientation) {
- this.latitudeOrientation = latitudeOrientation;
- }
+ /**
+ * latitudeOrientation setter
+ * @param latitudeOrientation latitudeOrientation
+ */
+ public void setLatitudeOrientation(Character latitudeOrientation) {
+ this.latitudeOrientation = latitudeOrientation;
+ }
- /**
- * longitudeDegrees getter
- * @return longitudeDegrees
- */
- public Integer getLongitudeDegrees() {
- return longitudeDegrees;
- }
+ /**
+ * longitudeDegrees getter
+ * @return longitudeDegrees
+ */
+ public Integer getLongitudeDegrees() {
+ return longitudeDegrees;
+ }
- /**
- * longitudeDegrees setter
- * @param longitudeDegrees longitudeDegrees
- */
- public void setLongitudeDegrees(Integer longitudeDegrees) {
- this.longitudeDegrees = longitudeDegrees;
- }
+ /**
+ * longitudeDegrees setter
+ * @param longitudeDegrees longitudeDegrees
+ */
+ public void setLongitudeDegrees(Integer longitudeDegrees) {
+ this.longitudeDegrees = longitudeDegrees;
+ }
- /**
- * longitudeMinutes getter
- * @return longitudeMinutes
- */
- public BigDecimal getLongitudeMinutes() {
- return longitudeMinutes;
- }
+ /**
+ * longitudeMinutes getter
+ * @return longitudeMinutes
+ */
+ public BigDecimal getLongitudeMinutes() {
+ return longitudeMinutes;
+ }
- /**
- * longitudeMinutes setter
- * @param longitudeMinutes longitudeMinutes
- */
- public void setLongitudeMinutes(BigDecimal longitudeMinutes) {
- this.longitudeMinutes = longitudeMinutes;
- }
+ /**
+ * longitudeMinutes setter
+ * @param longitudeMinutes longitudeMinutes
+ */
+ public void setLongitudeMinutes(BigDecimal longitudeMinutes) {
+ this.longitudeMinutes = longitudeMinutes;
+ }
- /**
- * longitudeOrientation getter
- * @return longitudeOrientation
- */
- public Character getLongitudeOrientation() {
- return longitudeOrientation;
- }
+ /**
+ * longitudeOrientation getter
+ * @return longitudeOrientation
+ */
+ public Character getLongitudeOrientation() {
+ return longitudeOrientation;
+ }
- /**
- * longitudeOrientation setter
- * @param longitudeOrientation longitudeOrientation
- */
- public void setLongitudeOrientation(Character longitudeOrientation) {
- this.longitudeOrientation = longitudeOrientation;
- }
+ /**
+ * longitudeOrientation setter
+ * @param longitudeOrientation longitudeOrientation
+ */
+ public void setLongitudeOrientation(Character longitudeOrientation) {
+ this.longitudeOrientation = longitudeOrientation;
+ }
}
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/model/ManageUtilisateurModel.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/model/ManageUtilisateurModel.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/model/ManageUtilisateurModel.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -38,64 +38,64 @@
*/
public final class ManageUtilisateurModel implements Serializable {
- /** Campagnes pour lesquelles l'utilisateur a des droits */
- private final List<Campagne> campagnes = new ArrayList<Campagne>();
+ /** Campagnes pour lesquelles l'utilisateur a des droits */
+ private final List<Campagne> campagnes = new ArrayList<Campagne>();
- /** Droits sur les campagnes pour l'utilisateur */
- private Map<Campagne, CampagnePersonneDroits> campagnesDroits;
+ /** Droits sur les campagnes pour l'utilisateur */
+ private Map<Campagne, CampagnePersonneDroits> campagnesDroits;
- /** Lots pour lesquels l'utilisateur a des droits */
- private final List<Lot> lots = new ArrayList<Lot>();
+ /** Lots pour lesquels l'utilisateur a des droits */
+ private final List<Lot> lots = new ArrayList<Lot>();
- /** Droits sur les lots pour l'utilisateur */
- private Map<Lot, LotPersonneDroits> lotsDroits;
+ /** Droits sur les lots pour l'utilisateur */
+ private Map<Lot, LotPersonneDroits> lotsDroits;
- /**
- * campagnesDroits getter
- * @return campagnesDroits
- */
- public Map<Campagne, CampagnePersonneDroits> getCampagnesDroits() {
- return campagnesDroits;
- }
+ /**
+ * campagnesDroits getter
+ * @return campagnesDroits
+ */
+ public Map<Campagne, CampagnePersonneDroits> getCampagnesDroits() {
+ return campagnesDroits;
+ }
- /**
- * campagnesDroits setter
- * @param campagnesDroits campagnesDroits
- */
- public void setCampagnesDroits(Map<Campagne, CampagnePersonneDroits> campagnesDroits) {
- this.campagnesDroits = campagnesDroits;
- }
+ /**
+ * campagnesDroits setter
+ * @param campagnesDroits campagnesDroits
+ */
+ public void setCampagnesDroits(Map<Campagne, CampagnePersonneDroits> campagnesDroits) {
+ this.campagnesDroits = campagnesDroits;
+ }
- /**
- * lotsDroits getter
- * @return lotsDroits
- */
- public Map<Lot, LotPersonneDroits> getLotsDroits() {
- return lotsDroits;
- }
+ /**
+ * lotsDroits getter
+ * @return lotsDroits
+ */
+ public Map<Lot, LotPersonneDroits> getLotsDroits() {
+ return lotsDroits;
+ }
- /**
- * lotsDroits setter
- * @param lotsDroits lotsDroits
- */
- public void setLotsDroits(Map<Lot, LotPersonneDroits> lotsDroits) {
- this.lotsDroits = lotsDroits;
- }
+ /**
+ * lotsDroits setter
+ * @param lotsDroits lotsDroits
+ */
+ public void setLotsDroits(Map<Lot, LotPersonneDroits> lotsDroits) {
+ this.lotsDroits = lotsDroits;
+ }
- /**
- * campagnes getter
- * @return campagnes
- */
- public List<Campagne> getCampagnes() {
- return campagnes;
- }
+ /**
+ * campagnes getter
+ * @return campagnes
+ */
+ public List<Campagne> getCampagnes() {
+ return campagnes;
+ }
- /**
- * lots getter
- * @return lots
- */
- public List<Lot> getLots() {
- return lots;
- }
+ /**
+ * lots getter
+ * @return lots
+ */
+ public List<Lot> getLots() {
+ return lots;
+ }
}
\ No newline at end of file
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/model/RegisterModel.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/model/RegisterModel.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/model/RegisterModel.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -35,52 +35,52 @@
* @author Mickael Tricot
*/
public final class RegisterModel implements Serializable {
- /** Mot de passe */
- @Length(min = PasswordTools.PASSWORD_LENGTH_MIN, max = PasswordTools.PASSWORD_LENGTH_MAX)
- @NotNull
- private String password;
+ /** Mot de passe */
+ @Length(min = PasswordTools.PASSWORD_LENGTH_MIN, max = PasswordTools.PASSWORD_LENGTH_MAX)
+ @NotNull
+ private String password;
- /** Confirmation supplémentaire */
- private String passwordConfirmation;
+ /** Confirmation supplémentaire */
+ private String passwordConfirmation;
- /**
- * Validate the model
- * @return TRUE if it is valid
- */
- public boolean validate() {
- return password.equals(passwordConfirmation);
- }
+ /**
+ * Validate the model
+ * @return TRUE if it is valid
+ */
+ public boolean validate() {
+ return password.equals(passwordConfirmation);
+ }
- /**
- * password getter
- * @return password
- */
- public String getPassword() {
- return password;
- }
+ /**
+ * password getter
+ * @return password
+ */
+ public String getPassword() {
+ return password;
+ }
- /**
- * password setter
- * @param password password
- */
- public void setPassword(String password) {
- this.password = password;
- }
+ /**
+ * password setter
+ * @param password password
+ */
+ public void setPassword(String password) {
+ this.password = password;
+ }
- /**
- * passwordConfirmation getter
- * @return passwordConfirmation
- */
- public String getPasswordConfirmation() {
- return passwordConfirmation;
- }
+ /**
+ * passwordConfirmation getter
+ * @return passwordConfirmation
+ */
+ public String getPasswordConfirmation() {
+ return passwordConfirmation;
+ }
- /**
- * passwordConfirmation setter
- * @param passwordConfirmation passwordConfirmation
- */
- public void setPasswordConfirmation(String passwordConfirmation) {
- this.passwordConfirmation = passwordConfirmation;
- }
+ /**
+ * passwordConfirmation setter
+ * @param passwordConfirmation passwordConfirmation
+ */
+ public void setPasswordConfirmation(String passwordConfirmation) {
+ this.passwordConfirmation = passwordConfirmation;
+ }
}
\ No newline at end of file
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/model/UpdateUtilisateurModel.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/model/UpdateUtilisateurModel.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/model/UpdateUtilisateurModel.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -37,92 +37,92 @@
*/
public final class UpdateUtilisateurModel implements Serializable {
- /** Mot de passe courant */
- @NotEmpty
- private String currentPassword;
+ /** Mot de passe courant */
+ @NotEmpty
+ private String currentPassword;
- /** Nouveau mot de passe */
- @Length(min = PasswordTools.PASSWORD_LENGTH_MIN, max = PasswordTools.PASSWORD_LENGTH_MAX)
- @NotNull
- private String newPassword;
+ /** Nouveau mot de passe */
+ @Length(min = PasswordTools.PASSWORD_LENGTH_MIN, max = PasswordTools.PASSWORD_LENGTH_MAX)
+ @NotNull
+ private String newPassword;
- /** Confirmation du nouveau mot de passe */
- private String newPasswordConfirmation;
+ /** Confirmation du nouveau mot de passe */
+ private String newPasswordConfirmation;
- /** Mot de passe */
- @NotEmpty
- private String password;
+ /** Mot de passe */
+ @NotEmpty
+ private String password;
- /**
- * Validate the model
- * @return TRUE if it is valid
- */
- public boolean validate() {
- return newPassword.equals(newPasswordConfirmation);
- }
+ /**
+ * Validate the model
+ * @return TRUE if it is valid
+ */
+ public boolean validate() {
+ return newPassword.equals(newPasswordConfirmation);
+ }
- /**
- * currentPassword getter
- * @return currentPassword
- */
- public String getCurrentPassword() {
- return currentPassword;
- }
+ /**
+ * currentPassword getter
+ * @return currentPassword
+ */
+ public String getCurrentPassword() {
+ return currentPassword;
+ }
- /**
- * currentPassword setter
- * @param currentPassword currentPassword
- */
- public void setCurrentPassword(String currentPassword) {
- this.currentPassword = currentPassword;
- }
+ /**
+ * currentPassword setter
+ * @param currentPassword currentPassword
+ */
+ public void setCurrentPassword(String currentPassword) {
+ this.currentPassword = currentPassword;
+ }
- /**
- * newPassword getter
- * @return newPassword
- */
- public String getNewPassword() {
- return newPassword;
- }
+ /**
+ * newPassword getter
+ * @return newPassword
+ */
+ public String getNewPassword() {
+ return newPassword;
+ }
- /**
- * newPassword setter
- * @param newPassword newPassword
- */
- public void setNewPassword(String newPassword) {
- this.newPassword = newPassword;
- }
+ /**
+ * newPassword setter
+ * @param newPassword newPassword
+ */
+ public void setNewPassword(String newPassword) {
+ this.newPassword = newPassword;
+ }
- /**
- * newPasswordConfirmation getter
- * @return newPasswordConfirmation
- */
- public String getNewPasswordConfirmation() {
- return newPasswordConfirmation;
- }
+ /**
+ * newPasswordConfirmation getter
+ * @return newPasswordConfirmation
+ */
+ public String getNewPasswordConfirmation() {
+ return newPasswordConfirmation;
+ }
- /**
- * newPasswordConfirmation setter
- * @param newPasswordConfirmation newPasswordConfirmation
- */
- public void setNewPasswordConfirmation(String newPasswordConfirmation) {
- this.newPasswordConfirmation = newPasswordConfirmation;
- }
+ /**
+ * newPasswordConfirmation setter
+ * @param newPasswordConfirmation newPasswordConfirmation
+ */
+ public void setNewPasswordConfirmation(String newPasswordConfirmation) {
+ this.newPasswordConfirmation = newPasswordConfirmation;
+ }
- /**
- * password getter
- * @return password
- */
- public String getPassword() {
- return password;
- }
+ /**
+ * password getter
+ * @return password
+ */
+ public String getPassword() {
+ return password;
+ }
- /**
- * password setter
- * @param password password
- */
- public void setPassword(String password) {
- this.password = password;
- }
+ /**
+ * password setter
+ * @param password password
+ */
+ public void setPassword(String password) {
+ this.password = password;
+ }
}
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/renderers/PersonneRenderer.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/renderers/PersonneRenderer.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/renderers/PersonneRenderer.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -32,9 +32,9 @@
*/
public class PersonneRenderer extends ChoiceRenderer<Personne> {
- /** {@inheritDoc} */
- @Override
- public Object getDisplayValue(final Personne personne) {
- return personne.getNom() + " " + personne.getPrenom();
- }
+ /** {@inheritDoc} */
+ @Override
+ public Object getDisplayValue(final Personne personne) {
+ return personne.getNom() + " " + personne.getPrenom();
+ }
}
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/renderers/ProduitRenderer.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/renderers/ProduitRenderer.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/renderers/ProduitRenderer.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -32,9 +32,9 @@
*/
public class ProduitRenderer extends ChoiceRenderer<Produit> {
- /** {@inheritDoc} */
- @Override
- public Object getDisplayValue(final Produit produit) {
- return produit.getRef();
- }
+ /** {@inheritDoc} */
+ @Override
+ public Object getDisplayValue(final Produit produit) {
+ return produit.getRef();
+ }
}
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/CallerPage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/CallerPage.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/CallerPage.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -34,52 +34,52 @@
*/
public final class CallerPage implements Serializable {
- /** Page class */
- private final Class<? extends TemplatePage> classPage;
+ /** Page class */
+ private final Class<? extends TemplatePage> classPage;
- /** Page instance */
- private final TemplatePage instancePage;
+ /** Page instance */
+ private final TemplatePage instancePage;
- /**
- * Constructor
- * @param page Page class
- */
- public CallerPage(Class<? extends TemplatePage> page) {
- AssertTools.assertNotNull(page);
- classPage = page;
- instancePage = null;
- }
+ /**
+ * Constructor
+ * @param page Page class
+ */
+ public CallerPage(Class<? extends TemplatePage> page) {
+ AssertTools.assertNotNull(page);
+ classPage = page;
+ instancePage = null;
+ }
- /**
- * Constructor
- * @param page Page instance
- */
- public CallerPage(TemplatePage page) {
- AssertTools.assertNotNull(page);
- classPage = null;
- instancePage = page;
- }
+ /**
+ * Constructor
+ * @param page Page instance
+ */
+ public CallerPage(TemplatePage page) {
+ AssertTools.assertNotNull(page);
+ classPage = null;
+ instancePage = page;
+ }
- /**
- * Add a page parameter (only for instance pages)
- * @param key Key
- * @param value Value
- */
- public void addPageParameter(String key, Object value) {
- if (instancePage != null) {
- instancePage.getPageParameters().add(key, value);
- }
- }
+ /**
+ * Add a page parameter (only for instance pages)
+ * @param key Key
+ * @param value Value
+ */
+ public void addPageParameter(String key, Object value) {
+ if (instancePage != null) {
+ instancePage.getPageParameters().add(key, value);
+ }
+ }
- /**
- * Set the response page for the current page
- * @param currentPage Current page
- */
- public void responsePage(TemplatePage currentPage) {
- if (classPage != null) {
- currentPage.setResponsePage(classPage);
- } else {
- currentPage.setResponsePage(instancePage);
- }
- }
+ /**
+ * Set the response page for the current page
+ * @param currentPage Current page
+ */
+ public void responsePage(TemplatePage currentPage) {
+ if (classPage != null) {
+ currentPage.setResponsePage(classPage);
+ } else {
+ currentPage.setResponsePage(instancePage);
+ }
+ }
}
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/behaviors/JSConfirmationBehavior.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/behaviors/JSConfirmationBehavior.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/behaviors/JSConfirmationBehavior.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -37,30 +37,30 @@
*/
public final class JSConfirmationBehavior extends Behavior {
- /** JS event */
- private static final String JS_EVENT = "onclick";
+ /** JS event */
+ private static final String JS_EVENT = "onclick";
- /** JS script template */
- private static final String JS_SCRIPT_TEMPLATE = "return confirm(\"%s\");";
+ /** JS script template */
+ private static final String JS_SCRIPT_TEMPLATE = "return confirm(\"%s\");";
- /** JS script */
- private final String jsScript;
+ /** JS script */
+ private final String jsScript;
- /**
- * Constructor
- * @param message Confirmation message
- */
- public JSConfirmationBehavior(String message) {
- AssertTools.assertNotEmpty(message);
- jsScript = String.format(JS_SCRIPT_TEMPLATE, message);
- }
+ /**
+ * Constructor
+ * @param message Confirmation message
+ */
+ public JSConfirmationBehavior(String message) {
+ AssertTools.assertNotEmpty(message);
+ jsScript = String.format(JS_SCRIPT_TEMPLATE, message);
+ }
- /** {@inheritDoc} */
- @Override
- public void onComponentTag(Component component, ComponentTag tag) {
- if (component instanceof Button || component instanceof Link<?>) {
- tag.getAttributes().remove(JS_EVENT);
- tag.getAttributes().put(JS_EVENT, jsScript);
- }
- }
+ /** {@inheritDoc} */
+ @Override
+ public void onComponentTag(Component component, ComponentTag tag) {
+ if (component instanceof Button || component instanceof Link<?>) {
+ tag.getAttributes().remove(JS_EVENT);
+ tag.getAttributes().put(JS_EVENT, jsScript);
+ }
+ }
}
\ No newline at end of file
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/behaviors/ReplaceEmptyLabelBehavior.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/behaviors/ReplaceEmptyLabelBehavior.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/behaviors/ReplaceEmptyLabelBehavior.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -31,16 +31,16 @@
*/
public class ReplaceEmptyLabelBehavior extends Behavior {
- /** Regular expression to display */
- public static final String NULL_PROPERTY = " - ";
+ /** Regular expression to display */
+ public static final String NULL_PROPERTY = " - ";
- /** {@inheritDoc} */
- @Override
- public void beforeRender(Component component) {
- super.bind(component);
- if (component.getDefaultModelObject() == null) {
- component.getResponse().write(NULL_PROPERTY);
- }
- }
+ /** {@inheritDoc} */
+ @Override
+ public void beforeRender(Component component) {
+ super.bind(component);
+ if (component.getDefaultModelObject() == null) {
+ component.getResponse().write(NULL_PROPERTY);
+ }
+ }
}
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/columns/BooleanPropertyColumn.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/columns/BooleanPropertyColumn.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/columns/BooleanPropertyColumn.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -39,34 +39,34 @@
*/
public class BooleanPropertyColumn<T> extends AbstractColumn<T> implements ExportableColumn<T> {
- /** wicket property expression */
- private final String propertyExpression;
+ /** wicket property expression */
+ private final String propertyExpression;
- /** page used to get messages */
- private final TemplatePage page;
+ /** page used to get messages */
+ private final TemplatePage page;
- /**
- * Constructor
- * @param displayModel DisplayModel
- * @param sortProperty SortProperty
- * @param propertyExpression Wicket property expression
- * @param page Page used to get True, False message
- */
- public BooleanPropertyColumn(IModel<String> displayModel, String sortProperty, String propertyExpression,
- TemplatePage page) {
- super(displayModel, sortProperty);
- this.propertyExpression = propertyExpression;
- this.page = page;
- }
+ /**
+ * Constructor
+ * @param displayModel DisplayModel
+ * @param sortProperty SortProperty
+ * @param propertyExpression Wicket property expression
+ * @param page Page used to get True, False message
+ */
+ public BooleanPropertyColumn(IModel<String> displayModel, String sortProperty, String propertyExpression,
+ TemplatePage page) {
+ super(displayModel, sortProperty);
+ this.propertyExpression = propertyExpression;
+ this.page = page;
+ }
- /** {@inheritDoc} */
- @Override
- public void populateItem(Item<ICellPopulator<T>> cellItem, String componentId, IModel<T> rowModel) {
- cellItem.add(new Label(componentId, new DisplayBooleanPropertyModel(rowModel.getObject(), propertyExpression,
- page)));
- }
+ /** {@inheritDoc} */
+ @Override
+ public void populateItem(Item<ICellPopulator<T>> cellItem, String componentId, IModel<T> rowModel) {
+ cellItem.add(new Label(componentId, new DisplayBooleanPropertyModel(rowModel.getObject(), propertyExpression,
+ page)));
+ }
- @Override
+ @Override
public String getHeaderName() {
return getDisplayModel().getObject().toString();
}
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/columns/DecimalPropertyColumn.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/columns/DecimalPropertyColumn.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/columns/DecimalPropertyColumn.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -41,39 +41,39 @@
*/
public class DecimalPropertyColumn<T> extends AbstractColumn<T> implements ExportableColumn<T> {
- /** wicket property expression */
- private final String propertyExpression;
+ /** wicket property expression */
+ private final String propertyExpression;
- /** locale property */
- private final Locale locale;
+ /** locale property */
+ private final Locale locale;
- /** format to display **/
- private DecimalDisplFormat format;
+ /** format to display **/
+ private DecimalDisplFormat format;
- /**
- * Constructor
- * @param displayModel DisplayModel
- * @param sortProperty SortProperty
- * @param propertyExpression Wicket property expression
- * @param format format to display
- * @param locale Locale used to format decimal
- */
- public DecimalPropertyColumn(IModel<String> displayModel, String sortProperty, String propertyExpression,
- DecimalDisplFormat format, Locale locale) {
- super(displayModel, sortProperty);
- this.propertyExpression = propertyExpression;
- this.format = format;
- this.locale = locale;
- }
+ /**
+ * Constructor
+ * @param displayModel DisplayModel
+ * @param sortProperty SortProperty
+ * @param propertyExpression Wicket property expression
+ * @param format format to display
+ * @param locale Locale used to format decimal
+ */
+ public DecimalPropertyColumn(IModel<String> displayModel, String sortProperty, String propertyExpression,
+ DecimalDisplFormat format, Locale locale) {
+ super(displayModel, sortProperty);
+ this.propertyExpression = propertyExpression;
+ this.format = format;
+ this.locale = locale;
+ }
- /** {@inheritDoc} */
- @Override
- public void populateItem(Item<ICellPopulator<T>> cellItem, String componentId, IModel<T> rowModel) {
- cellItem.add(new Label(componentId, new DisplayDecimalPropertyModel(rowModel.getObject(), propertyExpression,
- format, locale)));
- }
-
- @Override
+ /** {@inheritDoc} */
+ @Override
+ public void populateItem(Item<ICellPopulator<T>> cellItem, String componentId, IModel<T> rowModel) {
+ cellItem.add(new Label(componentId, new DisplayDecimalPropertyModel(rowModel.getObject(), propertyExpression,
+ format, locale)));
+ }
+
+ @Override
public String getHeaderName() {
return getDisplayModel().getObject().toString();
}
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/columns/EnumPropertyColumn.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/columns/EnumPropertyColumn.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/columns/EnumPropertyColumn.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -39,34 +39,34 @@
*/
public class EnumPropertyColumn<T> extends AbstractColumn<T> implements ExportableColumn<T> {
- /** wicket property expression */
- private final String propertyExpression;
+ /** wicket property expression */
+ private final String propertyExpression;
- /** locale property */
- private final TemplatePage page;
+ /** locale property */
+ private final TemplatePage page;
- /**
- * Constructor
- * @param displayModel DisplayModel
- * @param sortProperty SortProperty
- * @param propertyExpression Wicket property expression
- * @param page Page used to get enum messages
- */
- public EnumPropertyColumn(IModel<String> displayModel, String sortProperty, String propertyExpression,
- TemplatePage page) {
- super(displayModel, sortProperty);
- this.propertyExpression = propertyExpression;
- this.page = page;
- }
+ /**
+ * Constructor
+ * @param displayModel DisplayModel
+ * @param sortProperty SortProperty
+ * @param propertyExpression Wicket property expression
+ * @param page Page used to get enum messages
+ */
+ public EnumPropertyColumn(IModel<String> displayModel, String sortProperty, String propertyExpression,
+ TemplatePage page) {
+ super(displayModel, sortProperty);
+ this.propertyExpression = propertyExpression;
+ this.page = page;
+ }
- /** {@inheritDoc} */
- @Override
- public void populateItem(Item<ICellPopulator<T>> cellItem, String componentId, IModel<T> rowModel) {
- cellItem.add(new Label(componentId,
- new DisplayEnumPropertyModel(rowModel.getObject(), propertyExpression, page)));
- }
+ /** {@inheritDoc} */
+ @Override
+ public void populateItem(Item<ICellPopulator<T>> cellItem, String componentId, IModel<T> rowModel) {
+ cellItem.add(new Label(componentId,
+ new DisplayEnumPropertyModel(rowModel.getObject(), propertyExpression, page)));
+ }
- @Override
+ @Override
public String getHeaderName() {
return getDisplayModel().getObject().toString();
}
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/columns/LinkPropertyColumn.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/columns/LinkPropertyColumn.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/columns/LinkPropertyColumn.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -41,138 +41,138 @@
*/
abstract public class LinkPropertyColumn<T> extends PropertyColumn<T> implements ExportableColumn<T>{
- /** Popup settings */
- private PopupSettings popupSettings;
+ /** Popup settings */
+ private PopupSettings popupSettings;
- /** Label model */
- private IModel<String> labelModel;
+ /** Label model */
+ private IModel<String> labelModel;
- /** Title displayed for the link */
- protected String linkTitle;
+ /** Title displayed for the link */
+ protected String linkTitle;
- /**
- * Constructor
- * @param displayModel Display model
- * @param sortProperty Sort property
- * @param propertyExpression Property expression
- * @param popupSettings Popup setting
- */
- public LinkPropertyColumn(IModel<String> displayModel, String sortProperty, String propertyExpression,
- PopupSettings popupSettings) {
- this(displayModel, sortProperty, propertyExpression);
- this.popupSettings = popupSettings;
- }
+ /**
+ * Constructor
+ * @param displayModel Display model
+ * @param sortProperty Sort property
+ * @param propertyExpression Property expression
+ * @param popupSettings Popup setting
+ */
+ public LinkPropertyColumn(IModel<String> displayModel, String sortProperty, String propertyExpression,
+ PopupSettings popupSettings) {
+ this(displayModel, sortProperty, propertyExpression);
+ this.popupSettings = popupSettings;
+ }
- /**
- * Constructor
- * @param displayModel Display model
- * @param sortProperty Sort property
- * @param propertyExpression Property expression
- * @param linkTitle Title displayed for the link
- */
- public LinkPropertyColumn(IModel<String> displayModel, String sortProperty, String propertyExpression,
- String linkTitle) {
- this(displayModel, sortProperty, propertyExpression);
- this.linkTitle = linkTitle;
- }
+ /**
+ * Constructor
+ * @param displayModel Display model
+ * @param sortProperty Sort property
+ * @param propertyExpression Property expression
+ * @param linkTitle Title displayed for the link
+ */
+ public LinkPropertyColumn(IModel<String> displayModel, String sortProperty, String propertyExpression,
+ String linkTitle) {
+ this(displayModel, sortProperty, propertyExpression);
+ this.linkTitle = linkTitle;
+ }
- /**
- * Constructor
- * @param displayModel Display model
- * @param sortProperty Sort property
- * @param propertyExpression Property expression
- * @param linkTitle Title displayed for the link
- * @param popupSettings Popup setting
- */
- public LinkPropertyColumn(IModel<String> displayModel, String sortProperty, String propertyExpression,
- String linkTitle, PopupSettings popupSettings) {
- this(displayModel, sortProperty, propertyExpression);
- this.linkTitle = linkTitle;
- this.popupSettings = popupSettings;
- }
+ /**
+ * Constructor
+ * @param displayModel Display model
+ * @param sortProperty Sort property
+ * @param propertyExpression Property expression
+ * @param linkTitle Title displayed for the link
+ * @param popupSettings Popup setting
+ */
+ public LinkPropertyColumn(IModel<String> displayModel, String sortProperty, String propertyExpression,
+ String linkTitle, PopupSettings popupSettings) {
+ this(displayModel, sortProperty, propertyExpression);
+ this.linkTitle = linkTitle;
+ this.popupSettings = popupSettings;
+ }
- /**
- * Constructor
- * @param displayModel Display model
- * @param labelModel Label model
- */
- public LinkPropertyColumn(IModel<String> displayModel, IModel<String> labelModel) {
- super(displayModel, null);
- this.labelModel = labelModel;
- }
+ /**
+ * Constructor
+ * @param displayModel Display model
+ * @param labelModel Label model
+ */
+ public LinkPropertyColumn(IModel<String> displayModel, IModel<String> labelModel) {
+ super(displayModel, null);
+ this.labelModel = labelModel;
+ }
- /**
- * Constructor
- * @param displayModel Display model
- * @param sortProperty Sort property
- * @param propertyExpression Property expression
- */
- public LinkPropertyColumn(IModel<String> displayModel, String sortProperty, String propertyExpression) {
- super(displayModel, sortProperty, propertyExpression);
- }
+ /**
+ * Constructor
+ * @param displayModel Display model
+ * @param sortProperty Sort property
+ * @param propertyExpression Property expression
+ */
+ public LinkPropertyColumn(IModel<String> displayModel, String sortProperty, String propertyExpression) {
+ super(displayModel, sortProperty, propertyExpression);
+ }
- /**
- * Constructor
- * @param displayModel Display model
- * @param propertyExpression Property expression
- */
- public LinkPropertyColumn(IModel<String> displayModel, String propertyExpression) {
- super(displayModel, propertyExpression);
- }
+ /**
+ * Constructor
+ * @param displayModel Display model
+ * @param propertyExpression Property expression
+ */
+ public LinkPropertyColumn(IModel<String> displayModel, String propertyExpression) {
+ super(displayModel, propertyExpression);
+ }
- /** {@inheritDoc} */
- @Override
- public void populateItem(Item<ICellPopulator<T>> item, String componentId, IModel<T> model) {
- item.add(new LinkPanel(item, componentId, model));
- }
+ /** {@inheritDoc} */
+ @Override
+ public void populateItem(Item<ICellPopulator<T>> item, String componentId, IModel<T> model) {
+ item.add(new LinkPanel(item, componentId, model));
+ }
- /**
- * Override this method to react to link clicks. Your own/internal row id will most likely be inside the model.
- * @param item Item
- * @param componentId Component id
- * @param model Model
- */
- public abstract void onClick(Item<ICellPopulator<T>> item, String componentId, IModel<T> model);
+ /**
+ * Override this method to react to link clicks. Your own/internal row id will most likely be inside the model.
+ * @param item Item
+ * @param componentId Component id
+ * @param model Model
+ */
+ public abstract void onClick(Item<ICellPopulator<T>> item, String componentId, IModel<T> model);
- /**
- * Panel which include a link. Used with the LinkPropertyColumn$LinkPanel.html file
- */
- public class LinkPanel extends Panel {
+ /**
+ * Panel which include a link. Used with the LinkPropertyColumn$LinkPanel.html file
+ */
+ public class LinkPanel extends Panel {
- /**
- * Constructor
- * @param item Item
- * @param componentId Component id
- * @param model Model
- */
- public LinkPanel(final Item<ICellPopulator<T>> item, final String componentId, final IModel<T> model) {
- super(componentId);
+ /**
+ * Constructor
+ * @param item Item
+ * @param componentId Component id
+ * @param model Model
+ */
+ public LinkPanel(final Item<ICellPopulator<T>> item, final String componentId, final IModel<T> model) {
+ super(componentId);
- Link<T> link = new Link<T>("link") {
+ Link<T> link = new Link<T>("link") {
- @Override
- public void onClick() {
- LinkPropertyColumn.this.onClick(item, componentId, model);
- }
- };
- link.setPopupSettings(popupSettings);
- if (linkTitle != null) {
- link.add(new AttributeModifier("title", new Model<String>(linkTitle)));
- }
+ @Override
+ public void onClick() {
+ LinkPropertyColumn.this.onClick(item, componentId, model);
+ }
+ };
+ link.setPopupSettings(popupSettings);
+ if (linkTitle != null) {
+ link.add(new AttributeModifier("title", new Model<String>(linkTitle)));
+ }
- add(link);
+ add(link);
- IModel<?> tmpLabelModel = labelModel;
+ IModel<?> tmpLabelModel = labelModel;
- if (labelModel == null) {
- tmpLabelModel = createLabelModel(model);
- }
+ if (labelModel == null) {
+ tmpLabelModel = createLabelModel(model);
+ }
- link.add(new Label("label", tmpLabelModel));
- }
- }
-
- @Override
+ link.add(new Label("label", tmpLabelModel));
+ }
+ }
+
+ @Override
public String getHeaderName() {
return getDisplayModel().getObject().toString();
}
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/columns/LinkableImagePropertyColumn.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/columns/LinkableImagePropertyColumn.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/columns/LinkableImagePropertyColumn.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -39,73 +39,73 @@
*/
abstract public class LinkableImagePropertyColumn<T> extends AbstractColumn<T> {
- /** Relative url for the image */
- private String imageSrc;
+ /** Relative url for the image */
+ private String imageSrc;
- /** Title displayed for the link */
- private String linkTitle;
+ /** Title displayed for the link */
+ private String linkTitle;
- /** Alternative message displayed when image can't be rendered */
- private String altMessage;
+ /** Alternative message displayed when image can't be rendered */
+ private String altMessage;
- /**
- * Constructor
- * @param imageSrc Relative url for the image
- * @param linkTitle Title displayed for the link
- * @param altMessage Alternative message displayed when image can't be rendered
- */
- public LinkableImagePropertyColumn(String imageSrc, String linkTitle, String altMessage) {
- super(new Model<String>());
- this.imageSrc = imageSrc;
- this.linkTitle = linkTitle;
- this.altMessage = altMessage;
- }
+ /**
+ * Constructor
+ * @param imageSrc Relative url for the image
+ * @param linkTitle Title displayed for the link
+ * @param altMessage Alternative message displayed when image can't be rendered
+ */
+ public LinkableImagePropertyColumn(String imageSrc, String linkTitle, String altMessage) {
+ super(new Model<String>());
+ this.imageSrc = imageSrc;
+ this.linkTitle = linkTitle;
+ this.altMessage = altMessage;
+ }
- /** {@inheritDoc} */
- @Override
- public void populateItem(Item<ICellPopulator<T>> item, String componentId, IModel<T> model) {
- item.add(new LinkableImagePanel(item, componentId, model));
- }
+ /** {@inheritDoc} */
+ @Override
+ public void populateItem(Item<ICellPopulator<T>> item, String componentId, IModel<T> model) {
+ item.add(new LinkableImagePanel(item, componentId, model));
+ }
- /**
- * Override this method to react to link clicks. Your own/internal row id will most likely be inside the model.
- * @param item Item
- * @param componentId Component id
- * @param model Model
- */
- public abstract void onClick(Item<ICellPopulator<T>> item, String componentId, IModel<T> model);
+ /**
+ * Override this method to react to link clicks. Your own/internal row id will most likely be inside the model.
+ * @param item Item
+ * @param componentId Component id
+ * @param model Model
+ */
+ public abstract void onClick(Item<ICellPopulator<T>> item, String componentId, IModel<T> model);
- /**
- * Panel which include a linkable image. Used with the LinkableImagePropertyColumn$LinkablePanel.html file
- */
- public class LinkableImagePanel extends Panel {
+ /**
+ * Panel which include a linkable image. Used with the LinkableImagePropertyColumn$LinkablePanel.html file
+ */
+ public class LinkableImagePanel extends Panel {
- /**
- * Constructor
- * @param item Item
- * @param componentId Component id
- * @param model Model
- */
- public LinkableImagePanel(final Item<ICellPopulator<T>> item, final String componentId, final IModel<T> model) {
- super(componentId);
+ /**
+ * Constructor
+ * @param item Item
+ * @param componentId Component id
+ * @param model Model
+ */
+ public LinkableImagePanel(final Item<ICellPopulator<T>> item, final String componentId, final IModel<T> model) {
+ super(componentId);
- Link<T> link = new Link<T>("link") {
+ Link<T> link = new Link<T>("link") {
- @Override
- public void onClick() {
- LinkableImagePropertyColumn.this.onClick(item, componentId, model);
- }
- };
- if (linkTitle != null) {
- link.add(new AttributeModifier("title", new Model<String>(linkTitle)));
- }
- ContextImage image = new ContextImage("image", new Model<String>(imageSrc));
- if (altMessage != null) {
- image.add(new AttributeModifier("alt", new Model<String>(altMessage)));
- }
- link.add(image);
+ @Override
+ public void onClick() {
+ LinkableImagePropertyColumn.this.onClick(item, componentId, model);
+ }
+ };
+ if (linkTitle != null) {
+ link.add(new AttributeModifier("title", new Model<String>(linkTitle)));
+ }
+ ContextImage image = new ContextImage("image", new Model<String>(imageSrc));
+ if (altMessage != null) {
+ image.add(new AttributeModifier("alt", new Model<String>(altMessage)));
+ }
+ link.add(image);
- add(link);
- }
- }
+ add(link);
+ }
+ }
}
\ No newline at end of file
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/columns/MapValuePropertyColumn.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/columns/MapValuePropertyColumn.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/columns/MapValuePropertyColumn.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -41,32 +41,32 @@
*/
public class MapValuePropertyColumn<T, U> extends AbstractColumn<T> implements ExportableColumn<T> {
- /** wicket property expression */
- private final String propertyExpression;
+ /** wicket property expression */
+ private final String propertyExpression;
- /** map */
- private final Map<U, String> map;
+ /** map */
+ private final Map<U, String> map;
- /**
- * Constructor
- * @param displayModel DisplayModel
- * @param sortProperty SortProperty
- * @param propertyExpression Wicket property expression
- * @param map Applying map
- */
- public MapValuePropertyColumn(IModel<String> displayModel, String sortProperty, String propertyExpression,
- Map<U, String> map) {
- super(displayModel, sortProperty);
- this.propertyExpression = propertyExpression;
- this.map = map;
- }
+ /**
+ * Constructor
+ * @param displayModel DisplayModel
+ * @param sortProperty SortProperty
+ * @param propertyExpression Wicket property expression
+ * @param map Applying map
+ */
+ public MapValuePropertyColumn(IModel<String> displayModel, String sortProperty, String propertyExpression,
+ Map<U, String> map) {
+ super(displayModel, sortProperty);
+ this.propertyExpression = propertyExpression;
+ this.map = map;
+ }
- /** {@inheritDoc} */
- @Override
- public void populateItem(Item<ICellPopulator<T>> cellItem, String componentId, IModel<T> rowModel) {
- cellItem.add(new Label(componentId, new DisplayMapValuePropertyModel<U>(rowModel.getObject(),
- propertyExpression, map)));
- }
+ /** {@inheritDoc} */
+ @Override
+ public void populateItem(Item<ICellPopulator<T>> cellItem, String componentId, IModel<T> rowModel) {
+ cellItem.add(new Label(componentId, new DisplayMapValuePropertyModel<U>(rowModel.getObject(),
+ propertyExpression, map)));
+ }
@Override
public String getHeaderName() {
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/columns/PercentPropertyColumn.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/columns/PercentPropertyColumn.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/columns/PercentPropertyColumn.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -39,31 +39,31 @@
*/
public class PercentPropertyColumn<T> extends AbstractColumn<T> {
- /** wicket property expression */
- private final String propertyExpression;
+ /** wicket property expression */
+ private final String propertyExpression;
- /** locale property */
- private final Locale locale;
+ /** locale property */
+ private final Locale locale;
- /**
- * Constructor
- * @param displayModel DisplayModel
- * @param sortProperty SortProperty
- * @param propertyExpression Wicket property expression
- * @param locale Locale used to format decimal
- */
- public PercentPropertyColumn(IModel<String> displayModel, String sortProperty, String propertyExpression,
- Locale locale) {
- super(displayModel, sortProperty);
- this.propertyExpression = propertyExpression;
- this.locale = locale;
- }
+ /**
+ * Constructor
+ * @param displayModel DisplayModel
+ * @param sortProperty SortProperty
+ * @param propertyExpression Wicket property expression
+ * @param locale Locale used to format decimal
+ */
+ public PercentPropertyColumn(IModel<String> displayModel, String sortProperty, String propertyExpression,
+ Locale locale) {
+ super(displayModel, sortProperty);
+ this.propertyExpression = propertyExpression;
+ this.locale = locale;
+ }
- /** {@inheritDoc} */
- @Override
- public void populateItem(Item<ICellPopulator<T>> cellItem, String componentId, IModel<T> rowModel) {
- cellItem.add(new Label(componentId, new DisplayPercentPropertyModel(rowModel.getObject(), propertyExpression,
- locale)));
- }
+ /** {@inheritDoc} */
+ @Override
+ public void populateItem(Item<ICellPopulator<T>> cellItem, String componentId, IModel<T> rowModel) {
+ cellItem.add(new Label(componentId, new DisplayPercentPropertyModel(rowModel.getObject(), propertyExpression,
+ locale)));
+ }
}
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/columns/ShortDatePropertyColumn.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/columns/ShortDatePropertyColumn.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/columns/ShortDatePropertyColumn.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -40,34 +40,34 @@
*/
public class ShortDatePropertyColumn<T> extends AbstractColumn<T> implements ExportableColumn<T> {
- /** wicket property expression */
- private final String propertyExpression;
+ /** wicket property expression */
+ private final String propertyExpression;
- /** locale property */
- private final Locale locale;
+ /** locale property */
+ private final Locale locale;
- /**
- * Constructor
- * @param displayModel DisplayModel
- * @param sortProperty SortProperty
- * @param propertyExpression Wicket property expression
- * @param locale Locale used to format decimal
- */
- public ShortDatePropertyColumn(IModel<String> displayModel, String sortProperty, String propertyExpression,
- Locale locale) {
- super(displayModel, sortProperty);
- this.propertyExpression = propertyExpression;
- this.locale = locale;
- }
+ /**
+ * Constructor
+ * @param displayModel DisplayModel
+ * @param sortProperty SortProperty
+ * @param propertyExpression Wicket property expression
+ * @param locale Locale used to format decimal
+ */
+ public ShortDatePropertyColumn(IModel<String> displayModel, String sortProperty, String propertyExpression,
+ Locale locale) {
+ super(displayModel, sortProperty);
+ this.propertyExpression = propertyExpression;
+ this.locale = locale;
+ }
- /** {@inheritDoc} */
- @Override
- public void populateItem(Item<ICellPopulator<T>> cellItem, String componentId, IModel<T> rowModel) {
- cellItem.add(new Label(componentId, new DisplayShortDatePropertyModel(rowModel.getObject(), propertyExpression,
- locale)));
- }
-
- @Override
+ /** {@inheritDoc} */
+ @Override
+ public void populateItem(Item<ICellPopulator<T>> cellItem, String componentId, IModel<T> rowModel) {
+ cellItem.add(new Label(componentId, new DisplayShortDatePropertyModel(rowModel.getObject(), propertyExpression,
+ locale)));
+ }
+
+ @Override
public String getHeaderName() {
return getDisplayModel().getObject().toString();
}
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/converters/BigDecimalConverterImpl.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/converters/BigDecimalConverterImpl.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/converters/BigDecimalConverterImpl.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -41,48 +41,48 @@
*/
public final class BigDecimalConverterImpl extends AbstractDecimalConverter<BigDecimal> {
- /** The minimum number of digits printed for the fraction portion of decimals **/
- public static final int DECIMAL_MIN_FRACTION_DIGIT = 0;
+ /** The minimum number of digits printed for the fraction portion of decimals **/
+ public static final int DECIMAL_MIN_FRACTION_DIGIT = 0;
- /** Logger */
- // private static final Log LOG = LogTools.getLog();
- /** The singleton instance for a big integer converter */
- public static final IConverter<BigDecimal> INSTANCE = new BigDecimalConverterImpl();
+ /** Logger */
+ // private static final Log LOG = LogTools.getLog();
+ /** The singleton instance for a big integer converter */
+ public static final IConverter<BigDecimal> INSTANCE = new BigDecimalConverterImpl();
- /** {@inheritDoc} */
- @Override
- public BigDecimal convertToObject(String value, Locale locale) {
- if (value == null || value.trim().equals("")) {
- return null;
- }
+ /** {@inheritDoc} */
+ @Override
+ public BigDecimal convertToObject(String value, Locale locale) {
+ if (value == null || value.trim().equals("")) {
+ return null;
+ }
- if (locale == null) {
- locale = Locale.getDefault();
- }
+ if (locale == null) {
+ locale = Locale.getDefault();
+ }
- try {
- return NumberTools.parseBigDecimal(value, locale, DataContext.DECIMAL_SCALE, DataContext.DECIMAL_PRECISION
- - DataContext.DECIMAL_SCALE);
- } catch (RuntimeException e) {
- throw new ConversionException(e);
- }
- }
+ try {
+ return NumberTools.parseBigDecimal(value, locale, DataContext.DECIMAL_SCALE, DataContext.DECIMAL_PRECISION
+ - DataContext.DECIMAL_SCALE);
+ } catch (RuntimeException e) {
+ throw new ConversionException(e);
+ }
+ }
- /** {@inheritDoc} */
- public String convertToString(final BigDecimal value, Locale locale) {
- try {
- return NumberTools.bigDecimalToString(value, locale, DECIMAL_MIN_FRACTION_DIGIT, DataContext.DECIMAL_SCALE,
- DataContext.DECIMAL_PRECISION - DataContext.DECIMAL_SCALE);
- } catch (RuntimeException e) {
- throw new ConversionException(e);
- }
- }
+ /** {@inheritDoc} */
+ public String convertToString(final BigDecimal value, Locale locale) {
+ try {
+ return NumberTools.bigDecimalToString(value, locale, DECIMAL_MIN_FRACTION_DIGIT, DataContext.DECIMAL_SCALE,
+ DataContext.DECIMAL_PRECISION - DataContext.DECIMAL_SCALE);
+ } catch (RuntimeException e) {
+ throw new ConversionException(e);
+ }
+ }
- /**
- * @see org.apache.wicket.util.convert.converter.AbstractConverter#getTargetType()
- */
- @Override
- protected Class<BigDecimal> getTargetType() {
- return BigDecimal.class;
- }
+ /**
+ * @see org.apache.wicket.util.convert.converter.AbstractConverter#getTargetType()
+ */
+ @Override
+ protected Class<BigDecimal> getTargetType() {
+ return BigDecimal.class;
+ }
}
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/converters/DoubleConverterImpl.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/converters/DoubleConverterImpl.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/converters/DoubleConverterImpl.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -37,49 +37,49 @@
*/
public final class DoubleConverterImpl extends AbstractDecimalConverter<Double> {
- /** The minimum number of digits printed for the fraction portion of decimals **/
- public static final int DECIMAL_MIN_FRACTION_DIGIT = 0;
+ /** The minimum number of digits printed for the fraction portion of decimals **/
+ public static final int DECIMAL_MIN_FRACTION_DIGIT = 0;
- /** Logger */
- // private static final Log LOG = LogTools.getLog();
- /** The singleton instance for a float converter */
- public static final IConverter<Double> INSTANCE = new DoubleConverterImpl();
+ /** Logger */
+ // private static final Log LOG = LogTools.getLog();
+ /** The singleton instance for a float converter */
+ public static final IConverter<Double> INSTANCE = new DoubleConverterImpl();
- /** {@inheritDoc} */
- @Override
- public Double convertToObject(String value, Locale locale) {
- if (value == null || value.trim().equals("")) {
- return null;
- }
+ /** {@inheritDoc} */
+ @Override
+ public Double convertToObject(String value, Locale locale) {
+ if (value == null || value.trim().equals("")) {
+ return null;
+ }
- if (locale == null) {
- locale = Locale.getDefault();
- }
+ if (locale == null) {
+ locale = Locale.getDefault();
+ }
- try {
- return NumberTools.parseDouble(value, locale, WebContext.DOUBLE_MAX_FRACTION_DIGIT);
- } catch (Exception e) {
- throw new ConversionException(e);
- }
- }
+ try {
+ return NumberTools.parseDouble(value, locale, WebContext.DOUBLE_MAX_FRACTION_DIGIT);
+ } catch (Exception e) {
+ throw new ConversionException(e);
+ }
+ }
- /** {@inheritDoc} */
- @Override
- public String convertToString(final Double value, Locale locale) {
- try {
- return NumberTools.doubleToString(value, locale, DECIMAL_MIN_FRACTION_DIGIT,
- WebContext.DOUBLE_MAX_FRACTION_DIGIT);
- } catch (Exception e) {
- throw new ConversionException(e);
- }
- }
+ /** {@inheritDoc} */
+ @Override
+ public String convertToString(final Double value, Locale locale) {
+ try {
+ return NumberTools.doubleToString(value, locale, DECIMAL_MIN_FRACTION_DIGIT,
+ WebContext.DOUBLE_MAX_FRACTION_DIGIT);
+ } catch (Exception e) {
+ throw new ConversionException(e);
+ }
+ }
- /**
- * @see org.apache.wicket.util.convert.converter.AbstractConverter#getTargetType()
- */
- @Override
- protected Class<Double> getTargetType() {
- return Double.class;
- }
+ /**
+ * @see org.apache.wicket.util.convert.converter.AbstractConverter#getTargetType()
+ */
+ @Override
+ protected Class<Double> getTargetType() {
+ return Double.class;
+ }
}
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/forms/AutoCompleteTextFieldString.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/forms/AutoCompleteTextFieldString.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/forms/AutoCompleteTextFieldString.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -47,110 +47,110 @@
*/
public class AutoCompleteTextFieldString extends AutoCompleteTextField<String> {
- /**
- * Comparison mode
- */
- public enum ComparisonMode {
- /** choice.contains(input) */
- CONTAINS,
- /** choice.endsWith(input) */
- ENDS_WITH,
- /** choice.equals(input) */
- EQUALS,
- /** choice.startsWith(input) */
- STARTS_WITH;
- }
+ /**
+ * Comparison mode
+ */
+ public enum ComparisonMode {
+ /** choice.contains(input) */
+ CONTAINS,
+ /** choice.endsWith(input) */
+ ENDS_WITH,
+ /** choice.equals(input) */
+ EQUALS,
+ /** choice.startsWith(input) */
+ STARTS_WITH;
+ }
- /**
- * String purge for comparison
- * @param string String
- * @return Purged string (trim, lower case, no accent)
- */
- private static String purgeString(String string) {
- return new StringTransformer(string).trimToNull().replaceAccents().toLowerCase().toString();
- }
+ /**
+ * String purge for comparison
+ * @param string String
+ * @return Purged string (trim, lower case, no accent)
+ */
+ private static String purgeString(String string) {
+ return new StringTransformer(string).trimToNull().replaceAccents().toLowerCase().toString();
+ }
- /** Choices (pairs of purge choice & choice) */
- private final List<Pair<String, String>> choices;
+ /** Choices (pairs of purge choice & choice) */
+ private final List<Pair<String, String>> choices;
- /** Max number of choices */
- private final int maxChoices;
+ /** Max number of choices */
+ private final int maxChoices;
- /** Min processing length */
- private final int minLength;
+ /** Min processing length */
+ private final int minLength;
- /** Comparison mode */
- private final ComparisonMode mode;
+ /** Comparison mode */
+ private final ComparisonMode mode;
- /**
- * Constructor
- * @param id ID
- * @param model Model
- * @param choices Choices
- * @param mode Comparison mode
- */
- public AutoCompleteTextFieldString(String id, IModel<String> model, List<String> choices, ComparisonMode mode) {
- this(id, model, choices, mode, 0, Integer.MAX_VALUE);
- }
+ /**
+ * Constructor
+ * @param id ID
+ * @param model Model
+ * @param choices Choices
+ * @param mode Comparison mode
+ */
+ public AutoCompleteTextFieldString(String id, IModel<String> model, List<String> choices, ComparisonMode mode) {
+ this(id, model, choices, mode, 0, Integer.MAX_VALUE);
+ }
- /**
- * Constructor
- * @param id ID
- * @param model Model
- * @param choices Choices
- * @param mode Comparison mode
- * @param minLength Min processing length (default 0)
- * @param maxChoices Max choices (default Integer.MAX_VALUE)
- */
- @SuppressWarnings("unchecked")
- public AutoCompleteTextFieldString(String id, IModel<String> model, List<String> choices, ComparisonMode mode,
- int minLength, int maxChoices) {
- super(id, model, StringAutoCompleteRenderer.INSTANCE);
- AssertTools.assertNotNull(choices);
- AssertTools.assertNotNull(mode);
- AssertTools.assertNotNegative(minLength);
- AssertTools.assertPositive(maxChoices);
- this.choices = new ArrayList<Pair<String, String>>();
- for (String choice : choices) {
- String purgeChoice = purgeString(choice);
- if (purgeChoice != null && purgeChoice.length() >= minLength) {
- this.choices.add(new Pair<String, String>(purgeChoice, choice));
- }
- }
- this.mode = mode;
- this.minLength = minLength;
- this.maxChoices = maxChoices;
- }
+ /**
+ * Constructor
+ * @param id ID
+ * @param model Model
+ * @param choices Choices
+ * @param mode Comparison mode
+ * @param minLength Min processing length (default 0)
+ * @param maxChoices Max choices (default Integer.MAX_VALUE)
+ */
+ @SuppressWarnings("unchecked")
+ public AutoCompleteTextFieldString(String id, IModel<String> model, List<String> choices, ComparisonMode mode,
+ int minLength, int maxChoices) {
+ super(id, model, StringAutoCompleteRenderer.INSTANCE);
+ AssertTools.assertNotNull(choices);
+ AssertTools.assertNotNull(mode);
+ AssertTools.assertNotNegative(minLength);
+ AssertTools.assertPositive(maxChoices);
+ this.choices = new ArrayList<Pair<String, String>>();
+ for (String choice : choices) {
+ String purgeChoice = purgeString(choice);
+ if (purgeChoice != null && purgeChoice.length() >= minLength) {
+ this.choices.add(new Pair<String, String>(purgeChoice, choice));
+ }
+ }
+ this.mode = mode;
+ this.minLength = minLength;
+ this.maxChoices = maxChoices;
+ }
- /** {@inheritDoc} */
- @Override
- protected Iterator<String> getChoices(String input) {
- TreeSet<String> choicesList = new TreeSet<String>();
- String purgeInput = purgeString(input);
- if (StringTools.length(purgeInput) >= minLength) {
- Iterator<Pair<String, String>> i = choices.iterator();
- while (i.hasNext() && choicesList.size() < maxChoices) {
- Pair<String, String> choice = i.next();
- if (mode == ComparisonMode.STARTS_WITH && choice.getKey().startsWith(purgeInput)
- || mode == ComparisonMode.CONTAINS && choice.getKey().contains(purgeInput)
- || mode == ComparisonMode.ENDS_WITH && choice.getKey().endsWith(purgeInput)
- || mode == ComparisonMode.EQUALS && choice.getKey().equals(purgeInput)) {
- choicesList.add(choice.getValue());
- }
- }
- }
- return choicesList.iterator();
- }
+ /** {@inheritDoc} */
+ @Override
+ protected Iterator<String> getChoices(String input) {
+ TreeSet<String> choicesList = new TreeSet<String>();
+ String purgeInput = purgeString(input);
+ if (StringTools.length(purgeInput) >= minLength) {
+ Iterator<Pair<String, String>> i = choices.iterator();
+ while (i.hasNext() && choicesList.size() < maxChoices) {
+ Pair<String, String> choice = i.next();
+ if (mode == ComparisonMode.STARTS_WITH && choice.getKey().startsWith(purgeInput)
+ || mode == ComparisonMode.CONTAINS && choice.getKey().contains(purgeInput)
+ || mode == ComparisonMode.ENDS_WITH && choice.getKey().endsWith(purgeInput)
+ || mode == ComparisonMode.EQUALS && choice.getKey().equals(purgeInput)) {
+ choicesList.add(choice.getValue());
+ }
+ }
+ }
+ return choicesList.iterator();
+ }
- /**
- * Add a choice at the suggestion list
- * @param choice The choice to add
- */
- public void addChoice(String choice) {
- String purgeChoice = purgeString(choice);
- if (purgeChoice != null && purgeChoice.length() >= minLength) {
- this.choices.add(new Pair<String, String>(purgeChoice, choice));
- }
- }
+ /**
+ * Add a choice at the suggestion list
+ * @param choice The choice to add
+ */
+ public void addChoice(String choice) {
+ String purgeChoice = purgeString(choice);
+ if (purgeChoice != null && purgeChoice.length() >= minLength) {
+ this.choices.add(new Pair<String, String>(purgeChoice, choice));
+ }
+ }
}
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/forms/SubmittableButton.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/forms/SubmittableButton.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/forms/SubmittableButton.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -36,74 +36,74 @@
*/
public final class SubmittableButton extends Button {
- /** Logger */
- private static final Log LOG = LogTools.getLog();
+ /** Logger */
+ private static final Log LOG = LogTools.getLog();
- /** Submittable */
- private final SubmittableButtonEvents submittable;
+ /** Submittable */
+ private final SubmittableButtonEvents submittable;
- /** Specific page which provide error messages, null if none */
- private Class<? extends TemplatePage> specificMsgPage = null;
+ /** Specific page which provide error messages, null if none */
+ private Class<? extends TemplatePage> specificMsgPage = null;
- /**
- * Constructor
- * @param id ID
- * @param submittable Submittable
- * @param specificMsgPage Page wich provide error messages
- */
- public SubmittableButton(String id, Class<? extends TemplatePage> specificMsgPage,
- SubmittableButtonEvents submittable) {
- super(id);
- this.submittable = submittable;
- this.specificMsgPage = specificMsgPage;
- }
+ /**
+ * Constructor
+ * @param id ID
+ * @param submittable Submittable
+ * @param specificMsgPage Page wich provide error messages
+ */
+ public SubmittableButton(String id, Class<? extends TemplatePage> specificMsgPage,
+ SubmittableButtonEvents submittable) {
+ super(id);
+ this.submittable = submittable;
+ this.specificMsgPage = specificMsgPage;
+ }
- /**
- * Constructor
- * @param id ID
- * @param model Model
- * @param submittable Submittable
- */
- public SubmittableButton(String id, IModel<String> model, SubmittableButtonEvents submittable) {
- super(id, model);
- this.submittable = submittable;
- }
+ /**
+ * Constructor
+ * @param id ID
+ * @param model Model
+ * @param submittable Submittable
+ */
+ public SubmittableButton(String id, IModel<String> model, SubmittableButtonEvents submittable) {
+ super(id, model);
+ this.submittable = submittable;
+ }
- /**
- * Constructor
- * @param id ID
- * @param submittable Submittable
- */
- public SubmittableButton(String id, SubmittableButtonEvents submittable) {
- super(id);
- this.submittable = submittable;
- }
+ /**
+ * Constructor
+ * @param id ID
+ * @param submittable Submittable
+ */
+ public SubmittableButton(String id, SubmittableButtonEvents submittable) {
+ super(id);
+ this.submittable = submittable;
+ }
- /** {@inheritDoc} */
- @Override
- public void onSubmit() {
- submittable.onValidate();
+ /** {@inheritDoc} */
+ @Override
+ public void onSubmit() {
+ submittable.onValidate();
- if (!getPage().hasErrorMessage()) {
- try {
- submittable.onProcess();
- } catch (UnexpectedException e) {
- throw e;
- } catch (RuntimeException e) {
- LOG.error(e.getMessage(), e);
- throw e;
- } catch (Exception e) {
- if (specificMsgPage == null) {
- ((TemplatePage) getPage()).errorCurrentPage(getId(), e);
- } else {
- ((TemplatePage) getPage()).errorCurrentPage(specificMsgPage, getId(), e);
- }
- }
- }
- if (getPage().hasErrorMessage()) {
- submittable.onError();
- } else {
- submittable.onSuccess();
- }
- }
+ if (!getPage().hasErrorMessage()) {
+ try {
+ submittable.onProcess();
+ } catch (UnexpectedException e) {
+ throw e;
+ } catch (RuntimeException e) {
+ LOG.error(e.getMessage(), e);
+ throw e;
+ } catch (Exception e) {
+ if (specificMsgPage == null) {
+ ((TemplatePage) getPage()).errorCurrentPage(getId(), e);
+ } else {
+ ((TemplatePage) getPage()).errorCurrentPage(specificMsgPage, getId(), e);
+ }
+ }
+ }
+ if (getPage().hasErrorMessage()) {
+ submittable.onError();
+ } else {
+ submittable.onSuccess();
+ }
+ }
}
\ No newline at end of file
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/forms/SubmittableButtonEvents.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/forms/SubmittableButtonEvents.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/forms/SubmittableButtonEvents.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -32,28 +32,28 @@
*/
public abstract class SubmittableButtonEvents implements Serializable {
- /**
- * (3) Action to perform on process error. For example, reset some form fields.
- */
- public void onError() {
- // Nothing to do (by default)
- }
+ /**
+ * (3) Action to perform on process error. For example, reset some form fields.
+ */
+ public void onError() {
+ // Nothing to do (by default)
+ }
- /**
- * (2) Process the form goal. For example, call the related service method.
- * @throws AbstractException if an error occured
- */
- public abstract void onProcess() throws AbstractException;
+ /**
+ * (2) Process the form goal. For example, call the related service method.
+ * @throws AbstractException if an error occured
+ */
+ public abstract void onProcess() throws AbstractException;
- /**
- * (3) Action to perform on process success. For example, redirect and display a success message.
- */
- public abstract void onSuccess();
+ /**
+ * (3) Action to perform on process success. For example, redirect and display a success message.
+ */
+ public abstract void onSuccess();
- /**
- * (1) Action to perform on validate. For example, validate the form model.
- */
- public void onValidate() {
- // Nothing to do (by default)
- }
+ /**
+ * (1) Action to perform on validate. For example, validate the form model.
+ */
+ public void onValidate() {
+ // Nothing to do (by default)
+ }
}
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/models/DisplayBooleanPropertyModel.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/models/DisplayBooleanPropertyModel.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/models/DisplayBooleanPropertyModel.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -32,44 +32,44 @@
*/
public class DisplayBooleanPropertyModel extends PropertyModel<Object> {
- /** page */
- private final TemplatePage page;
+ /** page */
+ private final TemplatePage page;
- /** true string */
- private static final String TRUE_KEY = "Boolean.true";
- /** false string */
- private static final String FALSE_KEY = "Boolean.false";
+ /** true string */
+ private static final String TRUE_KEY = "Boolean.true";
+ /** false string */
+ private static final String FALSE_KEY = "Boolean.false";
- /**
- * Constructor
- * @param modelObject mo
- * @param expression e
- * @param page p
- */
- public DisplayBooleanPropertyModel(Object modelObject, String expression, TemplatePage page) {
- super(modelObject, expression);
- this.page = page;
- }
+ /**
+ * Constructor
+ * @param modelObject mo
+ * @param expression e
+ * @param page p
+ */
+ public DisplayBooleanPropertyModel(Object modelObject, String expression, TemplatePage page) {
+ super(modelObject, expression);
+ this.page = page;
+ }
- /** {@inheritDoc} */
- @Override
- public String getObject() {
- return booleanValueMessage((Boolean) super.getObject());
- }
+ /** {@inheritDoc} */
+ @Override
+ public String getObject() {
+ return booleanValueMessage((Boolean) super.getObject());
+ }
- /**
- * Retrieve a boolean value message. Null-safe methode
- * @param boolValue The boolean value
- * @return The associated message, null if the Boolean is null
- */
- private final String booleanValueMessage(Boolean boolValue) {
- if (boolValue == null) {
- return null;
- }
- if (boolValue) {
- return page.getString(TRUE_KEY);
- } else {
- return page.getString(FALSE_KEY);
- }
- }
+ /**
+ * Retrieve a boolean value message. Null-safe methode
+ * @param boolValue The boolean value
+ * @return The associated message, null if the Boolean is null
+ */
+ private final String booleanValueMessage(Boolean boolValue) {
+ if (boolValue == null) {
+ return null;
+ }
+ if (boolValue) {
+ return page.getString(TRUE_KEY);
+ } else {
+ return page.getString(FALSE_KEY);
+ }
+ }
}
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/models/DisplayDecimalPropertyModel.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/models/DisplayDecimalPropertyModel.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/models/DisplayDecimalPropertyModel.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -36,72 +36,72 @@
*/
public class DisplayDecimalPropertyModel extends PropertyModel<Object> {
- /** Format to display decimal */
- public enum DecimalDisplFormat {
- /** Small format, use the NB_DECIMAL_SMALL_FORMAT defined in the class **/
- SMALL,
- /** Large format, use the max number of decimal configured in the application **/
- LARGE
- }
+ /** Format to display decimal */
+ public enum DecimalDisplFormat {
+ /** Small format, use the NB_DECIMAL_SMALL_FORMAT defined in the class **/
+ SMALL,
+ /** Large format, use the max number of decimal configured in the application **/
+ LARGE
+ }
- /** Number of decimal displayed for small number **/
- private int NB_DECIMAL_SMALL = 2;
+ /** Number of decimal displayed for small number **/
+ private int NB_DECIMAL_SMALL = 2;
- /** locale property */
- private Locale locale;
+ /** locale property */
+ private Locale locale;
- /** format to display **/
- private DecimalDisplFormat format;
+ /** format to display **/
+ private DecimalDisplFormat format;
- /**
- * Constructor
- * @param modelObject modelObject
- * @param expression expression
- * @param format format
- * @param locale locale
- */
- public DisplayDecimalPropertyModel(Object modelObject, String expression, DecimalDisplFormat format, Locale locale) {
- super(modelObject, expression);
- this.format = format;
- this.locale = locale;
- }
+ /**
+ * Constructor
+ * @param modelObject modelObject
+ * @param expression expression
+ * @param format format
+ * @param locale locale
+ */
+ public DisplayDecimalPropertyModel(Object modelObject, String expression, DecimalDisplFormat format, Locale locale) {
+ super(modelObject, expression);
+ this.format = format;
+ this.locale = locale;
+ }
- /** {@inheritDoc} */
- @Override
- public Object getObject() {
- return formatDecimalValue((Number) super.getObject());
- }
+ /** {@inheritDoc} */
+ @Override
+ public Object getObject() {
+ return formatDecimalValue((Number) super.getObject());
+ }
- /**
- * Get the format for decimals
- * @return the format
- */
- private final NumberFormat getDecimalFormat() {
- int numberOfDec = format == DecimalDisplFormat.SMALL ? NB_DECIMAL_SMALL : DataContext.DECIMAL_SCALE;
+ /**
+ * Get the format for decimals
+ * @return the format
+ */
+ private final NumberFormat getDecimalFormat() {
+ int numberOfDec = format == DecimalDisplFormat.SMALL ? NB_DECIMAL_SMALL : DataContext.DECIMAL_SCALE;
- NumberFormat fmt = NumberFormat.getNumberInstance(locale);
+ NumberFormat fmt = NumberFormat.getNumberInstance(locale);
- fmt.setMaximumIntegerDigits(DataContext.DECIMAL_PRECISION - DataContext.DECIMAL_SCALE);
+ fmt.setMaximumIntegerDigits(DataContext.DECIMAL_PRECISION - DataContext.DECIMAL_SCALE);
- fmt.setMaximumFractionDigits(numberOfDec);
- // affichage obligatoire des chiffres après la virgule
- fmt.setMinimumFractionDigits(numberOfDec);
+ fmt.setMaximumFractionDigits(numberOfDec);
+ // affichage obligatoire des chiffres après la virgule
+ fmt.setMinimumFractionDigits(numberOfDec);
- fmt.setRoundingMode(RoundingMode.HALF_UP);
+ fmt.setRoundingMode(RoundingMode.HALF_UP);
- return fmt;
- }
+ return fmt;
+ }
- /**
- * Retrieve a decimal in the appropriate format. Null-safe methode
- * @param decimalValue The decimal value
- * @return The string who represent the decimal value, null if the decimal value is null
- */
- private final String formatDecimalValue(Number decimalValue) {
- if (decimalValue == null) {
- return null;
- }
- return getDecimalFormat().format(decimalValue);
- }
+ /**
+ * Retrieve a decimal in the appropriate format. Null-safe methode
+ * @param decimalValue The decimal value
+ * @return The string who represent the decimal value, null if the decimal value is null
+ */
+ private final String formatDecimalValue(Number decimalValue) {
+ if (decimalValue == null) {
+ return null;
+ }
+ return getDecimalFormat().format(decimalValue);
+ }
}
\ No newline at end of file
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/models/DisplayEnumPropertyModel.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/models/DisplayEnumPropertyModel.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/models/DisplayEnumPropertyModel.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -32,44 +32,44 @@
*/
public class DisplayEnumPropertyModel extends PropertyModel<Object> {
- /** pattern */
- final String pattern;
+ /** pattern */
+ final String pattern;
- /** page */
- final TemplatePage page;
+ /** page */
+ final TemplatePage page;
- /**
- * Constructor
- * @param modelObject mo
- * @param expression e
- * @param page p
- */
- public DisplayEnumPropertyModel(Object modelObject, String expression, TemplatePage page) {
- super(modelObject, expression);
- this.pattern = TemplatePage.PATTERN_ENUM_VALUE_LABEL;
- this.page = page;
- }
+ /**
+ * Constructor
+ * @param modelObject mo
+ * @param expression e
+ * @param page p
+ */
+ public DisplayEnumPropertyModel(Object modelObject, String expression, TemplatePage page) {
+ super(modelObject, expression);
+ this.pattern = TemplatePage.PATTERN_ENUM_VALUE_LABEL;
+ this.page = page;
+ }
- /**
- * {@inheritDoc}
- * @return the enum value
- */
- @Override
- public String getObject() {
- return enumValueMessage(super.getObject());
- }
+ /**
+ * {@inheritDoc}
+ * @return the enum value
+ */
+ @Override
+ public String getObject() {
+ return enumValueMessage(super.getObject());
+ }
- /**
- * Retrieve an enum value message (class.value). Null-safe methode
- * @param <E> Enum type
- * @param enumValue Enum value, null is the enumValue is null
- * @return Enum value message
- */
- private final <E extends Enum<?>> String enumValueMessage(Object enumValue) {
- if (enumValue == null) {
- return null;
- }
- String enumValueMessage = String.format(pattern, enumValue.getClass().getSimpleName(), enumValue.toString());
- return page.getString(enumValueMessage);
- }
+ /**
+ * Retrieve an enum value message (class.value). Null-safe methode
+ * @param <E> Enum type
+ * @param enumValue Enum value, null is the enumValue is null
+ * @return Enum value message
+ */
+ private final <E extends Enum<?>> String enumValueMessage(Object enumValue) {
+ if (enumValue == null) {
+ return null;
+ }
+ String enumValueMessage = String.format(pattern, enumValue.getClass().getSimpleName(), enumValue.toString());
+ return page.getString(enumValueMessage);
+ }
}
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/models/DisplayMapValuePropertyModel.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/models/DisplayMapValuePropertyModel.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/models/DisplayMapValuePropertyModel.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -34,24 +34,24 @@
*/
public class DisplayMapValuePropertyModel<T> extends PropertyModel<Object> {
- /** map */
- private final Map<T, String> map;
+ /** map */
+ private final Map<T, String> map;
- /**
- * Constructor
- * @param modelObject Model object
- * @param expression Expression to reach property model
- * @param map Applying map
- */
- public DisplayMapValuePropertyModel(Object modelObject, String expression, Map<T, String> map) {
- super(modelObject, expression);
- this.map = map;
- }
+ /**
+ * Constructor
+ * @param modelObject Model object
+ * @param expression Expression to reach property model
+ * @param map Applying map
+ */
+ public DisplayMapValuePropertyModel(Object modelObject, String expression, Map<T, String> map) {
+ super(modelObject, expression);
+ this.map = map;
+ }
- /** {@inheritDoc} */
- @Override
- public String getObject() {
- return map.get(super.getObject());
- }
+ /** {@inheritDoc} */
+ @Override
+ public String getObject() {
+ return map.get(super.getObject());
+ }
}
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/models/DisplayPercentPropertyModel.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/models/DisplayPercentPropertyModel.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/models/DisplayPercentPropertyModel.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -36,47 +36,47 @@
*/
public class DisplayPercentPropertyModel extends PropertyModel<Object> {
- /** locale */
- private final Locale locale;
+ /** locale */
+ private final Locale locale;
- /**
- * Constructor
- * @param modelObject mo
- * @param expression e
- * @param locale locale
- */
- public DisplayPercentPropertyModel(Object modelObject, String expression, Locale locale) {
- super(modelObject, expression);
- this.locale = locale;
- }
+ /**
+ * Constructor
+ * @param modelObject mo
+ * @param expression e
+ * @param locale locale
+ */
+ public DisplayPercentPropertyModel(Object modelObject, String expression, Locale locale) {
+ super(modelObject, expression);
+ this.locale = locale;
+ }
- /** {@inheritDoc} */
- @Override
- public String getObject() {
- return formatPercentValue((Number) super.getObject());
- }
+ /** {@inheritDoc} */
+ @Override
+ public String getObject() {
+ return formatPercentValue((Number) super.getObject());
+ }
- /**
- * Retrieve a purcent in the appropriate format. Null-safe methode
- * @param percentValue The purcentValue
- * @return The string who represent the purcent, null if the purcent value is null
- */
- private final String formatPercentValue(Number percentValue) {
- if (percentValue == null) {
- return null;
- }
- return this.getPercentFormat().format(percentValue);
- }
+ /**
+ * Retrieve a purcent in the appropriate format. Null-safe methode
+ * @param percentValue The purcentValue
+ * @return The string who represent the purcent, null if the purcent value is null
+ */
+ private final String formatPercentValue(Number percentValue) {
+ if (percentValue == null) {
+ return null;
+ }
+ return this.getPercentFormat().format(percentValue);
+ }
- /**
- * Get the format for purcents
- * @return the format
- */
- private final NumberFormat getPercentFormat() {
- // pourcents with two digits after the point
- NumberFormat percentFormat = NumberFormat.getPercentInstance(locale);
- percentFormat.setMaximumFractionDigits(WebContext.PERCENT_PRECISION);
- return percentFormat;
- }
+ /**
+ * Get the format for purcents
+ * @return the format
+ */
+ private final NumberFormat getPercentFormat() {
+ // pourcents with two digits after the point
+ NumberFormat percentFormat = NumberFormat.getPercentInstance(locale);
+ percentFormat.setMaximumFractionDigits(WebContext.PERCENT_PRECISION);
+ return percentFormat;
+ }
}
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/models/DisplayShortDatePropertyModel.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/models/DisplayShortDatePropertyModel.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/models/DisplayShortDatePropertyModel.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -34,44 +34,44 @@
*/
public class DisplayShortDatePropertyModel extends PropertyModel<Object> {
- /** locale */
- private final Locale locale;
+ /** locale */
+ private final Locale locale;
- /**
- * Constructor
- * @param modelObject mo
- * @param expression e
- * @param locale l
- */
- public DisplayShortDatePropertyModel(Object modelObject, String expression, Locale locale) {
- super(modelObject, expression);
- this.locale = locale;
- }
+ /**
+ * Constructor
+ * @param modelObject mo
+ * @param expression e
+ * @param locale l
+ */
+ public DisplayShortDatePropertyModel(Object modelObject, String expression, Locale locale) {
+ super(modelObject, expression);
+ this.locale = locale;
+ }
- /** {@inheritDoc} */
- @Override
- public String getObject() {
- return formatShortDateValue((Date) super.getObject());
- }
+ /** {@inheritDoc} */
+ @Override
+ public String getObject() {
+ return formatShortDateValue((Date) super.getObject());
+ }
- /**
- * Retrieve a date in the appropriate format. Null-safe methode
- * @param dateValue The date (year, month, day only)
- * @return The string who represent the date, null if the date is null
- */
- private final String formatShortDateValue(Date dateValue) {
- if (dateValue == null) {
- return null;
- }
- return getShortDateFormat().format(dateValue);
- }
+ /**
+ * Retrieve a date in the appropriate format. Null-safe methode
+ * @param dateValue The date (year, month, day only)
+ * @return The string who represent the date, null if the date is null
+ */
+ private final String formatShortDateValue(Date dateValue) {
+ if (dateValue == null) {
+ return null;
+ }
+ return getShortDateFormat().format(dateValue);
+ }
- /**
- * Get the format for short date
- * @return the format
- */
- private final DateFormat getShortDateFormat() {
- return DateFormat.getDateInstance(DateFormat.SHORT, locale);
- }
+ /**
+ * Get the format for short date
+ * @return the format
+ */
+ private final DateFormat getShortDateFormat() {
+ return DateFormat.getDateInstance(DateFormat.SHORT, locale);
+ }
}
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/models/GenericLoadableDetachableModel.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/models/GenericLoadableDetachableModel.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/models/GenericLoadableDetachableModel.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -44,52 +44,52 @@
*/
public final class GenericLoadableDetachableModel<M extends AbstractModel> extends LoadableDetachableModel<M> {
- /** Logger */
- private static final Log LOG = LogTools.getLog();
+ /** Logger */
+ private static final Log LOG = LogTools.getLog();
- /** DAO */
- @SpringBean
- private GenericDao dao;
+ /** DAO */
+ @SpringBean
+ private GenericDao dao;
- /** Model class */
- private final Class<M> modelClass;
+ /** Model class */
+ private final Class<M> modelClass;
- /** Model ID */
- private final Serializable modelID;
+ /** Model ID */
+ private final Serializable modelID;
- /**
- * Constructor
- * @param modelClass Model class
- * @param modelID Model ID
- */
- public GenericLoadableDetachableModel(Class<M> modelClass, Serializable modelID) {
- AssertTools.assertNotNull(modelClass);
- AssertTools.assertNotNull(modelID);
- this.modelClass = modelClass;
- this.modelID = modelID;
- WebApplicationImpl.injectSpringBeans(this);
- }
+ /**
+ * Constructor
+ * @param modelClass Model class
+ * @param modelID Model ID
+ */
+ public GenericLoadableDetachableModel(Class<M> modelClass, Serializable modelID) {
+ AssertTools.assertNotNull(modelClass);
+ AssertTools.assertNotNull(modelID);
+ this.modelClass = modelClass;
+ this.modelID = modelID;
+ WebApplicationImpl.injectSpringBeans(this);
+ }
- /**
- * Constructor
- * @param model Model
- */
- @SuppressWarnings("unchecked")
- public GenericLoadableDetachableModel(M model) {
- this((Class<M>) model.getClass(), model.getIdValue());
- setObject(model);
- }
+ /**
+ * Constructor
+ * @param model Model
+ */
+ @SuppressWarnings("unchecked")
+ public GenericLoadableDetachableModel(M model) {
+ this((Class<M>) model.getClass(), model.getIdValue());
+ setObject(model);
+ }
- /** {@inheritDoc} */
- @Override
- protected M load() {
- try {
- // LOG.debug("chargement LOAD, " + modelClass + "- id : " + modelID);
- return dao.read(modelClass, modelID);
- } catch (Exception e) {
- LOG.error(e.getMessage(), e);
- throw new UnexpectedException(e);
- }
- }
+ /** {@inheritDoc} */
+ @Override
+ protected M load() {
+ try {
+ // LOG.debug("chargement LOAD, " + modelClass + "- id : " + modelID);
+ return dao.read(modelClass, modelID);
+ } catch (Exception e) {
+ LOG.error(e.getMessage(), e);
+ throw new UnexpectedException(e);
+ }
+ }
}
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/models/LoadableDetachableSortableListDataProvider.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/models/LoadableDetachableSortableListDataProvider.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/models/LoadableDetachableSortableListDataProvider.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -52,105 +52,105 @@
*/
public final class LoadableDetachableSortableListDataProvider<M extends AbstractModel> extends SortableDataProvider<M> {
- /** Logger */
- private static final Log LOG = LogTools.getLog();
+ /** Logger */
+ private static final Log LOG = LogTools.getLog();
- /** Comparator */
- private final Comparator<Object> comparator;
+ /** Comparator */
+ private final Comparator<Object> comparator;
- /** Data list */
- // TODO penser à remettre "transient" à la liste
- private List<M> list;
+ /** Data list */
+ // TODO penser à remettre "transient" à la liste
+ private List<M> list;
- /** Locale */
- private final Locale locale;
+ /** Locale */
+ private final Locale locale;
- /** To recognize a special sort by codePays */
- final static String CODE_PAYS_PROPERTY = "codePays";
+ /** To recognize a special sort by codePays */
+ final static String CODE_PAYS_PROPERTY = "codePays";
- /** Current filter to select results */
- // private FilterMapHomeMade filter;
- /**
- * Constructor
- * @param list List
- * @param locale Locale
- */
- @SuppressWarnings("unchecked")
- public LoadableDetachableSortableListDataProvider(List<M> list, Locale locale) {
- AssertTools.assertNotNull(list);
- AssertTools.assertIn(locale, DataContext.LOCALES);
- this.list = list;
- this.locale = locale;
- comparator = new NullComparator(true);
- }
+ /** Current filter to select results */
+ // private FilterMapHomeMade filter;
+ /**
+ * Constructor
+ * @param list List
+ * @param locale Locale
+ */
+ @SuppressWarnings("unchecked")
+ public LoadableDetachableSortableListDataProvider(List<M> list, Locale locale) {
+ AssertTools.assertNotNull(list);
+ AssertTools.assertIn(locale, DataContext.LOCALES);
+ this.list = list;
+ this.locale = locale;
+ comparator = new NullComparator(true);
+ }
- /** {@inheritDoc} */
- @Override
- public Iterator<? extends M> iterator(int first, int count) {
+ /** {@inheritDoc} */
+ @Override
+ public Iterator<? extends M> iterator(int first, int count) {
- if (getSort() != null && !StringUtils.isEmpty(getSort().getProperty())) {
- Collections.sort(list, new Comparator<M>() {
- @Override
- public int compare(M o1, M o2) {
- try {
- Comparable<? extends Object> c1;
- Object c2;
- c1 = GenericsTools.cast(BeanTools.getValueFromPath(o1, AccessType.GETTER, getSort()
- .getProperty()));
+ if (getSort() != null && !StringUtils.isEmpty(getSort().getProperty())) {
+ Collections.sort(list, new Comparator<M>() {
+ @Override
+ public int compare(M o1, M o2) {
+ try {
+ Comparable<? extends Object> c1;
+ Object c2;
+ c1 = GenericsTools.cast(BeanTools.getValueFromPath(o1, AccessType.GETTER, getSort()
+ .getProperty()));
- c2 = GenericsTools.cast(BeanTools.getValueFromPath(o2, AccessType.GETTER, getSort()
- .getProperty()));
+ c2 = GenericsTools.cast(BeanTools.getValueFromPath(o2, AccessType.GETTER, getSort()
+ .getProperty()));
- // Exceptions
- // Countries are sorted by country name, not by country code
- if (getSort().getProperty().endsWith(CODE_PAYS_PROPERTY)) {
- if (c1 != null) {
- c1 = WebContext.COUNTRIES.get(locale).get(c1);
- }
- if (c2 != null) {
- c2 = WebContext.COUNTRIES.get(locale).get(c2);
- }
- }
+ // Exceptions
+ // Countries are sorted by country name, not by country code
+ if (getSort().getProperty().endsWith(CODE_PAYS_PROPERTY)) {
+ if (c1 != null) {
+ c1 = WebContext.COUNTRIES.get(locale).get(c1);
+ }
+ if (c2 != null) {
+ c2 = WebContext.COUNTRIES.get(locale).get(c2);
+ }
+ }
- return (getSort().isAscending() ? 1 : -1) * comparator.compare(c1, c2);
- } catch (Exception e) {
- LOG.error(e.getMessage(), e);
- throw new UnexpectedException(e);
- }
- }
- });
- }
+ return (getSort().isAscending() ? 1 : -1) * comparator.compare(c1, c2);
+ } catch (Exception e) {
+ LOG.error(e.getMessage(), e);
+ throw new UnexpectedException(e);
+ }
+ }
+ });
+ }
- return list.subList(first, Math.min(first + count, size())).iterator();
- }
+ return list.subList(first, Math.min(first + count, size())).iterator();
+ }
- /** {@inheritDoc} */
- @Override
- public GenericLoadableDetachableModel<M> model(M object) {
- // return new Model<M>(object);
- return new GenericLoadableDetachableModel<M>(object);
- }
+ /** {@inheritDoc} */
+ @Override
+ public GenericLoadableDetachableModel<M> model(M object) {
+ // return new Model<M>(object);
+ return new GenericLoadableDetachableModel<M>(object);
+ }
- /** {@inheritDoc} */
- @Override
- public int size() {
- return list.size();
- }
+ /** {@inheritDoc} */
+ @Override
+ public int size() {
+ return list.size();
+ }
- /**
- * list getter
- * @return list
- */
- public List<M> getList() {
- return list;
- }
+ /**
+ * list getter
+ * @return list
+ */
+ public List<M> getList() {
+ return list;
+ }
- /**
- * list setter
- * @param list list
- */
- public void setList(List<M> list) {
- this.list = list;
- }
+ /**
+ * list setter
+ * @param list list
+ */
+ public void setList(List<M> list) {
+ this.list = list;
+ }
}
\ No newline at end of file
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/panels/CollapsiblePanel.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/panels/CollapsiblePanel.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/panels/CollapsiblePanel.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -37,63 +37,63 @@
*/
public abstract class CollapsiblePanel extends Panel {
- /** Reference for the expand image */
- private PackageResourceReference closed = new PackageResourceReference(CollapsiblePanel.class, "expand.png");
+ /** Reference for the expand image */
+ private PackageResourceReference closed = new PackageResourceReference(CollapsiblePanel.class, "expand.png");
- /** Reference for the collapse image */
- private PackageResourceReference open = new PackageResourceReference(CollapsiblePanel.class, "collapse.png");
+ /** Reference for the collapse image */
+ private PackageResourceReference open = new PackageResourceReference(CollapsiblePanel.class, "collapse.png");
- /** Does the panel is visible ? */
- private boolean visible = false;
+ /** Does the panel is visible ? */
+ private boolean visible = false;
- /** The panel which is showed/hid */
- protected Panel innerPanel;
+ /** The panel which is showed/hid */
+ protected Panel innerPanel;
- /**
- * Construct the panel
- * @param id Panel ID
- * @param titleModel Model used to get the panel title
- * @param defaultOpen Is the default state open
- */
- public CollapsiblePanel(String id, IModel<String> titleModel, boolean defaultOpen) {
- super(id);
- this.visible = defaultOpen;
- innerPanel = getInnerPanel("innerPanel");
- innerPanel.setVisible(visible);
- innerPanel.setOutputMarkupId(true);
- innerPanel.setOutputMarkupPlaceholderTag(true);
- add(innerPanel);
+ /**
+ * Construct the panel
+ * @param id Panel ID
+ * @param titleModel Model used to get the panel title
+ * @param defaultOpen Is the default state open
+ */
+ public CollapsiblePanel(String id, IModel<String> titleModel, boolean defaultOpen) {
+ super(id);
+ this.visible = defaultOpen;
+ innerPanel = getInnerPanel("innerPanel");
+ innerPanel.setVisible(visible);
+ innerPanel.setOutputMarkupId(true);
+ innerPanel.setOutputMarkupPlaceholderTag(true);
+ add(innerPanel);
- final Image showHideImage = new Image("showHideIcon") {
- private static final long serialVersionUID = 8638737301579767296L;
+ final Image showHideImage = new Image("showHideIcon") {
+ private static final long serialVersionUID = 8638737301579767296L;
- @Override
- public ResourceReference getImageResourceReference() {
- return visible ? open : closed;
- }
- };
- showHideImage.setOutputMarkupId(true);
- IndicatingAjaxLink<Void> showHideLink = new IndicatingAjaxLink<Void>("showHideLink") {
- private static final long serialVersionUID = -1929927616508773911L;
+ @Override
+ public ResourceReference getImageResourceReference() {
+ return visible ? open : closed;
+ }
+ };
+ showHideImage.setOutputMarkupId(true);
+ IndicatingAjaxLink<Void> showHideLink = new IndicatingAjaxLink<Void>("showHideLink") {
+ private static final long serialVersionUID = -1929927616508773911L;
- @Override
- public void onClick(AjaxRequestTarget target) {
- visible = !visible;
- innerPanel.setVisible(visible);
- target.add(innerPanel);
- target.add(showHideImage);
- }
- };
- showHideLink.add(showHideImage);
- add(new Label("titlePanel", titleModel));
- add(showHideLink);
- }
+ @Override
+ public void onClick(AjaxRequestTarget target) {
+ visible = !visible;
+ innerPanel.setVisible(visible);
+ target.add(innerPanel);
+ target.add(showHideImage);
+ }
+ };
+ showHideLink.add(showHideImage);
+ add(new Label("titlePanel", titleModel));
+ add(showHideLink);
+ }
- /**
- * Construct the container contained within the collapsible panel
- * @param markupId ID that should be used for the inner panel
- * @return The inner container displayed when collapsible is open
- */
- protected abstract Panel getInnerPanel(String markupId);
+ /**
+ * Construct the container contained within the collapsible panel
+ * @param markupId ID that should be used for the inner panel
+ * @return The inner container displayed when collapsible is open
+ */
+ protected abstract Panel getInnerPanel(String markupId);
}
\ No newline at end of file
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/panels/PropertyLabelLinkPanel.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/panels/PropertyLabelLinkPanel.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/panels/PropertyLabelLinkPanel.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -36,63 +36,63 @@
**/
abstract public class PropertyLabelLinkPanel<T> extends Panel {
- /** generated link */
- private Link<T> link;
+ /** generated link */
+ private Link<T> link;
- /**
- * Constructor
- * @param id panel id
- * @param linkModel model used to generate the link
- */
- public PropertyLabelLinkPanel(String id, IModel<T> linkModel) {
- super(id, linkModel);
- link = new Link<T>("link") {
+ /**
+ * Constructor
+ * @param id panel id
+ * @param linkModel model used to generate the link
+ */
+ public PropertyLabelLinkPanel(String id, IModel<T> linkModel) {
+ super(id, linkModel);
+ link = new Link<T>("link") {
- @Override
- public void onClick() {
- PropertyLabelLinkPanel.this.onClick();
- }
- };
- add(link);
+ @Override
+ public void onClick() {
+ PropertyLabelLinkPanel.this.onClick();
+ }
+ };
+ add(link);
- link.add(new Label("label", linkModel));
- }
+ link.add(new Label("label", linkModel));
+ }
- /**
- * Constructor
- * @param id panel id
- * @param linkModel model used to generate the link
- * @param linkTitle title displayed for the link
- */
- public PropertyLabelLinkPanel(String id, IModel<T> linkModel, String linkTitle) {
- this(id, linkModel);
+ /**
+ * Constructor
+ * @param id panel id
+ * @param linkModel model used to generate the link
+ * @param linkTitle title displayed for the link
+ */
+ public PropertyLabelLinkPanel(String id, IModel<T> linkModel, String linkTitle) {
+ this(id, linkModel);
- if (linkTitle != null) {
- link.add(new AttributeModifier("title", new Model<String>(linkTitle)));
- }
- }
+ if (linkTitle != null) {
+ link.add(new AttributeModifier("title", new Model<String>(linkTitle)));
+ }
+ }
- /**
- * Get the model
- * @return model
- */
- @SuppressWarnings("unchecked")
- public IModel<T> getModel() {
- return (IModel<T>) getDefaultModel();
- }
+ /**
+ * Get the model
+ * @return model
+ */
+ @SuppressWarnings("unchecked")
+ public IModel<T> getModel() {
+ return (IModel<T>) getDefaultModel();
+ }
- /**
- * Get the model object
- * @return model object
- */
- @SuppressWarnings("unchecked")
- public T getModelObject() {
- return (T) getDefaultModelObject();
- }
+ /**
+ * Get the model object
+ * @return model object
+ */
+ @SuppressWarnings("unchecked")
+ public T getModelObject() {
+ return (T) getDefaultModelObject();
+ }
- /**
- * Override this method to react to link clicks.
- */
- public abstract void onClick();
+ /**
+ * Override this method to react to link clicks.
+ */
+ public abstract void onClick();
}
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/panels/PropertyLabelLinkProduitPanel.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/panels/PropertyLabelLinkProduitPanel.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/panels/PropertyLabelLinkProduitPanel.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -42,82 +42,82 @@
*/
public abstract class PropertyLabelLinkProduitPanel extends Panel {
- /** generated link */
- private Link<Produit> link;
+ /** generated link */
+ private Link<Produit> link;
- /**
- * Constructor
- * @param id panel id
- * @param produitModel model used to generate the link
- */
- public PropertyLabelLinkProduitPanel(String id, final IModel<Produit> produitModel) {
- super(id, produitModel);
- link = new Link<Produit>("link") {
+ /**
+ * Constructor
+ * @param id panel id
+ * @param produitModel model used to generate the link
+ */
+ public PropertyLabelLinkProduitPanel(String id, final IModel<Produit> produitModel) {
+ super(id, produitModel);
+ link = new Link<Produit>("link") {
- @Override
- public void onClick() {
- if (produitModel.getObject().isExtrait()) {
- Extrait extrait = (Extrait) produitModel.getObject();
- onClickIfExtrait(extrait);
- } else {
- // le produit est une fraction
- Fraction fraction = (Fraction) produitModel.getObject();
- onClickIfFraction(fraction);
- }
- }
- };
- add(link);
+ @Override
+ public void onClick() {
+ if (produitModel.getObject().isExtrait()) {
+ Extrait extrait = (Extrait) produitModel.getObject();
+ onClickIfExtrait(extrait);
+ } else {
+ // le produit est une fraction
+ Fraction fraction = (Fraction) produitModel.getObject();
+ onClickIfFraction(fraction);
+ }
+ }
+ };
+ add(link);
- link.add(new Label("label", produitModel));
- }
+ link.add(new Label("label", produitModel));
+ }
- /**
- * Constructor
- * @param id panel id
- * @param produitModel model used to generate the link
- * @param page page used to get messages
- */
- public PropertyLabelLinkProduitPanel(String id, IModel<Produit> produitModel, TemplatePage page) {
- this(id, produitModel);
- if (produitModel.getObject() != null) {
- String linkTitle;
- // title différent suivant si le produit provient d'une extraction ou d'une purification
- if (produitModel.getObject().isExtrait()) {
- linkTitle = page.getString("ReadExtraction");
- } else {
- linkTitle = page.getString("ReadPurification");
- }
- link.add(new AttributeModifier("title", new Model<String>(linkTitle)));
- }
- }
+ /**
+ * Constructor
+ * @param id panel id
+ * @param produitModel model used to generate the link
+ * @param page page used to get messages
+ */
+ public PropertyLabelLinkProduitPanel(String id, IModel<Produit> produitModel, TemplatePage page) {
+ this(id, produitModel);
+ if (produitModel.getObject() != null) {
+ String linkTitle;
+ // title différent suivant si le produit provient d'une extraction ou d'une purification
+ if (produitModel.getObject().isExtrait()) {
+ linkTitle = page.getString("ReadExtraction");
+ } else {
+ linkTitle = page.getString("ReadPurification");
+ }
+ link.add(new AttributeModifier("title", new Model<String>(linkTitle)));
+ }
+ }
- /**
- * Get the model
- * @return model
- */
- @SuppressWarnings("unchecked")
- public final IModel<Produit> getModel() {
- return (IModel<Produit>) getDefaultModel();
- }
+ /**
+ * Get the model
+ * @return model
+ */
+ @SuppressWarnings("unchecked")
+ public final IModel<Produit> getModel() {
+ return (IModel<Produit>) getDefaultModel();
+ }
- /**
- * Get the model object
- * @return model object
- */
- public final Produit getModelObject() {
- return (Produit) getDefaultModelObject();
- }
+ /**
+ * Get the model object
+ * @return model object
+ */
+ public final Produit getModelObject() {
+ return (Produit) getDefaultModelObject();
+ }
- /**
- * Executed on click evenement when the produis is an extrait
- * @param extrait extrait
- */
- public abstract void onClickIfExtrait(Extrait extrait);
+ /**
+ * Executed on click evenement when the produis is an extrait
+ * @param extrait extrait
+ */
+ public abstract void onClickIfExtrait(Extrait extrait);
- /**
- * Executed on click evenement when the produis is a fraction
- * @param fraction fraction
- */
- public abstract void onClickIfFraction(Fraction fraction);
+ /**
+ * Executed on click evenement when the produis is a fraction
+ * @param fraction fraction
+ */
+ public abstract void onClickIfFraction(Fraction fraction);
}
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/panels/SimpleTooltipPanel.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/panels/SimpleTooltipPanel.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/panels/SimpleTooltipPanel.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -36,15 +36,15 @@
*/
public class SimpleTooltipPanel extends Panel {
- /**
- * Constructor
- * @param id Component id
- * @param messageModel Message Model displayed over the image
- */
- public SimpleTooltipPanel(String id, IModel<?> messageModel) {
- super(id);
- WebComponent img = new Image("tooltip", new PackageResourceReference(SimpleTooltipPanel.class, "tooltip.png"));
- img.add(new AttributeModifier("title", messageModel));
- add(img);
- }
+ /**
+ * Constructor
+ * @param id Component id
+ * @param messageModel Message Model displayed over the image
+ */
+ public SimpleTooltipPanel(String id, IModel<?> messageModel) {
+ super(id);
+ WebComponent img = new Image("tooltip", new PackageResourceReference(SimpleTooltipPanel.class, "tooltip.png"));
+ img.add(new AttributeModifier("title", messageModel));
+ add(img);
+ }
}
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/renderers/EnumChoiceRenderer.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/renderers/EnumChoiceRenderer.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/renderers/EnumChoiceRenderer.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -35,26 +35,26 @@
*/
public final class EnumChoiceRenderer<E extends Enum<?>> implements IChoiceRenderer<E>, Serializable {
- /** Page */
- private final TemplatePage page;
+ /** Page */
+ private final TemplatePage page;
- /**
- * Constructor
- * @param page Page
- */
- public EnumChoiceRenderer(TemplatePage page) {
- this.page = page;
- }
+ /**
+ * Constructor
+ * @param page Page
+ */
+ public EnumChoiceRenderer(TemplatePage page) {
+ this.page = page;
+ }
- /** {@inheritDoc} */
- @Override
- public String getDisplayValue(E enumValue) {
- return page.enumValueMessage(enumValue);
- }
+ /** {@inheritDoc} */
+ @Override
+ public String getDisplayValue(E enumValue) {
+ return page.enumValueMessage(enumValue);
+ }
- /** {@inheritDoc} */
- @Override
- public String getIdValue(E enumValue, int index) {
- return enumValue.toString();
- }
+ /** {@inheritDoc} */
+ @Override
+ public String getIdValue(E enumValue, int index) {
+ return enumValue.toString();
+ }
}
\ No newline at end of file
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/renderers/MapChoiceRenderer.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/renderers/MapChoiceRenderer.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/renderers/MapChoiceRenderer.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -35,26 +35,26 @@
*/
public final class MapChoiceRenderer<K, V> implements IChoiceRenderer<K>, Serializable {
- /** Map */
- private final Map<K, V> map;
+ /** Map */
+ private final Map<K, V> map;
- /**
- * Constructor
- * @param map Map
- */
- public MapChoiceRenderer(Map<K, V> map) {
- this.map = map;
- }
+ /**
+ * Constructor
+ * @param map Map
+ */
+ public MapChoiceRenderer(Map<K, V> map) {
+ this.map = map;
+ }
- /** {@inheritDoc} */
- @Override
- public V getDisplayValue(K object) {
- return map.get(object);
- }
+ /** {@inheritDoc} */
+ @Override
+ public V getDisplayValue(K object) {
+ return map.get(object);
+ }
- /** {@inheritDoc} */
- @Override
- public String getIdValue(K object, int index) {
- return object != null ? object.toString() : null;
- }
+ /** {@inheritDoc} */
+ @Override
+ public String getIdValue(K object, int index) {
+ return object != null ? object.toString() : null;
+ }
}
\ No newline at end of file
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/resources/WebMessages.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/resources/WebMessages.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/resources/WebMessages.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -39,32 +39,32 @@
@Service
public final class WebMessages implements IStringResourceLoader {
- /** Message source */
- private final MessageSourceAccessor source;
+ /** Message source */
+ private final MessageSourceAccessor source;
- /**
- * Constructor
- * @param source Message source
- */
- public WebMessages(MessageSourceAccessor source) {
- AssertTools.assertNotNull(source);
- this.source = source;
- }
+ /**
+ * Constructor
+ * @param source Message source
+ */
+ public WebMessages(MessageSourceAccessor source) {
+ AssertTools.assertNotNull(source);
+ this.source = source;
+ }
- /** {@inheritDoc} */
- @Override
- public String loadStringResource(Class<?> clazz, String key, Locale locale, String style, String variation) {
- try {
- return source.getMessage(key, locale);
- } catch (NoSuchMessageException e) {
- return null;
- }
- }
+ /** {@inheritDoc} */
+ @Override
+ public String loadStringResource(Class<?> clazz, String key, Locale locale, String style, String variation) {
+ try {
+ return source.getMessage(key, locale);
+ } catch (NoSuchMessageException e) {
+ return null;
+ }
+ }
- /** {@inheritDoc} */
- @Override
- public String loadStringResource(Component component, String key, Locale locale, String style, String variation) {
- return component != null ? loadStringResource(component.getClass(), key, locale, null, null) : null;
- }
+ /** {@inheritDoc} */
+ @Override
+ public String loadStringResource(Component component, String key, Locale locale, String style, String variation) {
+ return component != null ? loadStringResource(component.getClass(), key, locale, null, null) : null;
+ }
}
\ No newline at end of file
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/security/AuthContainer.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/security/AuthContainer.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/security/AuthContainer.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -30,31 +30,31 @@
*/
public final class AuthContainer extends WebMarkupContainer {
- /** Authorization? */
- private final boolean authorized;
+ /** Authorization? */
+ private final boolean authorized;
- /**
- * Constructor
- * @param id ID
- * @param roles Authorized roles
- */
- public AuthContainer(String id, AuthRole... roles) {
- super(id);
- authorized = AuthStrategy.isAuthorized(roles);
- }
+ /**
+ * Constructor
+ * @param id ID
+ * @param roles Authorized roles
+ */
+ public AuthContainer(String id, AuthRole... roles) {
+ super(id);
+ authorized = AuthStrategy.isAuthorized(roles);
+ }
- /**
- * authorized getter
- * @return authorized
- */
- public boolean isAuthorized() {
- return authorized;
- }
+ /**
+ * authorized getter
+ * @return authorized
+ */
+ public boolean isAuthorized() {
+ return authorized;
+ }
- /** {@inheritDoc} */
- @Override
- protected void onBeforeRender() {
- setVisibilityAllowed(isAuthorized());
- super.onBeforeRender();
- }
+ /** {@inheritDoc} */
+ @Override
+ protected void onBeforeRender() {
+ setVisibilityAllowed(isAuthorized());
+ super.onBeforeRender();
+ }
}
\ No newline at end of file
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/security/AuthRole.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/security/AuthRole.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/security/AuthRole.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -27,10 +27,10 @@
* @author Mickael Tricot
*/
public enum AuthRole {
- /** Administrator */
- ADMIN,
- /** User */
- USER,
- /** Visitor */
- VISITOR;
+ /** Administrator */
+ ADMIN,
+ /** User */
+ USER,
+ /** Visitor */
+ VISITOR;
}
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/security/AuthRoles.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/security/AuthRoles.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/security/AuthRoles.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -34,9 +34,9 @@
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface AuthRoles {
- /**
- * Authorized roles (all roles if null or empty)
- * @return Authorized roles
- */
- AuthRole[] value();
+ /**
+ * Authorized roles (all roles if null or empty)
+ * @return Authorized roles
+ */
+ AuthRole[] value();
}
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/security/AuthSession.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/security/AuthSession.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/security/AuthSession.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -48,161 +48,161 @@
*/
public final class AuthSession extends WebSession implements Serializable {
- /** Logger */
- private static final Log LOG = LogTools.getLog();
+ /** Logger */
+ private static final Log LOG = LogTools.getLog();
- /** Attribute: rememberMe */
- private static final String ATTRIBUTE_REMEMBER_ME = "rememberMe";
+ /** Attribute: rememberMe */
+ private static final String ATTRIBUTE_REMEMBER_ME = "rememberMe";
- /** Attribute: roles */
- private static final String ATTRIBUTE_ROLE = "role";
+ /** Attribute: roles */
+ private static final String ATTRIBUTE_ROLE = "role";
- /** Attribute: utilisateur */
- private static final String ATTRIBUTE_UTILISATEUR = "utilisateur";
+ /** Attribute: utilisateur */
+ private static final String ATTRIBUTE_UTILISATEUR = "utilisateur";
- /** Personne service */
- @SpringBean
- private PersonneService personneService;
+ /** Personne service */
+ @SpringBean
+ private PersonneService personneService;
- /**
- * Constructor
- * @param request Request
- */
- public AuthSession(Request request) {
- super(request);
- WebApplicationImpl.injectSpringBeans(this);
- if (!DataContext.LOCALES.contains(getLocale())) {
- setLocale(Locale.getDefault());
- }
- setAttribute(ATTRIBUTE_ROLE, new HashSet<TypeDroit>());
- setUtilisateur(null);
+ /**
+ * Constructor
+ * @param request Request
+ */
+ public AuthSession(Request request) {
+ super(request);
+ WebApplicationImpl.injectSpringBeans(this);
+ if (!DataContext.LOCALES.contains(getLocale())) {
+ setLocale(Locale.getDefault());
+ }
+ setAttribute(ATTRIBUTE_ROLE, new HashSet<TypeDroit>());
+ setUtilisateur(null);
- if (!autologin()) {
- logout();
- }
- bind();
- }
+ if (!autologin()) {
+ logout();
+ }
+ bind();
+ }
- /**
- * Autologin
- * @return Success
- */
- private boolean autologin() {
+ /**
+ * Autologin
+ * @return Success
+ */
+ private boolean autologin() {
- String[] cookie = WebApplication.get().getSecuritySettings().getAuthenticationStrategy().load();
- // cookie[0] = courriel, cookie[1] = passwordHash
- if (cookie != null && cookie.length == 2 && !StringUtils.isEmpty(cookie[0]) && !StringUtils.isEmpty(cookie[1])
- && authenticate(cookie[0], cookie[1])) {
- try {
- // connexion without cookie persistance because already exists
- connectUser(personneService.loadUtilisateur(cookie[0]), false);
- } catch (DataNotFoundException e) {
- // just in cas the user is deleted by another user between authenticate and plainLogin
- return false;
- }
- return true;
- }
- return false;
- }
+ String[] cookie = WebApplication.get().getSecuritySettings().getAuthenticationStrategy().load();
+ // cookie[0] = courriel, cookie[1] = passwordHash
+ if (cookie != null && cookie.length == 2 && !StringUtils.isEmpty(cookie[0]) && !StringUtils.isEmpty(cookie[1])
+ && authenticate(cookie[0], cookie[1])) {
+ try {
+ // connexion without cookie persistance because already exists
+ connectUser(personneService.loadUtilisateur(cookie[0]), false);
+ } catch (DataNotFoundException e) {
+ // just in cas the user is deleted by another user between authenticate and plainLogin
+ return false;
+ }
+ return true;
+ }
+ return false;
+ }
- /** {@inheritDoc} */
- @Override
- public boolean authenticate(String username, String password) {
- LOG.debug(personneService.authenticateUtilisateur(username, password));
- return personneService.authenticateUtilisateur(username, password);
- }
+ /** {@inheritDoc} */
+ @Override
+ public boolean authenticate(String username, String password) {
+ LOG.debug(personneService.authenticateUtilisateur(username, password));
+ return personneService.authenticateUtilisateur(username, password);
+ }
- /**
- * rememberMe getter
- * @return rememberMe
- */
- public Boolean getRememberMe() {
- return (Boolean) getAttribute(ATTRIBUTE_REMEMBER_ME);
- }
+ /**
+ * rememberMe getter
+ * @return rememberMe
+ */
+ public Boolean getRememberMe() {
+ return (Boolean) getAttribute(ATTRIBUTE_REMEMBER_ME);
+ }
- /**
- * role getter
- * @return role
- */
- public AuthRole getRole() {
- return (AuthRole) getAttribute(ATTRIBUTE_ROLE);
- }
+ /**
+ * role getter
+ * @return role
+ */
+ public AuthRole getRole() {
+ return (AuthRole) getAttribute(ATTRIBUTE_ROLE);
+ }
- /**
- * utilisateur getter
- * @return utilisateur
- */
- public Utilisateur getUtilisateur() {
- Integer idPersonne = (Integer) getAttribute(ATTRIBUTE_UTILISATEUR);
- Utilisateur utilisateur = null;
- if (idPersonne != null) {
- try {
- utilisateur = personneService.loadUtilisateur(idPersonne);
- } catch (DataNotFoundException e) {
- logout();
- } catch (Exception e) {
- LOG.debug(e.getClass() + e.getMessage());
- return null;
- }
- }
- return utilisateur;
- }
+ /**
+ * utilisateur getter
+ * @return utilisateur
+ */
+ public Utilisateur getUtilisateur() {
+ Integer idPersonne = (Integer) getAttribute(ATTRIBUTE_UTILISATEUR);
+ Utilisateur utilisateur = null;
+ if (idPersonne != null) {
+ try {
+ utilisateur = personneService.loadUtilisateur(idPersonne);
+ } catch (DataNotFoundException e) {
+ logout();
+ } catch (Exception e) {
+ LOG.debug(e.getClass() + e.getMessage());
+ return null;
+ }
+ }
+ return utilisateur;
+ }
- /**
- * Connect the user (to do after authenticating)
- * @param utilisateur Utilisateur
- * @param rememberMe True if the authentication is saved in a cookie
- */
- public void connectUser(Utilisateur utilisateur, boolean rememberMe) {
- setUtilisateur(utilisateur);
- setRole(utilisateur.getTypeDroit() == TypeDroit.UTILISATEUR ? AuthRole.USER : AuthRole.ADMIN);
+ /**
+ * Connect the user (to do after authenticating)
+ * @param utilisateur Utilisateur
+ * @param rememberMe True if the authentication is saved in a cookie
+ */
+ public void connectUser(Utilisateur utilisateur, boolean rememberMe) {
+ setUtilisateur(utilisateur);
+ setRole(utilisateur.getTypeDroit() == TypeDroit.UTILISATEUR ? AuthRole.USER : AuthRole.ADMIN);
- setRememberMe(rememberMe);
- if (rememberMe) {
- WebApplication.get().getSecuritySettings().getAuthenticationStrategy()
- .save(utilisateur.getCourriel(), utilisateur.getPasswordHash());
- }
- }
+ setRememberMe(rememberMe);
+ if (rememberMe) {
+ WebApplication.get().getSecuritySettings().getAuthenticationStrategy()
+ .save(utilisateur.getCourriel(), utilisateur.getPasswordHash());
+ }
+ }
- /**
- * Logout action
- */
- public void logout() {
- setUtilisateur(null);
- setRememberMe(false);
- setRole(AuthRole.VISITOR);
- WebApplication.get().getSecuritySettings().getAuthenticationStrategy().remove();
- }
+ /**
+ * Logout action
+ */
+ public void logout() {
+ setUtilisateur(null);
+ setRememberMe(false);
+ setRole(AuthRole.VISITOR);
+ WebApplication.get().getSecuritySettings().getAuthenticationStrategy().remove();
+ }
- /**
- * rememberMe setter
- * @param rememberMe RememberMe
- */
- private void setRememberMe(Boolean rememberMe) {
- setAttribute(ATTRIBUTE_REMEMBER_ME, rememberMe);
- }
+ /**
+ * rememberMe setter
+ * @param rememberMe RememberMe
+ */
+ private void setRememberMe(Boolean rememberMe) {
+ setAttribute(ATTRIBUTE_REMEMBER_ME, rememberMe);
+ }
- /**
- * role setter
- * @param role Role
- */
- private void setRole(AuthRole role) {
- setAttribute(ATTRIBUTE_ROLE, role);
- }
+ /**
+ * role setter
+ * @param role Role
+ */
+ private void setRole(AuthRole role) {
+ setAttribute(ATTRIBUTE_ROLE, role);
+ }
- /**
- * utilisateur setter
- * @param utilisateur Utilisateur
- */
- private void setUtilisateur(Utilisateur utilisateur) {
- setAttribute(ATTRIBUTE_UTILISATEUR, utilisateur != null ? utilisateur.getIdPersonne() : null);
- }
+ /**
+ * utilisateur setter
+ * @param utilisateur Utilisateur
+ */
+ private void setUtilisateur(Utilisateur utilisateur) {
+ setAttribute(ATTRIBUTE_UTILISATEUR, utilisateur != null ? utilisateur.getIdPersonne() : null);
+ }
- /**
- * Login action
- * @param utilisateur Utilisateur
- */
- public void update(Utilisateur utilisateur) {
- connectUser(utilisateur, getRememberMe());
- }
+ /**
+ * Login action
+ * @param utilisateur Utilisateur
+ */
+ public void update(Utilisateur utilisateur) {
+ connectUser(utilisateur, getRememberMe());
+ }
}
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/security/AuthStrategy.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/security/AuthStrategy.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/security/AuthStrategy.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -36,22 +36,22 @@
*/
public final class AuthStrategy extends AbstractPageAuthorizationStrategy {
- /**
- * Check security
- * @param authorizedRoles Authorized roles
- * @return TRUE if the personne is authorized or if authorizedRoles is null or empty
- */
- public static boolean isAuthorized(AuthRole[] authorizedRoles) {
- return authorizedRoles == null
- || authorizedRoles.length == 0
- || new HashSet<AuthRole>(Arrays.asList(authorizedRoles)).contains(((AuthSession) Session.get())
- .getRole());
- }
+ /**
+ * Check security
+ * @param authorizedRoles Authorized roles
+ * @return TRUE if the personne is authorized or if authorizedRoles is null or empty
+ */
+ public static boolean isAuthorized(AuthRole[] authorizedRoles) {
+ return authorizedRoles == null
+ || authorizedRoles.length == 0
+ || new HashSet<AuthRole>(Arrays.asList(authorizedRoles)).contains(((AuthSession) Session.get())
+ .getRole());
+ }
- /** {@inheritDoc} */
- @Override
- protected <P extends Page> boolean isPageAuthorized(Class<P> pageClass) {
- AuthRoles roles = pageClass.getAnnotation(AuthRoles.class);
- return roles == null || isAuthorized(roles.value());
- }
+ /** {@inheritDoc} */
+ @Override
+ protected <P extends Page> boolean isPageAuthorized(Class<P> pageClass) {
+ AuthRoles roles = pageClass.getAnnotation(AuthRoles.class);
+ return roles == null || isAuthorized(roles.value());
+ }
}
Modified: trunk/cantharella.web/src/test/java/nc/ird/cantharella/web/AbstractWebTest.java
===================================================================
--- trunk/cantharella.web/src/test/java/nc/ird/cantharella/web/AbstractWebTest.java 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/cantharella.web/src/test/java/nc/ird/cantharella/web/AbstractWebTest.java 2013-01-29 09:48:04 UTC (rev 65)
@@ -41,11 +41,11 @@
@ContextConfiguration(loader = AnnotationConfigContextLoader.class, classes = WebContext.class)
public abstract class AbstractWebTest extends AbstractJUnit4SpringContextTests {
- /**
- * Initialization
- */
- @Before
- public void setUp() {
- applicationContext.getAutowireCapableBeanFactory().autowireBean(this);
- }
+ /**
+ * Initialization
+ */
+ @Before
+ public void setUp() {
+ applicationContext.getAutowireCapableBeanFactory().autowireBean(this);
+ }
}
\ No newline at end of file
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2013-01-28 17:34:37 UTC (rev 64)
+++ trunk/pom.xml 2013-01-29 09:48:04 UTC (rev 65)
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
@@ -97,7 +98,8 @@
<!-- license header configuration -->
<license.organizationName>
- IRD (Institut de Recherche pour le Developpement) and by respective authors (see below)
+ IRD (Institut de Recherche pour le
+ Developpement) and by respective authors (see below)
</license.organizationName>
<license.licenseName>agpl_v3</license.licenseName>
@@ -110,7 +112,7 @@
<log4jVersion>1.2.17</log4jVersion>
<junitVersion>4.11</junitVersion>
<version.slf4j>1.7.2</version.slf4j>
-
+
<version.postgresql>9.1-901-1.jdbc4</version.postgresql>
<version.h2>1.3.170</version.h2>
@@ -135,9 +137,10 @@
<version.servlet-api>2.5</version.servlet-api>
<version.wicket>1.5.6</version.wicket>
-
- <!-- FIXME echatellier Probleme de parallelisation des tests unitaire, cause
- org.hibernate.HibernateException: Don't change the reference to a collection with cascade="all-delete-orphan": nc.ird.cantharella.data.model.Personne.campagnesDroits -->
+
+ <!-- FIXME echatellier Probleme de parallelisation des tests unitaire,
+ cause org.hibernate.HibernateException: Don't change the reference to a collection
+ with cascade="all-delete-orphan": nc.ird.cantharella.data.model.Personne.campagnesDroits -->
<maven.test.skip>true</maven.test.skip>
</properties>
@@ -152,7 +155,7 @@
<pluginManagement>
<plugins>
-
+
<!-- plugin site -->
<plugin>
<artifactId>maven-site-plugin</artifactId>
@@ -165,7 +168,7 @@
</dependencies>
</plugin>
-
+
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>hibernate3-maven-plugin</artifactId>
@@ -215,12 +218,8 @@
<version>${version.opencsv}</version>
</dependency>
- <!-- <dependency>
- <groupId>javassist</groupId>
- <artifactId>javassist</artifactId>
- <version>${version.javassist}</version>
- <scope>runtime</scope>
- </dependency> -->
+ <!-- <dependency> <groupId>javassist</groupId> <artifactId>javassist</artifactId>
+ <version>${version.javassist}</version> <scope>runtime</scope> </dependency> -->
<dependency>
<groupId>org.aspectj</groupId>
@@ -293,11 +292,8 @@
<version>${version.jpa}</version>
</dependency>
- <!--<dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-c3p0</artifactId>
- <version>${version.hibernate}</version>
- </dependency>-->
+ <!--<dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-c3p0</artifactId>
+ <version>${version.hibernate}</version> </dependency> -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
@@ -429,7 +425,7 @@
<version>${version.h2}</version>
</dependency>
- <!-- for JUnit Spring Test with @Configuration -->
+ <!-- for JUnit Spring Test with @Configuration -->
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib-nodep</artifactId>
@@ -445,93 +441,37 @@
</dependencyManagement>
- <!--dependencies-->
+ <!--dependencies -->
- <!-- Dependencies for all layers -->
+ <!-- Dependencies for all layers -->
- <!--dependency>
- <groupId>commons-codec</groupId>
- <artifactId>commons-codec</artifactId>
- <version>${version.commons-codec}</version>
- </dependency>
+ <!--dependency> <groupId>commons-codec</groupId> <artifactId>commons-codec</artifactId>
+ <version>${version.commons-codec}</version> </dependency> <dependency> <groupId>javassist</groupId>
+ <artifactId>javassist</artifactId> <version>${version.javassist}</version>
+ <scope>runtime</scope> </dependency> <dependency> <groupId>org.aspectj</groupId>
+ <artifactId>aspectjrt</artifactId> <version>${version.aspectj}</version>
+ </dependency> <dependency> <groupId>org.aspectj</groupId> <artifactId>aspectjweaver</artifactId>
+ <version>${version.aspectj}</version> </dependency> <dependency> <groupId>org.slf4j</groupId>
+ <artifactId>jcl-over-slf4j</artifactId> <version>${version.slf4j}</version>
+ <scope>runtime</scope> </dependency> <dependency> <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId> <version>${version.slf4j}</version> <scope>runtime</scope>
+ </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-log4j12</artifactId>
+ <version>${version.slf4j}</version> <scope>runtime</scope> </dependency>
+ <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context</artifactId>
+ <version>${version.spring}</version> </dependency> <dependency> <groupId>org.springframework</groupId>
+ <artifactId>spring-context-support</artifactId> <version>${version.spring}</version>
+ </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-test</artifactId>
+ <version>${version.spring}</version> <scope>test</scope> </dependency> <dependency>
+ <groupId>cglib</groupId> <artifactId>cglib-nodep</artifactId> <version>${version.cglib}</version>
+ <scope>test</scope> </dependency> <dependency> <groupId>javax.mail</groupId>
+ <artifactId>mail</artifactId> <version>${version.mail}</version> </dependency>
+ <dependency> <groupId>com.ibm.icu</groupId> <artifactId>icu4j</artifactId>
+ <version>${version.icu4j}</version> </dependency -->
- <dependency>
- <groupId>javassist</groupId>
- <artifactId>javassist</artifactId>
- <version>${version.javassist}</version>
- <scope>runtime</scope>
- </dependency>
+ <!--/dependencies -->
- <dependency>
- <groupId>org.aspectj</groupId>
- <artifactId>aspectjrt</artifactId>
- <version>${version.aspectj}</version>
- </dependency>
- <dependency>
- <groupId>org.aspectj</groupId>
- <artifactId>aspectjweaver</artifactId>
- <version>${version.aspectj}</version>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>jcl-over-slf4j</artifactId>
- <version>${version.slf4j}</version>
- <scope>runtime</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <version>${version.slf4j}</version>
- <scope>runtime</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <version>${version.slf4j}</version>
- <scope>runtime</scope>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-context</artifactId>
- <version>${version.spring}</version>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-context-support</artifactId>
- <version>${version.spring}</version>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-test</artifactId>
- <version>${version.spring}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>cglib</groupId>
- <artifactId>cglib-nodep</artifactId>
- <version>${version.cglib}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>javax.mail</groupId>
- <artifactId>mail</artifactId>
- <version>${version.mail}</version>
- </dependency>
- <dependency>
- <groupId>com.ibm.icu</groupId>
- <artifactId>icu4j</artifactId>
- <version>${version.icu4j}</version>
- </dependency-->
-
- <!--/dependencies-->
-
-
- <!--repositories>
- <repository>
- <id>repository.springframework.milestone</id>
- <name>Spring Framework Maven Milestone Repository</name>
- <url>http://maven.springframework.org/milestone</url>
- </repository>
- </repositories-->
+ <!--repositories> <repository> <id>repository.springframework.milestone</id>
+ <name>Spring Framework Maven Milestone Repository</name> <url>http://maven.springframework.org/milestone</url>
+ </repository> </repositories -->
</project>
1
0
r64 - trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/behaviors
by echatellier@users.forge.codelutin.com 28 Jan '13
by echatellier@users.forge.codelutin.com 28 Jan '13
28 Jan '13
Author: echatellier
Date: 2013-01-28 18:34:37 +0100 (Mon, 28 Jan 2013)
New Revision: 64
Url: http://forge.codelutin.com/projects/cantharella/repository/revisions/64
Log:
URL must be context relative
Modified:
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/behaviors/MoleculeViewBehavior.java
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/behaviors/MoleculeViewBehavior.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/behaviors/MoleculeViewBehavior.java 2013-01-28 17:18:32 UTC (rev 63)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/behaviors/MoleculeViewBehavior.java 2013-01-28 17:34:37 UTC (rev 64)
@@ -56,11 +56,11 @@
@Override
public void renderHead(Component component, IHeaderResponse response) {
- response.renderCSSReference("/ChemDoodleWeb/css/ChemDoodleWeb.css");
- response.renderJavaScriptReference("/js/jquery-1.9.0.min.js");
- response.renderJavaScriptReference("/ChemDoodleWeb/js/ChemDoodleWeb-libs.js");
- response.renderJavaScriptReference("/ChemDoodleWeb/js/ChemDoodleWeb.js");
- response.renderJavaScriptReference("/js/molviewer.js");
+ response.renderCSSReference("ChemDoodleWeb/css/ChemDoodleWeb.css");
+ response.renderJavaScriptReference("js/jquery-1.9.0.min.js");
+ response.renderJavaScriptReference("ChemDoodleWeb/js/ChemDoodleWeb-libs.js");
+ response.renderJavaScriptReference("ChemDoodleWeb/js/ChemDoodleWeb.js");
+ response.renderJavaScriptReference("js/molviewer.js");
}
@Override
1
0
28 Jan '13
Author: echatellier
Date: 2013-01-28 18:18:32 +0100 (Mon, 28 Jan 2013)
New Revision: 63
Url: http://forge.codelutin.com/projects/cantharella/repository/revisions/63
Log:
Use autocompletefield to manage identifieePar input
Added:
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/dao/impl/MoleculeDao.java
Modified:
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Molecule.java
trunk/cantharella.data/src/main/resources/commons/sql/dev_update.sql
trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/MoleculeService.java
trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/MoleculeServiceImpl.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule/ListMoleculesPage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule/ManageMoleculePage.html
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule/ManageMoleculePage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule/ReadMoleculePage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/search/SearchPage.java
Added: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/dao/impl/MoleculeDao.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/dao/impl/MoleculeDao.java (rev 0)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/dao/impl/MoleculeDao.java 2013-01-28 17:18:32 UTC (rev 63)
@@ -0,0 +1,51 @@
+/*
+ * #%L
+ * Cantharella :: Data
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2013 IRD (Institut de Recherche pour le Developpement) and by respective authors (see below)
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+package nc.ird.cantharella.data.dao.impl;
+
+import nc.ird.cantharella.data.dao.AbstractModelDao;
+import nc.ird.cantharella.data.model.Molecule;
+
+import org.hibernate.criterion.DetachedCriteria;
+import org.hibernate.criterion.Order;
+import org.hibernate.criterion.Projections;
+
+/**
+ * DAO molecules.
+ *
+ * @author Mickael Tricot
+ * @author Adrien Cheype
+ */
+public final class MoleculeDao extends AbstractModelDao {
+
+ /** Criteria : différents programmes des campagnes déjà saisis */
+ public static final DetachedCriteria CRITERIA_DISTINCT_MOLECULE_ORGANISMES = DetachedCriteria
+ .forClass(Molecule.class).setProjection(Projections.distinct(Projections.property("identifieePar")))
+ .addOrder(Order.asc("identifieePar"));
+
+ /**
+ * Constructor (prevents from instantiation)
+ */
+ private MoleculeDao() {
+ //
+ }
+}
Property changes on: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/dao/impl/MoleculeDao.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Molecule.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Molecule.java 2013-01-28 17:17:45 UTC (rev 62)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Molecule.java 2013-01-28 17:18:32 UTC (rev 63)
@@ -114,8 +114,9 @@
private Campagne campagne;
/** Identifiee par. */
- @Enumerated(EnumType.ORDINAL)
- private TypeOrganisme identifieePar;
+ @Length(max = LENGTH_MEDIUM_TEXT)
+ @Field(index=Index.YES, analyze=Analyze.YES, store=Store.YES)
+ private String identifieePar;
/** Publication d'origine */
@Lob
@@ -267,14 +268,14 @@
/**
* @return the identifieePar
*/
- public TypeOrganisme getIdentifieePar() {
+ public String getIdentifieePar() {
return identifieePar;
}
/**
* @param identifieePar the identifieePar to set
*/
- public void setIdentifieePar(TypeOrganisme identifieePar) {
+ public void setIdentifieePar(String identifieePar) {
this.identifieePar = identifieePar;
}
Modified: trunk/cantharella.data/src/main/resources/commons/sql/dev_update.sql
===================================================================
--- trunk/cantharella.data/src/main/resources/commons/sql/dev_update.sql 2013-01-28 17:17:45 UTC (rev 62)
+++ trunk/cantharella.data/src/main/resources/commons/sql/dev_update.sql 2013-01-28 17:18:32 UTC (rev 63)
@@ -48,7 +48,7 @@
publiOrigine text,
campagne_idCampagne int4,
createur_idPersonne int4 not null,
- identifieePar int4,
+ identifieePar varchar(60),
primary key (idMolecule)
)
Modified: trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/MoleculeService.java
===================================================================
--- trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/MoleculeService.java 2013-01-28 17:17:45 UTC (rev 62)
+++ trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/MoleculeService.java 2013-01-28 17:18:32 UTC (rev 63)
@@ -90,4 +90,10 @@
* @return TRUE s'il a le droit
*/
boolean updateOrdeleteMoleculeEnabled(Molecule molecule, Utilisateur utilisateur);
+
+ /**
+ * Liste les programmes des organismes déjà saisis
+ * @return Organisme des molécules
+ */
+ public List<String> listMoleculeOrganisme();
}
Modified: trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/MoleculeServiceImpl.java
===================================================================
--- trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/MoleculeServiceImpl.java 2013-01-28 17:17:45 UTC (rev 62)
+++ trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/MoleculeServiceImpl.java 2013-01-28 17:18:32 UTC (rev 63)
@@ -25,6 +25,8 @@
import java.util.List;
import nc.ird.cantharella.data.dao.GenericDao;
+import nc.ird.cantharella.data.dao.impl.CampagneDao;
+import nc.ird.cantharella.data.dao.impl.MoleculeDao;
import nc.ird.cantharella.data.exceptions.DataConstraintException;
import nc.ird.cantharella.data.exceptions.DataNotFoundException;
import nc.ird.cantharella.data.exceptions.UnexpectedException;
@@ -108,4 +110,11 @@
return utilisateur.getTypeDroit() == TypeDroit.ADMINISTRATEUR
|| utilisateur.getIdPersonne() == molecule.getCreateur().getIdPersonne();
}
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("unchecked")
+ @Override
+ public List<String> listMoleculeOrganisme() {
+ return (List<String>) dao.list(MoleculeDao.CRITERIA_DISTINCT_MOLECULE_ORGANISMES);
+ }
}
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule/ListMoleculesPage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule/ListMoleculesPage.java 2013-01-28 17:17:45 UTC (rev 62)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule/ListMoleculesPage.java 2013-01-28 17:18:32 UTC (rev 63)
@@ -133,8 +133,8 @@
setResponsePage(new ReadCampagnePage(model.getObject().getCampagne().getIdCampagne(), currentPage));
}
});
- columns.add(new EnumPropertyColumn<Molecule>(new Model<String>(getString("Molecule.identifieePar")), "identifieePar",
- "identifieePar", this));
+ columns.add(new PropertyColumn<Molecule>(new Model<String>(getString("Molecule.identifieePar")), "identifieePar",
+ "identifieePar"));
columns.add(new LinkableImagePropertyColumn<Molecule>("images/edit.png", getString("Update"), getString("Update")) {
// pas de lien d'édition si l'utilisateur n'a pas les droits
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule/ManageMoleculePage.html
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule/ManageMoleculePage.html 2013-01-28 17:17:45 UTC (rev 62)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule/ManageMoleculePage.html 2013-01-28 17:18:32 UTC (rev 63)
@@ -76,7 +76,7 @@
<div class="property">
<label for="Molecule.identifieePar"><wicket:message key="Molecule.identifieePar" /></label>
- <select id="Molecule.identifieePar" wicket:id="Molecule.identifieePar" />
+ <input type="text" id="Molecule.identifieePar" wicket:id="Molecule.identifieePar" />
</div>
<div class="property">
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule/ManageMoleculePage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule/ManageMoleculePage.java 2013-01-28 17:17:45 UTC (rev 62)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule/ManageMoleculePage.java 2013-01-28 17:18:32 UTC (rev 63)
@@ -34,40 +34,34 @@
import nc.ird.cantharella.data.model.Fraction;
import nc.ird.cantharella.data.model.Molecule;
import nc.ird.cantharella.data.model.MoleculeProvenance;
-import nc.ird.cantharella.data.model.Personne;
import nc.ird.cantharella.data.model.Produit;
-import nc.ird.cantharella.data.model.ResultatTestBio;
import nc.ird.cantharella.data.model.Utilisateur;
-import nc.ird.cantharella.data.model.ResultatTestBio.TypeResultat;
import nc.ird.cantharella.data.model.Specimen.TypeOrganisme;
import nc.ird.cantharella.data.validation.utils.ModelValidator;
import nc.ird.cantharella.service.services.CampagneService;
import nc.ird.cantharella.service.services.MoleculeService;
import nc.ird.cantharella.service.services.PersonneService;
import nc.ird.cantharella.service.services.ProduitService;
-import nc.ird.cantharella.service.utils.normalizers.UniqueFieldNormalizer;
-import nc.ird.cantharella.service.utils.normalizers.utils.Normalizer;
import nc.ird.cantharella.web.pages.TemplatePage;
import nc.ird.cantharella.web.pages.domain.campagne.ManageCampagnePage;
import nc.ird.cantharella.web.pages.domain.extraction.ReadExtractionPage;
import nc.ird.cantharella.web.pages.domain.purification.ReadPurificationPage;
-import nc.ird.cantharella.web.pages.renderers.PersonneRenderer;
import nc.ird.cantharella.web.pages.renderers.ProduitRenderer;
import nc.ird.cantharella.web.utils.CallerPage;
import nc.ird.cantharella.web.utils.behaviors.JSConfirmationBehavior;
import nc.ird.cantharella.web.utils.behaviors.MoleculeEditorBehavior;
import nc.ird.cantharella.web.utils.behaviors.ReplaceEmptyLabelBehavior;
+import nc.ird.cantharella.web.utils.forms.AutoCompleteTextFieldString;
import nc.ird.cantharella.web.utils.forms.SubmittableButton;
import nc.ird.cantharella.web.utils.forms.SubmittableButtonEvents;
+import nc.ird.cantharella.web.utils.forms.AutoCompleteTextFieldString.ComparisonMode;
import nc.ird.cantharella.web.utils.models.DisplayDecimalPropertyModel;
import nc.ird.cantharella.web.utils.models.DisplayDecimalPropertyModel.DecimalDisplFormat;
import nc.ird.cantharella.web.utils.panels.PropertyLabelLinkProduitPanel;
-import nc.ird.cantharella.web.utils.renderers.EnumChoiceRenderer;
import nc.ird.cantharella.web.utils.security.AuthRole;
import nc.ird.cantharella.web.utils.security.AuthRoles;
import nc.ird.module.utils.LogTools;
-import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.wicket.AttributeModifier;
import org.apache.wicket.MarkupContainer;
@@ -185,6 +179,7 @@
}
// Initialisation des listes
+ List<String> organismes = moleculeService.listMoleculeOrganisme();
campagnes = campagneService.listCampagnes(getSession().getUtilisateur());
final Form<Void> formView = new Form<Void>("Form");
@@ -220,10 +215,8 @@
}
});
- DropDownChoice<TypeOrganisme> identifieeParInput = new DropDownChoice<TypeOrganisme>("Molecule.identifieePar",
- new PropertyModel<TypeOrganisme>(moleculeModel, "identifieePar"),
- Arrays.asList(TypeOrganisme.values()), new EnumChoiceRenderer<TypeOrganisme>(this));
- //identifieeParInput.setNullValid(false);
+ AutoCompleteTextFieldString identifieeParInput = new AutoCompleteTextFieldString("Molecule.identifieePar",
+ new PropertyModel<String>(moleculeModel, "identifieePar"), organismes, ComparisonMode.CONTAINS);
nouvMoleculRefresh.add(identifieeParInput);
DropDownChoice<Campagne> campagnesInput = new DropDownChoice<Campagne>("Molecule.campagne",
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule/ReadMoleculePage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule/ReadMoleculePage.java 2013-01-28 17:17:45 UTC (rev 62)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule/ReadMoleculePage.java 2013-01-28 17:18:32 UTC (rev 63)
@@ -22,7 +22,6 @@
*/
package nc.ird.cantharella.web.pages.domain.molecule;
-import java.math.BigDecimal;
import java.util.List;
import nc.ird.cantharella.data.exceptions.DataConstraintException;
@@ -33,17 +32,12 @@
import nc.ird.cantharella.data.model.MoleculeProvenance;
import nc.ird.cantharella.data.model.Personne;
import nc.ird.cantharella.data.model.Produit;
-import nc.ird.cantharella.data.model.Station;
-import nc.ird.cantharella.data.model.Utilisateur;
import nc.ird.cantharella.service.services.MoleculeService;
-import nc.ird.cantharella.web.config.WebContext;
import nc.ird.cantharella.web.pages.TemplatePage;
import nc.ird.cantharella.web.pages.domain.extraction.ReadExtractionPage;
import nc.ird.cantharella.web.pages.domain.lot.ManageLotPage;
import nc.ird.cantharella.web.pages.domain.personne.ReadPersonnePage;
import nc.ird.cantharella.web.pages.domain.purification.ReadPurificationPage;
-import nc.ird.cantharella.web.pages.domain.station.ReadStationPage;
-import nc.ird.cantharella.web.pages.renderers.ProduitRenderer;
import nc.ird.cantharella.web.utils.CallerPage;
import nc.ird.cantharella.web.utils.behaviors.JSConfirmationBehavior;
import nc.ird.cantharella.web.utils.behaviors.MoleculeViewBehavior;
@@ -52,7 +46,6 @@
import nc.ird.cantharella.web.utils.forms.SubmittableButtonEvents;
import nc.ird.cantharella.web.utils.models.DisplayBooleanPropertyModel;
import nc.ird.cantharella.web.utils.models.DisplayDecimalPropertyModel;
-import nc.ird.cantharella.web.utils.models.DisplayMapValuePropertyModel;
import nc.ird.cantharella.web.utils.models.DisplayDecimalPropertyModel.DecimalDisplFormat;
import nc.ird.cantharella.web.utils.models.GenericLoadableDetachableModel;
import nc.ird.cantharella.web.utils.panels.PropertyLabelLinkPanel;
@@ -62,14 +55,10 @@
import org.apache.wicket.AttributeModifier;
import org.apache.wicket.MarkupContainer;
-import org.apache.wicket.ajax.AjaxRequestTarget;
-import org.apache.wicket.ajax.markup.html.form.AjaxFallbackButton;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.form.Button;
-import org.apache.wicket.markup.html.form.DropDownChoice;
import org.apache.wicket.markup.html.form.Form;
-import org.apache.wicket.markup.html.form.TextField;
import org.apache.wicket.markup.html.link.Link;
import org.apache.wicket.markup.html.list.ListItem;
import org.apache.wicket.markup.html.list.ListView;
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/search/SearchPage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/search/SearchPage.java 2013-01-28 17:17:45 UTC (rev 62)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/search/SearchPage.java 2013-01-28 17:18:32 UTC (rev 63)
@@ -613,8 +613,8 @@
setResponsePage(new ReadCampagnePage(model.getObject().getCampagne().getIdCampagne(), currentPage));
}
});
- columns.add(new EnumPropertyColumn<Molecule>(new Model<String>(getString("Molecule.identifieePar")), "identifieePar",
- "identifieePar", this));
+ columns.add(new PropertyColumn<Molecule>(new Model<String>(getString("Molecule.identifieePar")), "identifieePar",
+ "identifieePar"));
final DataTable<Molecule> moleculesDataTable = new AjaxFallbackDefaultDataTable<Molecule>(
getResource() + ".Molecules.Results", columns,
1
0
r62 - trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/behaviors
by echatellier@users.forge.codelutin.com 28 Jan '13
by echatellier@users.forge.codelutin.com 28 Jan '13
28 Jan '13
Author: echatellier
Date: 2013-01-28 18:17:45 +0100 (Mon, 28 Jan 2013)
New Revision: 62
Url: http://forge.codelutin.com/projects/cantharella/repository/revisions/62
Log:
URL must be context relative
Modified:
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/behaviors/MoleculeEditorBehavior.java
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/behaviors/MoleculeEditorBehavior.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/behaviors/MoleculeEditorBehavior.java 2013-01-28 16:02:08 UTC (rev 61)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/behaviors/MoleculeEditorBehavior.java 2013-01-28 17:17:45 UTC (rev 62)
@@ -56,14 +56,14 @@
@Override
public void renderHead(Component component, IHeaderResponse response) {
- response.renderCSSReference("/ChemDoodleWeb/css/ChemDoodleWeb.css");
- response.renderCSSReference("/ChemDoodleWeb/css/jquery-ui-1.9.2.custom.css");
- response.renderJavaScriptReference("/js/jquery-1.9.0.min.js");
- response.renderJavaScriptReference("/ChemDoodleWeb/js/ChemDoodleWeb-libs.js");
- response.renderJavaScriptReference("/ChemDoodleWeb/js/ChemDoodleWeb.js");
- response.renderJavaScriptReference("/ChemDoodleWeb/js/jquery-ui-1.9.2.custom.min.js");
- response.renderJavaScriptReference("/ChemDoodleWeb/js/ChemDoodleWeb-sketcher.js");
- response.renderJavaScriptReference("/js/moleditor.js");
+ response.renderCSSReference("ChemDoodleWeb/css/ChemDoodleWeb.css");
+ response.renderCSSReference("ChemDoodleWeb/css/jquery-ui-1.9.2.custom.css");
+ response.renderJavaScriptReference("js/jquery-1.9.0.min.js");
+ response.renderJavaScriptReference("ChemDoodleWeb/js/ChemDoodleWeb-libs.js");
+ response.renderJavaScriptReference("ChemDoodleWeb/js/ChemDoodleWeb.js");
+ response.renderJavaScriptReference("ChemDoodleWeb/js/jquery-ui-1.9.2.custom.min.js");
+ response.renderJavaScriptReference("ChemDoodleWeb/js/ChemDoodleWeb-sketcher.js");
+ response.renderJavaScriptReference("js/moleditor.js");
}
@Override
1
0
r61 - in trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain: molecule search
by echatellier@users.forge.codelutin.com 28 Jan '13
by echatellier@users.forge.codelutin.com 28 Jan '13
28 Jan '13
Author: echatellier
Date: 2013-01-28 17:02:08 +0100 (Mon, 28 Jan 2013)
New Revision: 61
Url: http://forge.codelutin.com/projects/cantharella/repository/revisions/61
Log:
Add molecule behaviour in search page
Modified:
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule/ListMoleculesPage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/search/SearchPage.java
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule/ListMoleculesPage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule/ListMoleculesPage.java 2013-01-28 15:56:22 UTC (rev 60)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule/ListMoleculesPage.java 2013-01-28 16:02:08 UTC (rev 61)
@@ -25,13 +25,11 @@
import java.util.ArrayList;
import java.util.List;
-import nc.ird.cantharella.data.model.Lot;
import nc.ird.cantharella.data.model.Molecule;
import nc.ird.cantharella.service.services.MoleculeService;
import nc.ird.cantharella.web.config.WebContext;
import nc.ird.cantharella.web.pages.TemplatePage;
import nc.ird.cantharella.web.pages.domain.campagne.ReadCampagnePage;
-import nc.ird.cantharella.web.pages.domain.lot.ManageLotPage;
import nc.ird.cantharella.web.utils.CallerPage;
import nc.ird.cantharella.web.utils.behaviors.MoleculeViewBehavior;
import nc.ird.cantharella.web.utils.columns.BooleanPropertyColumn;
@@ -39,7 +37,6 @@
import nc.ird.cantharella.web.utils.columns.EnumPropertyColumn;
import nc.ird.cantharella.web.utils.columns.LinkPropertyColumn;
import nc.ird.cantharella.web.utils.columns.LinkableImagePropertyColumn;
-import nc.ird.cantharella.web.utils.columns.LinkableImagePropertyColumn.LinkableImagePanel;
import nc.ird.cantharella.web.utils.models.DisplayDecimalPropertyModel.DecimalDisplFormat;
import nc.ird.cantharella.web.utils.models.LoadableDetachableSortableListDataProvider;
import nc.ird.cantharella.web.utils.security.AuthRole;
@@ -112,8 +109,6 @@
setResponsePage(new ReadMoleculePage(model.getObject().getIdMolecule(), currentPage));
}
});
-// columns.add(new PropertyColumn<Molecule>(new Model<String>(getString("Molecule.formuleDevMol")), "formuleDevMol",
-// "formuleDevMol"));
columns.add(new AbstractColumn<Molecule>(new Model<String>(getString("Molecule.formuleDevMol"))) {
public void populateItem(Item<ICellPopulator<Molecule>> cellItem, String componentId, IModel<Molecule> rowModel) {
cellItem.add(new Label(componentId, "-")
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/search/SearchPage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/search/SearchPage.java 2013-01-28 15:56:22 UTC (rev 60)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/search/SearchPage.java 2013-01-28 16:02:08 UTC (rev 61)
@@ -45,7 +45,6 @@
import nc.ird.cantharella.web.pages.domain.campagne.ReadCampagnePage;
import nc.ird.cantharella.web.pages.domain.extraction.ReadExtractionPage;
import nc.ird.cantharella.web.pages.domain.lot.ReadLotPage;
-import nc.ird.cantharella.web.pages.domain.molecule.ManageMoleculePage;
import nc.ird.cantharella.web.pages.domain.molecule.ReadMoleculePage;
import nc.ird.cantharella.web.pages.domain.purification.ReadPurificationPage;
import nc.ird.cantharella.web.pages.domain.specimen.ListSpecimensPage;
@@ -53,6 +52,7 @@
import nc.ird.cantharella.web.pages.domain.station.ReadStationPage;
import nc.ird.cantharella.web.pages.domain.testBio.ReadTestBioPage;
import nc.ird.cantharella.web.utils.CallerPage;
+import nc.ird.cantharella.web.utils.behaviors.MoleculeViewBehavior;
import nc.ird.cantharella.web.utils.behaviors.ReplaceEmptyLabelBehavior;
import nc.ird.cantharella.web.utils.columns.BooleanPropertyColumn;
import nc.ird.cantharella.web.utils.columns.DecimalPropertyColumn;
@@ -63,7 +63,6 @@
import nc.ird.cantharella.web.utils.columns.LinkableImagePropertyColumn;
import nc.ird.cantharella.web.utils.columns.MapValuePropertyColumn;
import nc.ird.cantharella.web.utils.columns.ShortDatePropertyColumn;
-import nc.ird.cantharella.web.utils.columns.LinkableImagePropertyColumn.LinkableImagePanel;
import nc.ird.cantharella.web.utils.links.CsvExportLink;
import nc.ird.cantharella.web.utils.models.DisplayDecimalPropertyModel;
import nc.ird.cantharella.web.utils.models.DisplayDecimalPropertyModel.DecimalDisplFormat;
@@ -591,8 +590,12 @@
setResponsePage(new ReadMoleculePage(model.getObject().getIdMolecule(), currentPage));
}
});
- columns.add(new PropertyColumn<Molecule>(new Model<String>(getString("Molecule.formuleDevMol")), "formuleDevMol",
- "formuleDevMol"));
+ columns.add(new AbstractColumn<Molecule>(new Model<String>(getString("Molecule.formuleDevMol"))) {
+ public void populateItem(Item<ICellPopulator<Molecule>> cellItem, String componentId, IModel<Molecule> rowModel) {
+ cellItem.add(new Label(componentId, "-")
+ .add(new MoleculeViewBehavior(new PropertyModel<String>(rowModel, "formuleDevMol"))));
+ }
+ });
columns.add(new PropertyColumn<Molecule>(new Model<String>(getString("Molecule.nomCommun")), "nomCommun",
"nomCommun"));
columns.add(new PropertyColumn<Molecule>(new Model<String>(getString("Molecule.familleChimique")), "familleChimique",
1
0
28 Jan '13
Author: echatellier
Date: 2013-01-28 16:56:22 +0100 (Mon, 28 Jan 2013)
New Revision: 60
Url: http://forge.codelutin.com/projects/cantharella/repository/revisions/60
Log:
Update spring to 3.2.1
Modified:
trunk/cantharella.service/pom.xml
trunk/pom.xml
Modified: trunk/cantharella.service/pom.xml
===================================================================
--- trunk/cantharella.service/pom.xml 2013-01-24 16:53:20 UTC (rev 59)
+++ trunk/cantharella.service/pom.xml 2013-01-28 15:56:22 UTC (rev 60)
@@ -118,6 +118,11 @@
<artifactId>spring-tx</artifactId>
</dependency>
<dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-jdbc</artifactId>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
</dependency>
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2013-01-24 16:53:20 UTC (rev 59)
+++ trunk/pom.xml 2013-01-28 15:56:22 UTC (rev 60)
@@ -126,7 +126,7 @@
<version.aspectj>1.6.8</version.aspectj>
<version.opencsv>2.3</version.opencsv>
<version.javassist>3.8.0.GA</version.javassist>
- <version.spring>3.2.0.RELEASE</version.spring>
+ <version.spring>3.2.1.RELEASE</version.spring>
<version.mail>1.4.5</version.mail>
<version.cglib>2.2.2</version.cglib>
@@ -267,6 +267,11 @@
</dependency>
<dependency>
<groupId>org.springframework</groupId>
+ <artifactId>spring-jdbc</artifactId>
+ <version>${version.spring}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>${version.spring}</version>
</dependency>
1
0