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
January 2013
- 2 participants
- 25 discussions
r55 - trunk/cantharella.data/src/main/resources/commons/sql
by echatellier@users.forge.codelutin.com 18 Jan '13
by echatellier@users.forge.codelutin.com 18 Jan '13
18 Jan '13
Author: echatellier
Date: 2013-01-18 17:36:05 +0100 (Fri, 18 Jan 2013)
New Revision: 55
Url: http://forge.codelutin.com/projects/cantharella/repository/revisions/55
Log:
Update schema modifications
Modified:
trunk/cantharella.data/src/main/resources/commons/sql/dev_update.sql
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-18 16:22:18 UTC (rev 54)
+++ trunk/cantharella.data/src/main/resources/commons/sql/dev_update.sql 2013-01-18 16:36:05 UTC (rev 55)
@@ -70,11 +70,6 @@
foreign key (createur_idPersonne)
references Personne
- alter table Molecule
- add constraint FKEC979EA67E7B9C4D
- foreign key (identifieePar_idPersonne)
- references Personne
-
alter table MoleculeProvenance
add constraint FK8B39E567F44F1B20
foreign key (molecule_idMolecule)
1
0
r54 - in trunk: cantharella.data/src/main/java/nc/ird/cantharella/data/model cantharella.service/src/main/java/nc/ird/cantharella/service/model cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/search cantharella.web/src/main/resources/commons
by echatellier@users.forge.codelutin.com 18 Jan '13
by echatellier@users.forge.codelutin.com 18 Jan '13
18 Jan '13
Author: echatellier
Date: 2013-01-18 17:22:18 +0100 (Fri, 18 Jan 2013)
New Revision: 54
Url: http://forge.codelutin.com/projects/cantharella/repository/revisions/54
Log:
refs #1652: add molecule to search engine
Modified:
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Molecule.java
trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/model/SearchResult.java
trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/SearchServiceImpl.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/search/SearchPage.html
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/search/SearchPage.java
trunk/cantharella.web/src/main/resources/commons/web_en.properties
trunk/cantharella.web/src/main/resources/commons/web_fr.properties
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-18 15:52:36 UTC (rev 53)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Molecule.java 2013-01-18 16:22:18 UTC (rev 54)
@@ -83,17 +83,18 @@
@NotNull
@Field(index=Index.YES, analyze=Analyze.YES, store=Store.YES)
private String familleChimique;
-
+
/** Famille developpée */
@Lob
@Type(type="org.hibernate.type.StringClobType") // see HHH-6105
private String formuleDevMol;
-
+
/** Nom IUPAC */
@Length(max = LENGTH_BIG_TEXT)
@NotNull
+ @Field(index=Index.YES, analyze=Analyze.YES, store=Store.YES)
private String nomIupca;
-
+
/** Formule brute */
@Length(max = LENGTH_MEDIUM_TEXT)
@NotEmpty
Modified: trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/model/SearchResult.java
===================================================================
--- trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/model/SearchResult.java 2013-01-18 15:52:36 UTC (rev 53)
+++ trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/model/SearchResult.java 2013-01-18 16:22:18 UTC (rev 54)
@@ -27,6 +27,7 @@
import nc.ird.cantharella.data.model.Extraction;
import nc.ird.cantharella.data.model.Lot;
+import nc.ird.cantharella.data.model.Molecule;
import nc.ird.cantharella.data.model.Purification;
import nc.ird.cantharella.data.model.ResultatTestBio;
import nc.ird.cantharella.data.model.Specimen;
@@ -53,6 +54,8 @@
protected List<ResultatTestBio> resultatTestBios;
protected List<Station> stations;
+
+ protected List<Molecule> molecules;
public List<Specimen> getSpecimens() {
return specimens;
@@ -101,4 +104,12 @@
public void setStations(List<Station> stations) {
this.stations = stations;
}
+
+ public List<Molecule> getMolecules() {
+ return molecules;
+ }
+
+ public void setMolecules(List<Molecule> molecules) {
+ this.molecules = molecules;
+ }
}
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-18 15:52:36 UTC (rev 53)
+++ trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/SearchServiceImpl.java 2013-01-18 16:22:18 UTC (rev 54)
@@ -28,6 +28,7 @@
import nc.ird.cantharella.data.model.Extraction;
import nc.ird.cantharella.data.model.Lot;
+import nc.ird.cantharella.data.model.Molecule;
import nc.ird.cantharella.data.model.Purification;
import nc.ird.cantharella.data.model.ResultatTestBio;
import nc.ird.cantharella.data.model.Specimen;
@@ -40,7 +41,6 @@
import org.apache.commons.logging.Log;
import org.apache.lucene.index.FieldInfos;
import org.apache.lucene.index.IndexReader;
-import org.apache.lucene.index.MultiReader;
import org.apache.lucene.queryParser.MultiFieldQueryParser;
import org.apache.lucene.queryParser.ParseException;
import org.apache.lucene.queryParser.QueryParser;
@@ -118,6 +118,7 @@
org.hibernate.Query hibPurification = getQuery(fullTextSession, Purification.class, strQuery, utilisateur);
org.hibernate.Query hibResultatTestBio = getQuery(fullTextSession, ResultatTestBio.class, strQuery, utilisateur);
org.hibernate.Query hibStation = getQuery(fullTextSession, Station.class, strQuery, utilisateur);
+ org.hibernate.Query hibMolecule = getQuery(fullTextSession, Molecule.class, strQuery, utilisateur);
// execute search
List<Specimen> specimens = hibSpecimen.list();
@@ -126,6 +127,7 @@
List<Purification> purifications = hibPurification.list();
List<ResultatTestBio> resultatTestBios = hibResultatTestBio.list();
List<Station> resultatStations = hibStation.list();
+ List<Molecule> resultatMolecules = hibMolecule.list();
result.setSpecimens(specimens);
result.setLots(lots);
@@ -133,6 +135,7 @@
result.setPurifications(purifications);
result.setResultatTestBios(resultatTestBios);
result.setStations(resultatStations);
+ result.setMolecules(resultatMolecules);
} catch (ParseException e) {
e.printStackTrace();
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/search/SearchPage.html
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/search/SearchPage.html 2013-01-18 15:52:36 UTC (rev 53)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/search/SearchPage.html 2013-01-18 16:22:18 UTC (rev 54)
@@ -61,6 +61,9 @@
<table cellspacing="0" wicket:id="SearchPage.ResultatTestBios.Results"/>
<a wicket:id="SearchPage.ResultatTestBios.ExportCSV"><wicket:message key="SearchPage.ExportCSV" /></a>
+<h3><wicket:message key="SearchPage.Molecules" /></h3>
+<table cellspacing="0" wicket:id="SearchPage.Molecules.Results"/>
+<a wicket:id="SearchPage.Molecules.ExportCSV"><wicket:message key="SearchPage.ExportCSV" /></a>
</wicket:extend>
</body>
</html>
\ No newline at end of file
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-18 15:52:36 UTC (rev 53)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/search/SearchPage.java 2013-01-18 16:22:18 UTC (rev 54)
@@ -30,6 +30,7 @@
import nc.ird.cantharella.data.model.Extrait;
import nc.ird.cantharella.data.model.Fraction;
import nc.ird.cantharella.data.model.Lot;
+import nc.ird.cantharella.data.model.Molecule;
import nc.ird.cantharella.data.model.Purification;
import nc.ird.cantharella.data.model.ResultatTestBio;
import nc.ird.cantharella.data.model.Specimen;
@@ -44,6 +45,8 @@
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;
import nc.ird.cantharella.web.pages.domain.specimen.ReadSpecimenPage;
@@ -60,6 +63,7 @@
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;
@@ -73,6 +77,7 @@
import org.apache.wicket.extensions.markup.html.repeater.data.table.DataTable;
import org.apache.wicket.extensions.markup.html.repeater.data.table.DefaultDataTable;
import org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn;
+import org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.form.TextField;
@@ -133,6 +138,7 @@
addPurificationsTable(currentPage, searchResult);
addTestBiosTable(currentPage, searchResult);
addStationsTable(currentPage, searchResult);
+ addMoleculesTable(currentPage, searchResult);
}
public String getQuery() {
@@ -561,4 +567,56 @@
add(stationsDataTable);
add(new CsvExportLink("SearchPage.Stations.ExportCSV", stationsDataTable, "stations.csv"));
}
+
+ protected void addMoleculesTable(final CallerPage currentPage, SearchResult searchResult) {
+
+ // Liste des molecules
+ final List<Molecule> molecules = searchResult.getMolecules();
+
+ LoadableDetachableSortableListDataProvider<Molecule> moleculesDataProvider = new LoadableDetachableSortableListDataProvider<Molecule>(
+ molecules, getSession().getLocale());
+
+ List<IColumn<Molecule>> columns = new ArrayList<IColumn<Molecule>>();
+
+ columns.add(new LinkableImagePropertyColumn<Molecule>("images/read.png", getString("Read"), getString("Read")) {
+ @Override
+ public void onClick(Item<ICellPopulator<Molecule>> item, String componentId, IModel<Molecule> model) {
+ setResponsePage(new ReadMoleculePage(model.getObject().getIdMolecule(), currentPage));
+ }
+ });
+ columns.add(new LinkPropertyColumn<Molecule>(new Model<String>(getString("Molecule.idMolecule")), "idMolecule", "idMolecule",
+ getString("Read")) {
+ @Override
+ public void onClick(Item<ICellPopulator<Molecule>> item, String componentId, IModel<Molecule> model) {
+ setResponsePage(new ReadMoleculePage(model.getObject().getIdMolecule(), currentPage));
+ }
+ });
+ columns.add(new PropertyColumn<Molecule>(new Model<String>(getString("Molecule.formuleDevMol")), "formuleDevMol",
+ "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",
+ "familleChimique"));
+ columns.add(new PropertyColumn<Molecule>(new Model<String>(getString("Molecule.formuleBrute")), "formuleBrute",
+ "formuleBrute"));
+ columns.add(new DecimalPropertyColumn<Molecule>(new Model<String>(getString("Molecule.masseMolaire")), "masseMolaire",
+ "masseMolaire", DecimalDisplFormat.SMALL, getLocale()));
+ columns.add(new BooleanPropertyColumn<Molecule>(new Model<String>(getString("Molecule.nouvMolecul")), "nouvMolecul",
+ "nouvMolecul", this));
+ columns.add(new LinkPropertyColumn<Molecule>(new Model<String>(getString("Molecule.campagne")), "campagne",
+ "campagne", getString("Read")) {
+ @Override
+ public void onClick(Item<ICellPopulator<Molecule>> item, String componentId, IModel<Molecule> model) {
+ setResponsePage(new ReadCampagnePage(model.getObject().getCampagne().getIdCampagne(), currentPage));
+ }
+ });
+ columns.add(new EnumPropertyColumn<Molecule>(new Model<String>(getString("Molecule.identifieePar")), "identifieePar",
+ "identifieePar", this));
+
+ final DataTable<Molecule> moleculesDataTable = new AjaxFallbackDefaultDataTable<Molecule>(
+ getResource() + ".Molecules.Results", columns,
+ moleculesDataProvider, WebContext.ROWS_PER_PAGE);
+ add(moleculesDataTable);
+ add(new CsvExportLink("SearchPage.Molecules.ExportCSV", moleculesDataTable, "molecules.csv"));
+ }
}
Modified: trunk/cantharella.web/src/main/resources/commons/web_en.properties
===================================================================
--- trunk/cantharella.web/src/main/resources/commons/web_en.properties 2013-01-18 15:52:36 UTC (rev 53)
+++ trunk/cantharella.web/src/main/resources/commons/web_en.properties 2013-01-18 16:22:18 UTC (rev 54)
@@ -290,6 +290,7 @@
SearchPage.Purifications=Purifications
SearchPage.ResultatTestBios=Bioassay
SearchPage.Stations=Stations
+SearchPage.Molecules=Molecules
SearchPage.QuerySyntax=Search terms (or parts of words using *). For a more advanced search, consult the ${advancedLink}.
SearchPage.QuerySyntaxAdvanced=complete syntax
SearchPage.ExportCSV=Export to CSV
Modified: trunk/cantharella.web/src/main/resources/commons/web_fr.properties
===================================================================
--- trunk/cantharella.web/src/main/resources/commons/web_fr.properties 2013-01-18 15:52:36 UTC (rev 53)
+++ trunk/cantharella.web/src/main/resources/commons/web_fr.properties 2013-01-18 16:22:18 UTC (rev 54)
@@ -289,6 +289,7 @@
SearchPage.Purifications=Purifications
SearchPage.ResultatTestBios=Tests biologiques
SearchPage.Stations=Stations
+SearchPage.Molecules=Molécules
SearchPage.QuerySyntax=Rechercher des termes (ou des parties de termes avec *). Pour une utilisation plus avancée de la recherche, consulter la ${advancedLink}.
SearchPage.QuerySyntaxAdvanced=synthaxe complète
SearchPage.ExportCSV=Exporter en CSV
1
0
r53 - in trunk/cantharella.data/src/main: java/nc/ird/cantharella/data/model resources/commons/sql
by echatellier@users.forge.codelutin.com 18 Jan '13
by echatellier@users.forge.codelutin.com 18 Jan '13
18 Jan '13
Author: echatellier
Date: 2013-01-18 16:52:36 +0100 (Fri, 18 Jan 2013)
New Revision: 53
Url: http://forge.codelutin.com/projects/cantharella/repository/revisions/53
Log:
refs #1646: Configuration de la sequence de id molecule
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/Molecule.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Specimen.java
trunk/cantharella.data/src/main/resources/commons/sql/dev_update.sql
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-18 15:37:14 UTC (rev 52)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Fraction.java 2013-01-18 15:52:36 UTC (rev 53)
@@ -30,7 +30,6 @@
import nc.ird.cantharella.data.validation.CollectionUniqueField;
-import org.hibernate.search.annotations.Indexed;
import org.hibernate.search.annotations.IndexedEmbedded;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotEmpty;
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-18 15:37:14 UTC (rev 52)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Molecule.java 2013-01-18 15:52:36 UTC (rev 53)
@@ -35,6 +35,7 @@
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
+import javax.persistence.SequenceGenerator;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
@@ -67,7 +68,8 @@
/** ID */
@Id
- @GeneratedValue
+ @GeneratedValue(generator="molecule_sequence_gen")
+ @SequenceGenerator(name="molecule_sequence_gen", sequenceName="molecule_sequence")
private Integer idMolecule;
/** Nom commun */
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-18 15:37:14 UTC (rev 52)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Specimen.java 2013-01-18 15:52:36 UTC (rev 53)
@@ -45,7 +45,6 @@
import org.apache.commons.beanutils.BeanComparator;
import org.hibernate.annotations.Type;
import org.hibernate.search.annotations.Analyze;
-import org.hibernate.search.annotations.DocumentId;
import org.hibernate.search.annotations.Field;
import org.hibernate.search.annotations.FullTextFilterDef;
import org.hibernate.search.annotations.FullTextFilterDefs;
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-18 15:37:14 UTC (rev 52)
+++ trunk/cantharella.data/src/main/resources/commons/sql/dev_update.sql 2013-01-18 15:52:36 UTC (rev 53)
@@ -84,4 +84,5 @@
add constraint FK8B39E567FE19187A
foreign key (produit_id)
references Produit
-
\ No newline at end of file
+
+ create sequence molecule_sequence
\ No newline at end of file
1
0
r52 - in trunk: cantharella.data/src/main/java/nc/ird/cantharella/data/model cantharella.data/src/main/resources/commons cantharella.data/src/main/resources/commons/sql cantharella.service/src/main/java/nc/ird/cantharella/service/services cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule cantharella.web/src/main/resources/commons
by echatellier@users.forge.codelutin.com 18 Jan '13
by echatellier@users.forge.codelutin.com 18 Jan '13
18 Jan '13
Author: echatellier
Date: 2013-01-18 16:37:14 +0100 (Fri, 18 Jan 2013)
New Revision: 52
Url: http://forge.codelutin.com/projects/cantharella/repository/revisions/52
Log:
refs #1646: visualisation des mol?\195?\169cules et ajout/visu des provenances
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/MoleculeProvenance.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/ResultatTestBio.java
trunk/cantharella.data/src/main/resources/commons/data_en.properties
trunk/cantharella.data/src/main/resources/commons/data_fr.properties
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.html
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule/ReadMoleculePage.java
trunk/cantharella.web/src/main/resources/commons/web_en.properties
trunk/cantharella.web/src/main/resources/commons/web_fr.properties
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-18 11:16:16 UTC (rev 51)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Molecule.java 2013-01-18 15:37:14 UTC (rev 52)
@@ -27,6 +27,8 @@
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;
@@ -38,6 +40,7 @@
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;
@@ -108,8 +111,8 @@
private Campagne campagne;
/** Identifiee par. */
- @ManyToOne(fetch = FetchType.EAGER)
- private Personne identifieePar;
+ @Enumerated(EnumType.ORDINAL)
+ private TypeOrganisme identifieePar;
/** Publication d'origine */
@Lob
@@ -261,14 +264,14 @@
/**
* @return the identifieePar
*/
- public Personne getIdentifieePar() {
+ public TypeOrganisme getIdentifieePar() {
return identifieePar;
}
/**
* @param identifieePar the identifieePar to set
*/
- public void setIdentifieePar(Personne identifieePar) {
+ public void setIdentifieePar(TypeOrganisme identifieePar) {
this.identifieePar = identifieePar;
}
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/MoleculeProvenance.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/MoleculeProvenance.java 2013-01-18 11:16:16 UTC (rev 51)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/MoleculeProvenance.java 2013-01-18 15:37:14 UTC (rev 52)
@@ -38,7 +38,7 @@
import nc.ird.cantharella.data.model.utils.AbstractModel;
@Entity
-public class MoleculeProvenance extends AbstractModel {
+public class MoleculeProvenance extends AbstractModel implements Cloneable {
/** Id */
@Id
@@ -116,4 +116,15 @@
public void setProduit(Produit produit) {
this.produit = produit;
}
+
+ /** {@inheritDoc} */
+ @Override
+ public MoleculeProvenance clone() throws CloneNotSupportedException {
+ MoleculeProvenance clone = (MoleculeProvenance) super.clone();
+ clone.id = id;
+ clone.pourcentage = pourcentage;
+ clone.molecule = molecule;
+ clone.produit = produit;
+ return clone;
+ }
}
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-01-18 11:16:16 UTC (rev 51)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/ResultatTestBio.java 2013-01-18 15:37:14 UTC (rev 52)
@@ -37,7 +37,6 @@
import javax.validation.constraints.NotNull;
import nc.ird.cantharella.data.config.DataContext;
-import nc.ird.cantharella.data.model.search.ProduitBridge;
import nc.ird.cantharella.data.model.search.UtilisateurSearchFilter;
import nc.ird.cantharella.data.model.utils.AbstractModel;
import nc.ird.cantharella.data.validation.CollectionUniqueField;
@@ -46,7 +45,6 @@
import org.apache.commons.beanutils.BeanComparator;
import org.apache.commons.collections.comparators.ComparatorChain;
import org.hibernate.annotations.Index;
-import org.hibernate.search.annotations.FieldBridge;
import org.hibernate.search.annotations.FullTextFilterDef;
import org.hibernate.search.annotations.FullTextFilterDefs;
import org.hibernate.search.annotations.Indexed;
Modified: trunk/cantharella.data/src/main/resources/commons/data_en.properties
===================================================================
--- trunk/cantharella.data/src/main/resources/commons/data_en.properties 2013-01-18 11:16:16 UTC (rev 51)
+++ trunk/cantharella.data/src/main/resources/commons/data_en.properties 2013-01-18 15:37:14 UTC (rev 52)
@@ -194,13 +194,13 @@
Molecule.publiOrigine=Publication d'origine
Molecule.complement=Compl�ment
Molecule.createur=Cr�ateur de la fiche
-Molecule.produits=Provenance
-Molecule.produits.produit.ref=R�f. Produit
-Molecule.produits.presence=%
-Molecule.produits.lot.ref=R�f. Lot
-Molecule.produits.genre=Genre
-Molecule.produits.espece=Esp�ce
-Molecule.produits.campagne=Campagne
+Molecule.provenance=Provenance
+Molecule.provenance.produit.ref=R�f. Produit
+Molecule.provenance.presence=%
+Molecule.provenance.lot.ref=R�f. Lot
+Molecule.provenance.genre=Genre
+Molecule.provenance.espece=Esp�ce
+Molecule.provenance.campagne=Campagne
TestBio.ref=Test ref.
Modified: trunk/cantharella.data/src/main/resources/commons/data_fr.properties
===================================================================
--- trunk/cantharella.data/src/main/resources/commons/data_fr.properties 2013-01-18 11:16:16 UTC (rev 51)
+++ trunk/cantharella.data/src/main/resources/commons/data_fr.properties 2013-01-18 15:37:14 UTC (rev 52)
@@ -194,13 +194,13 @@
Molecule.publiOrigine=Publication d'origine
Molecule.complement=Complément
Molecule.createur=Créateur de la fiche
-Molecule.produits=Provenance
-Molecule.produits.produit.ref=Réf. Produit
-Molecule.produits.presence=%
-Molecule.produits.lot.ref=Réf. Lot
-Molecule.produits.genre=Genre
-Molecule.produits.espece=Espèce
-Molecule.produits.campagne=Campagne
+Molecule.provenance=Provenance
+Molecule.provenance.produit.ref=Réf. Produit
+Molecule.provenance.presence=%
+Molecule.provenance.lot.ref=Réf. Lot
+Molecule.provenance.genre=Genre
+Molecule.provenance.espece=Espèce
+Molecule.provenance.campagne=Campagne
TestBio.ref=Réf. test
TestBio.manipulateur=Manipulateur
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-18 11:16:16 UTC (rev 51)
+++ trunk/cantharella.data/src/main/resources/commons/sql/dev_update.sql 2013-01-18 15:37:14 UTC (rev 52)
@@ -48,7 +48,7 @@
publiOrigine text,
campagne_idCampagne int4,
createur_idPersonne int4 not null,
- identifieePar_idPersonne int4,
+ identifieePar int4,
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-18 11:16:16 UTC (rev 51)
+++ trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/MoleculeService.java 2013-01-18 15:37:14 UTC (rev 52)
@@ -27,6 +27,7 @@
import nc.ird.cantharella.data.exceptions.DataConstraintException;
import nc.ird.cantharella.data.exceptions.DataNotFoundException;
import nc.ird.cantharella.data.model.Molecule;
+import nc.ird.cantharella.data.model.Utilisateur;
import nc.ird.cantharella.service.utils.normalizers.MoleculeNormalizer;
import nc.ird.cantharella.service.utils.normalizers.utils.Normalize;
@@ -81,5 +82,12 @@
*/
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);
}
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-18 11:16:16 UTC (rev 51)
+++ trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/MoleculeServiceImpl.java 2013-01-18 15:37:14 UTC (rev 52)
@@ -29,6 +29,8 @@
import nc.ird.cantharella.data.exceptions.DataNotFoundException;
import nc.ird.cantharella.data.exceptions.UnexpectedException;
import nc.ird.cantharella.data.model.Molecule;
+import nc.ird.cantharella.data.model.Utilisateur;
+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;
@@ -100,4 +102,10 @@
}
}
+
+ @Override
+ public boolean updateOrdeleteMoleculeEnabled(Molecule molecule, Utilisateur utilisateur) {
+ return utilisateur.getTypeDroit() == TypeDroit.ADMINISTRATEUR
+ || utilisateur.getIdPersonne() == molecule.getCreateur().getIdPersonne();
+ }
}
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-18 11:16:16 UTC (rev 51)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule/ListMoleculesPage.java 2013-01-18 15:37:14 UTC (rev 52)
@@ -25,13 +25,21 @@
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.columns.BooleanPropertyColumn;
+import nc.ird.cantharella.web.utils.columns.DecimalPropertyColumn;
+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;
import nc.ird.cantharella.web.utils.security.AuthRoles;
@@ -43,6 +51,7 @@
import org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn;
import org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn;
import org.apache.wicket.markup.html.WebMarkupContainer;
+import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.link.Link;
import org.apache.wicket.markup.repeater.Item;
import org.apache.wicket.model.IModel;
@@ -100,30 +109,46 @@
setResponsePage(new ReadMoleculePage(model.getObject().getIdMolecule(), currentPage));
}
});
-
+ columns.add(new PropertyColumn<Molecule>(new Model<String>(getString("Molecule.formuleDevMol")), "formuleDevMol",
+ "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",
"familleChimique"));
- columns.add(new PropertyColumn<Molecule>(new Model<String>(getString("Molecule.formuleDevMol")), "formuleDevMol",
- "formuleDevMol"));
- columns.add(new PropertyColumn<Molecule>(new Model<String>(getString("Molecule.nomIupca")), "nomIupca",
- "nomIupca"));
columns.add(new PropertyColumn<Molecule>(new Model<String>(getString("Molecule.formuleBrute")), "formuleBrute",
"formuleBrute"));
- columns.add(new PropertyColumn<Molecule>(new Model<String>(getString("Molecule.masseMolaire")), "masseMolaire",
- "masseMolaire"));
- columns.add(new PropertyColumn<Molecule>(new Model<String>(getString("Molecule.nouvMolecul")), "nouvMolecul",
- "nouvMolecul"));
- columns.add(new PropertyColumn<Molecule>(new Model<String>(getString("Molecule.campagne")), "campagne",
- "campagne"));
- columns.add(new PropertyColumn<Molecule>(new Model<String>(getString("Molecule.identifieePar")), "identifieePar",
- "identifieePar"));
- columns.add(new PropertyColumn<Molecule>(new Model<String>(getString("Molecule.publiOrigine")), "publiOrigine",
- "publiOrigine"));
- columns.add(new PropertyColumn<Molecule>(new Model<String>(getString("Molecule.complement")), "complement",
- "complement"));
+ columns.add(new DecimalPropertyColumn<Molecule>(new Model<String>(getString("Molecule.masseMolaire")), "masseMolaire",
+ "masseMolaire", DecimalDisplFormat.SMALL, getLocale()));
+ columns.add(new BooleanPropertyColumn<Molecule>(new Model<String>(getString("Molecule.nouvMolecul")), "nouvMolecul",
+ "nouvMolecul", this));
+ columns.add(new LinkPropertyColumn<Molecule>(new Model<String>(getString("Molecule.campagne")), "campagne",
+ "campagne", getString("Read")) {
+ @Override
+ public void onClick(Item<ICellPopulator<Molecule>> item, String componentId, IModel<Molecule> model) {
+ 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 LinkableImagePropertyColumn<Molecule>("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<Molecule>> item, String componentId, IModel<Molecule> model) {
+ if (moleculeService.updateOrdeleteMoleculeEnabled(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<Molecule>> item, String componentId, IModel<Molecule> model) {
+ setResponsePage(new ManageMoleculePage(model.getObject().getIdMolecule(), currentPage));
+ }
+ });
+
final DataTable<Molecule> moleculesDataTable = new AjaxFallbackDefaultDataTable<Molecule>("ListMoleculesPage.Molecules", columns,
moleculesDataProvider, WebContext.ROWS_PER_PAGE);
moleculesRefresh.add(moleculesDataTable);
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-18 11:16:16 UTC (rev 51)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule/ManageMoleculePage.html 2013-01-18 15:37:14 UTC (rev 52)
@@ -53,7 +53,7 @@
<input type="text" id="Molecule.formuleBrute" wicket:id="Molecule.formuleBrute" />
</div>
- <div class="property">
+ <div class="property required">
<label for="Molecule.masseMolaire"><wicket:message key="Molecule.masseMolaire" /></label>
<input type="text" id="Molecule.masseMolaire" wicket:id="Molecule.masseMolaire" />
</div>
@@ -97,61 +97,61 @@
</div>
<fieldset>
- <legend><wicket:message key="Molecule.produits" /></legend>
- <table class="large" cellspacing="0" wicket:id="Molecule.produits.Table">
+ <legend><wicket:message key="Molecule.provenance" /></legend>
+ <table class="large" cellspacing="0" wicket:id="Molecule.provenance.Table">
<thead>
<tr>
<th class="required">
- <label for="Molecule.produits.List.produit.ref"><wicket:message key="Molecule.produits.produit.ref" /></label>
+ <label for="Molecule.provenance.List.produit.ref"><wicket:message key="Molecule.provenance.produit.ref" /></label>
</th>
<th class="required">
- <label for="Molecule.produits.List.presence"><wicket:message key="Molecule.produits.presence" /></label>
+ <label for="Molecule.provenance.List.presence"><wicket:message key="Molecule.provenance.presence" /></label>
</th>
<th>
- <label for="Molecule.produits.List.lot.ref"><wicket:message key="Molecule.produits.lot.ref" /></label>
+ <label for="Molecule.provenance.List.lot.ref"><wicket:message key="Molecule.provenance.lot.ref" /></label>
</th>
<th>
- <label for="Molecule.produits.List.genre"><wicket:message key="Molecule.produits.genre" /></label>
+ <label for="Molecule.provenance.List.genre"><wicket:message key="Molecule.provenance.genre" /></label>
</th>
<th>
- <label for="Molecule.produits.List.espece"><wicket:message key="Molecule.produits.espece" /></label>
+ <label for="Molecule.provenance.List.espece"><wicket:message key="Molecule.provenance.espece" /></label>
</th>
<th>
- <label for="Molecule.produits.List.campagne"><wicket:message key="Molecule.produits.campagne" /></label>
+ <label for="Molecule.provenance.List.campagne"><wicket:message key="Molecule.provenance.campagne" /></label>
</th>
<th><wicket:message key="Actions" /></th>
</tr>
</thead>
<tbody>
- <tr wicket:id="Molecule.produits.List">
+ <tr wicket:id="Molecule.provenance.List">
<td>
- <span wicket:id="Molecule.produits.List.produit.ref" />
+ <span wicket:id="Molecule.provenance.List.produit.ref" />
</td>
<td>
- <span wicket:id="Molecule.produits.List.presence" />
+ <span wicket:id="Molecule.provenance.List.presence" />
</td>
<td>
- <span wicket:id="Molecule.produits.List.lot.ref" />
+ <span wicket:id="Molecule.provenance.List.lot.ref" />
</td>
<td>
- <span wicket:id="Molecule.produits.List.genre" />
+ <span wicket:id="Molecule.provenance.List.genre" />
</td>
<td>
- <span wicket:id="Molecule.produits.List.espece" />
+ <span wicket:id="Molecule.provenance.List.espece" />
</td>
<td>
- <span wicket:id="Molecule.produits.List.campagne" />
+ <span wicket:id="Molecule.provenance.List.campagne" />
</td>
<td>
- <input wicket:id="Molecule.produits.List.Delete" type="submit" wicket:message="value:Delete" />
+ <input wicket:id="Molecule.provenance.List.Delete" type="submit" wicket:message="value:Delete" />
</td>
</tr>
<tr>
<td>
- <select class="tiny" id="Molecule.produits.produit.ref" wicket:id="Molecule.produits.produit.ref" />
+ <select class="tiny" id="Molecule.provenance.produit.ref" wicket:id="Molecule.provenance.produit.ref" />
</td>
<td>
- <input type="text" class="tiny" id="Molecule.produits.presence" wicket:id="Molecule.produits.presence" />
+ <input type="text" class="tiny" id="Molecule.provenance.presence" wicket:id="Molecule.provenance.presence" />
</td>
<td>
todo lot
@@ -166,10 +166,15 @@
todo campagne
</td>
<td>
- <input wicket:id="Molecule.produits.Add" type="submit" wicket:message="value:Add" />
+ <input wicket:id="Molecule.provenance.Add" type="submit" wicket:message="value:Add" />
</td>
</tr>
</tbody>
+ <tfoot class="highlightFoot" wicket:id="Molecule.provenance.resultsNotAccessibles">
+ <tr>
+ <td colspan="7"><span class="info"><wicket:message key="Molecule.provenanceNotAccessibles"/></span></td>
+ </tr>
+ </tfoot>
</table>
</fieldset>
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-18 11:16:16 UTC (rev 51)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule/ManageMoleculePage.java 2013-01-18 15:37:14 UTC (rev 52)
@@ -23,40 +23,58 @@
package nc.ird.cantharella.web.pages.domain.molecule;
import java.math.BigDecimal;
+import java.util.Arrays;
import java.util.List;
import nc.ird.cantharella.data.exceptions.DataConstraintException;
import nc.ird.cantharella.data.exceptions.DataNotFoundException;
import nc.ird.cantharella.data.exceptions.UnexpectedException;
import nc.ird.cantharella.data.model.Campagne;
+import nc.ird.cantharella.data.model.Extrait;
+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.ReplaceEmptyLabelBehavior;
import nc.ird.cantharella.web.utils.forms.SubmittableButton;
import nc.ird.cantharella.web.utils.forms.SubmittableButtonEvents;
+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;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.markup.html.form.AjaxFallbackButton;
import org.apache.wicket.ajax.markup.html.form.AjaxSubmitLink;
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.CheckBox;
import org.apache.wicket.markup.html.form.DropDownChoice;
@@ -91,9 +109,6 @@
/** Logger */
private static final Log LOG = LogTools.getLog();
- /** Personnes */
- private final List<Personne> personnes;
-
/** Campagnes */
private final List<Campagne> campagnes;
@@ -146,7 +161,7 @@
* @param callerPage Page appelante
* @param multipleEntry Saisie multiple
*/
- private ManageMoleculePage(Integer idMolecule, final CallerPage callerPage) {
+ public ManageMoleculePage(Integer idMolecule, final CallerPage callerPage) {
super(ManageMoleculePage.class);
this.callerPage = callerPage;
@@ -168,18 +183,21 @@
}
// Initialisation des listes
- personnes = personneService.listPersonnes();
campagnes = campagneService.listCampagnes(getSession().getUtilisateur());
final Form<Void> formView = new Form<Void>("Form");
- initProvenanceFields(formView);
+ 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 TextField<String>("Molecule.formuleDevMol", new PropertyModel<String>(moleculeModel, "formuleDevMol")));
formView.add(new TextField<String>("Molecule.nomIupca", new PropertyModel<String>(moleculeModel, "nomIupca")));
formView.add(new TextField<String>("Molecule.formuleBrute", new PropertyModel<String>(moleculeModel, "formuleBrute")));
- formView.add(new TextField<String>("Molecule.masseMolaire", new PropertyModel<String>(moleculeModel, "masseMolaire")));
+
+ 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");
@@ -199,11 +217,11 @@
}
});
- DropDownChoice<Personne> pers = new DropDownChoice<Personne>("Molecule.identifieePar",
- new PropertyModel<Personne>(moleculeModel, "identifieePar"), personnes, new PersonneRenderer());
- //pers.setNullValid(false);
- //pers.setModelObject(extractionModel.getObject().getManipulateur());
- nouvMoleculRefresh.add(pers);
+ DropDownChoice<TypeOrganisme> identifieeParInput = new DropDownChoice<TypeOrganisme>("Molecule.identifieePar",
+ new PropertyModel<TypeOrganisme>(moleculeModel, "identifieePar"),
+ Arrays.asList(TypeOrganisme.values()), new EnumChoiceRenderer<TypeOrganisme>(this));
+ //identifieeParInput.setNullValid(false);
+ nouvMoleculRefresh.add(identifieeParInput);
DropDownChoice<Campagne> campagnesInput = new DropDownChoice<Campagne>("Molecule.campagne",
new PropertyModel<Campagne>(moleculeModel, "campagne"), campagnes);
@@ -309,17 +327,76 @@
*
* @param formView
*/
- private void initProvenanceFields(final Form<Void> formView) {
+ private void initProvenanceFields(final Form<Void> formView, final CallerPage currentPage) {
// Déclaration tableau des provenances
- final MarkupContainer provenanceTable = new WebMarkupContainer("Molecule.produits.Table");
+ final MarkupContainer provenanceTable = new WebMarkupContainer("Molecule.provenance.Table");
provenanceTable.setOutputMarkupId(true);
+ final WebMarkupContainer resultNotAccessibleCont = new WebMarkupContainer(
+ "Molecule.provenance.resultsNotAccessibles");
+ resultNotAccessibleCont.setOutputMarkupPlaceholderTag(true);
+ provenanceTable.add(resultNotAccessibleCont);
+
// Contenu tableaux provenance
- provenanceTable.add(new ListView<MoleculeProvenance>("Molecule.produits.List",
+ provenanceTable.add(new ListView<MoleculeProvenance>("Molecule.provenance.List",
new PropertyModel<List<MoleculeProvenance>>(moleculeModel, "provenances")) {
@Override
protected void populateItem(ListItem<MoleculeProvenance> item) {
- // TODO echatellier it's NOT produit (new object with %)
+ if (item.getIndex() % 2 == 1) {
+ item.add(new AttributeModifier("class", item.getIndex() % 2 == 0 ? "even" : "odd"));
+ }
+
+ IModel<MoleculeProvenance> provenanceModel = item.getModel();
+ final MoleculeProvenance provenance = provenanceModel.getObject();
+
+ // affichage + lien vers la fiche
+ item.add(new PropertyLabelLinkProduitPanel("Molecule.provenance.List.produit.ref",
+ new PropertyModel<Produit>(provenanceModel, "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));
+ }
+ });
+
+ item.add(new Label("Molecule.provenance.List.presence", new DisplayDecimalPropertyModel(
+ provenanceModel, "pourcentage", DecimalDisplFormat.SMALL, getLocale())))
+ .add(new ReplaceEmptyLabelBehavior());
+ item.add(new Label("Molecule.provenance.List.lot.ref", new PropertyModel<String>(provenanceModel,
+ "pourcentage")).add(new ReplaceEmptyLabelBehavior()));
+ item.add(new Label("Molecule.provenance.List.genre", new PropertyModel<String>(provenanceModel,
+ "pourcentage")).add(new ReplaceEmptyLabelBehavior()));
+ item.add(new Label("Molecule.provenance.List.espece", new PropertyModel<String>(provenanceModel,
+ "pourcentage")).add(new ReplaceEmptyLabelBehavior()));
+ item.add(new Label("Molecule.provenance.List.campagne", new PropertyModel<String>(provenanceModel,
+ "pourcentage")).add(new ReplaceEmptyLabelBehavior()));
+
+ // Action : suppression d'un résultat de test
+ Button deleteButton = new AjaxFallbackButton("Molecule.provenance.List.Delete", formView) {
+ @Override
+ protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
+ // Suppression
+ moleculeModel.getObject().getProvenances().remove(provenance);
+
+ if (target != null) {
+ target.add(provenanceTable);
+ refreshFeedbackPage(target);
+ }
+ }
+
+ @Override
+ protected void onError(AjaxRequestTarget target, Form<?> form) {
+ // never called
+ }
+
+ };
+ deleteButton.setDefaultFormProcessing(false);
+ item.add(deleteButton);
}
});
@@ -327,14 +404,15 @@
Utilisateur utilisateur = getSession().getUtilisateur();
List<Produit> utilisateurProduits = produitService.listProduits(utilisateur);
final DropDownChoice<Produit> produitChoice = new DropDownChoice<Produit>(
- "Molecule.produits.produit.ref", new PropertyModel<Produit>(newProvenanceModel, "produit"),
+ "Molecule.provenance.produit.ref", new PropertyModel<Produit>(newProvenanceModel, "produit"),
utilisateurProduits, new ProduitRenderer()) {
};
produitChoice.setNullValid(false);
provenanceTable.add(produitChoice);
+ //FIXME echatellier enable or disable resultNotAccessibleCont if product are not listed
- final TextField<BigDecimal> presenceInput = new TextField<BigDecimal>("Molecule.produits.presence",
+ final TextField<BigDecimal> presenceInput = new TextField<BigDecimal>("Molecule.provenance.presence",
new PropertyModel<BigDecimal>(newProvenanceModel, "pourcentage")) {
};
@@ -343,15 +421,42 @@
provenanceTable.add(presenceInput);
// Bouton AJAX pour ajouter un résultat de test
- addProvenanceButton = new AjaxFallbackButton("Molecule.produits.Add", formView) {
+ addProvenanceButton = new AjaxFallbackButton("Molecule.provenance.Add", formView) {
@Override
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
+ try {
+ // ajout du type molecule
+ newProvenanceModel.getObject().setMolecule(moleculeModel.getObject());
+ // ajout à la liste
+ MoleculeProvenance provenanceAdded = newProvenanceModel.getObject().clone();
+ moleculeModel.getObject().getProvenances().add(provenanceAdded);
+
+ List<String> errors = validator.validate(newProvenanceModel.getObject(), getSession().getLocale());
+
+ if (errors.isEmpty()) {
+ // réinit des champs de la ligne "ajout"
+ newProvenanceModel.getObject().setProduit(null);
+ newProvenanceModel.getObject().setPourcentage(null);
+ newProvenanceModel.getObject().setMolecule(null);
+ } else {
+ moleculeModel.getObject().getProvenances().remove(provenanceAdded);
+ addValidationErrors(errors);
+ }
+ } catch (CloneNotSupportedException e) {
+ LOG.error(e.getMessage(), e);
+ throw new UnexpectedException(e);
+ }
+
+ if (target != null) {
+ target.add(provenanceTable);
+ refreshFeedbackPage(target);
+ }
}
@Override
protected void onError(AjaxRequestTarget target, Form<?> form) {
-
+ refreshFeedbackPage(target);
}
};
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule/ReadMoleculePage.html
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule/ReadMoleculePage.html 2013-01-18 11:16:16 UTC (rev 51)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule/ReadMoleculePage.html 2013-01-18 15:37:14 UTC (rev 52)
@@ -66,22 +66,24 @@
<span class="value" wicket:id="Molecule.nouvMolecul" ></span>
</div>
- <div class="property">
- <span class="label"><wicket:message key="Molecule.campagne" /></span>
- <span class="value" wicket:id="Molecule.campagne" ></span>
- </div>
+ <div wicket:id="Molecule.nouvMolecul.Refresh">
+ <div class="property">
+ <span class="label"><wicket:message key="Molecule.campagne" /></span>
+ <span class="value" wicket:id="Molecule.campagne" ></span>
+ </div>
+
+ <div class="property">
+ <span class="label"><wicket:message key="Molecule.identifieePar" /></span>
+ <span class="value" wicket:id="Molecule.identifieePar" ></span>
+ </div>
+
+ <div class="property">
+ <span class="label"><wicket:message key="Molecule.publiOrigine" /></span>
+ <span class="value" wicket:id="Molecule.publiOrigine" ></span>
+ </div>
+ </div>
<div class="property">
- <span class="label"><wicket:message key="Molecule.identifieePar" /></span>
- <span class="value" wicket:id="Molecule.identifieePar" ></span>
- </div>
-
- <div class="property">
- <span class="label"><wicket:message key="Molecule.publiOrigine" /></span>
- <span class="value" wicket:id="Molecule.publiOrigine" ></span>
- </div>
-
- <div class="property">
<span class="label"><wicket:message key="Molecule.complement" /></span>
<span class="value" wicket:id="Molecule.complement"></span>
</div>
@@ -92,42 +94,59 @@
</div>
<fieldset>
- <legend><wicket:message key="Molecule.produits" /></legend>
- <!-- <table cellspacing="0" wicket:id="Molecule.produits.Table">
+ <legend><wicket:message key="Molecule.provenance" /></legend>
+ <table cellspacing="0" wicket:id="Molecule.provenance.Table">
<thead>
<tr>
<th>
- <wicket:message key="Extrait.typeExtrait" />
+ <wicket:message key="Molecule.provenance.produit.ref" />
</th>
<th>
- <wicket:message key="Extrait.ref" />
+ <wicket:message key="Molecule.provenance.presence" />
</th>
<th>
- <wicket:message key="Extrait.masseObtenue" />
+ <wicket:message key="Molecule.provenance.lot.ref" />
</th>
<th>
- <wicket:message key="Extrait.rendement" />
+ <wicket:message key="Molecule.provenance.genre" />
</th>
+ <th>
+ <wicket:message key="Molecule.provenance.espece" />
+ </th>
+ <th>
+ <wicket:message key="Molecule.provenance.campagne" />
+ </th>
</tr>
</thead>
<tbody>
- <tr wicket:id="Molecule.produits.List">
+ <tr wicket:id="Molecule.provenance.List">
<td>
- <span wicket:id="Extraction.extraits.List.typeExtrait" /><wicket:container wicket:id="Molecule.produits.List.typeExtrait.info"/>
+ <span wicket:id="Molecule.provenance.List.produit.ref" />
</td>
<td>
- <span wicket:id="Extraction.extraits.List.ref" />
+ <span wicket:id="Molecule.provenance.List.presence" />
</td>
<td>
- <span wicket:id="Extraction.extraits.List.masseObtenue" />
+ <span wicket:id="Molecule.provenance.List.lot.ref" />
</td>
<td>
- <span wicket:id="Extraction.extraits.List.rendement" />
+ <span wicket:id="Molecule.provenance.List.genre" />
</td>
+ <td>
+ <span wicket:id="Molecule.provenance.List.espece" />
+ </td>
+ <td>
+ <span wicket:id="Molecule.provenance.List.campagne" />
+ </td>
</tr>
</tbody>
- </table> -->
- <div class="property" wicket:id="Molecule.produits.noTable">
+ <tfoot class="highlightFoot" wicket:id="Molecule.provenance.resultsNotAccessibles">
+ <tr>
+ <td colspan="6"><span class="info"><wicket:message key="Molecule.provenanceNotAccessibles"/></span></td>
+ </tr>
+ </tfoot>
+ </table>
+ <div class="property" wicket:id="Molecule.provenance.noTable">
<span class="label"> </span>
<span class="value"><wicket:message key="List.none" /></span>
</div>
@@ -135,7 +154,7 @@
<form wicket:id="Form">
<div class="actions">
- <a class="edit" wicket:id="ReadMoleculePage.Lot.Update" wicket:message="title:Update">
+ <a class="edit" wicket:id="ReadMoleculePage.Molecule.Update" wicket:message="title:Update">
<wicket:message key="Update" />
</a>
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-18 11:16:16 UTC (rev 51)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule/ReadMoleculePage.java 2013-01-18 15:37:14 UTC (rev 52)
@@ -22,18 +22,60 @@
*/
package nc.ird.cantharella.web.pages.domain.molecule;
-import nc.ird.cantharella.data.model.Lot;
+import java.math.BigDecimal;
+import java.util.List;
+
+import nc.ird.cantharella.data.exceptions.DataConstraintException;
+import nc.ird.cantharella.data.model.Campagne;
+import nc.ird.cantharella.data.model.Extrait;
+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.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.ReplaceEmptyLabelBehavior;
+import nc.ird.cantharella.web.utils.forms.SubmittableButton;
+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;
+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 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;
import org.apache.wicket.model.IModel;
+import org.apache.wicket.model.Model;
import org.apache.wicket.model.PropertyModel;
+import org.apache.wicket.spring.injection.annot.SpringBean;
/**
* Lecture d'une molécule.
@@ -43,27 +85,169 @@
@AuthRoles( { AuthRole.ADMIN, AuthRole.USER })
public class ReadMoleculePage extends TemplatePage {
+ /** Action : delete */
+ public static final String ACTION_DELETE = "Delete";
+
/** Modèle : molecule */
private final IModel<Molecule> moleculeModel;
+ /** Service : molecule */
+ @SpringBean
+ private MoleculeService moleculeService;
+
+ /** Page appelante */
+ private final CallerPage callerPage;
+
public ReadMoleculePage(Integer idMolecule, final CallerPage callerPage) {
super(ReadMoleculePage.class);
+ this.callerPage = callerPage;
+ final CallerPage currentPage = new CallerPage(this);
// Initialisation du modèle
moleculeModel = new GenericLoadableDetachableModel<Molecule>(Molecule.class, idMolecule);
+ initProvenanceFields(currentPage);
+
add(new Label("Molecule.idMolecule", new PropertyModel<String>(moleculeModel, "idMolecule")));
add(new Label("Molecule.nomCommun", new PropertyModel<String>(moleculeModel, "nomCommun")).add(new ReplaceEmptyLabelBehavior()));
add(new Label("Molecule.familleChimique", new PropertyModel<String>(moleculeModel, "familleChimique")).add(new ReplaceEmptyLabelBehavior()));
add(new Label("Molecule.formuleDevMol", new PropertyModel<String>(moleculeModel, "formuleDevMol")).add(new ReplaceEmptyLabelBehavior()));
add(new Label("Molecule.nomIupca", new PropertyModel<String>(moleculeModel, "nomIupca")).add(new ReplaceEmptyLabelBehavior()));
add(new Label("Molecule.formuleBrute", new PropertyModel<String>(moleculeModel, "formuleBrute")).add(new ReplaceEmptyLabelBehavior()));
- add(new Label("Molecule.idMolecule", new PropertyModel<String>(moleculeModel, "idMolecule")).add(new ReplaceEmptyLabelBehavior()));
- add(new Label("Molecule.idMolecule", new PropertyModel<String>(moleculeModel, "idMolecule")).add(new ReplaceEmptyLabelBehavior()));
- add(new Label("Molecule.idMolecule", new PropertyModel<String>(moleculeModel, "idMolecule")).add(new ReplaceEmptyLabelBehavior()));
- add(new Label("Molecule.idMolecule", new PropertyModel<String>(moleculeModel, "idMolecule")).add(new ReplaceEmptyLabelBehavior()));
- add(new Label("Molecule.idMolecule", new PropertyModel<String>(moleculeModel, "idMolecule")).add(new ReplaceEmptyLabelBehavior()));
- add(new Label("Molecule.idMolecule", new PropertyModel<String>(moleculeModel, "idMolecule")).add(new ReplaceEmptyLabelBehavior()));
+ add(new Label("Molecule.masseMolaire", new DisplayDecimalPropertyModel(moleculeModel, "masseMolaire", DecimalDisplFormat.SMALL, getLocale())).add(new ReplaceEmptyLabelBehavior()));
+ add(new Label("Molecule.nouvMolecul", new DisplayBooleanPropertyModel(moleculeModel, "nouvMolecul", this)).add(new ReplaceEmptyLabelBehavior()));
+
+ final MarkupContainer nouvMoleculRefresh = new WebMarkupContainer("Molecule.nouvMolecul.Refresh");
+ nouvMoleculRefresh.setOutputMarkupId(true);
+ nouvMoleculRefresh.setVisible(moleculeModel.getObject().isNouvMolecul());
+ nouvMoleculRefresh.add(new Label("Molecule.campagne", new PropertyModel<Campagne>(moleculeModel, "campagne")).add(new ReplaceEmptyLabelBehavior()));
+ nouvMoleculRefresh.add(new Label("Molecule.identifieePar", new PropertyModel<Personne>(moleculeModel, "identifieePar")).add(new ReplaceEmptyLabelBehavior()));
+ nouvMoleculRefresh.add(new Label("Molecule.publiOrigine", new PropertyModel<String>(moleculeModel, "publiOrigine")).add(new ReplaceEmptyLabelBehavior()));
+ add(nouvMoleculRefresh);
+
+ add(new Label("Molecule.complement", new PropertyModel<String>(moleculeModel, "complement")).add(new ReplaceEmptyLabelBehavior()));
+
+ add(new PropertyLabelLinkPanel<Personne>("Molecule.createur", new PropertyModel<Personne>(moleculeModel, "createur"),
+ getString("Read")) {
+ @Override
+ public void onClick() {
+ setResponsePage(new ReadPersonnePage(getModelObject().getIdPersonne(), currentPage));
+ }
+ });
+
+ // Formulaire des actions
+ final Form<Void> formView = new Form<Void>("Form");
+
+ // Action : mise à jour (redirection vers le formulaire)
+ Link<Molecule> updateLink = new Link<Molecule>(getResource() + ".Molecule.Update", new Model<Molecule>(moleculeModel.getObject())) {
+ @Override
+ public void onClick() {
+ setResponsePage(new ManageMoleculePage(getModelObject().getIdMolecule(), currentPage));
+ }
+ };
+ updateLink.setVisibilityAllowed(moleculeService.updateOrdeleteMoleculeEnabled(moleculeModel.getObject(), getSession()
+ .getUtilisateur()));
+ formView.add(updateLink);
+
+ // Action : suppression
+ Button deleteButton = new SubmittableButton(ACTION_DELETE, ManageLotPage.class, new SubmittableButtonEvents() {
+ @Override
+ public void onProcess() throws DataConstraintException {
+ moleculeService.deleteMolecule(moleculeModel.getObject());
+ }
+
+ @Override
+ public void onSuccess() {
+ successNextPage(ManageMoleculePage.class, ACTION_DELETE);
+ redirect();
+ }
+ });
+ deleteButton.setVisibilityAllowed(moleculeService.updateOrdeleteMoleculeEnabled(moleculeModel.getObject(), getSession()
+ .getUtilisateur()));
+ deleteButton.add(new JSConfirmationBehavior(getString("Confirm")));
+ deleteButton.setDefaultFormProcessing(false);
+ formView.add(deleteButton);
+
+ // Action : retour
+ formView.add(new Link<Void>(getResource() + ".Molecule.Back") {
+ @Override
+ public void onClick() {
+ callerPage.responsePage((TemplatePage) getPage());
+ }
+ });
+ add(formView);
}
+ /**
+ * Redirection vers une autre page
+ */
+ private void redirect() {
+ callerPage.responsePage(this);
+ }
+
+ /**
+ * Init provenance table.
+ *
+ * @param formView
+ */
+ private void initProvenanceFields(final CallerPage currentPage) {
+ // Déclaration tableau des provenances
+ final MarkupContainer provenanceTable = new WebMarkupContainer("Molecule.provenance.Table");
+ provenanceTable.setOutputMarkupId(true);
+
+ final WebMarkupContainer resultNotAccessibleCont = new WebMarkupContainer(
+ "Molecule.provenance.resultsNotAccessibles");
+ resultNotAccessibleCont.setOutputMarkupPlaceholderTag(true);
+ provenanceTable.add(resultNotAccessibleCont);
+
+ // Contenu tableaux provenance
+ ListView<MoleculeProvenance> provenanceListView = new ListView<MoleculeProvenance>("Molecule.provenance.List",
+ new PropertyModel<List<MoleculeProvenance>>(moleculeModel, "provenances")) {
+ @Override
+ protected void populateItem(ListItem<MoleculeProvenance> item) {
+ if (item.getIndex() % 2 == 1) {
+ item.add(new AttributeModifier("class", item.getIndex() % 2 == 0 ? "even" : "odd"));
+ }
+
+ IModel<MoleculeProvenance> provenanceModel = item.getModel();
+ // affichage + lien vers la fiche
+ item.add(new PropertyLabelLinkProduitPanel("Molecule.provenance.List.produit.ref",
+ new PropertyModel<Produit>(provenanceModel, "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));
+ }
+ });
+
+ item.add(new Label("Molecule.provenance.List.presence", new DisplayDecimalPropertyModel(
+ provenanceModel, "pourcentage", DecimalDisplFormat.SMALL, getLocale())))
+ .add(new ReplaceEmptyLabelBehavior());
+ item.add(new Label("Molecule.provenance.List.lot.ref", new PropertyModel<String>(provenanceModel,
+ "pourcentage")).add(new ReplaceEmptyLabelBehavior()));
+ item.add(new Label("Molecule.provenance.List.genre", new PropertyModel<String>(provenanceModel,
+ "pourcentage")).add(new ReplaceEmptyLabelBehavior()));
+ item.add(new Label("Molecule.provenance.List.espece", new PropertyModel<String>(provenanceModel,
+ "pourcentage")).add(new ReplaceEmptyLabelBehavior()));
+ item.add(new Label("Molecule.provenance.List.campagne", new PropertyModel<String>(provenanceModel,
+ "pourcentage")).add(new ReplaceEmptyLabelBehavior()));
+ }
+ };
+ provenanceTable.add(provenanceListView);
+ add(provenanceTable);
+
+ // Selon la non existence d'elements dans la liste on affiche le span
+ MarkupContainer noTableProvenances = new WebMarkupContainer("Molecule.provenance.noTable") {
+ @Override
+ public boolean isVisible() {
+ return moleculeModel.getObject().getProvenances().isEmpty();
+ }
+ };
+ add(noTableProvenances);
+ }
}
Modified: trunk/cantharella.web/src/main/resources/commons/web_en.properties
===================================================================
--- trunk/cantharella.web/src/main/resources/commons/web_en.properties 2013-01-18 11:16:16 UTC (rev 51)
+++ trunk/cantharella.web/src/main/resources/commons/web_en.properties 2013-01-18 15:37:14 UTC (rev 52)
@@ -370,6 +370,8 @@
MethodePurification.parametres.index.IConverter.Integer=The index must be an integer
MethodePurification.parametres.index=Index
+Molecule.provenanceNotAccessibles=Certains produits associés ne sont pas affichés car vous n'avez pas les droits nécéssaires
+
TestBio.date.IConverter.Date= The date is incorrectly formatted (DD/MM/YY)
TestBio.concMasseDefaut.IConverter.BigDecimal=Default Conc./Mass - must be a decimal number
TestBio.resultats.valeur.IConverter.BigDecimal=Value - must be a decimal number
Modified: trunk/cantharella.web/src/main/resources/commons/web_fr.properties
===================================================================
--- trunk/cantharella.web/src/main/resources/commons/web_fr.properties 2013-01-18 11:16:16 UTC (rev 51)
+++ trunk/cantharella.web/src/main/resources/commons/web_fr.properties 2013-01-18 15:37:14 UTC (rev 52)
@@ -368,6 +368,8 @@
MethodePurification.parametres.index.IConverter.Integer=L'index doit être un entier
MethodePurification.parametres.index=Index
+Molecule.provenanceNotAccessibles=Certains produits associés ne sont pas affichés car vous n'avez pas les droits nécéssaires
+
TestBio.date.IConverter.Date=La date est mal formatée (JJ/MM/AA)
TestBio.concMasseDefaut.IConverter.BigDecimal=Conc./Masse par défaut - doit être un nombre décimal
TestBio.resultats.valeur.IConverter.BigDecimal=Valeur - doit être un nombre décimal
1
0
18 Jan '13
Author: echatellier
Date: 2013-01-18 12:16:16 +0100 (Fri, 18 Jan 2013)
New Revision: 51
Url: http://forge.codelutin.com/projects/cantharella/repository/revisions/51
Log:
Update to hibernate-search 4.2.0 and lucene 3.6.2.
Use commons-lang3 everywhere.
Fix dependencies.
Modified:
trunk/cantharella.data/pom.xml
trunk/cantharella.data/src/license/THIRD-PARTY.properties
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/config/ValidationIntegrator.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/validation/utils/ModelValidatorImpl.java
trunk/cantharella.data/src/test/java/nc/ird/cantharella/data/SchemaExporter.java
trunk/cantharella.service/pom.xml
trunk/cantharella.service/src/license/THIRD-PARTY.properties
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/SearchServiceImpl.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/PopulateDB.java
trunk/cantharella.web/pom.xml
trunk/cantharella.web/src/license/THIRD-PARTY.properties
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/testBio/ManageTestBioPage.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/utils/models/LoadableDetachableSortableListDataProvider.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/security/AuthSession.java
trunk/pom.xml
Modified: trunk/cantharella.data/pom.xml
===================================================================
--- trunk/cantharella.data/pom.xml 2013-01-18 09:45:42 UTC (rev 50)
+++ trunk/cantharella.data/pom.xml 2013-01-18 11:16:16 UTC (rev 51)
@@ -130,7 +130,7 @@
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
- <artifactId>hibernate-search-orm</artifactId>
+ <artifactId>hibernate-search-engine</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
@@ -157,6 +157,11 @@
<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>c3p0</groupId>
Modified: trunk/cantharella.data/src/license/THIRD-PARTY.properties
===================================================================
--- trunk/cantharella.data/src/license/THIRD-PARTY.properties 2013-01-18 09:45:42 UTC (rev 50)
+++ trunk/cantharella.data/src/license/THIRD-PARTY.properties 2013-01-18 11:16:16 UTC (rev 51)
@@ -2,35 +2,25 @@
#-------------------------------------------------------------------------------
# Already used licenses in project :
# - Affero General Public License (AGPL)
+# - Apache License 2.0
# - BSD License
# - COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0
# - Common Public License Version 1.0
# - Eclipse Public License - v 1.0
-# - ICU License
+# - GNU Lesser General Public License, version 2.1
# - Indiana University Extreme! Lab Software License, vesion 1.1.1
# - Lesser General Public License (LPGL)
# - Lesser General Public License (LPGL) v 2.1
# - MIT License
+# - MPL 1.1
+# - New BSD License
# - Public Domain
# - The Apache Software License, Version 2.0
+# - The H2 License, Version 1.0
# - license.txt
#-------------------------------------------------------------------------------
# Please fill the missing licenses for dependencies :
#
#
-#Mon Nov 26 18:02:47 CET 2012
-antlr--antlr--2.7.6=BSD License
+#Fri Jan 18 10:34:09 CET 2013
dom4j--dom4j--1.6.1=BSD License
-javassist--javassist--3.8.0.GA=The Apache Software License, Version 2.0
-javax.transaction--jta--1.1=Java Transaction API (JTA) License
-net.sf.jsr107cache--jsr107cache--1.0=The Apache Software License, Version 2.0
-org.springframework--spring-aop--3.1.0.RELEASE=The Apache Software License, Version 2.0
-org.springframework--spring-asm--3.1.0.RELEASE=The Apache Software License, Version 2.0
-org.springframework--spring-beans--3.1.0.RELEASE=The Apache Software License, Version 2.0
-org.springframework--spring-context--3.1.0.RELEASE=The Apache Software License, Version 2.0
-org.springframework--spring-core--3.1.0.RELEASE=The Apache Software License, Version 2.0
-org.springframework--spring-expression--3.1.0.RELEASE=The Apache Software License, Version 2.0
-org.springframework--spring-jdbc--3.1.0.RELEASE=The Apache Software License, Version 2.0
-org.springframework--spring-orm--3.1.0.RELEASE=The Apache Software License, Version 2.0
-org.springframework--spring-test--3.1.0.RELEASE=The Apache Software License, Version 2.0
-org.springframework--spring-tx--3.1.0.RELEASE=The Apache Software License, Version 2.0
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-01-18 09:45:42 UTC (rev 50)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/config/ValidationIntegrator.java 2013-01-18 11:16:16 UTC (rev 51)
@@ -1,5 +1,28 @@
package nc.ird.cantharella.data.config;
+/*
+ * #%L
+ * Cantharella :: Data
+ * $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%
+ */
+
import javax.validation.Validation;
import javax.validation.ValidatorFactory;
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-01-18 09:45:42 UTC (rev 50)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/search/ProduitBridge.java 2013-01-18 11:16:16 UTC (rev 51)
@@ -1,5 +1,28 @@
package nc.ird.cantharella.data.model.search;
+/*
+ * #%L
+ * Cantharella :: Data
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 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%
+ */
+
import nc.ird.cantharella.data.model.Extrait;
import nc.ird.cantharella.data.model.Fraction;
import nc.ird.cantharella.data.model.Produit;
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-18 09:45:42 UTC (rev 50)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/validation/utils/ModelValidatorImpl.java 2013-01-18 11:16:16 UTC (rev 51)
@@ -39,7 +39,7 @@
import nc.ird.module.utils.AssertTools;
import nc.ird.module.utils.LogTools;
-import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.springframework.context.NoSuchMessageException;
import org.springframework.context.support.MessageSourceAccessor;
Modified: trunk/cantharella.data/src/test/java/nc/ird/cantharella/data/SchemaExporter.java
===================================================================
--- trunk/cantharella.data/src/test/java/nc/ird/cantharella/data/SchemaExporter.java 2013-01-18 09:45:42 UTC (rev 50)
+++ trunk/cantharella.data/src/test/java/nc/ird/cantharella/data/SchemaExporter.java 2013-01-18 11:16:16 UTC (rev 51)
@@ -1,5 +1,28 @@
package nc.ird.cantharella.data;
+/*
+ * #%L
+ * Cantharella :: Data
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 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%
+ */
+
import java.io.IOException;
import java.util.Properties;
Modified: trunk/cantharella.service/pom.xml
===================================================================
--- trunk/cantharella.service/pom.xml 2013-01-18 09:45:42 UTC (rev 50)
+++ trunk/cantharella.service/pom.xml 2013-01-18 11:16:16 UTC (rev 51)
@@ -72,8 +72,8 @@
</dependency>
<dependency>
- <groupId>commons-lang</groupId>
- <artifactId>commons-lang</artifactId>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-lang3</artifactId>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
@@ -81,6 +81,23 @@
</dependency>
<dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-search-engine</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-search-orm</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.lucene</groupId>
+ <artifactId>lucene-core</artifactId>
+ </dependency>
+
+ <dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
</dependency>
@@ -141,6 +158,7 @@
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
+ <scope>test</scope>
</dependency>
<dependency>
Modified: trunk/cantharella.service/src/license/THIRD-PARTY.properties
===================================================================
--- trunk/cantharella.service/src/license/THIRD-PARTY.properties 2013-01-18 09:45:42 UTC (rev 50)
+++ trunk/cantharella.service/src/license/THIRD-PARTY.properties 2013-01-18 11:16:16 UTC (rev 51)
@@ -2,37 +2,27 @@
#-------------------------------------------------------------------------------
# Already used licenses in project :
# - Affero General Public License (AGPL)
+# - Apache License 2.0
# - BSD License
+# - CDDL
# - COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0
# - Common Public License Version 1.0
# - Eclipse Public License - v 1.0
-# - ICU License
+# - GNU Lesser General Public License, version 2.1
+# - GPLv2+CE
# - Indiana University Extreme! Lab Software License, vesion 1.1.1
-# - Java Transaction API (JTA) License
# - Lesser General Public License (LPGL)
# - Lesser General Public License (LPGL) v 2.1
# - MIT License
+# - MPL 1.1
+# - New BSD License
# - Public Domain
# - The Apache Software License, Version 2.0
+# - The H2 License, Version 1.0
# - license.txt
#-------------------------------------------------------------------------------
# Please fill the missing licenses for dependencies :
#
#
-#Mon Nov 26 18:07:22 CET 2012
-antlr--antlr--2.7.6=BSD License
+#Fri Jan 18 10:45:39 CET 2013
dom4j--dom4j--1.6.1=BSD License
-javassist--javassist--3.8.0.GA=The Apache Software License, Version 2.0
-javax.transaction--jta--1.1=Java Transaction API (JTA) License
-net.sf.jsr107cache--jsr107cache--1.0=The Apache Software License, Version 2.0
-org.springframework--spring-aop--3.1.0.RELEASE=The Apache Software License, Version 2.0
-org.springframework--spring-asm--3.1.0.RELEASE=The Apache Software License, Version 2.0
-org.springframework--spring-beans--3.1.0.RELEASE=The Apache Software License, Version 2.0
-org.springframework--spring-context--3.1.0.RELEASE=The Apache Software License, Version 2.0
-org.springframework--spring-context-support--3.1.0.RELEASE=The Apache Software License, Version 2.0
-org.springframework--spring-core--3.1.0.RELEASE=The Apache Software License, Version 2.0
-org.springframework--spring-expression--3.1.0.RELEASE=The Apache Software License, Version 2.0
-org.springframework--spring-jdbc--3.1.0.RELEASE=The Apache Software License, Version 2.0
-org.springframework--spring-orm--3.1.0.RELEASE=The Apache Software License, Version 2.0
-org.springframework--spring-test--3.1.0.RELEASE=The Apache Software License, Version 2.0
-org.springframework--spring-tx--3.1.0.RELEASE=The Apache Software License, Version 2.0
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-18 09:45:42 UTC (rev 50)
+++ trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/MailServiceImpl.java 2013-01-18 11:16:16 UTC (rev 51)
@@ -33,7 +33,7 @@
import nc.ird.module.utils.AssertTools;
import nc.ird.module.utils.LogTools;
-import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mail.MailSender;
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-18 09:45:42 UTC (rev 50)
+++ trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/SearchServiceImpl.java 2013-01-18 11:16:16 UTC (rev 51)
@@ -22,7 +22,6 @@
*/
package nc.ird.cantharella.service.services.impl;
-import java.util.Collection;
import java.util.List;
import javax.annotation.Resource;
@@ -39,12 +38,15 @@
import nc.ird.module.utils.LogTools;
import org.apache.commons.logging.Log;
+import org.apache.lucene.index.FieldInfos;
import org.apache.lucene.index.IndexReader;
+import org.apache.lucene.index.MultiReader;
import org.apache.lucene.queryParser.MultiFieldQueryParser;
import org.apache.lucene.queryParser.ParseException;
import org.apache.lucene.queryParser.QueryParser;
import org.apache.lucene.queryParser.QueryParser.Operator;
import org.apache.lucene.search.Query;
+import org.apache.lucene.util.ReaderUtil;
import org.apache.lucene.util.Version;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
@@ -149,9 +151,12 @@
// build a multi field query parser to search in all fields
IndexReader reader = searchFactory.getIndexReaderAccessor().open(clazz);
- Collection<String> fieldNames = reader.getFieldNames(IndexReader.FieldOption.ALL);
- String[] fieldArray = fieldNames.toArray(new String[fieldNames.size()]);
- QueryParser parser = new MultiFieldQueryParser(Version.LUCENE_35, fieldArray, searchFactory.getAnalyzer(clazz));
+ FieldInfos fieldInfos = ReaderUtil.getMergedFieldInfos(reader);
+ String[] fieldArray = new String[fieldInfos.size()];
+ for (int i = 0 ; i < fieldInfos.size(); i++) {
+ fieldArray[i] = fieldInfos.fieldName(i);
+ }
+ QueryParser parser = new MultiFieldQueryParser(Version.LUCENE_36, fieldArray, searchFactory.getAnalyzer(clazz));
searchFactory.getIndexReaderAccessor().close(reader);
// autorisation de "*" en premier caractere
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-18 09:45:42 UTC (rev 50)
+++ trunk/cantharella.service/src/test/java/nc/ird/cantharella/service/utils/ExcelColumnsReader.java 2013-01-18 11:16:16 UTC (rev 51)
@@ -34,7 +34,7 @@
import nc.ird.cantharella.service.exceptions.ExcelImportException;
import nc.ird.module.utils.AssertTools;
-import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.StringUtils;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
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-18 09:45:42 UTC (rev 50)
+++ trunk/cantharella.service/src/test/java/nc/ird/cantharella/service/utils/PopulateDB.java 2013-01-18 11:16:16 UTC (rev 51)
@@ -64,7 +64,7 @@
import nc.ird.module.utils.LogTools;
import org.apache.commons.io.FileUtils;
-import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
Modified: trunk/cantharella.web/pom.xml
===================================================================
--- trunk/cantharella.web/pom.xml 2013-01-18 09:45:42 UTC (rev 50)
+++ trunk/cantharella.web/pom.xml 2013-01-18 11:16:16 UTC (rev 51)
@@ -205,8 +205,8 @@
</dependency>
<dependency>
- <groupId>commons-lang</groupId>
- <artifactId>commons-lang</artifactId>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-lang3</artifactId>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
Modified: trunk/cantharella.web/src/license/THIRD-PARTY.properties
===================================================================
--- trunk/cantharella.web/src/license/THIRD-PARTY.properties 2013-01-18 09:45:42 UTC (rev 50)
+++ trunk/cantharella.web/src/license/THIRD-PARTY.properties 2013-01-18 11:16:16 UTC (rev 51)
@@ -2,16 +2,22 @@
#-------------------------------------------------------------------------------
# Already used licenses in project :
# - Affero General Public License (AGPL)
+# - Apache License 2.0
# - BSD License
+# - CDDL
# - COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0
# - Common Public License Version 1.0
+# - Copyright (c) 2000-2011 INRIA, France Telecom
# - Eclipse Public License - v 1.0
-# - ICU License
+# - GNU Lesser General Public License, version 2.1
+# - GPLv2+CE
# - Indiana University Extreme! Lab Software License, vesion 1.1.1
-# - Java Transaction API (JTA) License
# - Lesser General Public License (LPGL)
# - Lesser General Public License (LPGL) v 2.1
+# - License Agreement for Java(TM) Servlet API Specification Interface Classes
# - MIT License
+# - MPL 1.1
+# - New BSD License
# - Public Domain
# - The Apache Software License, Version 2.0
# - license.txt
@@ -19,23 +25,7 @@
# Please fill the missing licenses for dependencies :
#
#
-#Mon Nov 26 18:10:35 CET 2012
-antlr--antlr--2.7.6=BSD License
+#Fri Jan 18 11:06:20 CET 2013
asm--asm--3.1=Copyright (c) 2000-2011 INRIA, France Telecom
dom4j--dom4j--1.6.1=BSD License
-javassist--javassist--3.8.0.GA=The Apache Software License, Version 2.0
javax.servlet--servlet-api--2.5=License Agreement for Java(TM) Servlet API Specification Interface Classes
-javax.transaction--jta--1.1=Java Transaction API (JTA) License
-net.sf.jsr107cache--jsr107cache--1.0=The Apache Software License, Version 2.0
-org.springframework--spring-aop--3.1.0.RELEASE=The Apache Software License, Version 2.0
-org.springframework--spring-asm--3.1.0.RELEASE=The Apache Software License, Version 2.0
-org.springframework--spring-beans--3.1.0.RELEASE=The Apache Software License, Version 2.0
-org.springframework--spring-context--3.1.0.RELEASE=The Apache Software License, Version 2.0
-org.springframework--spring-context-support--3.1.0.RELEASE=The Apache Software License, Version 2.0
-org.springframework--spring-core--3.1.0.RELEASE=The Apache Software License, Version 2.0
-org.springframework--spring-expression--3.1.0.RELEASE=The Apache Software License, Version 2.0
-org.springframework--spring-jdbc--3.1.0.RELEASE=The Apache Software License, Version 2.0
-org.springframework--spring-orm--3.1.0.RELEASE=The Apache Software License, Version 2.0
-org.springframework--spring-test--3.1.0.RELEASE=The Apache Software License, Version 2.0
-org.springframework--spring-tx--3.1.0.RELEASE=The Apache Software License, Version 2.0
-org.springframework--spring-web--3.1.0.RELEASE=The Apache Software License, Version 2.0
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-18 09:45:42 UTC (rev 50)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/config/panels/ListMethodeExtractionPanel.java 2013-01-18 11:16:16 UTC (rev 51)
@@ -29,7 +29,7 @@
import nc.ird.cantharella.web.pages.domain.config.ManageMethodeExtractionPage;
import nc.ird.cantharella.web.utils.models.LoadableDetachableSortableListDataProvider;
-import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.StringUtils;
import org.apache.wicket.AttributeModifier;
import org.apache.wicket.MarkupContainer;
import org.apache.wicket.markup.html.WebMarkupContainer;
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-18 09:45:42 UTC (rev 50)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/config/panels/ListMethodePurificationPanel.java 2013-01-18 11:16:16 UTC (rev 51)
@@ -29,7 +29,7 @@
import nc.ird.cantharella.web.pages.domain.config.ManageMethodePurificationPage;
import nc.ird.cantharella.web.utils.models.LoadableDetachableSortableListDataProvider;
-import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.StringUtils;
import org.apache.wicket.AttributeModifier;
import org.apache.wicket.MarkupContainer;
import org.apache.wicket.markup.html.WebMarkupContainer;
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-18 09:45:42 UTC (rev 50)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/testBio/ManageTestBioPage.java 2013-01-18 11:16:16 UTC (rev 51)
@@ -70,7 +70,7 @@
import nc.ird.module.utils.CollectionTools;
import nc.ird.module.utils.LogTools;
-import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.wicket.AttributeModifier;
import org.apache.wicket.MarkupContainer;
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-18 09:45:42 UTC (rev 50)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/model/CaptchaModel.java 2013-01-18 11:16:16 UTC (rev 51)
@@ -24,7 +24,7 @@
import java.io.Serializable;
-import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.StringUtils;
import org.hibernate.validator.constraints.NotEmpty;
/**
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-18 09:45:42 UTC (rev 50)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/models/LoadableDetachableSortableListDataProvider.java 2013-01-18 11:16:16 UTC (rev 51)
@@ -39,7 +39,7 @@
import nc.ird.module.utils.LogTools;
import org.apache.commons.collections.comparators.NullComparator;
-import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.wicket.extensions.markup.html.repeater.util.SortableDataProvider;
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-18 09:45:42 UTC (rev 50)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/security/AuthSession.java 2013-01-18 11:16:16 UTC (rev 51)
@@ -34,7 +34,7 @@
import nc.ird.cantharella.web.config.WebApplicationImpl;
import nc.ird.module.utils.LogTools;
-import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.wicket.protocol.http.WebApplication;
import org.apache.wicket.protocol.http.WebSession;
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2013-01-18 09:45:42 UTC (rev 50)
+++ trunk/pom.xml 2013-01-18 11:16:16 UTC (rev 51)
@@ -119,8 +119,8 @@
<version.hibernate>4.1.9.Final</version.hibernate>
<version.hibernate-validator>4.3.1.Final</version.hibernate-validator>
<version.hibernate3-maven-plugin>3.0</version.hibernate3-maven-plugin>
- <version.hibernate-search>4.1.1.Final</version.hibernate-search>
- <version.lucene>3.5.0</version.lucene>
+ <version.hibernate-search>4.2.0.Final</version.hibernate-search>
+ <version.lucene>3.6.2</version.lucene>
<version.c3p0>0.9.1</version.c3p0>
<version.aspectj>1.6.8</version.aspectj>
@@ -315,6 +315,11 @@
<version>${version.hibernate-search}</version>
</dependency>
<dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-search-engine</artifactId>
+ <version>${version.hibernate-search}</version>
+ </dependency>
+ <dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-core</artifactId>
<version>${version.lucene}</version>
1
0
r50 - trunk/cantharella.data/src/main/resources/commons/sql
by echatellier@users.forge.codelutin.com 18 Jan '13
by echatellier@users.forge.codelutin.com 18 Jan '13
18 Jan '13
Author: echatellier
Date: 2013-01-18 10:45:42 +0100 (Fri, 18 Jan 2013)
New Revision: 50
Url: http://forge.codelutin.com/projects/cantharella/repository/revisions/50
Log:
Add license header
Modified:
trunk/cantharella.data/src/main/resources/commons/sql/dev_update.sql
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-17 17:44:14 UTC (rev 49)
+++ trunk/cantharella.data/src/main/resources/commons/sql/dev_update.sql 2013-01-18 09:45:42 UTC (rev 50)
@@ -1,3 +1,25 @@
+---
+-- #%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%
+---
-- Mise à jour à appliquer à la base de données
-- pour les modifications effectuées pendant le développement
1
0
r49 - trunk/cantharella.data/src/main/resources/commons/sql
by echatellier@users.forge.codelutin.com 17 Jan '13
by echatellier@users.forge.codelutin.com 17 Jan '13
17 Jan '13
Author: echatellier
Date: 2013-01-17 18:44:14 +0100 (Thu, 17 Jan 2013)
New Revision: 49
Url: http://forge.codelutin.com/projects/cantharella/repository/revisions/49
Log:
Ajout des requetes de mise ?\195?\160 jour de la base
Added:
trunk/cantharella.data/src/main/resources/commons/sql/dev_update.sql
Added: trunk/cantharella.data/src/main/resources/commons/sql/dev_update.sql
===================================================================
--- trunk/cantharella.data/src/main/resources/commons/sql/dev_update.sql (rev 0)
+++ trunk/cantharella.data/src/main/resources/commons/sql/dev_update.sql 2013-01-17 17:44:14 UTC (rev 49)
@@ -0,0 +1,65 @@
+-- Mise à jour à appliquer à la base de données
+-- pour les modifications effectuées pendant le développement
+
+-- Documents (16/11/2012)
+ create table TypeDocument (
+ idTypeDocument int4 not null,
+ description text not null,
+ domaine varchar(60),
+ estImage boolean not null,
+ nom varchar(60) not null unique,
+ primary key (idTypeDocument),
+ unique (nom)
+ )
+
+-- Molecules (07/01/2013)
+ create table Molecule (
+ idMolecule int4 not null,
+ complement text,
+ familleChimique varchar(60) not null,
+ formuleBrute varchar(60) not null,
+ formuleDevMol text,
+ masseMolaire numeric(9, 4) check (masseMolaire<=99999 AND masseMolaire>=0),
+ nomCommun varchar(100) not null,
+ nomIupca varchar(255) not null,
+ nouvMolecul boolean not null,
+ publiOrigine text,
+ campagne_idCampagne int4,
+ createur_idPersonne int4 not null,
+ identifieePar_idPersonne int4,
+ primary key (idMolecule)
+ )
+
+ create table MoleculeProvenance (
+ id int4 not null,
+ pourcentage numeric(9, 4) check (pourcentage>=0 AND pourcentage<=100),
+ molecule_idMolecule int4 not null,
+ produit_id int4 not null,
+ primary key (id)
+ )
+
+ alter table Molecule
+ add constraint FKEC979EA61AA103F8
+ foreign key (campagne_idCampagne)
+ references Campagne
+
+ alter table Molecule
+ add constraint FKEC979EA6822055B9
+ foreign key (createur_idPersonne)
+ references Personne
+
+ alter table Molecule
+ add constraint FKEC979EA67E7B9C4D
+ foreign key (identifieePar_idPersonne)
+ references Personne
+
+ alter table MoleculeProvenance
+ add constraint FK8B39E567F44F1B20
+ foreign key (molecule_idMolecule)
+ references Molecule
+
+ alter table MoleculeProvenance
+ add constraint FK8B39E567FE19187A
+ foreign key (produit_id)
+ references Produit
+
\ No newline at end of file
1
0
r48 - trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model
by echatellier@users.forge.codelutin.com 10 Jan '13
by echatellier@users.forge.codelutin.com 10 Jan '13
10 Jan '13
Author: echatellier
Date: 2013-01-10 10:45:47 +0100 (Thu, 10 Jan 2013)
New Revision: 48
Url: http://forge.codelutin.com/projects/cantharella/repository/revisions/48
Log:
Configuration du niveau d'indexation
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/Lot.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/Specimen.java
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-07 16:52:33 UTC (rev 47)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Extraction.java 2013-01-10 09:45:47 UTC (rev 48)
@@ -105,7 +105,7 @@
/** Lot utilisé pour l'extraction **/
@NotNull
@ManyToOne(fetch = FetchType.EAGER, optional = false)
- @IndexedEmbedded
+ @IndexedEmbedded(depth=1)
private Lot lot;
/** Masse avant l'extraction **/
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-07 16:52:33 UTC (rev 47)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Lot.java 2013-01-10 09:45:47 UTC (rev 48)
@@ -90,7 +90,7 @@
/** Campagne */
@NotNull
@ManyToOne(fetch = FetchType.EAGER, optional = false)
- @IndexedEmbedded
+ @IndexedEmbedded(depth=1)
private Campagne campagne;
/** complement */
@@ -151,13 +151,13 @@
/** Spécimen source */
@NotNull
@ManyToOne(fetch = FetchType.EAGER, optional = false)
- @IndexedEmbedded
+ @IndexedEmbedded(depth=1)
private Specimen specimenRef;
/** Station */
@NotNull
@ManyToOne(fetch = FetchType.EAGER, optional = false)
- @IndexedEmbedded
+ @IndexedEmbedded(depth=1)
private Station station;
/** Extractions provenants du lot */
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-07 16:52:33 UTC (rev 47)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Molecule.java 2013-01-10 09:45:47 UTC (rev 48)
@@ -104,7 +104,7 @@
private boolean nouvMolecul;
@ManyToOne(fetch = FetchType.EAGER)
- @IndexedEmbedded
+ @IndexedEmbedded(depth=1)
private Campagne campagne;
/** Identifiee par. */
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-07 16:52:33 UTC (rev 47)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Specimen.java 2013-01-10 09:45:47 UTC (rev 48)
@@ -154,7 +154,7 @@
/** Station */
@ManyToOne(fetch = FetchType.EAGER)
- @IndexedEmbedded
+ @IndexedEmbedded(depth=1)
private Station station;
/** Compléments d'information */
1
0
r47 - trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule
by echatellier@users.forge.codelutin.com 07 Jan '13
by echatellier@users.forge.codelutin.com 07 Jan '13
07 Jan '13
Author: echatellier
Date: 2013-01-07 17:52:33 +0100 (Mon, 07 Jan 2013)
New Revision: 47
Url: http://forge.codelutin.com/projects/cantharella/repository/revisions/47
Log:
Improve molecule reading
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/ReadMoleculePage.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-07 16:23:51 UTC (rev 46)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule/ListMoleculesPage.java 2013-01-07 16:52:33 UTC (rev 47)
@@ -29,8 +29,6 @@
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.lot.ListLotsPage;
-import nc.ird.cantharella.web.pages.domain.lot.ReadLotPage;
import nc.ird.cantharella.web.utils.CallerPage;
import nc.ird.cantharella.web.utils.columns.LinkPropertyColumn;
import nc.ird.cantharella.web.utils.columns.LinkableImagePropertyColumn;
@@ -66,7 +64,7 @@
public ListMoleculesPage() {
super(ListMoleculesPage.class);
- final CallerPage currentPage = new CallerPage(ListLotsPage.class);
+ final CallerPage currentPage = new CallerPage(ListMoleculesPage.class);
add(new Link<Void>(getResource() + ".NewMolecule") {
@Override
@@ -99,7 +97,7 @@
getString("Read")) {
@Override
public void onClick(Item<ICellPopulator<Molecule>> item, String componentId, IModel<Molecule> model) {
- setResponsePage(new ReadLotPage(model.getObject().getIdMolecule(), currentPage));
+ setResponsePage(new ReadMoleculePage(model.getObject().getIdMolecule(), currentPage));
}
});
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-07 16:23:51 UTC (rev 46)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule/ReadMoleculePage.java 2013-01-07 16:52:33 UTC (rev 47)
@@ -22,11 +22,19 @@
*/
package nc.ird.cantharella.web.pages.domain.molecule;
+import nc.ird.cantharella.data.model.Lot;
+import nc.ird.cantharella.data.model.Molecule;
import nc.ird.cantharella.web.pages.TemplatePage;
import nc.ird.cantharella.web.utils.CallerPage;
+import nc.ird.cantharella.web.utils.behaviors.ReplaceEmptyLabelBehavior;
+import nc.ird.cantharella.web.utils.models.GenericLoadableDetachableModel;
import nc.ird.cantharella.web.utils.security.AuthRole;
import nc.ird.cantharella.web.utils.security.AuthRoles;
+import org.apache.wicket.markup.html.basic.Label;
+import org.apache.wicket.model.IModel;
+import org.apache.wicket.model.PropertyModel;
+
/**
* Lecture d'une molécule.
*
@@ -35,8 +43,27 @@
@AuthRoles( { AuthRole.ADMIN, AuthRole.USER })
public class ReadMoleculePage extends TemplatePage {
+ /** Modèle : molecule */
+ private final IModel<Molecule> moleculeModel;
+
public ReadMoleculePage(Integer idMolecule, final CallerPage callerPage) {
super(ReadMoleculePage.class);
+
+ // Initialisation du modèle
+ moleculeModel = new GenericLoadableDetachableModel<Molecule>(Molecule.class, idMolecule);
+
+ add(new Label("Molecule.idMolecule", new PropertyModel<String>(moleculeModel, "idMolecule")));
+ add(new Label("Molecule.nomCommun", new PropertyModel<String>(moleculeModel, "nomCommun")).add(new ReplaceEmptyLabelBehavior()));
+ add(new Label("Molecule.familleChimique", new PropertyModel<String>(moleculeModel, "familleChimique")).add(new ReplaceEmptyLabelBehavior()));
+ add(new Label("Molecule.formuleDevMol", new PropertyModel<String>(moleculeModel, "formuleDevMol")).add(new ReplaceEmptyLabelBehavior()));
+ add(new Label("Molecule.nomIupca", new PropertyModel<String>(moleculeModel, "nomIupca")).add(new ReplaceEmptyLabelBehavior()));
+ add(new Label("Molecule.formuleBrute", new PropertyModel<String>(moleculeModel, "formuleBrute")).add(new ReplaceEmptyLabelBehavior()));
+ add(new Label("Molecule.idMolecule", new PropertyModel<String>(moleculeModel, "idMolecule")).add(new ReplaceEmptyLabelBehavior()));
+ add(new Label("Molecule.idMolecule", new PropertyModel<String>(moleculeModel, "idMolecule")).add(new ReplaceEmptyLabelBehavior()));
+ add(new Label("Molecule.idMolecule", new PropertyModel<String>(moleculeModel, "idMolecule")).add(new ReplaceEmptyLabelBehavior()));
+ add(new Label("Molecule.idMolecule", new PropertyModel<String>(moleculeModel, "idMolecule")).add(new ReplaceEmptyLabelBehavior()));
+ add(new Label("Molecule.idMolecule", new PropertyModel<String>(moleculeModel, "idMolecule")).add(new ReplaceEmptyLabelBehavior()));
+ add(new Label("Molecule.idMolecule", new PropertyModel<String>(moleculeModel, "idMolecule")).add(new ReplaceEmptyLabelBehavior()));
}
}
1
0
r46 - in trunk: cantharella.data/src/main/java/nc/ird/cantharella/data/model cantharella.data/src/main/resources/commons cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule cantharella.web/src/main/java/nc/ird/cantharella/web/pages/renderers cantharella.web/src/main/resources/commons
by echatellier@users.forge.codelutin.com 07 Jan '13
by echatellier@users.forge.codelutin.com 07 Jan '13
07 Jan '13
Author: echatellier
Date: 2013-01-07 17:23:51 +0100 (Mon, 07 Jan 2013)
New Revision: 46
Url: http://forge.codelutin.com/projects/cantharella/repository/revisions/46
Log:
refs #1646: list et creation de molecules
Added:
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/MoleculeProvenance.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/renderers/ProduitRenderer.java
Modified:
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Molecule.java
trunk/cantharella.data/src/main/resources/commons/data_en.properties
trunk/cantharella.data/src/main/resources/commons/data_fr.properties
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/resources/commons/web_en.properties
trunk/cantharella.web/src/main/resources/commons/web_fr.properties
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-07 10:50:58 UTC (rev 45)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Molecule.java 2013-01-07 16:23:51 UTC (rev 46)
@@ -1,7 +1,31 @@
+/*
+ * #%L
+ * Cantharella :: Data
+ * $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%
+ */
package nc.ird.cantharella.data.model;
+import java.math.BigDecimal;
import java.util.List;
+import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
@@ -9,8 +33,11 @@
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
+import javax.validation.constraints.Max;
+import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
+import nc.ird.cantharella.data.config.DataContext;
import nc.ird.cantharella.data.model.search.UtilisateurSearchFilter;
import nc.ird.cantharella.data.model.utils.AbstractModel;
@@ -68,21 +95,21 @@
private String formuleBrute;
/** Masse molaire */
- @NotEmpty
- private Double masseMolaire;
+ @Min(value = 0)
+ @Max(value = DataContext.DECIMAL_MAX)
+ @Column(precision = DataContext.DECIMAL_PRECISION, scale = DataContext.DECIMAL_SCALE)
+ private BigDecimal masseMolaire;
/** Est-ce une nouvelle molécule ? */
- @NotEmpty
- private Boolean nouvMolecul;
+ private boolean nouvMolecul;
- @ManyToOne(fetch = FetchType.EAGER, optional = false)
+ @ManyToOne(fetch = FetchType.EAGER)
@IndexedEmbedded
private Campagne campagne;
/** Identifiee par. */
- @Length(max = LENGTH_MEDIUM_TEXT)
- @NotNull
- private String identifieePar;
+ @ManyToOne(fetch = FetchType.EAGER)
+ private Personne identifieePar;
/** Publication d'origine */
@Lob
@@ -101,9 +128,9 @@
private Personne createur;
/** Produit utilisé obtenir le résultat **/
- @OneToMany(fetch = FetchType.LAZY)
+ @OneToMany(mappedBy = "molecule", fetch = FetchType.LAZY, orphanRemoval = true)
@Cascade({ CascadeType.SAVE_UPDATE })
- private List<Produit> produits;
+ private List<MoleculeProvenance> provenances;
/**
* @return the idMolecule
@@ -192,28 +219,28 @@
/**
* @return the masseMolaire
*/
- public Double getMasseMolaire() {
+ public BigDecimal getMasseMolaire() {
return masseMolaire;
}
/**
* @param masseMolaire the masseMolaire to set
*/
- public void setMasseMolaire(Double masseMolaire) {
+ public void setMasseMolaire(BigDecimal masseMolaire) {
this.masseMolaire = masseMolaire;
}
/**
* @return the nouvMolecul
*/
- public Boolean getNouvMolecul() {
+ public boolean isNouvMolecul() {
return nouvMolecul;
}
/**
* @param nouvMolecul the nouvMolecul to set
*/
- public void setNouvMolecul(Boolean nouvMolecul) {
+ public void setNouvMolecul(boolean nouvMolecul) {
this.nouvMolecul = nouvMolecul;
}
@@ -232,6 +259,20 @@
}
/**
+ * @return the identifieePar
+ */
+ public Personne getIdentifieePar() {
+ return identifieePar;
+ }
+
+ /**
+ * @param identifieePar the identifieePar to set
+ */
+ public void setIdentifieePar(Personne identifieePar) {
+ this.identifieePar = identifieePar;
+ }
+
+ /**
* @return the publiOrigine
*/
public String getPubliOrigine() {
@@ -274,16 +315,16 @@
}
/**
- * @return the produits
+ * @return the provenances
*/
- public List<Produit> getProduits() {
- return produits;
+ public List<MoleculeProvenance> getProvenances() {
+ return provenances;
}
/**
- * @param produits the produits to set
+ * @param provenance the provenances to set
*/
- public void setProduits(List<Produit> produits) {
- this.produits = produits;
+ public void setProvenances(List<MoleculeProvenance> provenances) {
+ this.provenances = provenances;
}
}
Added: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/MoleculeProvenance.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/MoleculeProvenance.java (rev 0)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/MoleculeProvenance.java 2013-01-07 16:23:51 UTC (rev 46)
@@ -0,0 +1,119 @@
+/*
+ * #%L
+ * Cantharella :: Data
+ * $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%
+ */
+package nc.ird.cantharella.data.model;
+
+import java.math.BigDecimal;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.ManyToOne;
+import javax.validation.constraints.Max;
+import javax.validation.constraints.Min;
+import javax.validation.constraints.NotNull;
+
+import nc.ird.cantharella.data.config.DataContext;
+import nc.ird.cantharella.data.model.utils.AbstractModel;
+
+@Entity
+public class MoleculeProvenance extends AbstractModel {
+
+ /** Id */
+ @Id
+ @GeneratedValue
+ private Integer id;
+
+ /** Concentration/masse **/
+ @Min(value = 0)
+ @Max(value = 100)
+ @Column(precision = DataContext.DECIMAL_PRECISION, scale = DataContext.DECIMAL_SCALE)
+ private BigDecimal pourcentage;
+
+ /** Molecule dont fait partie la provenance */
+ @NotNull
+ @ManyToOne(fetch = FetchType.EAGER, optional = false)
+ private Molecule molecule;
+
+ /** Produit sur lequel porte la provenance **/
+ @NotNull
+ @ManyToOne(fetch = FetchType.EAGER, optional = false)
+ private Produit produit;
+
+ /**
+ * @return the id
+ */
+ public Integer getId() {
+ return id;
+ }
+
+ /**
+ * @param id the id to set
+ */
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
+ /**
+ * @return the pourcentage
+ */
+ public BigDecimal getPourcentage() {
+ return pourcentage;
+ }
+
+ /**
+ * @param pourcentage the pourcentage to set
+ */
+ public void setPourcentage(BigDecimal pourcentage) {
+ this.pourcentage = pourcentage;
+ }
+
+ /**
+ * @return the molecule
+ */
+ public Molecule getMolecule() {
+ return molecule;
+ }
+
+ /**
+ * @param molecule the molecule to set
+ */
+ public void setMolecule(Molecule molecule) {
+ this.molecule = molecule;
+ }
+
+ /**
+ * @return the produit
+ */
+ public Produit getProduit() {
+ return produit;
+ }
+
+ /**
+ * @param produit the produit to set
+ */
+ public void setProduit(Produit produit) {
+ this.produit = produit;
+ }
+}
Property changes on: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/MoleculeProvenance.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Modified: trunk/cantharella.data/src/main/resources/commons/data_en.properties
===================================================================
--- trunk/cantharella.data/src/main/resources/commons/data_en.properties 2013-01-07 10:50:58 UTC (rev 45)
+++ trunk/cantharella.data/src/main/resources/commons/data_en.properties 2013-01-07 16:23:51 UTC (rev 46)
@@ -195,6 +195,12 @@
Molecule.complement=Compl�ment
Molecule.createur=Cr�ateur de la fiche
Molecule.produits=Provenance
+Molecule.produits.produit.ref=R�f. Produit
+Molecule.produits.presence=%
+Molecule.produits.lot.ref=R�f. Lot
+Molecule.produits.genre=Genre
+Molecule.produits.espece=Esp�ce
+Molecule.produits.campagne=Campagne
TestBio.ref=Test ref.
Modified: trunk/cantharella.data/src/main/resources/commons/data_fr.properties
===================================================================
--- trunk/cantharella.data/src/main/resources/commons/data_fr.properties 2013-01-07 10:50:58 UTC (rev 45)
+++ trunk/cantharella.data/src/main/resources/commons/data_fr.properties 2013-01-07 16:23:51 UTC (rev 46)
@@ -195,8 +195,13 @@
Molecule.complement=Complément
Molecule.createur=Créateur de la fiche
Molecule.produits=Provenance
+Molecule.produits.produit.ref=Réf. Produit
+Molecule.produits.presence=%
+Molecule.produits.lot.ref=Réf. Lot
+Molecule.produits.genre=Genre
+Molecule.produits.espece=Espèce
+Molecule.produits.campagne=Campagne
-
TestBio.ref=Réf. test
TestBio.manipulateur=Manipulateur
TestBio.organismeTesteur=Organisme testeur
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-07 10:50:58 UTC (rev 45)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule/ListMoleculesPage.java 2013-01-07 16:23:51 UTC (rev 46)
@@ -25,17 +25,13 @@
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.columns.TaxonomyPropertyColumn;
import nc.ird.cantharella.web.pages.domain.lot.ListLotsPage;
import nc.ird.cantharella.web.pages.domain.lot.ReadLotPage;
-import nc.ird.cantharella.web.pages.domain.specimen.ReadSpecimenPage;
-import nc.ird.cantharella.web.pages.domain.station.ReadStationPage;
import nc.ird.cantharella.web.utils.CallerPage;
-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.models.LoadableDetachableSortableListDataProvider;
@@ -53,10 +49,20 @@
import org.apache.wicket.markup.repeater.Item;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model;
+import org.apache.wicket.spring.injection.annot.SpringBean;
+/**
+ * Liste des molécules.
+ *
+ * @author Eric Chatellier
+ */
@AuthRoles( { AuthRole.ADMIN, AuthRole.USER })
public class ListMoleculesPage extends TemplatePage {
+ /** Service : molecule */
+ @SpringBean
+ private MoleculeService moleculeService;
+
public ListMoleculesPage() {
super(ListMoleculesPage.class);
@@ -76,7 +82,7 @@
add(moleculesRefresh);
// Liste des molecules
- final List<Molecule> molecules = new ArrayList<Molecule>();
+ final List<Molecule> molecules = moleculeService.listMolecules();
LoadableDetachableSortableListDataProvider<Molecule> moleculesDataProvider = new LoadableDetachableSortableListDataProvider<Molecule>(
molecules, getSession().getLocale());
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-07 10:50:58 UTC (rev 45)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule/ManageMoleculePage.html 2013-01-07 16:23:51 UTC (rev 46)
@@ -58,27 +58,34 @@
<input type="text" id="Molecule.masseMolaire" wicket:id="Molecule.masseMolaire" />
</div>
- <div class="property">
- <label for="Molecule.nouvMolecul"><wicket:message key="Molecule.nouvMolecul" /></label>
- <input type="checkbox" id="Molecule.nouvMolecul" wicket:id="Molecule.nouvMolecul" />
- </div>
-
- <div class="property required">
- <label for="Molecule.campagne"><wicket:message key="Molecule.campagne" /></label>
- <select id="Molecule.campagne" wicket:id="Molecule.campagne" />
- <a wicket:id="NewCampagne" class="add"><wicket:message key="ListCampagnesPage.NewCampagne" /></a>
- </div>
-
- <div class="property">
- <label for="Molecule.identifieePar"><wicket:message key="Molecule.identifieePar" /></label>
- <input type="text" id="Molecule.identifieePar" wicket:id="Molecule.identifieePar" />
- </div>
-
- <div class="property">
- <label for="Molecule.publiOrigine"><wicket:message key="Molecule.publiOrigine" /></label>
- <textarea id="Molecule.publiOrigine" wicket:id="Molecule.publiOrigine"></textarea>
- </div>
+ <fieldset>
+ <legend><wicket:message key="Molecule.nouvMolecul" /></legend>
+
+ <div class="property">
+ <label for="Molecule.nouvMolecul"><wicket:message key="Molecule.nouvMolecul" /></label>
+ <input type="checkbox" id="Molecule.nouvMolecul" wicket:id="Molecule.nouvMolecul" />
+ </div>
+
+
+ <div wicket:id="Molecule.nouvMolecul.Refresh">
+ <div class="property">
+ <label for="Molecule.campagne"><wicket:message key="Molecule.campagne" /></label>
+ <select id="Molecule.campagne" wicket:id="Molecule.campagne" />
+ <a wicket:id="NewCampagne" class="add"><wicket:message key="ListCampagnesPage.NewCampagne" /></a>
+ </div>
+
+ <div class="property">
+ <label for="Molecule.identifieePar"><wicket:message key="Molecule.identifieePar" /></label>
+ <select id="Molecule.identifieePar" wicket:id="Molecule.identifieePar" />
+ </div>
+ <div class="property">
+ <label for="Molecule.publiOrigine"><wicket:message key="Molecule.publiOrigine" /></label>
+ <textarea id="Molecule.publiOrigine" wicket:id="Molecule.publiOrigine"></textarea>
+ </div>
+ </div>
+ </fieldset>
+
<div class="property">
<label for="Molecule.complement"><wicket:message key="Molecule.complement" /></label>
<textarea id="Molecule.complement" wicket:id="Molecule.complement"></textarea>
@@ -88,7 +95,84 @@
<label for="Molecule.createur"><wicket:message key="Molecule.createur" /></label>
<input type="text" id="Molecule.createur" wicket:id="Molecule.createur" disabled="disabled"/>
</div>
-
+
+ <fieldset>
+ <legend><wicket:message key="Molecule.produits" /></legend>
+ <table class="large" cellspacing="0" wicket:id="Molecule.produits.Table">
+ <thead>
+ <tr>
+ <th class="required">
+ <label for="Molecule.produits.List.produit.ref"><wicket:message key="Molecule.produits.produit.ref" /></label>
+ </th>
+ <th class="required">
+ <label for="Molecule.produits.List.presence"><wicket:message key="Molecule.produits.presence" /></label>
+ </th>
+ <th>
+ <label for="Molecule.produits.List.lot.ref"><wicket:message key="Molecule.produits.lot.ref" /></label>
+ </th>
+ <th>
+ <label for="Molecule.produits.List.genre"><wicket:message key="Molecule.produits.genre" /></label>
+ </th>
+ <th>
+ <label for="Molecule.produits.List.espece"><wicket:message key="Molecule.produits.espece" /></label>
+ </th>
+ <th>
+ <label for="Molecule.produits.List.campagne"><wicket:message key="Molecule.produits.campagne" /></label>
+ </th>
+ <th><wicket:message key="Actions" /></th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr wicket:id="Molecule.produits.List">
+ <td>
+ <span wicket:id="Molecule.produits.List.produit.ref" />
+ </td>
+ <td>
+ <span wicket:id="Molecule.produits.List.presence" />
+ </td>
+ <td>
+ <span wicket:id="Molecule.produits.List.lot.ref" />
+ </td>
+ <td>
+ <span wicket:id="Molecule.produits.List.genre" />
+ </td>
+ <td>
+ <span wicket:id="Molecule.produits.List.espece" />
+ </td>
+ <td>
+ <span wicket:id="Molecule.produits.List.campagne" />
+ </td>
+ <td>
+ <input wicket:id="Molecule.produits.List.Delete" type="submit" wicket:message="value:Delete" />
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <select class="tiny" id="Molecule.produits.produit.ref" wicket:id="Molecule.produits.produit.ref" />
+ </td>
+ <td>
+ <input type="text" class="tiny" id="Molecule.produits.presence" wicket:id="Molecule.produits.presence" />
+ </td>
+ <td>
+ todo lot
+ </td>
+ <td>
+ todo genre
+ </td>
+ <td>
+ todo espece
+ </td>
+ <td>
+ todo campagne
+ </td>
+ <td>
+ <input wicket:id="Molecule.produits.Add" type="submit" wicket:message="value:Add" />
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </fieldset>
+
<div class="actions">
<input type="submit" wicket:message="value:Submit" wicket:id="Create" />
<input type="submit" wicket:message="value:Submit" wicket:id="Update" />
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-07 10:50:58 UTC (rev 45)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule/ManageMoleculePage.java 2013-01-07 16:23:51 UTC (rev 46)
@@ -22,6 +22,7 @@
*/
package nc.ird.cantharella.web.pages.domain.molecule;
+import java.math.BigDecimal;
import java.util.List;
import nc.ird.cantharella.data.exceptions.DataConstraintException;
@@ -29,11 +30,19 @@
import nc.ird.cantharella.data.exceptions.UnexpectedException;
import nc.ird.cantharella.data.model.Campagne;
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.Utilisateur;
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.web.pages.TemplatePage;
import nc.ird.cantharella.web.pages.domain.campagne.ManageCampagnePage;
+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.forms.SubmittableButton;
@@ -42,10 +51,12 @@
import nc.ird.cantharella.web.utils.security.AuthRoles;
import nc.ird.module.utils.LogTools;
-import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.logging.Log;
+import org.apache.wicket.MarkupContainer;
import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.ajax.markup.html.form.AjaxFallbackButton;
import org.apache.wicket.ajax.markup.html.form.AjaxSubmitLink;
+import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.form.Button;
import org.apache.wicket.markup.html.form.CheckBox;
import org.apache.wicket.markup.html.form.DropDownChoice;
@@ -53,15 +64,17 @@
import org.apache.wicket.markup.html.form.TextArea;
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;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model;
import org.apache.wicket.model.PropertyModel;
import org.apache.wicket.spring.injection.annot.SpringBean;
/**
- * Gestion des lots
- * @author Mickael Tricot
- * @author Adrien Cheype
+ * Gestion des molecules.
+ *
+ * @author Eric Chatellier
*/
@AuthRoles({ AuthRole.USER, AuthRole.ADMIN })
public final class ManageMoleculePage extends TemplatePage {
@@ -78,16 +91,30 @@
/** Logger */
private static final Log LOG = LogTools.getLog();
+ /** Personnes */
+ private final List<Personne> personnes;
+
/** Campagnes */
private final List<Campagne> campagnes;
+ /** Service : personne */
+ @SpringBean
+ private PersonneService personneService;
+
/** Service : campagne */
@SpringBean
private CampagneService campagneService;
+ /** Service : produit */
+ @SpringBean
+ private ProduitService produitService;
+
/** Modèle : molecule */
private final IModel<Molecule> moleculeModel;
+ /** Modèle to add new provenance. */
+ private Model<MoleculeProvenance> newProvenanceModel;
+
/** Service : molecule */
@SpringBean
private MoleculeService moleculeService;
@@ -98,6 +125,9 @@
/** Page appelante */
private final CallerPage callerPage;
+
+ /** Bouton d'ajout d'une provenance **/
+ Button addProvenanceButton;
/**
* Constructeur (mode création)
@@ -122,6 +152,8 @@
final CallerPage currentPage = new CallerPage(this);
+ newProvenanceModel = new Model<MoleculeProvenance>(new MoleculeProvenance());
+
// Initialisation du modèle
try {
moleculeModel = new Model<Molecule>(idMolecule == null ? new Molecule() : moleculeService.loadMolecule(idMolecule));
@@ -136,62 +168,53 @@
}
// Initialisation des listes
+ personnes = personneService.listPersonnes();
campagnes = campagneService.listCampagnes(getSession().getUtilisateur());
- /*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");
+ initProvenanceFields(formView);
+
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 TextField<String>("Molecule.formuleDevMol", new PropertyModel<String>(moleculeModel, "formuleDevMol")));
formView.add(new TextField<String>("Molecule.nomIupca", new PropertyModel<String>(moleculeModel, "nomIupca")));
formView.add(new TextField<String>("Molecule.formuleBrute", new PropertyModel<String>(moleculeModel, "formuleBrute")));
formView.add(new TextField<String>("Molecule.masseMolaire", new PropertyModel<String>(moleculeModel, "masseMolaire")));
- formView.add(new CheckBox("Molecule.nouvMolecul", new PropertyModel<Boolean>(moleculeModel, "nouvMolecul")));
- formView.add(new TextField<String>("Molecule.identifieePar", new PropertyModel<String>(moleculeModel, "identifieePar")) {
+
+ // 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")) {
@Override
- public boolean isVisible() {
- return BooleanUtils.isTrue(moleculeModel.getObject().getNouvMolecul());
+ protected void onSelectionChanged(Boolean newSelection) {
+ nouvMoleculRefresh.setVisible(newSelection);
}
+ @Override
+ protected boolean wantOnSelectionChangedNotifications() {
+ return true;
+ }
});
+ DropDownChoice<Personne> pers = new DropDownChoice<Personne>("Molecule.identifieePar",
+ new PropertyModel<Personne>(moleculeModel, "identifieePar"), personnes, new PersonneRenderer());
+ //pers.setNullValid(false);
+ //pers.setModelObject(extractionModel.getObject().getManipulateur());
+ nouvMoleculRefresh.add(pers);
+
DropDownChoice<Campagne> campagnesInput = new DropDownChoice<Campagne>("Molecule.campagne",
- new PropertyModel<Campagne>(moleculeModel, "campagne"), campagnes) {
- @Override
- public boolean isVisible() {
- return BooleanUtils.isTrue(moleculeModel.getObject().getNouvMolecul());
- }
- };
- campagnesInput.setNullValid(false);
- formView.add(campagnesInput);
+ new PropertyModel<Campagne>(moleculeModel, "campagne"), campagnes);
+ //campagnesInput.setNullValid(false);
+ nouvMoleculRefresh.add(campagnesInput);
// Action : création d'une nouvelle campagne
// ajaxSubmitLink permet de sauvegarder l'état du formulaire
- formView.add(new AjaxSubmitLink("NewCampagne") {
+ nouvMoleculRefresh.add(new AjaxSubmitLink("NewCampagne") {
@Override
- protected void onSubmit(AjaxRequestTarget arg0, Form<?> arg1) {
+ protected void onSubmit(AjaxRequestTarget request, Form<?> form) {
setResponsePage(new ManageCampagnePage(currentPage, false));
}
@@ -200,21 +223,12 @@
protected void onError(AjaxRequestTarget target, Form<?> form) {
setResponsePage(new ManageCampagnePage(currentPage, false));
}
- @Override
- public boolean isVisible() {
- return BooleanUtils.isTrue(moleculeModel.getObject().getNouvMolecul());
- }
});
- formView.add(new TextArea<String>("Molecule.publiOrigine", new PropertyModel<String>(moleculeModel, "publiOrigine")) {
- @Override
- public boolean isVisible() {
- return BooleanUtils.isTrue(moleculeModel.getObject().getNouvMolecul());
- }
- });
- formView.add(new TextArea<String>("Molecule.complement", new PropertyModel<String>(moleculeModel, "complement")));
-
+ nouvMoleculRefresh.add(new TextArea<String>("Molecule.publiOrigine", new PropertyModel<String>(moleculeModel, "publiOrigine")));
+ 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));
@@ -291,6 +305,62 @@
}
/**
+ * Init provenance table.
+ *
+ * @param formView
+ */
+ private void initProvenanceFields(final Form<Void> formView) {
+ // Déclaration tableau des provenances
+ final MarkupContainer provenanceTable = new WebMarkupContainer("Molecule.produits.Table");
+ provenanceTable.setOutputMarkupId(true);
+
+ // Contenu tableaux provenance
+ provenanceTable.add(new ListView<MoleculeProvenance>("Molecule.produits.List",
+ new PropertyModel<List<MoleculeProvenance>>(moleculeModel, "provenances")) {
+ @Override
+ protected void populateItem(ListItem<MoleculeProvenance> item) {
+ // TODO echatellier it's NOT produit (new object with %)
+ }
+ });
+
+ // champs d'input
+ Utilisateur utilisateur = getSession().getUtilisateur();
+ List<Produit> utilisateurProduits = produitService.listProduits(utilisateur);
+ final DropDownChoice<Produit> produitChoice = new DropDownChoice<Produit>(
+ "Molecule.produits.produit.ref", new PropertyModel<Produit>(newProvenanceModel, "produit"),
+ utilisateurProduits, new ProduitRenderer()) {
+
+ };
+ produitChoice.setNullValid(false);
+ provenanceTable.add(produitChoice);
+
+ final TextField<BigDecimal> presenceInput = new TextField<BigDecimal>("Molecule.produits.presence",
+ new PropertyModel<BigDecimal>(newProvenanceModel, "pourcentage")) {
+
+ };
+ presenceInput.setOutputMarkupId(true);
+ presenceInput.setOutputMarkupPlaceholderTag(true);
+ provenanceTable.add(presenceInput);
+
+ // Bouton AJAX pour ajouter un résultat de test
+ addProvenanceButton = new AjaxFallbackButton("Molecule.produits.Add", formView) {
+ @Override
+ protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
+
+ }
+
+ @Override
+ protected void onError(AjaxRequestTarget target, Form<?> form) {
+
+ }
+
+ };
+ provenanceTable.add(addProvenanceButton);
+
+ formView.add(provenanceTable);
+ }
+
+ /**
* Redirection vers une autre page. Cas où le formulaire est validé
*/
private void redirect() {
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-07 10:50:58 UTC (rev 45)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule/ReadMoleculePage.java 2013-01-07 16:23:51 UTC (rev 46)
@@ -27,6 +27,11 @@
import nc.ird.cantharella.web.utils.security.AuthRole;
import nc.ird.cantharella.web.utils.security.AuthRoles;
+/**
+ * Lecture d'une molécule.
+ *
+ * @author Eric Chatellier
+ */
@AuthRoles( { AuthRole.ADMIN, AuthRole.USER })
public class ReadMoleculePage extends TemplatePage {
Added: 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 (rev 0)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/renderers/ProduitRenderer.java 2013-01-07 16:23:51 UTC (rev 46)
@@ -0,0 +1,40 @@
+/*
+ * #%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%
+ */
+package nc.ird.cantharella.web.pages.renderers;
+
+import nc.ird.cantharella.data.model.Produit;
+
+import org.apache.wicket.markup.html.form.ChoiceRenderer;
+
+/**
+ * Renderer to display Produit with product ref.
+ * @author Eric Chatellier
+ */
+public class ProduitRenderer extends ChoiceRenderer<Produit> {
+
+ /** {@inheritDoc} */
+ @Override
+ public Object getDisplayValue(final Produit produit) {
+ return produit.getRef();
+ }
+}
Property changes on: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/renderers/ProduitRenderer.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Modified: trunk/cantharella.web/src/main/resources/commons/web_en.properties
===================================================================
--- trunk/cantharella.web/src/main/resources/commons/web_en.properties 2013-01-07 10:50:58 UTC (rev 45)
+++ trunk/cantharella.web/src/main/resources/commons/web_en.properties 2013-01-07 16:23:51 UTC (rev 46)
@@ -192,6 +192,12 @@
ManagePurificationPage.Delete.DataConstraintException=There are data linked to this purification
ManageMoleculePage=Molecule management
+ManageMoleculePage.Create.DataConstraintException=Can't save molecule
+ManageMoleculePage.Create.OK=Molecule added
+ManageMoleculePage.Update.DataConstraintException=Cant' update molecule
+ManageMoleculePage.Update.OK=Molecule updated
+ManageMoleculePage.Delete.DataConstraintException=Can't delete molecule
+ManageMoleculePage.Delete.OK=Molecule deleted
ManageTestBioPage=Bioassay management
ManageTestBioPage.Create.OK=Bioassay added
Modified: trunk/cantharella.web/src/main/resources/commons/web_fr.properties
===================================================================
--- trunk/cantharella.web/src/main/resources/commons/web_fr.properties 2013-01-07 10:50:58 UTC (rev 45)
+++ trunk/cantharella.web/src/main/resources/commons/web_fr.properties 2013-01-07 16:23:51 UTC (rev 46)
@@ -191,6 +191,12 @@
ManagePurificationPage.Delete.DataConstraintException=Il existe des données liées à cette purification
ManageMoleculePage=Gestion d'une molécule
+ManageMoleculePage.Create.DataConstraintException=Impossible de sauver la molécule
+ManageMoleculePage.Create.OK=Molecule ajoutée
+ManageMoleculePage.Update.DataConstraintException=Impossible de modifier la molécule
+ManageMoleculePage.Update.OK=Molecule mise à jour
+ManageMoleculePage.Delete.DataConstraintException=Impossible de supprimer la molécule
+ManageMoleculePage.Delete.OK=Molecule supprimée
ManageTestBioPage=Gestion d'un test biologique
ManageTestBioPage.Create.OK=Test biologique ajouté
1
0