mailman.cloud.codelutin.com
Sign In Sign Up
Manage this list Sign In Sign Up

Keyboard Shortcuts

Thread View

  • j: Next unread message
  • k: Previous unread message
  • j a: Jump to all threads
  • j l: Jump to MailingList overview

Observe-commits

Thread Start a new thread
Download
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
observe-commits@list.forge.codelutin.com

  • 7199 discussions
[Git][ultreiaio/ird-observe][develop] Update askToFillTripObservations_en_GB.ftl
by Pascal Cauquil 21 Sep '20

21 Sep '20
Pascal Cauquil pushed to branch develop at ultreiaio / ird-observe Commits: 521ffcaa by Pascal Cauquil at 2020-09-21T13:04:24+00:00 Update askToFillTripObservations_en_GB.ftl - - - - - 1 changed file: - client-datasource-editor-common/src/main/i18n/templates/askToFillTripObservations_en_GB.ftl Changes: ===================================== client-datasource-editor-common/src/main/i18n/templates/askToFillTripObservations_en_GB.ftl ===================================== @@ -25,21 +25,21 @@ To be able to acquire data of type <i>${dtoType}</i>, the trip form must first be completed: </p> <ul> - <li>The <i>Observations</i> checkbox must be checked</li> - <li>The <i>Observations</i> tab must be properly filled</li> + <li>On tab <i>Common characteristics</i>, checkbox <i>Observations</i> must be checked</li> + <li>Tab <i>Observations</i> must be completed</li> </ul> <hr/> <br/> <p> - Click on <b>Access to trip form</b> to fill properly the form and save. + Click on <b>Access to trip form</b> to complete these data and save. </p> <br/> -<p>The <i>observations</i> box will be checked automatically and you will be redirected to the proper - tab. +<p>Checkbox <i>Observations</i> will be checked automatically and you will be redirected to tab <i>Observations</i>. </p> + <br/> <p> - You can then enter the data. + You can then enter data. </p> </body> </html> View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/commit/521ffcaa141fb863e59c1550f… -- View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/commit/521ffcaa141fb863e59c1550f… You're receiving this email because of your account on gitlab.com.
1 0
0 0
[Git][ultreiaio/ird-observe][develop] Update askToFillTripLogbook_en_GB.ftl
by Pascal Cauquil 21 Sep '20

21 Sep '20
Pascal Cauquil pushed to branch develop at ultreiaio / ird-observe Commits: 3962ac12 by Pascal Cauquil at 2020-09-21T12:59:44+00:00 Update askToFillTripLogbook_en_GB.ftl - - - - - 1 changed file: - client-datasource-editor-common/src/main/i18n/templates/askToFillTripLogbook_en_GB.ftl Changes: ===================================== client-datasource-editor-common/src/main/i18n/templates/askToFillTripLogbook_en_GB.ftl ===================================== @@ -25,21 +25,20 @@ To be able to acquire data of type <i>${dtoType}</i>, the trip form must first be completed: </p> <ul> - <li>The <i>Logbook and associated data</i> checkbox must be checked</li> - <li>The <i>Logbook and associated data</i> tab must be properly filled</li> + <li>On tab <i>Common characteristics</i>, checkbox <i>Logbook and associated data</i> must be checked</li> + <li>Tab <i>Logbook and associated data</i> must be completed</li> </ul> <hr/> <br/> <p> - Click on <b>Access to trip form</b> to fill properly the form and save. + Click on <b>Access to trip form</b> to complete these data and save. </p> <br/> -<p>The <i>logbook and associated data</i> box will be checked automatically and you will be redirected to the proper - tab. +<p>Checkbox <i>Logbook and associated data</i> will be checked automatically and you will be redirected to tab <i>Logbook and associated data</i>. </p> <br/> <p> - You can then enter the data. + You can then enter data. </p> </body> </html> View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/commit/3962ac12c4db5606f71037122… -- View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/commit/3962ac12c4db5606f71037122… You're receiving this email because of your account on gitlab.com.
1 0
0 0
[Git][ultreiaio/ird-observe][develop] Update askToFillTripObservations_fr_FR.ftl
by Pascal Cauquil 21 Sep '20

21 Sep '20
Pascal Cauquil pushed to branch develop at ultreiaio / ird-observe Commits: cc098194 by Pascal Cauquil at 2020-09-21T12:50:03+00:00 Update askToFillTripObservations_fr_FR.ftl - - - - - 1 changed file: - client-datasource-editor-common/src/main/i18n/templates/askToFillTripObservations_fr_FR.ftl Changes: ===================================== client-datasource-editor-common/src/main/i18n/templates/askToFillTripObservations_fr_FR.ftl ===================================== @@ -26,8 +26,8 @@ : </p> <ul> - <li>Sur l'onglet <i>Caractéristiques</i>, la case <i>Observations</i> doit être cochée</li> - <li>L'onglet <i>Caractéristiques des observations</i> doit être complété</li> + <li>Sur l'onglet <i>Caractéristiques communes</i>, la case <i>Observations</i> doit être cochée</li> + <li>L'onglet <i>Observations</i> doit être complété</li> </ul> <hr/> <br/> @@ -35,7 +35,7 @@ Cliquer sur <b>Accéder au formulaire marée</b> pour compléter ces données et enregistrer. <p> <br/> -<p> La case <i>Observations</i> sera cochée automatiquement, et vous serez dirigé vers l'onglet <i>Caractéristiques d'observation</i>. +<p> La case <i>Observations</i> sera cochée automatiquement, et vous serez dirigé vers l'onglet <i>Observation</i>. </p> <br/> <p> Vous pourrez ensuite saisir les données souhaitées.</p> View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/commit/cc09819460586f8ee044aa3a1… -- View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/commit/cc09819460586f8ee044aa3a1… You're receiving this email because of your account on gitlab.com.
1 0
0 0
[Git][ultreiaio/ird-observe][develop] Update askToFillTripLogbook_fr_FR.ftl
by Pascal Cauquil 21 Sep '20

21 Sep '20
Pascal Cauquil pushed to branch develop at ultreiaio / ird-observe Commits: 38e200fd by Pascal Cauquil at 2020-09-21T12:48:44+00:00 Update askToFillTripLogbook_fr_FR.ftl - - - - - 1 changed file: - client-datasource-editor-common/src/main/i18n/templates/askToFillTripLogbook_fr_FR.ftl Changes: ===================================== client-datasource-editor-common/src/main/i18n/templates/askToFillTripLogbook_fr_FR.ftl ===================================== @@ -25,8 +25,8 @@ Pour pouvoir créer une donnée de type <i>${dtoType}</i>, le formulaire marée doit d'abord être complété : </p> <ul> - <li>Sur l'onglet <i>Caractéristiques</i>, la case <i>Livre de bord et données associées</i> doit être cochée</li> - <li>L'onglet <i>Caractéristiques livre de bord</i> doit être complété</li> + <li>Sur l'onglet <i>Caractéristiques communes</i>, la case <i>Livre de bord et données associées</i> doit être cochée</li> + <li>L'onglet <i>ivre de bord et données associées</i> doit être complété</li> </ul> <hr/> <br/> @@ -34,7 +34,7 @@ Cliquer sur <b>Accéder au formulaire marée</b> pour compléter ces données et enregistrer. <p> <br/> -<p> La case <i>Livre de bord et données associées</i> sera cochée automatiquement, et vous serez dirigé vers l'onglet <i>Caractéristiques livre de bord</i>. +<p> La case <i>Livre de bord et données associées</i> sera cochée automatiquement, et vous serez dirigé vers l'onglet <i>Livre de bord et données associées</i>. </p> <br/> <p> Vous pourrez ensuite saisir les données souhaitées.</p> View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/commit/38e200fd5d98a6e31021c54b4… -- View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/commit/38e200fd5d98a6e31021c54b4… You're receiving this email because of your account on gitlab.com.
1 0
0 0
[Git][ultreiaio/ird-observe][develop] Update askToFillTripLogbook_fr_FR.ftl
by Pascal Cauquil 21 Sep '20

21 Sep '20
Pascal Cauquil pushed to branch develop at ultreiaio / ird-observe Commits: 94e420da by Pascal Cauquil at 2020-09-21T12:37:37+00:00 Update askToFillTripLogbook_fr_FR.ftl - - - - - 1 changed file: - client-datasource-editor-common/src/main/i18n/templates/askToFillTripLogbook_fr_FR.ftl Changes: ===================================== client-datasource-editor-common/src/main/i18n/templates/askToFillTripLogbook_fr_FR.ftl ===================================== @@ -25,8 +25,8 @@ Pour pouvoir créer une donnée de type <i>${dtoType}</i>, le formulaire marée doit d'abord être complété : </p> <ul> - <li>Sur l'onglet 'Caractéristiques', la case <i>Livre de bord et données associées</i> doit être cochée</li> - <li>L'onglet <i>Livre de bord et données associées</i> doit être complété</li> + <li>Sur l'onglet <i>Caractéristiques</i>, la case <i>Livre de bord et données associées</i> doit être cochée</li> + <li>L'onglet <i>Caractéristiques livre de bord</i> doit être complété</li> </ul> <hr/> <br/> @@ -34,7 +34,7 @@ Cliquer sur <b>Accéder au formulaire marée</b> pour compléter ces données et enregistrer. <p> <br/> -<p> La case <i>livre de bord et données associées</i> sera cochée automatiquement, et vous serez dirigé vers l'onglet <i>Livre de bord et données associées</i>. +<p> La case <i>Livre de bord et données associées</i> sera cochée automatiquement, et vous serez dirigé vers l'onglet <i>Caractéristiques livre de bord</i>. </p> <br/> <p> Vous pourrez ensuite saisir les données souhaitées.</p> View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/commit/94e420da87cd70d9e98955335… -- View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/commit/94e420da87cd70d9e98955335… You're receiving this email because of your account on gitlab.com.
1 0
0 0
[Git][ultreiaio/ird-observe][develop] Update askToFillTripObservations_fr_FR.ftl
by Pascal Cauquil 21 Sep '20

21 Sep '20
Pascal Cauquil pushed to branch develop at ultreiaio / ird-observe Commits: c7c82221 by Pascal Cauquil at 2020-09-21T12:35:54+00:00 Update askToFillTripObservations_fr_FR.ftl - - - - - 1 changed file: - client-datasource-editor-common/src/main/i18n/templates/askToFillTripObservations_fr_FR.ftl Changes: ===================================== client-datasource-editor-common/src/main/i18n/templates/askToFillTripObservations_fr_FR.ftl ===================================== @@ -26,8 +26,8 @@ : </p> <ul> - <li>La case <i>Observations</i> doit être cochée</li> - <li>Le saisisseur des observations doit être sélectionné</li> + <li>Sur l'onglet <i>Caractéristiques</i>, la case <i>Observations</i> doit être cochée</li> + <li>L'onglet <i>Caractéristiques des observations</i> doit être complété</li> </ul> <hr/> <br/> @@ -35,10 +35,9 @@ Cliquer sur <b>Accéder au formulaire marée</b> pour compléter ces données et enregistrer. <p> <br/> -<p> La case <i>observations</i> sera cochée automatiquement, et vous serez redirigé vers l'onglet - à renseigner. +<p> La case <i>Observations</i> sera cochée automatiquement, et vous serez dirigé vers l'onglet <i>Caractéristiques d'observation</i>. </p> <br/> -<p> Vous pourrez ensuite saisir la donnée souhaitée.</p> +<p> Vous pourrez ensuite saisir les données souhaitées.</p> </body> </html> View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/commit/c7c8222104110f535aaf11f00… -- View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/commit/c7c8222104110f535aaf11f00… You're receiving this email because of your account on gitlab.com.
1 0
0 0
[Git][ultreiaio/ird-observe][develop] Update askToFillTripLogbook_fr_FR.ftl
by Pascal Cauquil 21 Sep '20

21 Sep '20
Pascal Cauquil pushed to branch develop at ultreiaio / ird-observe Commits: ea8349a0 by Pascal Cauquil at 2020-09-21T12:30:48+00:00 Update askToFillTripLogbook_fr_FR.ftl - - - - - 1 changed file: - client-datasource-editor-common/src/main/i18n/templates/askToFillTripLogbook_fr_FR.ftl Changes: ===================================== client-datasource-editor-common/src/main/i18n/templates/askToFillTripLogbook_fr_FR.ftl ===================================== @@ -25,8 +25,8 @@ Pour pouvoir créer une donnée de type <i>${dtoType}</i>, le formulaire marée doit d'abord être complété : </p> <ul> - <li>La case <i>Livre de bord et données associées</i> doit être cochée</li> - <li>L'onglet <i>Livre de bord et données associées</i> doit dûment renseigné</li> + <li>Sur l'onglet 'Caractéristiques', la case <i>Livre de bord et données associées</i> doit être cochée</li> + <li>L'onglet <i>Livre de bord et données associées</i> doit être complété</li> </ul> <hr/> <br/> @@ -34,10 +34,9 @@ Cliquer sur <b>Accéder au formulaire marée</b> pour compléter ces données et enregistrer. <p> <br/> -<p> La case <i>livre de bord et données associées</i> sera cochée automatiquement, et vous serez redirigé vers l'onglet - à renseigner. +<p> La case <i>livre de bord et données associées</i> sera cochée automatiquement, et vous serez dirigé vers l'onglet <i>Livre de bord et données associées</i>. </p> <br/> -<p> Vous pourrez ensuite saisir la donnée souhaitée.</p> +<p> Vous pourrez ensuite saisir les données souhaitées.</p> </body> </html> View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/commit/ea8349a028715b63014f73db8… -- View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/commit/ea8349a028715b63014f73db8… You're receiving this email because of your account on gitlab.com.
1 0
0 0
[Git][ultreiaio/ird-observe][develop] Nouveau texte de popup pour le cas 'Vous devez mettre à jour le form marée...
by Tony CHEMIT 19 Sep '20

19 Sep '20
Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe Commits: edfb9063 by Tony Chemit at 2020-09-19T16:00:39+02:00 Nouveau texte de popup pour le cas &#39;Vous devez mettre à jour le form marée avant de pouvoir saisir le livre de bord&#39; - See #1605 - - - - - 17 changed files: - client-datasource-editor-common/pom.xml - + client-datasource-editor-common/src/main/i18n/templates/askToFillTripLogbook_en_GB.ftl - + client-datasource-editor-common/src/main/i18n/templates/askToFillTripLogbook_es_ES.ftl - + client-datasource-editor-common/src/main/i18n/templates/askToFillTripLogbook_fr_FR.ftl - + client-datasource-editor-common/src/main/i18n/templates/askToFillTripObservations_en_GB.ftl - + client-datasource-editor-common/src/main/i18n/templates/askToFillTripObservations_es_ES.ftl - + client-datasource-editor-common/src/main/i18n/templates/askToFillTripObservations_fr_FR.ftl - client-datasource-editor-common/src/main/java/fr/ird/observe/client/datasource/editor/content/data/TripActionHelper.java - client-datasource-editor-common/src/main/java/fr/ird/observe/client/datasource/editor/content/data/TripUI.java - client-datasource-editor-ll/src/main/java/fr/ird/observe/client/datasource/editor/content/data/ll/CreateSupport.java - client-datasource-editor-ll/src/main/java/fr/ird/observe/client/datasource/editor/content/data/ll/LlTripActionHelper.java - client-datasource-editor-ps/src/main/java/fr/ird/observe/client/datasource/editor/content/data/ps/CreateSupport.java - client-datasource-editor-ps/src/main/java/fr/ird/observe/client/datasource/editor/content/data/ps/PsTripActionHelper.java - client-datasource-editor-ps/src/main/java/fr/ird/observe/client/datasource/editor/content/data/ps/localmarket/actions/LocalmarketUIActionSupport.java - observe-i18n/src/main/i18n/translations/observe_en_GB.properties - observe-i18n/src/main/i18n/translations/observe_es_ES.properties - observe-i18n/src/main/i18n/translations/observe_fr_FR.properties Changes: ===================================== client-datasource-editor-common/pom.xml ===================================== @@ -90,6 +90,11 @@ <version>${project.version}</version> </dependency> + <dependency> + <groupId>io.ultreia.java4all</groupId> + <artifactId>application-template</artifactId> + </dependency> + <dependency> <groupId>io.ultreia.java4all.jaxx</groupId> <artifactId>jaxx-runtime-spi</artifactId> ===================================== client-datasource-editor-common/src/main/i18n/templates/askToFillTripLogbook_en_GB.ftl ===================================== @@ -0,0 +1,45 @@ +<#-- + #%L + ObServe :: Client DataSource Editor Common + %% + Copyright (C) 2008 - 2020 IRD, Code Lutin, Ultreia.io + %% + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU 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 General Public + License along with this program. If not, see + <http://www.gnu.org/licenses/gpl-3.0.html>. + #L% +--> +<html> +<body> +<p> + To be able to acquire data of type <i>${dtoType}</i>, the trip form must first be completed: +</p> +<ul> + <li>The <i>Logbook and associated data</i> checkbox must be checked</li> + <li>The <i>Logbook and associated data</i> tab must be properly filled</li> +</ul> +<hr/> +<br/> +<p> + Click on <b>Access to trip form</b> to fill properly the form and save.. +</p> +<br/> +<p>The <i>logbook and associated data</i> box will be checked automatically and you will be redirected to the proper + tab. +</p> +<br/> +<p> + You can then enter the data. +</p> +</body> +</html> ===================================== client-datasource-editor-common/src/main/i18n/templates/askToFillTripLogbook_es_ES.ftl ===================================== @@ -0,0 +1,49 @@ +<#-- + #%L + ObServe :: Client DataSource Editor Common + %% + Copyright (C) 2008 - 2020 IRD, Code Lutin, Ultreia.io + %% + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU 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 General Public + License along with this program. If not, see + <http://www.gnu.org/licenses/gpl-3.0.html>. + #L% +--> +<html> +<body> +<p> + Para poder acceder al diario de pesca (<i>${dtoType}</i>), primero se debe completar el formulario de marea: +</p> +<ul> + <li>La casilla <i>diario de pesca y datos asociados</i> debe estar marcada</li> + <li>Se debe seleccionar la identidad de la persona que registra los datos en el <i>diario de pesca y datos + asociados</i> (observador/a u otro/a) + </li> +</ul> +<hr/> +<br/> +<p> + Haga click en <b>Acceder al formulario de marea</b> para añadir la identidad de la persona que registra los datos y + guardar. +</p> +<br/> +<p> + La casilla <i>diario de pesca y datos asociados</i> se marcará automáticamente. +</p> +<br/> +<p> + Podrá entonces introducir + datos. +</p> +</body> +</html> ===================================== client-datasource-editor-common/src/main/i18n/templates/askToFillTripLogbook_fr_FR.ftl ===================================== @@ -0,0 +1,43 @@ +<#-- + #%L + ObServe :: Client DataSource Editor Common + %% + Copyright (C) 2008 - 2020 IRD, Code Lutin, Ultreia.io + %% + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU 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 General Public + License along with this program. If not, see + <http://www.gnu.org/licenses/gpl-3.0.html>. + #L% +--> +<html> +<body> +<p> + Pour pouvoir créer une donnée de type <i>${dtoType}</i>, le formulaire marée doit d'abord être complété : +</p> +<ul> + <li>La case <i>Livre de bord et données associées</i> doit être cochée</li> + <li>L'onglet <i>Livre de bord et données associées</i> doit dûment renseigné</li> +</ul> +<hr/> +<br/> +<p> + Cliquer sur <b>Accéder au formulaire marée</b> pour compléter ces données et enregistrer. +<p> +<br/> +<p> La case <i>livre de bord et données associées</i> sera cochée automatiquement, et vous serez redirigé vers l'onglet + à renseigner. +</p> +<br/> +<p> Vous pourrez ensuite saisir la donnée souhaitée.</p> +</body> +</html> ===================================== client-datasource-editor-common/src/main/i18n/templates/askToFillTripObservations_en_GB.ftl ===================================== @@ -0,0 +1,45 @@ +<#-- + #%L + ObServe :: Client DataSource Editor Common + %% + Copyright (C) 2008 - 2020 IRD, Code Lutin, Ultreia.io + %% + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU 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 General Public + License along with this program. If not, see + <http://www.gnu.org/licenses/gpl-3.0.html>. + #L% +--> +<html> +<body> +<p> + To be able to acquire data of type <i>${dtoType}</i>, the trip form must first be completed: +</p> +<ul> + <li>The <i>Observations</i> checkbox must be checked</li> + <li>The <i>Observations</i> tab must be properly filled</li> +</ul> +<hr/> +<br/> +<p> + Click on <b>Access to trip form</b> to fill properly the form and save.. +</p> +<br/> +<p>The <i>observations</i> box will be checked automatically and you will be redirected to the proper + tab. +</p> +<br/> +<p> + You can then enter the data. +</p> +</body> +</html> ===================================== client-datasource-editor-common/src/main/i18n/templates/askToFillTripObservations_es_ES.ftl ===================================== @@ -0,0 +1,49 @@ +<#-- + #%L + ObServe :: Client DataSource Editor Common + %% + Copyright (C) 2008 - 2020 IRD, Code Lutin, Ultreia.io + %% + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU 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 General Public + License along with this program. If not, see + <http://www.gnu.org/licenses/gpl-3.0.html>. + #L% +--> +<html> +<body> +<p> + Para poder acceder al observaciones (<i>${dtoType}</i>), primero se debe completar el formulario de marea: +</p> +<ul> + <li>La casilla <i>observaciones</i> debe estar marcada</li> + <li>Se debe seleccionar la identidad de la persona que registra los datos en el <i>observaciones</i> (observador/a u + otro/a) + </li> +</ul> +<hr/> +<br/> +<p> + Haga click en <b>Acceder al formulario de marea</b> para añadir la identidad de la persona que registra los datos y + guardar. +</p> +<br/> +<p> + La casilla <i>observaciones</i> se marcará automáticamente. +</p> +<br/> +<p> + Podrá entonces introducir + datos. +</p> +</body> +</html> ===================================== client-datasource-editor-common/src/main/i18n/templates/askToFillTripObservations_fr_FR.ftl ===================================== @@ -0,0 +1,44 @@ +<#-- + #%L + ObServe :: Client DataSource Editor Common + %% + Copyright (C) 2008 - 2020 IRD, Code Lutin, Ultreia.io + %% + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU 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 General Public + License along with this program. If not, see + <http://www.gnu.org/licenses/gpl-3.0.html>. + #L% +--> +<html> +<body> +<p> + Pour pouvoir créer une donnée d'observation de type <i>${dtoType}</i>, le formulaire marée doit d'abord être complété + : +</p> +<ul> + <li>La case <i>Observations</i> doit être cochée</li> + <li>Le saisisseur des observations doit être sélectionné</li> +</ul> +<hr/> +<br/> +<p> + Cliquer sur <b>Accéder au formulaire marée</b> pour compléter ces données et enregistrer. +<p> + <br/> +<p> La case <i>observations</i> sera cochée automatiquement, et vous serez redirigé vers l'onglet + à renseigner. +</p> +<br/> +<p> Vous pourrez ensuite saisir la donnée souhaitée.</p> +</body> +</html> ===================================== client-datasource-editor-common/src/main/java/fr/ird/observe/client/datasource/editor/content/data/TripActionHelper.java ===================================== @@ -22,56 +22,107 @@ package fr.ird.observe.client.datasource.editor.content.data; * #L% */ +import fr.ird.observe.client.WithClientUIContext; import fr.ird.observe.client.datasource.editor.content.ContentUI; import fr.ird.observe.client.datasource.editor.tree.navigation.NavigationTree; -import fr.ird.observe.client.main.ObserveMainUI; import fr.ird.observe.client.util.UIHelper; import fr.ird.observe.dto.data.DataDto; import fr.ird.observe.dto.data.TripAware; import fr.ird.observe.dto.decoration.ObserveI18nDecoratorHelper; import fr.ird.observe.navigation.tree.ReferenceNode; import fr.ird.observe.spi.DtoModelHelper; +import io.ultreia.java4all.application.template.spi.GenerateTemplate; import io.ultreia.java4all.i18n.I18n; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import org.nuiton.jaxx.runtime.swing.TabInfo; +import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.SwingUtilities; import javax.swing.tree.TreeNode; +import java.util.Objects; +import java.util.function.Function; import static io.ultreia.java4all.i18n.I18n.t; /** * Store here any mutual code for some actions. */ -public class TripActionHelper { +@GenerateTemplate(template = { + "askToFillTripObservations.ftl", + "askToFillTripLogbook.ftl" +}) +public abstract class TripActionHelper implements WithClientUIContext { private static final Logger log = LogManager.getLogger(TripActionHelper.class); - protected static boolean gotoTripObservationTab(ObserveMainUI mainui, ContentUI ui, TripAware tripDto, Class<? extends DataDto> dtoType, int tabIndex) { + protected final ContentUI ui; + /** + * Used internal by template. + */ + private String dtoType; + + protected TripActionHelper(ContentUI ui) { + this.ui = Objects.requireNonNull(ui); + } + + public boolean gotoTripObservationTab(Class<? extends DataDto> dtoType) { + TripAware tripDto = getTrip(); + return gotoTripObservationTab(tripDto, dtoType); + } + + public boolean gotoTripLogbookTab(Class<? extends DataDto> dtoType) { + TripAware tripDto = getTrip(); + return gotoTripLogbookTab(tripDto, dtoType); + } + + protected abstract TripAware getTrip(); + + protected boolean gotoTripObservationTab(TripAware tripDto, Class<? extends DataDto> dtoType) { boolean canExecuteAction = tripDto.isObservationsAvailability(); if (!canExecuteAction) { - askAndGotoTripMetaDataTab(mainui, ui, tripDto, dtoType, TripAware.PROPERTY_OBSERVATIONS_AVAILABILITY, tabIndex); + String dataType = I18n.t(ObserveI18nDecoratorHelper.getTypeI18nKey(dtoType)); + String message = getObservationMessage(dataType); + askAndGotoTripMetaDataTab(tripDto, dataType, message, TripAware.PROPERTY_OBSERVATIONS_AVAILABILITY, TripUI::getObservationsTab); } return canExecuteAction; } - protected static boolean gotoTripLogbookTab(ObserveMainUI mainui, ContentUI ui, TripAware tripDto, Class<? extends DataDto> dtoType, int tabIndex) { + protected boolean gotoTripLogbookTab(TripAware tripDto, Class<? extends DataDto> dtoType) { boolean canExecuteAction = tripDto.isLogbookAvailability(); if (!canExecuteAction) { - askAndGotoTripMetaDataTab(mainui, ui, tripDto, dtoType, TripAware.PROPERTY_LOGBOOK_AVAILABILITY, tabIndex); + String dataType = I18n.t(ObserveI18nDecoratorHelper.getTypeI18nKey(dtoType)); + String message = getLogbookMessage(dataType); + askAndGotoTripMetaDataTab(tripDto, dataType, message, TripAware.PROPERTY_LOGBOOK_AVAILABILITY, TripUI::getLogbookTab); } return canExecuteAction; } - private static void askAndGotoTripMetaDataTab(ObserveMainUI mainui, ContentUI ui, TripAware tripDto, Class<? extends DataDto> dtoType, String availabilityPropertyName, int tabIndex) { - String dataType = I18n.t(ObserveI18nDecoratorHelper.getTypeI18nKey(dtoType)); + protected String getObservationMessage(String dtoType) { + this.dtoType = dtoType; + try { + return TripActionHelperTemplate.generateAskToFillTripObservations(this); + } finally { + this.dtoType = null; + } + } + + protected String getLogbookMessage(String dtoType) { + this.dtoType = dtoType; + try { + return TripActionHelperTemplate.generateAskToFillTripLogbook(this); + } finally { + this.dtoType = null; + } + } + + private void askAndGotoTripMetaDataTab(TripAware tripDto, String dataType, String message, String availabilityPropertyName, Function<TripUI, TabInfo> tabGetter) { // Let's ask user to fill them - //FIXME Use a template int response = UIHelper.askUser( - mainui, - t("observe.data.common.Trip.title.can.not.create.trip.sub.data"), - dataType, + getClientUIContext().getMainUI(), + t("observe.data.common.Trip.title.can.not.create.trip.sub.data", dataType), + new JLabel(message), JOptionPane.WARNING_MESSAGE, new Object[]{ t("observe.data.common.Trip.choice.go.to.trip"), @@ -91,7 +142,15 @@ public class TripActionHelper { // set availability flag to true tripUI.getModel().set(availabilityPropertyName, true); // go to meta-data tab - SwingUtilities.invokeLater(() -> tripUI.getMainTabbedPane().setSelectedIndex(tabIndex)); + TabInfo tabInfo = tabGetter.apply(tripUI); + SwingUtilities.invokeLater(() -> tripUI.selectTab(tabInfo)); } } + + + public String getDtoType() { + return dtoType; + } + + } ===================================== client-datasource-editor-common/src/main/java/fr/ird/observe/client/datasource/editor/content/data/TripUI.java ===================================== @@ -24,6 +24,7 @@ package fr.ird.observe.client.datasource.editor.content.data; import fr.ird.observe.client.datasource.editor.content.data.open.ContentOpenableUIModel; import fr.ird.observe.client.datasource.editor.content.data.trip.map.TripMapUI; +import org.nuiton.jaxx.runtime.swing.TabInfo; import javax.swing.JTabbedPane; @@ -44,4 +45,16 @@ public interface TripUI { ContentOpenableUIModel<?, ?> getModel(); + TabInfo getGeneralTab(); + + TabInfo getMapTab(); + + TabInfo getObservationsTab(); + + TabInfo getLogbookTab(); + + default void selectTab(TabInfo tabInfo) { + getMainTabbedPane().setSelectedIndex(tabInfo.getTabIndex()); + } + } ===================================== client-datasource-editor-ll/src/main/java/fr/ird/observe/client/datasource/editor/content/data/ll/CreateSupport.java ===================================== @@ -50,11 +50,11 @@ public class CreateSupport<D extends DataDto, R extends DataDtoReference<D, R>> protected boolean canExecuteAction(ActionEvent e) { boolean canExecuteAction = super.canExecuteAction(e); if (canExecuteAction && checkTripAvailability) { + LlTripActionHelper helper = new LlTripActionHelper(ui); if (getBeanType().getName().contains(".observation.")) { - canExecuteAction = LlTripActionHelper.gotoTripObservationTab(getMainUI(), ui, getServicesProvider(), getBeanType()); + canExecuteAction = helper.gotoTripObservationTab(getBeanType()); } else { - canExecuteAction = LlTripActionHelper.gotoTripLogbookTab(getMainUI(), ui, getServicesProvider(), getBeanType()); - + canExecuteAction = helper.gotoTripLogbookTab(getBeanType()); } } return canExecuteAction; ===================================== client-datasource-editor-ll/src/main/java/fr/ird/observe/client/datasource/editor/content/data/ll/LlTripActionHelper.java ===================================== @@ -22,13 +22,9 @@ package fr.ird.observe.client.datasource.editor.content.data.ll; * #L% */ -import fr.ird.observe.client.ClientUIContextApplicationComponent; import fr.ird.observe.client.datasource.editor.content.ContentUI; import fr.ird.observe.client.datasource.editor.content.data.TripActionHelper; -import fr.ird.observe.client.main.ObserveMainUI; -import fr.ird.observe.dto.data.DataDto; import fr.ird.observe.dto.data.ll.common.TripDto; -import fr.ird.observe.services.ObserveServicesProvider; /** * Created on 18/09/2020. @@ -38,22 +34,13 @@ import fr.ird.observe.services.ObserveServicesProvider; */ public class LlTripActionHelper extends TripActionHelper { - public static boolean gotoTripObservationTab(ObserveMainUI mainui, ContentUI ui, ObserveServicesProvider servicesProvider, Class<? extends DataDto> dtoType) { - TripDto tripDto = getTrip(servicesProvider); - return gotoTripObservationTab(mainui, ui, tripDto, dtoType, 2); + public LlTripActionHelper(ContentUI ui) { + super(ui); } - public static boolean gotoTripLogbookTab(ObserveMainUI mainui, ContentUI ui, ObserveServicesProvider servicesProvider, Class<? extends DataDto> dtoType) { - TripDto tripDto = getTrip(servicesProvider); - return gotoTripLogbookTab(mainui, ui, tripDto, dtoType, 3); - } - - public static String getSelectedTripId() { - return ClientUIContextApplicationComponent.value().getObserveSelectModel().getLongline().getTrip().getId(); - } - - static TripDto getTrip(ObserveServicesProvider servicesProvider) { - String tripId = getSelectedTripId(); - return servicesProvider.getLlCommonTripService().loadDto(tripId); + @Override + protected TripDto getTrip() { + String tripId = getClientUIContext().getObserveSelectModel().getLongline().getTrip().getId(); + return getClientUIContext().getDataSourcesManager().getMainDataSource().getLlCommonTripService().loadDto(tripId); } } ===================================== client-datasource-editor-ps/src/main/java/fr/ird/observe/client/datasource/editor/content/data/ps/CreateSupport.java ===================================== @@ -50,11 +50,11 @@ public class CreateSupport<D extends DataDto, R extends DataDtoReference<D, R>> protected boolean canExecuteAction(ActionEvent e) { boolean canExecuteAction = super.canExecuteAction(e); if (canExecuteAction && checkTripAvailability) { + PsTripActionHelper helper = new PsTripActionHelper(ui); if (getBeanType().getName().contains(".observation.")) { - canExecuteAction = PsTripActionHelper.gotoTripObservationTab(getMainUI(), ui, getServicesProvider(), getBeanType()); + canExecuteAction = helper.gotoTripObservationTab(getBeanType()); } else { - canExecuteAction = PsTripActionHelper.gotoTripLogbookTab(getMainUI(), ui, getServicesProvider(), getBeanType()); - + canExecuteAction = helper.gotoTripLogbookTab(getBeanType()); } } return canExecuteAction; ===================================== client-datasource-editor-ps/src/main/java/fr/ird/observe/client/datasource/editor/content/data/ps/PsTripActionHelper.java ===================================== @@ -22,13 +22,9 @@ package fr.ird.observe.client.datasource.editor.content.data.ps; * #L% */ -import fr.ird.observe.client.ClientUIContextApplicationComponent; import fr.ird.observe.client.datasource.editor.content.ContentUI; import fr.ird.observe.client.datasource.editor.content.data.TripActionHelper; -import fr.ird.observe.client.main.ObserveMainUI; -import fr.ird.observe.dto.data.DataDto; import fr.ird.observe.dto.data.ps.common.TripDto; -import fr.ird.observe.services.ObserveServicesProvider; /** * Created on 18/09/2020. @@ -38,22 +34,13 @@ import fr.ird.observe.services.ObserveServicesProvider; */ public class PsTripActionHelper extends TripActionHelper { - public static boolean gotoTripObservationTab(ObserveMainUI mainui, ContentUI ui, ObserveServicesProvider servicesProvider, Class<? extends DataDto> dtoType) { - TripDto tripDto = getTrip(servicesProvider); - return gotoTripObservationTab(mainui, ui, tripDto, dtoType, 1); + public PsTripActionHelper(ContentUI ui) { + super(ui); } - public static boolean gotoTripLogbookTab(ObserveMainUI mainui, ContentUI ui, ObserveServicesProvider servicesProvider, Class<? extends DataDto> dtoType) { - TripDto tripDto = getTrip(servicesProvider); - return gotoTripLogbookTab(mainui, ui, tripDto, dtoType, 2); - } - - public static String getSelectedTripId() { - return ClientUIContextApplicationComponent.value().getObserveSelectModel().getSeine().getTrip().getId(); - } - - static TripDto getTrip(ObserveServicesProvider servicesProvider) { - String tripId = getSelectedTripId(); - return servicesProvider.getPsCommonTripService().loadDto(tripId); + @Override + protected TripDto getTrip() { + String tripId = getClientUIContext().getObserveSelectModel().getSeine().getTrip().getId(); + return getClientUIContext().getDataSourcesManager().getMainDataSource().getPsCommonTripService().loadDto(tripId); } } ===================================== client-datasource-editor-ps/src/main/java/fr/ird/observe/client/datasource/editor/content/data/ps/localmarket/actions/LocalmarketUIActionSupport.java ===================================== @@ -68,7 +68,8 @@ public abstract class LocalmarketUIActionSupport<D extends DataDto> extends Cont protected boolean canExecuteAction(ActionEvent e) { boolean canExecuteAction = super.canExecuteAction(e); if (canExecuteAction) { - canExecuteAction = PsTripActionHelper.gotoTripLogbookTab(getMainUI(), ui, getServicesProvider(), getBeanType()); + PsTripActionHelper helper = new PsTripActionHelper(ui); + canExecuteAction = helper.gotoTripLogbookTab(getBeanType()); } return canExecuteAction; } ===================================== observe-i18n/src/main/i18n/translations/observe_en_GB.properties ===================================== @@ -440,8 +440,8 @@ observe.data.Trip.validation.startDate.after.now=Start date of the trip must be observe.data.Trip.validation.unclosed.activityObs=There is an open activity on trip (%1$s). observe.data.Trip.validation.unclosed.routeObs=There is an open route on trip (%1$s). observe.data.Trip.validation.vessel.overlap=There is already a trip using same vessel on equivalent date range. \#TODO -observe.data.common.Trip.choice.go.to.trip=Go to trip -observe.data.common.Trip.title.can.not.create.trip.sub.data=Can't create a trip data... +observe.data.common.Trip.choice.go.to.trip=Access to trip form +observe.data.common.Trip.title.can.not.create.trip.sub.data=Can't create a trip data of type `%s`... observe.data.ll.Activity.validation.endDate.after.currentTrip.startDate=End date must be after current trip start date observe.data.ll.Activity.validation.endDate.after.startDate=End date must be after start date observe.data.ll.Activity.validation.endDate.before.currentTrip.endDate=End date must be before current trip end date @@ -490,11 +490,11 @@ observe.data.ll.common.Trip.availableData=Available data observe.data.ll.common.Trip.ersId=Id ERS observe.data.ll.common.Trip.generalComment=Comment observe.data.ll.common.Trip.generalTab=Common characteristics -observe.data.ll.common.Trip.logbookAvailability=Logbook +observe.data.ll.common.Trip.logbookAvailability=Logbook and associated data observe.data.ll.common.Trip.logbookComment=Comment observe.data.ll.common.Trip.logbookDataEntryOperator=Data entry operator observe.data.ll.common.Trip.logbookDataQuality=Data quality -observe.data.ll.common.Trip.logbookTab=Logbook +observe.data.ll.common.Trip.logbookTab=Logbook and associated data observe.data.ll.common.Trip.mapTab=Map observe.data.ll.common.Trip.message.not.open=Current trip is not opened, no edit possible. observe.data.ll.common.Trip.noOfCrewMembers=Numer of crew @@ -1343,7 +1343,7 @@ observe.data.ps.common.Trip.list=List of trips observe.data.ps.common.Trip.list.message.none=< No trip for current program > observe.data.ps.common.Trip.localMarketTotalWeight=Local market total weight (t) observe.data.ps.common.Trip.loch=Loch (mile) -observe.data.ps.common.Trip.logbookAvailability=Logbook +observe.data.ps.common.Trip.logbookAvailability=Logbook and associated data observe.data.ps.common.Trip.logbookComment=Comment observe.data.ps.common.Trip.logbookDataEntryOperator=Data entry operator observe.data.ps.common.Trip.logbookDataQuality=Data quality ===================================== observe-i18n/src/main/i18n/translations/observe_es_ES.properties ===================================== @@ -440,8 +440,8 @@ observe.data.Trip.validation.startDate.after.now=Start date of the trip must be observe.data.Trip.validation.unclosed.activityObs=Existe una actividad que no fue cerrada (%1$s). observe.data.Trip.validation.unclosed.routeObs=Existe una ruta que no fue cerrada (%1$s). observe.data.Trip.validation.vessel.overlap=There is already a trip using same vessel on equivalent date range. \#TODO -observe.data.common.Trip.choice.go.to.trip=Go to trip \#TODO -observe.data.common.Trip.title.can.not.create.trip.sub.data=Can't create a trip data... \#TODO +observe.data.common.Trip.choice.go.to.trip=Acceder al formulario de marea +observe.data.common.Trip.title.can.not.create.trip.sub.data=Can't create a trip data of type `%s`... \#TODO observe.data.ll.Activity.validation.endDate.after.currentTrip.startDate=End date must be after current trip start date \#TODO observe.data.ll.Activity.validation.endDate.after.startDate=End date must be after start date \#TODO observe.data.ll.Activity.validation.endDate.before.currentTrip.endDate=End date must be before current trip end date \#TODO @@ -490,21 +490,21 @@ observe.data.ll.common.Trip.availableData=Données disponibles observe.data.ll.common.Trip.ersId=Id ERS observe.data.ll.common.Trip.generalComment=Comentarios observe.data.ll.common.Trip.generalTab=General características -observe.data.ll.common.Trip.logbookAvailability=Logbook \#TODO +observe.data.ll.common.Trip.logbookAvailability=Diario de pesca y datos asociados observe.data.ll.common.Trip.logbookComment=Comentarios observe.data.ll.common.Trip.logbookDataEntryOperator=Operador de captación de datos observe.data.ll.common.Trip.logbookDataQuality=Qualité de donnée \#TODO -observe.data.ll.common.Trip.logbookTab=Caractéristiques Logbook +observe.data.ll.common.Trip.logbookTab=Diario de pesca y datos asociados observe.data.ll.common.Trip.mapTab=Mapa observe.data.ll.common.Trip.message.not.open=La marea actual no está abierta, no se puede modificar. observe.data.ll.common.Trip.noOfCrewMembers=Nombre d'équipage observe.data.ll.common.Trip.noOfDays=Duración (días) observe.data.ll.common.Trip.observationMethod=Observations method \#TODO -observe.data.ll.common.Trip.observationsAvailability=Données d'observation +observe.data.ll.common.Trip.observationsAvailability=Observaciones observe.data.ll.common.Trip.observationsComment=Comentarios observe.data.ll.common.Trip.observationsDataEntryOperator=Operador de captación de datos observe.data.ll.common.Trip.observationsDataQuality=Qualité de donnée \#TODO -observe.data.ll.common.Trip.observationsTab=Caractéristiques d'observation +observe.data.ll.common.Trip.observationsTab=Observaciones observe.data.ll.common.Trip.species=Especie objetivo observe.data.ll.common.Trip.species.selected=Espèces sélectionnées \#TODO observe.data.ll.common.Trip.species.universe=Espèces disponibles \#TODO @@ -1343,7 +1343,7 @@ observe.data.ps.common.Trip.list=Lista de mareas observe.data.ps.common.Trip.list.message.none=Ninguna marea para el programa actual observe.data.ps.common.Trip.localMarketTotalWeight=Total marché local (en t) \#TODO observe.data.ps.common.Trip.loch=Loch (miles nautiques) \#TODO -observe.data.ps.common.Trip.logbookAvailability=Logbook \#TODO +observe.data.ps.common.Trip.logbookAvailability=Diario de pesca y datos asociados observe.data.ps.common.Trip.logbookComment=Comentario observe.data.ps.common.Trip.logbookDataEntryOperator=Opérateur de saisie \#TODO observe.data.ps.common.Trip.logbookDataQuality=Qualité de donnée \#TODO ===================================== observe-i18n/src/main/i18n/translations/observe_fr_FR.properties ===================================== @@ -440,8 +440,8 @@ observe.data.Trip.validation.startDate.after.now=La date de début de marée doi observe.data.Trip.validation.unclosed.activityObs=Il existe une activité non clôturée (%1$s). observe.data.Trip.validation.unclosed.routeObs=Il existe une route non clôturée (%1$s). observe.data.Trip.validation.vessel.overlap=Il existe déjà une marée utilisant ce navire sur une plage temporelle équivalente. \#TODO -observe.data.common.Trip.choice.go.to.trip=Accéder à la marée -observe.data.common.Trip.title.can.not.create.trip.sub.data=Impossible de créer une donnée de marée... +observe.data.common.Trip.choice.go.to.trip=Accéder au formulaire marée +observe.data.common.Trip.title.can.not.create.trip.sub.data=Impossible de créer une donnée de type `%s` pour la marée... observe.data.ll.Activity.validation.endDate.after.currentTrip.startDate=La date de fin doit être supérieure ou égale à la date de début de marée observe.data.ll.Activity.validation.endDate.after.startDate=La date de fin doit être supérieure ou égale à la date de début de l'activité observe.data.ll.Activity.validation.endDate.before.currentTrip.endDate=La date de fin doit être inférieur ou égale à la date de fin de marée @@ -490,11 +490,11 @@ observe.data.ll.common.Trip.availableData=Données disponibles observe.data.ll.common.Trip.ersId=Id ERS observe.data.ll.common.Trip.generalComment=Commentaire observe.data.ll.common.Trip.generalTab=Caractéristiques communes -observe.data.ll.common.Trip.logbookAvailability=Livre de bord +observe.data.ll.common.Trip.logbookAvailability=Livre de bord et données associées observe.data.ll.common.Trip.logbookComment=Commentaire observe.data.ll.common.Trip.logbookDataEntryOperator=Opérateur de saisie observe.data.ll.common.Trip.logbookDataQuality=Qualité de donnée -observe.data.ll.common.Trip.logbookTab=Caractéristiques Logbook +observe.data.ll.common.Trip.logbookTab=Livre de bord et données associées observe.data.ll.common.Trip.mapTab=Carte observe.data.ll.common.Trip.message.not.open=La marée courante n'est pas ouverte, aucune modification possible. observe.data.ll.common.Trip.noOfCrewMembers=Nombre d'équipage @@ -504,7 +504,7 @@ observe.data.ll.common.Trip.observationsAvailability=Données d'observation observe.data.ll.common.Trip.observationsComment=Commentaire observe.data.ll.common.Trip.observationsDataEntryOperator=Opérateur de saisie observe.data.ll.common.Trip.observationsDataQuality=Qualité de donnée -observe.data.ll.common.Trip.observationsTab=Caractéristiques d'observation +observe.data.ll.common.Trip.observationsTab=Données d'observation observe.data.ll.common.Trip.species=Espèces ciblées observe.data.ll.common.Trip.species.selected=Espèces sélectionnées observe.data.ll.common.Trip.species.universe=Espèces disponibles @@ -1343,7 +1343,7 @@ observe.data.ps.common.Trip.list=Liste des marées observe.data.ps.common.Trip.list.message.none=< Aucune marée pour le programme courant > observe.data.ps.common.Trip.localMarketTotalWeight=Total marché local (en t) observe.data.ps.common.Trip.loch=Loch (miles nautiques) -observe.data.ps.common.Trip.logbookAvailability=Livre de Bord +observe.data.ps.common.Trip.logbookAvailability=Livre de bord et données associées observe.data.ps.common.Trip.logbookComment=Commentaire observe.data.ps.common.Trip.logbookDataEntryOperator=Opérateur de saisie observe.data.ps.common.Trip.logbookDataQuality=Qualité de donnée View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/commit/edfb9063f743dcb6eb2a641f0… -- View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/commit/edfb9063f743dcb6eb2a641f0… You're receiving this email because of your account on gitlab.com.
1 0
0 0
[Git][ultreiaio/ird-observe][develop] 47 commits: [V9] Sur le formulaire PS/Observations/Captures faune associée, champ...
by Tony CHEMIT 18 Sep '20

18 Sep '20
Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe Commits: 5c061900 by Tony Chemit at 2020-09-15T13:14:52+02:00 [V9] Sur le formulaire PS/Observations/Captures faune associée, champ &quot;Origine de l&#39;information&quot; - See #119 (Ajout de la propriété dans l&#39;ui) Réorganisation des données d’observation PS - Réorganisation des captures et échantillons de cible et bycatch observés - See #1254 (Revue de la migration) - - - - - 71d82de0 by Tony Chemit at 2020-09-15T13:15:36+02:00 [V9] Sur le formulaire PS/Observations/Captures faune associée, champ &quot;Origine de l&#39;information&quot; - See #119 (Ajout de la propriété dans l&#39;ui) Réorganisation des données d’observation PS - Réorganisation des captures et échantillons de cible et bycatch observés - See #1254 (Revue de la migration) - - - - - 39a0e052 by Tony Chemit at 2020-09-15T13:49:54+02:00 Ajout de EntityPathsSelectorGenerator (A finir) - - - - - ccbf22b8 by Tony Chemit at 2020-09-15T14:59:03+02:00 Ps logbook Set rendre éditable le type de banc - - - - - fbfe5720 by Tony Chemit at 2020-09-15T16:34:03+02:00 Renommage de la nouvelle speciesList - - - - - b1b30519 by Tony Chemit at 2020-09-16T13:21:35+02:00 Correction de la recherche d&#39;un nœud éditable (si on a un double rebond sur le parent) - - - - - 22a1a595 by Tony Chemit at 2020-09-16T13:47:08+02:00 LocalMarket fix Sample comparator - - - - - 36ad7705 by Tony Chemit at 2020-09-16T13:48:40+02:00 LocalMarket make top node a trip type one to make possible - - - - - 723ee0f9 by Tony Chemit at 2020-09-16T13:48:57+02:00 LocalMarket fix some i18n - - - - - 388754e2 by Tony Chemit at 2020-09-16T13:52:18+02:00 LocalMarket fix (but not good at all) migration script for relation nm on String (table is on public schema) - - - - - 9e231e05 by Tony Chemit at 2020-09-16T14:22:28+02:00 LocalMarket fix Packaging filter on harbour - - - - - e358bfe2 by Tony Chemit at 2020-09-16T14:22:36+02:00 LocalMarket fix migration - - - - - d83778d0 by Tony Chemit at 2020-09-16T14:40:10+02:00 LocalMarket fix species list id to use - - - - - 6b530c3b by Tony Chemit at 2020-09-16T14:41:39+02:00 LocalMarket fix referential i18n - - - - - 7217bab4 by Tony Chemit at 2020-09-16T16:48:43+02:00 LocalMarket fix migration - - - - - 2722a48a by Tony Chemit at 2020-09-16T16:49:10+02:00 LocalMarket fix default number on Survey and Sample - - - - - ee6198e7 by Tony Chemit at 2020-09-16T17:09:02+02:00 LocalMarket fix label and do not edit if no packaging found on landing harbour - - - - - 800d8d5c by Tony Chemit at 2020-09-16T17:09:29+02:00 fix computation of showData on ContentTableUIModel - - - - - f69ec690 by Tony Chemit at 2020-09-17T13:46:13+02:00 Localmarket delete unused speciesList - - - - - bc5ff3d5 by Tony Chemit at 2020-09-17T14:38:30+02:00 Localmarket, Landing, WellPlan, Logbook review SpeciesList to use with proper configuration - - - - - 67a13f8e by Tony Chemit at 2020-09-17T14:38:30+02:00 Localmarket Do not disabled data tabs on create mode - - - - - aa17b13d by Tony Chemit at 2020-09-17T14:38:30+02:00 Sample Delete Sample.subSampleNumber (not needed here!) - - - - - 1a7af754 by Tony Chemit at 2020-09-17T14:38:30+02:00 Localmarket review some validations and input in ui - - - - - 6206b331 by Tony Chemit at 2020-09-17T14:38:30+02:00 Logbook review some validations and input in ui - - - - - d986304b by Tony Chemit at 2020-09-17T14:38:30+02:00 Landing review some validations - - - - - 406b2a27 by Tony Chemit at 2020-09-17T14:38:30+02:00 Wellplan review some validations - - - - - b98f7038 by Tony Chemit at 2020-09-17T14:38:30+02:00 Localmarket review some validations - - - - - 435fab4d by Tony Chemit at 2020-09-17T14:38:30+02:00 Localmarket use a configuration to get default sizeMeasureType Logbook use a configuration to get default sizeMeasureType - - - - - 76e6d66d by Tony Chemit at 2020-09-17T14:38:30+02:00 Landing Use only species used in a weight category - - - - - c5cac20c by Tony Chemit at 2020-09-17T14:38:30+02:00 Landing Use only species used in a weight category - - - - - 0e7c9a7c by Tony Chemit at 2020-09-17T14:38:30+02:00 Logbook Delete Activity.observedSystemDistance + optimize i18n - - - - - 2290d07a by Tony Chemit at 2020-09-17T14:38:30+02:00 Landing Rendre ordonnable Trip.landing - - - - - 663b91da by Tony Chemit at 2020-09-17T14:38:30+02:00 Wellplan Rendre ordonnable Trip.wellplan - - - - - 39acc31b by Tony Chemit at 2020-09-17T16:26:00+02:00 Sample optimize service api to get set activities of the trip Wellplan optimize service api to get set activities of the trip - - - - - 4421b362 by Tony Chemit at 2020-09-17T16:26:00+02:00 Wellplan suppression du schéma ps_wellplan et déplacement dans ps_logbook - - - - - b9b5aeae by Tony Chemit at 2020-09-17T16:26:00+02:00 Localmarket Ajout SamplePart.sizeClass, renommage Packaging.weight en meanWeight - - - - - 0e7e04ea by Tony Chemit at 2020-09-17T17:04:15+02:00 Logbook Sample review subSampleNumber at save time - - - - - 1489a141 by Tony Chemit at 2020-09-18T09:04:42+02:00 template better generate on none main dto - - - - - b8ade736 by Tony Chemit at 2020-09-18T09:56:01+02:00 Localmarket let&#39;s display edit batches for survey (on survey form) - - - - - 2014263c by Tony Chemit at 2020-09-18T09:57:57+02:00 Localmarket improve Batch.origin layout on form - - - - - 63096934 by Tony Chemit at 2020-09-18T10:28:28+02:00 change one maven module order - - - - - f0e29326 by Tony Chemit at 2020-09-18T11:45:34+02:00 avoid nasty swing NPE - - - - - 0deb9245 by Tony Chemit at 2020-09-18T12:31:57+02:00 Localmarket Survey make validation works as a charm - - - - - a63e5c3e by Tony Chemit at 2020-09-18T13:50:31+02:00 Localmarket Sample make validation works as a charm - - - - - 8cc918b9 by Tony Chemit at 2020-09-18T15:47:17+02:00 Localmarket Sample review well (just a simple String in database separated by comma) - - - - - df820fbf by Tony Chemit at 2020-09-18T15:57:20+02:00 Ajouter un nouveau bouton sur le formulaire d&#39;une ligne sélectionnée dans un écran de type table créer/enregister ET nouveau - Closes #1613 - - - - - 6c1d81a3 by Tony Chemit at 2020-09-18T21:55:17+02:00 Stash on ListCreate action - - - - - 30 changed files: - client-configuration/src/main/config/Client.ini - client-configuration/src/main/i18n/getters/config.getter - client-core/src/main/java/fr/ird/observe/client/main/body/ClientConfigUI.java - client-core/src/main/java/fr/ird/observe/client/util/ObserveKeyStrokesSupport.java - client-datasource-editor-api/src/main/i18n/getters/java.getter - client-datasource-editor-api/src/main/java/fr/ird/observe/client/datasource/editor/content/data/list/actions/Create.java → client-datasource-editor-api/src/main/java/fr/ird/observe/client/datasource/editor/content/data/list/actions/CreateSupport.java - client-datasource-editor-api/src/main/java/fr/ird/observe/client/datasource/editor/content/data/open/actions/SaveActionSupport.java - client-datasource-editor-api/src/main/java/fr/ird/observe/client/datasource/editor/content/data/table/ContentTableUI.jaxx - client-datasource-editor-api/src/main/java/fr/ird/observe/client/datasource/editor/content/data/table/ContentTableUI.jcss - client-datasource-editor-api/src/main/java/fr/ird/observe/client/datasource/editor/content/data/table/ContentTableUIHandler.java - client-datasource-editor-api/src/main/java/fr/ird/observe/client/datasource/editor/content/data/table/ContentTableUIModel.java - + client-datasource-editor-api/src/main/java/fr/ird/observe/client/datasource/editor/content/data/table/actions/SaveAndNewEntry.java - client-datasource-editor-api/src/main/java/fr/ird/observe/client/datasource/editor/menu/actions/SelectLonglineLandingAction.java - client-datasource-editor-api/src/main/java/fr/ird/observe/client/datasource/editor/menu/actions/SelectSeineLocalmarketSampleAction.java - client-datasource-editor-api/src/main/java/fr/ird/observe/client/datasource/editor/tree/navigation/NavigationTreeCellRenderer.java - client-datasource-editor-api/src/main/java/fr/ird/observe/client/datasource/editor/tree/navigation/nodes/NavigationTreeNodeSupport.java - client-datasource-editor-common/src/main/i18n/getters/java.getter - client-datasource-editor-common/src/main/java/fr/ird/observe/client/datasource/editor/content/data/TripActionHelper.java - client-datasource-editor-ll/src/main/i18n/getters/java.getter - client-datasource-editor-ll/src/main/i18n/getters/jaxx.getter - dto/src/main/java/fr/ird/observe/dto/decoration/init/DataPsWellplanModelDecoratorInitializer.java → client-datasource-editor-ll/src/main/java/fr/ird/observe/client/datasource/editor/content/data/ll/CreateSupport.java - + client-datasource-editor-ll/src/main/java/fr/ird/observe/client/datasource/editor/content/data/ll/LlTripActionHelper.java - client-datasource-editor-ll/src/main/java/fr/ird/observe/client/datasource/editor/content/data/ll/common/TripListUI.jcss - + client-datasource-editor-ll/src/main/java/fr/ird/observe/client/datasource/editor/content/data/ll/common/actions/TripListCreate.java - client-datasource-editor-ll/src/main/java/fr/ird/observe/client/datasource/editor/content/data/ll/landing/LandingListUI.jcss - client-datasource-editor-ll/src/main/java/fr/ird/observe/client/datasource/editor/content/data/ll/landing/LandingUI.jcss - client-datasource-editor-ll/src/main/java/fr/ird/observe/client/datasource/editor/content/data/ll/landing/actions/LandingListUICreate.java - client-datasource-editor-ll/src/main/java/fr/ird/observe/client/datasource/editor/content/data/ll/landing/actions/LandingListUIMove.java - client-datasource-editor-ll/src/main/java/fr/ird/observe/client/datasource/editor/content/data/ll/landing/actions/LandingUIMove.java - client-datasource-editor-ll/src/main/java/fr/ird/observe/client/datasource/editor/content/data/ll/landing/actions/LandingUISelectTransshipment.java The diff was not included because it is too large. View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/460db38ae21a16bab3e402fd… -- View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/460db38ae21a16bab3e402fd… You're receiving this email because of your account on gitlab.com.
1 0
0 0
[Git][ultreiaio/ird-observe][develop] 3 commits: Use the natural order of attributes declaration to generate the form...
by Tony CHEMIT 13 Sep '20

13 Sep '20
Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe Commits: d39db83e by Tony Chemit at 2020-09-12T16:46:32+02:00 Use the natural order of attributes declaration to generate the form definition, in ordre to have a deterministic order (some filters may need other ones) - - - - - 28a14073 by Tony Chemit at 2020-09-12T17:11:53+02:00 Insertion du plan de cuves - See #1260 Meilleur filtrage des catégories de poids et espèces - - - - - 460db38a by Tony Chemit at 2020-09-13T21:43:17+02:00 Begin of usage of TopiaMetadataModelPaths - - - - - 28 changed files: - client-datasource-editor-ps/src/main/java/fr/ird/observe/client/datasource/editor/content/data/ps/wellplan/WellPlanUI.jcss - client-datasource-editor-ps/src/main/java/fr/ird/observe/client/datasource/editor/content/data/ps/wellplan/WellPlanUIHandler.java - client-datasource-editor-ps/src/main/java/fr/ird/observe/client/datasource/editor/content/data/ps/wellplan/WellPlanUIModel.java - dto/src/main/models/Observe-23-data-ps-wellplan.model - persistence/pom.xml - persistence/src/main/java/fr/ird/observe/entities/ObserveTopiaApplicationContext.java - persistence/src/main/models/Observe-21-data-ps-logbook.model - persistence/src/main/models/Observe-23-data-ps-wellplan.model - persistence/src/main/models/Observe-24-data-ps-localmarket.model - persistence/src/main/models/Observe-30-data-ll-observation.model - persistence/src/main/models/Observe-31-data-ll-logbook.model - − persistence/src/test/java/fr/ird/observe/entities/ObserveTopiaMetadataModelSupportTest.java - + persistence/src/test/java/fr/ird/observe/entities/TopiaMetadataModelPathsTest.java - pom.xml - server-core/src/main/filtered-resources/mapping - services-api/src/main/java/fr/ird/observe/services/service/data/ps/common/TripService.java - services-local/src/main/java/fr/ird/observe/services/local/service/data/ps/common/TripServiceLocal.java - services-local/src/test/java/fr/ird/observe/services/local/service/data/TripManagementServiceLocalTest.java - templates/pom.xml - templates/src/main/java/fr/ird/observe/toolkit/templates/GeneratePersistence.java - templates/src/main/java/fr/ird/observe/toolkit/templates/dto/DtoTransformer.java - toolbox-maven-plugin/src/main/java/fr/ird/observe/maven/plugins/toolbox/GenerateEntityUpdateSqlFilesMojo.java → templates/src/main/java/fr/ird/observe/toolkit/templates/entity/EntityLastUpdateDateFieldSqlScriptGenerator.java - + templates/src/main/java/fr/ird/observe/toolkit/templates/entity/EntityLastUpdateDateTableSqlScriptGenerator.java - persistence/src/main/java/fr/ird/observe/entities/ObserveTopiaMetadataModelSupport.java → templates/src/main/java/fr/ird/observe/toolkit/templates/entity/EntityPathsGenerator.java - test/src/main/java/fr/ird/observe/test/ObserveFixtures.java - + test/src/main/resources/fixtures/entity-paths.properties - test/src/main/resources/fixtures/global.properties - toolbox-maven-plugin/pom.xml Changes: ===================================== client-datasource-editor-ps/src/main/java/fr/ird/observe/client/datasource/editor/content/data/ps/wellplan/WellPlanUI.jcss ===================================== @@ -18,8 +18,4 @@ * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-3.0.html>. * #L% - */ -#activity { - _listNoLoad:true; - data:{model.getActivities()}; -} + */ \ No newline at end of file ===================================== client-datasource-editor-ps/src/main/java/fr/ird/observe/client/datasource/editor/content/data/ps/wellplan/WellPlanUIHandler.java ===================================== @@ -25,10 +25,13 @@ package fr.ird.observe.client.datasource.editor.content.data.ps.wellplan; import fr.ird.observe.client.datasource.editor.content.data.table.ContentTableUIHandler; import fr.ird.observe.client.datasource.editor.content.data.table.ContentTableUILayoutFocusTraversalPolicy; import fr.ird.observe.client.datasource.editor.content.spi.ContentUIReferenceCache; +import fr.ird.observe.client.datasource.editor.content.spi.ReferentialReferencesFilter; import fr.ird.observe.dto.data.ps.wellplan.TripWellPlanDto; import fr.ird.observe.dto.data.ps.wellplan.WellPlanDto; import fr.ird.observe.dto.form.Form; +import fr.ird.observe.dto.referential.common.SpeciesDto; import fr.ird.observe.dto.referential.common.SpeciesReference; +import fr.ird.observe.dto.referential.ps.logbook.WeightCategoryDto; import fr.ird.observe.dto.referential.ps.logbook.WeightCategoryReference; import fr.ird.observe.dto.result.SaveResultDto; import org.nuiton.jaxx.runtime.spi.UIHandler; @@ -37,6 +40,7 @@ import java.awt.Component; import java.beans.PropertyChangeListener; import java.util.Collections; import java.util.List; +import java.util.Objects; import java.util.stream.Collectors; /** @@ -73,7 +77,8 @@ public class WellPlanUIHandler extends ContentTableUIHandler<TripWellPlanDto, We @Override protected void onAfterInitAddReferentialFilters(ContentUIReferenceCache referenceCache) { - referenceCache.addReferentialFilter(WellPlanDto.PROPERTY_SPECIES, newPsSpeciesList(getClientConfig().getSpeciesListSeineLogbookCatchId())); + referenceCache.addReferentialFilter(WellPlanDto.PROPERTY_WEIGHT_CATEGORY, newPsLogbookWeightCategoryList(getClientConfig().getSpeciesListSeineLogbookCatchId())); + referenceCache.addReferentialFilter(WellPlanDto.PROPERTY_SPECIES, newPsSpeciesList()); } @Override @@ -109,7 +114,7 @@ public class WellPlanUIHandler extends ContentTableUIHandler<TripWellPlanDto, We newCategories = Collections.emptyList(); } else { List<WeightCategoryReference> referentialReferences = getModel().getReferenceCache().getReferentialReferences(WellPlanDto.PROPERTY_WEIGHT_CATEGORY); - newCategories = referentialReferences.stream().filter(r -> r.getSpecies().equals(species)).collect(Collectors.toList()); + newCategories = referentialReferences.stream().filter(r -> Objects.equals(r.getSpecies(), species)).collect(Collectors.toList()); WeightCategoryReference weightCategory = getModel().getTableEditBean().getWeightCategory(); if (weightCategory != null && newCategories.contains(weightCategory)) { newCategory = weightCategory; @@ -119,4 +124,17 @@ public class WellPlanUIHandler extends ContentTableUIHandler<TripWellPlanDto, We ui.getWeightCategory().setSelectedItem(newCategory); } + protected ReferentialReferencesFilter<SpeciesDto, SpeciesReference> newPsSpeciesList() { + return incomingReferences -> { + List<WeightCategoryReference> weightCategories = getModel().getReferenceCache().getReferentialReferences(WellPlanDto.PROPERTY_WEIGHT_CATEGORY); + return weightCategories.stream().map(WeightCategoryReference::getSpecies).collect(Collectors.toList()); + }; + } + + protected ReferentialReferencesFilter<WeightCategoryDto, WeightCategoryReference> newPsLogbookWeightCategoryList(String speciesListId) { + return incomingReferences -> { + String tripId = getClientUIContext().getObserveSelectModel().getSeine().getTrip().getId(); + return getPsCommonTripService().getLogbookWeightCategoryByListAndTrip(tripId, speciesListId).toList(); + }; + } } ===================================== client-datasource-editor-ps/src/main/java/fr/ird/observe/client/datasource/editor/content/data/ps/wellplan/WellPlanUIModel.java ===================================== @@ -29,7 +29,6 @@ import fr.ird.observe.dto.data.ps.wellplan.WellPlanDto; import fr.ird.observe.dto.form.Form; import fr.ird.observe.dto.reference.DataDtoReferenceSet; -import java.util.List; import java.util.stream.Collectors; /** @@ -40,26 +39,15 @@ import java.util.stream.Collectors; */ public class WellPlanUIModel extends ContentTableUIModel<TripWellPlanDto, WellPlanDto> { - private List<ActivityReference> activities; - public WellPlanUIModel() { super(TripWellPlanDto.class, WellPlanDto.class, TripWellPlanDto.PROPERTY_WELL_PLAN); } @Override public void openForm(Form<TripWellPlanDto> form) { - super.openForm(form); - String tripId = getBean().getId(); + String tripId = form.getObject().getId(); DataDtoReferenceSet<ActivityReference> activities = getObserveDataSourcesManager().getMainDataSource().getPsLogbookActivityService().getActivitySeineByTrip(tripId); - setActivities(activities.stream().filter(ActivityReference::isSetOperation).collect(Collectors.toList())); - } - - public List<ActivityReference> getActivities() { - return activities; - } - - public void setActivities(List<ActivityReference> activities) { - this.activities = activities; - firePropertyChange("activities", activities); + getReferenceCache().setDataReferenceSet(WellPlanDto.PROPERTY_ACTIVITY, DataDtoReferenceSet.of(ActivityReference.class, activities.stream().filter(ActivityReference::isSetOperation).collect(Collectors.toList()))); + super.openForm(form); } } ===================================== dto/src/main/models/Observe-23-data-ps-wellplan.model ===================================== @@ -3,8 +3,8 @@ package fr.ird.observe.dto.data.ps.wellplan | form=self packagePriority=23 data.ps.wellplan.WellPlan > data.Data >> data.WellIdAware | references=species,well,weight,weightCategoryLabel activity {*:1} fr.ird.observe.dto.data.ps.logbook.ActivityReference | notNull well + {*:1} String | notNull -species {*:1} fr.ird.observe.dto.referential.common.SpeciesReference | notNull weightCategory {*:1} fr.ird.observe.dto.referential.ps.logbook.WeightCategoryReference | notNull +species {*:1} fr.ird.observe.dto.referential.common.SpeciesReference | notNull weight + {*:1} Float | notNull data.ps.wellplan.TripWellPlan > data.Commentable | form=data.ps.wellplan.WellPlan mainDto=data.ps.common.Trip ===================================== persistence/pom.xml ===================================== @@ -391,38 +391,6 @@ </executions> </plugin> - - <plugin> - <groupId>fr.ird.observe.toolkit</groupId> - <artifactId>toolbox-maven-plugin</artifactId> - <version>${project.version}</version> - <executions> - <execution> - <id>generate-entity-update-sql-files</id> - <goals> - <goal>generate-entity-update-sql-files</goal> - </goals> - </execution> - </executions> - <dependencies> - <dependency> - <groupId>${project.groupId}</groupId> - <artifactId>dto</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>fr.ird.observe.toolkit</groupId> - <artifactId>common-persistence</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.javassist</groupId> - <artifactId>javassist</artifactId> - <version>${lib.version.javassist}</version> - </dependency> - </dependencies> - </plugin> - </plugins> </build> </project> ===================================== persistence/src/main/java/fr/ird/observe/entities/ObserveTopiaApplicationContext.java ===================================== @@ -23,7 +23,6 @@ package fr.ird.observe.entities; */ import com.google.common.collect.ImmutableSet; -import fr.ird.observe.entities.data.DataEntity; import fr.ird.observe.entities.referential.ReferentialEntity; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -33,13 +32,14 @@ import org.hibernate.tool.schema.TargetType; import org.nuiton.topia.persistence.TopiaException; import org.nuiton.topia.persistence.jdbc.JdbcHelper; import org.nuiton.topia.persistence.metadata.TopiaMetadataEntity; -import org.nuiton.topia.persistence.metadata.TopiaMetadataEntityPathsBuilder; import org.nuiton.topia.persistence.metadata.TopiaMetadataModel; +import org.nuiton.topia.persistence.metadata.TopiaMetadataModelPaths; import org.nuiton.topia.persistence.script.SqlScriptReader; import org.nuiton.topia.persistence.script.TopiaSqlScript; import org.nuiton.topia.persistence.support.TopiaMetadataModelSupport; import org.nuiton.topia.service.migration.TopiaMigrationService; import org.nuiton.topia.service.script.TopiaSqlScriptGeneratorService; +import org.nuiton.topia.service.script.table.DefaultTopiaSqlTablesPredicate; import org.nuiton.topia.service.script.table.TopiaSqlTable; import org.nuiton.topia.service.script.table.TopiaSqlTables; import org.nuiton.topia.service.script.table.TopiaSqlTablesFactory; @@ -50,20 +50,19 @@ import java.util.LinkedHashSet; import java.util.Objects; import java.util.Set; import java.util.UUID; -import java.util.function.Predicate; import java.util.stream.Collectors; public class ObserveTopiaApplicationContext extends AbstractObserveTopiaApplicationContext implements TopiaMetadataModelSupport { static final String MIGRATION_SERVICE_NAME = "migration"; static final String SQL_SCRIPT_GENERATOR_BATCH_SERVICE_NAME = "sqlScriptGenerator"; - private static final Set<String> SECTIONS = ImmutableSet.of( - ObserveEntityEnum.ll_observation_Branchline.name(), - ObserveEntityEnum.ll_observation_Basket.name(), - ObserveEntityEnum.ll_observation_Section.name()); - private static final Set<String> SECTIONS_HOLDERS = ImmutableSet.of( - ObserveEntityEnum.ll_observation_Catch.name(), - ObserveEntityEnum.ll_observation_Tdr.name()); + // private static final Set<String> SECTIONS = ImmutableSet.of( +// ObserveEntityEnum.ll_observation_Branchline.name(), +// ObserveEntityEnum.ll_observation_Basket.name(), +// ObserveEntityEnum.ll_observation_Section.name()); +// private static final Set<String> SECTIONS_HOLDERS = ImmutableSet.of( +// ObserveEntityEnum.ll_observation_Catch.name(), +// ObserveEntityEnum.ll_observation_Tdr.name()); private static final Logger log = LogManager.getLogger(ObserveTopiaApplicationContext.class); @SuppressWarnings("SpellCheckingInspection") private static final String INSERT_LAST_UPDATE_PATTERN = "INSERT INTO COMMON.LASTUPDATEDATE (TOPIAID, TOPIAVERSION, TOPIACREATEDATE, TYPE, LASTUPDATEDATE) VALUES ('fr.ird.observe.entities.LastUpdateDate#1236861982132#0.%03d', 0, CURRENT_TIMESTAMP, '%s', CURRENT_TIMESTAMP);"; @@ -90,20 +89,6 @@ public class ObserveTopiaApplicationContext extends AbstractObserveTopiaApplicat return new ObserveTopiaMetadataModelSupport(); } - protected static boolean rejectAssociationType0(TopiaMetadataEntity metadataEntity, TopiaMetadataEntity propertyType) { - return (SECTIONS_HOLDERS.contains(propertyType.getType()) && SECTIONS.contains(metadataEntity.getType())) - || (ObserveEntityEnum.ps_logbook_Activity.name().equals(propertyType.getType()) && ObserveEntityEnum.ps_logbook_Sample.name().equals(metadataEntity.getType())) - || (ObserveEntityEnum.ps_localmarket_Survey.name().equals(propertyType.getType()) && ObserveEntityEnum.ps_localmarket_Batch.name().equals(metadataEntity.getType())) - ; - } - - protected static boolean rejectReversedAssociationType0(TopiaMetadataEntity metadataEntity, TopiaMetadataEntity propertyType) { - return (ObserveEntityEnum.ll_observation_Activity.name().equals(propertyType.getType()) && ObserveEntityEnum.ll_logbook_Activity.name().equals(metadataEntity.getType())) - || (ObserveEntityEnum.ps_observation_Activity.name().equals(propertyType.getType()) && ObserveEntityEnum.ps_logbook_Activity.name().equals(metadataEntity.getType())) - || (ObserveEntityEnum.ll_logbook_Sample.name().equals(propertyType.getType()) && ObserveEntityEnum.ll_logbook_Activity.name().equals(metadataEntity.getType())) - ; - } - @Override public ObserveTopiaPersistenceContext newPersistenceContext() { ObserveTopiaPersistenceContext persistenceContext = new ObserveTopiaPersistenceContext( @@ -207,6 +192,11 @@ public class ObserveTopiaApplicationContext extends AbstractObserveTopiaApplicat return getTopiaMetadataModelSupport().getMetadataModel(); } + @Override + public TopiaMetadataModelPaths getMetadataModelPaths() { + return getTopiaMetadataModelSupport().getMetadataModelPaths(); + } + @Override public boolean equals(Object o) { if (this == o) return true; @@ -243,7 +233,7 @@ public class ObserveTopiaApplicationContext extends AbstractObserveTopiaApplicat if (tripSeineTables == null) { log.debug("Loading tripSeineTables."); - tripSeineTables = topiaSqlTablesFactory.newReplicateEntityTables(new TripReplicateTablesPredicate(), ObserveEntityEnum.ps_common_Trip); + tripSeineTables = topiaSqlTablesFactory.newReplicateEntityTables(new DefaultTopiaSqlTablesPredicate(), ObserveEntityEnum.ps_common_Trip); log.info(String.format("For Trip, found %d tables to use.", tripSeineTables.size())); } return tripSeineTables; @@ -253,7 +243,7 @@ public class ObserveTopiaApplicationContext extends AbstractObserveTopiaApplicat if (tripLonglineTables == null) { log.debug("Loading tripLonglineTables."); - tripLonglineTables = topiaSqlTablesFactory.newReplicateEntityTables(new TripReplicateTablesPredicate(), ObserveEntityEnum.ll_common_Trip); + tripLonglineTables = topiaSqlTablesFactory.newReplicateEntityTables(new DefaultTopiaSqlTablesPredicate(), ObserveEntityEnum.ll_common_Trip); log.info(String.format("For Trip, found %d tables to use.", tripLonglineTables.size())); TopiaSqlTable basketTable = tripLonglineTables.getTable(ObserveEntityEnum.ll_observation_Basket); @@ -292,11 +282,10 @@ public class ObserveTopiaApplicationContext extends AbstractObserveTopiaApplicat } public TopiaSqlTables getReferentialTables() { - if (referentialTables == null) { log.debug("Loading referentialTables."); referentialTables = topiaSqlTablesFactory.newReplicateEntityTables( - new TripReplicateTablesPredicate(), + new DefaultTopiaSqlTablesPredicate(), Entities.REFERENCE_ENTITIES); } log.info(String.format("For Referential, found %d tables to use.", referentialTables.size())); @@ -305,112 +294,26 @@ public class ObserveTopiaApplicationContext extends AbstractObserveTopiaApplicat public <E extends ReferentialEntity<?, ?>> TopiaSqlTables getReferentialTable(Class<E> entityType) { ObserveEntityEnum entityEnum = ObserveEntityEnum.valueOf(entityType); - return referentialTables = topiaSqlTablesFactory.newReplicateEntityTables(new TripReplicateTablesPredicate(), entityEnum); - } - - private TopiaMetadataModelSupport getTopiaMetadataModelSupport() { - return topiaMetadataModelSupport == null ? topiaMetadataModelSupport = newModelSupport() : topiaMetadataModelSupport; + return referentialTables = topiaSqlTablesFactory.newReplicateEntityTables(new DefaultTopiaSqlTablesPredicate(), entityEnum); } public ObserveTopiaUsageModel getTopiaUsageModel() { return topiaUsageModel == null ? topiaUsageModel = new ObserveTopiaUsageModel() : topiaUsageModel; } - private void executeSqlStatements0(TopiaSqlScript content) { - - SqlScriptReader scriptLocation = content.getLocation(); -// if (getConfiguration().isH2Configuration()) { -// -// String protocol = scriptLocation.getProtocol(); -// boolean local = LOCAL_PROTOCOLS.contains(protocol.toLowerCase()); -// -// Path tempFile = null; -// try { -// if (local) { -// tempFile = Paths.get(scriptLocation.toURI()); -// } else { -// tempFile = Files.createTempFile("observeRestoreH2", ".sql"); -// Files.copy(scriptLocation.openStream(), tempFile); -// } -//// log.info(String.format("Restore script size: %s to h2 from file : %s", StringUtil.convertMemory(Files.size(tempFile)), tempFile.toString())); -// JdbcH2Helper2 jdbcH2Helper = new JdbcH2Helper2(configuration); -// -// jdbcH2Helper.restore(tempFile.toFile()); -// } finally { -// if (!local && tempFile != null) { -// Files.delete(tempFile); -// } -// } -// -// } else { - -// log.info(String.format("Load script (size: %s)", StringUtil.convertMemory(content.length))); - - try (ObserveTopiaPersistenceContext persistenceContext = newPersistenceContext()) { - persistenceContext.executeSqlScript(scriptLocation); - persistenceContext.commit(); - } -// } - - } - public BlobIdsIterator newBlobIdsIterator(Path blobIdsPath) { return new BlobIdsIterator(getMetadataModel(), blobIdsPath, this); } - private static class TripReplicateTablesPredicate implements TopiaSqlTablesFactory.TopiaSqlTablesPredicate { - - private final Set<TopiaMetadataEntity> done = new LinkedHashSet<>(); - - @Override - public boolean acceptEntity(TopiaMetadataEntity metadataEntity) { - return done.add(metadataEntity); - } - - @Override - public boolean acceptAssociation(TopiaMetadataEntity metadataEntity, String propertyName, TopiaMetadataEntity propertyType) { - return !rejectAssociationType0(metadataEntity, propertyType); - } - - @Override - public boolean acceptReversedAssociation(TopiaMetadataEntity metadataEntity, String propertyName, TopiaMetadataEntity propertyType) { - return !rejectReversedAssociationType0(metadataEntity, propertyType); - - } - - @Override - public boolean acceptNmAssociation(TopiaMetadataEntity metadataEntity, String propertyName, TopiaMetadataEntity propertyType) { - return !rejectAssociationType0(metadataEntity, propertyType); - } - + private TopiaMetadataModelSupport getTopiaMetadataModelSupport() { + return topiaMetadataModelSupport == null ? topiaMetadataModelSupport = newModelSupport() : topiaMetadataModelSupport; } - public static class ObserveDataEntityPathsBuilder extends TopiaMetadataEntityPathsBuilder { - - public ObserveDataEntityPathsBuilder() { - super(e -> DataEntity.class.isAssignableFrom(ObserveEntityEnum.valueOf(e.getType()).getContract())); - } - - @Override - protected Visitor createVisitor(Predicate<TopiaMetadataEntity> acceptType) { - return new ObServeVisitor(acceptType); - } - - private static class ObServeVisitor extends Visitor { - - public ObServeVisitor(Predicate<TopiaMetadataEntity> acceptType) { - super(acceptType); - } - - @Override - protected boolean rejectReversedAssociationType(TopiaMetadataEntity metadataEntity, String propertyName, TopiaMetadataEntity propertyType) { - return rejectReversedAssociationType0(metadataEntity, propertyType) || super.rejectReversedAssociationType(metadataEntity, propertyName, propertyType); - } - - @Override - protected boolean rejectAssociationType(TopiaMetadataEntity metadataEntity, String propertyName, TopiaMetadataEntity propertyType) { - return rejectAssociationType0(metadataEntity, propertyType) || super.rejectAssociationType(metadataEntity, propertyName, propertyType); - } + private void executeSqlStatements0(TopiaSqlScript content) { + SqlScriptReader scriptLocation = content.getLocation(); + try (ObserveTopiaPersistenceContext persistenceContext = newPersistenceContext()) { + persistenceContext.executeSqlScript(scriptLocation); + persistenceContext.commit(); } } ===================================== persistence/src/main/models/Observe-21-data-ps-logbook.model ===================================== @@ -14,7 +14,7 @@ seaSurfaceTemperature + {*:1} Float | sqlType=numeric windDirection + {*:1} Integer vesselActivity {*:1} referential.ps.common.VesselActivity wind {*:0..1} referential.common.Wind -relatedObservedActivity + {0..1} data.ps.observation.Activity +relatedObservedActivity + {0..1} data.ps.observation.Activity | skipModelNavigation floatingObject + {*} data.ps.logbook.FloatingObject | unique observedSystem {*:*} referential.ps.logbook.ObservedSystem | unique set + {0..1} data.ps.logbook.Set @@ -91,7 +91,7 @@ bigsWeight + {*:1} Float | sqlType=numeric totalWeight + {*:1} Float | sqlType=numeric weightedWeight + {*:1} Float | sqlType=numeric subSampleNumber + {*:1} Integer -activity {*:*} data.ps.logbook.Activity +activity {*:*} data.ps.logbook.Activity | skipModelNavigation sampleSpecies + {*} data.ps.logbook.SampleSpecies | ordered data.ps.logbook.SampleSpecies > data.DataEntity | entity ===================================== persistence/src/main/models/Observe-23-data-ps-wellplan.model ===================================== @@ -1,7 +1,7 @@ package fr.ird.observe.entities.data.ps.wellplan | dbSchema=ps_wellplan data.ps.wellplan.WellPlan > data.DataEntity | entity -activity {*:1} data.ps.logbook.Activity +activity {*:1} data.ps.logbook.Activity | skipModelNavigation well + {*:1} String species {*:1} referential.common.Species weightCategory {*:1} referential.ps.logbook.WeightCategory ===================================== persistence/src/main/models/Observe-24-data-ps-localmarket.model ===================================== @@ -5,7 +5,7 @@ species {*:1} referential.common.Species | notNull packaging {*:1} referential.ps.localmarket.Packaging | notNull count + {*:1} Integer weight + {*:1} Float | sqlType=numeric -survey {*:0..1} data.ps.localmarket.Survey +survey {*:0..1} data.ps.localmarket.Survey | skipModelNavigation origin + {*:1} String | hibernateAttributeType=text comment + {*:1} String | hibernateAttributeType=text ===================================== persistence/src/main/models/Observe-30-data-ll-observation.model ===================================== @@ -44,9 +44,9 @@ haulingIdentifier + {*:1} Integer floatline1Length + {*:1} Float floatline2Length + {*:1} Float branchline + {*} data.ll.observation.Branchline | unique orderBy=settingIdentifier -catches {*} data.ll.observation.Catch -tdr {*} data.ll.observation.Tdr -set {*:1} data.ll.observation.Set +catches {*} data.ll.observation.Catch | skipModelNavigation +tdr {*} data.ll.observation.Tdr | skipModelNavigation +set {*:1} data.ll.observation.Set | skipModelNavigation getSection() data.ll.observation.Section setSection(section data.ll.observation.Section) @@ -68,8 +68,8 @@ tracelineLength + {*:1} Float | sqlType=numeric hookLost + {*:1} Boolean traceCutOff + {*:1} Boolean hookType {*:0..1} referential.ll.common.HookType -tdr {*} data.ll.observation.Tdr -catches {*} data.ll.observation.Catch +tdr {*} data.ll.observation.Tdr | skipModelNavigation +catches {*} data.ll.observation.Catch | skipModelNavigation baitType {*:0..1} referential.ll.common.BaitType topType {*:0..1} referential.ll.common.LineType tracelineType {*:0..1} referential.ll.common.LineType @@ -102,14 +102,14 @@ photoReferences + {*:1} String number + {*:1} Integer acquisitionMode + {*:1} int tagNumber + {*:1} String -basket {*:0..1} data.ll.observation.Basket -branchline {*:0..1} data.ll.observation.Branchline +basket {*:0..1} data.ll.observation.Basket | skipModelNavigation +branchline {*:0..1} data.ll.observation.Branchline | skipModelNavigation catchFate {*:1} referential.ll.common.CatchFate discardHealthStatus {*:1} referential.ll.common.HealthStatus sizeMeasure + {*} data.ll.observation.SizeMeasure | orderBy=topiaCreateDate speciesCatch {*:1} referential.common.Species predator {*:*} referential.common.Species -section {*:0..1} data.ll.observation.Section +section {*:0..1} data.ll.observation.Section | skipModelNavigation maturityStatus {*:0..1} referential.ll.observation.MaturityStatus stomachFullness {*:0..1} referential.ll.observation.StomachFullness hookPosition {*:0..1} referential.ll.observation.HookPosition @@ -138,10 +138,10 @@ hookSize {*:1} referential.ll.common.HookSize data.ll.observation.Section > data.DataEntity >> data.ll.observation.LonglineCompositionAware | entity settingIdentifier + {*:1} Integer | notNull haulingIdentifier + {*:1} Integer -set {*:1} data.ll.observation.Set -basket + {*} data.ll.observation.Basket | unique orderBy=settingIdentifier -tdr {*} data.ll.observation.Tdr -catches {*} data.ll.observation.Catch +set {*:1} data.ll.observation.Set | skipModelNavigation +basket + {*} data.ll.observation.Basket | unique orderBy=settingIdentifier +tdr {*} data.ll.observation.Tdr | skipModelNavigation +catches {*} data.ll.observation.Catch | skipModelNavigation data.ll.observation.SensorUsed > data.DataEntity | entity data + {*:1} !java.sql.Blob @@ -254,11 +254,11 @@ minFishingDepth + {*:1} Float maxFishingDepth + {*:1} Float meanFishingDepth + {*:1} Float medianFishingDepth + {*:1} Float -branchline {*:0..1} data.ll.observation.Branchline +branchline {*:0..1} data.ll.observation.Branchline | skipModelNavigation sensorBrand {*:0..1} referential.ll.observation.SensorBrand species {*:*} referential.common.Species -section {*:0..1} data.ll.observation.Section -basket {*:0..1} data.ll.observation.Basket +section {*:0..1} data.ll.observation.Section | skipModelNavigation +basket {*:0..1} data.ll.observation.Basket | skipModelNavigation itemHorizontalPosition {*:0..1} referential.ll.observation.ItemHorizontalPosition itemVerticalPosition {*:0..1} referential.ll.observation.ItemVerticalPosition getDeploymentStartDate() Date ===================================== persistence/src/main/models/Observe-31-data-ll-logbook.model ===================================== @@ -14,7 +14,7 @@ currentDirection + {*:1} Integer vesselActivity {*:1} referential.ll.common.VesselActivity | lazy=false dataQuality {*:0..1} referential.common.DataQuality fpaZone {*:1} referential.common.FpaZone -relatedObservedActivity + {0..1} data.ll.observation.Activity +relatedObservedActivity + {0..1} data.ll.observation.Activity | skipModelNavigation set + {0..1} data.ll.logbook.Set sample + {0..1} data.ll.logbook.Sample getStartDate() Date ===================================== persistence/src/test/java/fr/ird/observe/entities/ObserveTopiaMetadataModelSupportTest.java deleted ===================================== @@ -1,68 +0,0 @@ -package fr.ird.observe.entities; - -/*- - * #%L - * ObServe :: Persistence - * %% - * Copyright (C) 2008 - 2020 IRD, Code Lutin, Ultreia.io - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU 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 General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import com.google.common.collect.ImmutableMap; -import fr.ird.observe.test.ObserveFixtures; -import org.junit.Assert; -import org.junit.Test; -import org.nuiton.topia.persistence.metadata.TopiaMetadataEntity; -import org.nuiton.topia.persistence.metadata.TopiaMetadataEntityPath; -import org.nuiton.topia.persistence.metadata.TopiaMetadataEntityPathsBuilder; -import org.nuiton.topia.persistence.metadata.TopiaMetadataModel; - -public class ObserveTopiaMetadataModelSupportTest { - - @Test - public void testEntityPathsBuilder() { - - TopiaMetadataModel model = ObserveTopiaApplicationContext.newModelSupport().getMetadataModel(); - - TopiaMetadataEntityPathsBuilder entityPathsBuilder = new ObserveTopiaApplicationContext.ObserveDataEntityPathsBuilder(); - - TopiaMetadataEntity tripPs = model.getEntity(ObserveEntityEnum.ps_common_Trip.name()); - ImmutableMap<TopiaMetadataEntity, TopiaMetadataEntityPath> pathsPs = entityPathsBuilder.build(model, tripPs); - Assert.assertNotNull(pathsPs); - Assert.assertEquals(ObserveFixtures.PERSISTENCE_PS_DATA_PATH, pathsPs.size()); - - TopiaMetadataEntity tripLl = model.getEntity(ObserveEntityEnum.ll_common_Trip.name()); - ImmutableMap<TopiaMetadataEntity, TopiaMetadataEntityPath> pathsLl = entityPathsBuilder.build(model, tripLl); - Assert.assertNotNull(pathsLl); - Assert.assertEquals(ObserveFixtures.PERSISTENCE_LL_DATA_PATH, pathsLl.size()); - } - - @Test - public void getDataEntityPaths() { - - TopiaMetadataModel model = ObserveTopiaApplicationContext.newModelSupport().getMetadataModel(); - ImmutableMap<TopiaMetadataEntity, TopiaMetadataEntityPath> dataEntityPaths = model.getDataEntityPaths(); - Assert.assertNotNull(dataEntityPaths); - Assert.assertEquals(ObserveFixtures.PERSISTENCE_DATA_PATH, dataEntityPaths.size()); - Assert.assertFalse(model.getDataEntityPath(fr.ird.observe.entities.data.ps.common.Trip.class).isPresent()); - Assert.assertTrue(model.getDataEntityPath(fr.ird.observe.entities.data.ps.common.GearUseFeatures.class).isPresent()); - Assert.assertTrue(model.getDataEntityPath(fr.ird.observe.entities.data.ps.common.GearUseFeaturesMeasurement.class).isPresent()); - Assert.assertFalse(model.getDataEntityPath(fr.ird.observe.entities.data.ll.common.Trip.class).isPresent()); - Assert.assertTrue(model.getDataEntityPath(fr.ird.observe.entities.data.ll.common.GearUseFeatures.class).isPresent()); - Assert.assertTrue(model.getDataEntityPath(fr.ird.observe.entities.data.ll.common.GearUseFeaturesMeasurement.class).isPresent()); - } -} ===================================== persistence/src/test/java/fr/ird/observe/entities/TopiaMetadataModelPathsTest.java ===================================== @@ -0,0 +1,101 @@ +package fr.ird.observe.entities; + +/*- + * #%L + * ObServe :: Persistence + * %% + * Copyright (C) 2008 - 2020 IRD, Code Lutin, Ultreia.io + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU 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 General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Multimap; +import fr.ird.observe.test.ObserveFixtures; +import org.junit.Assert; +import org.junit.Test; +import org.nuiton.topia.persistence.metadata.TopiaMetadataEntity; +import org.nuiton.topia.persistence.metadata.TopiaMetadataEntityPath; +import org.nuiton.topia.persistence.metadata.TopiaMetadataModel; +import org.nuiton.topia.persistence.metadata.TopiaMetadataModelPaths; + +import java.util.Collection; +import java.util.List; +import java.util.Map; +import java.util.Optional; + +/** + * Created on 13/09/2020. + * + * @author Tony Chemit - dev(a)tchemit.fr + * @since 8.1.0 + */ +public class TopiaMetadataModelPathsTest { + + + @Test + public void getEntityPaths() { + + TopiaMetadataModel model = ObserveTopiaApplicationContext.newModelSupport().getMetadataModel(); + TopiaMetadataModelPaths paths = TopiaMetadataModelPaths.load(model); + Multimap<TopiaMetadataEntity, TopiaMetadataEntityPath> dataEntityPaths = paths.getEntityPaths(); + Assert.assertNotNull(dataEntityPaths); + Assert.assertEquals(ObserveFixtures.PERSISTENCE_DATA_PATH, dataEntityPaths.asMap().size()); + Assert.assertFalse(paths.getEntityPathsForEntryPoint(model.getMetadataEntity(fr.ird.observe.entities.data.ps.common.Trip.class)).isPresent()); + Assert.assertTrue(paths.getEntityPathsForEntryPoint(model.getMetadataEntity(fr.ird.observe.entities.data.ps.common.GearUseFeatures.class)).isPresent()); + Assert.assertTrue(paths.getEntityPathsForEntryPoint(model.getMetadataEntity(fr.ird.observe.entities.data.ps.common.GearUseFeaturesMeasurement.class)).isPresent()); + Assert.assertFalse(paths.getEntityPathsForEntryPoint(model.getMetadataEntity(fr.ird.observe.entities.data.ll.common.Trip.class)).isPresent()); + Assert.assertTrue(paths.getEntityPathsForEntryPoint(model.getMetadataEntity(fr.ird.observe.entities.data.ll.common.GearUseFeatures.class)).isPresent()); + Assert.assertTrue(paths.getEntityPathsForEntryPoint(model.getMetadataEntity(fr.ird.observe.entities.data.ll.common.GearUseFeaturesMeasurement.class)).isPresent()); + } + + @Test + public void getEntityPathsCount() { + ImmutableMap<String, Long> excepted = ObserveFixtures.PERSISTENCE_ENTITY_PATHS; + TopiaMetadataModel model = ObserveTopiaApplicationContext.newModelSupport().getMetadataModel(); + + TopiaMetadataModelPaths paths = TopiaMetadataModelPaths.load(model); + Multimap<TopiaMetadataEntity, TopiaMetadataEntityPath> dataEntityPaths = paths.getEntityPaths(); + + Assert.assertNotNull(paths); + for (Map.Entry<TopiaMetadataEntity, Collection<TopiaMetadataEntityPath>> entry : paths.asMap().entrySet()) { + int actualPathsCount = entry.getValue().stream().map(TopiaMetadataEntityPath::getLinks).mapToInt(List::size).sum(); + System.out.printf("%s=%d%n", ObserveEntityEnum.valueOf(entry.getKey().getType()), actualPathsCount); + } + for (Map.Entry<String, Long> entry : excepted.entrySet()) { + String type = entry.getKey(); + Optional<TopiaMetadataEntity> optionalTopiaMetadataEntity = paths.keySet().stream().filter(k -> k.getType().equals(type)).findFirst(); + Assert.assertTrue("Could not find expected type in result: " + type, optionalTopiaMetadataEntity.isPresent()); + TopiaMetadataEntity topiaMetadataEntity = optionalTopiaMetadataEntity.get(); + Collection<TopiaMetadataEntityPath> topiaMetadataLinks = paths.get(topiaMetadataEntity); + int expectedPathsCount = Math.toIntExact(entry.getValue()); + int actualPathsCount = topiaMetadataLinks.stream().map(TopiaMetadataEntityPath::getLinks).mapToInt(List::size).sum(); + Assert.assertEquals(String.format("for type %s, expected links size: %d but was %d", type, expectedPathsCount, actualPathsCount), expectedPathsCount, actualPathsCount); + } + ImmutableSet<String> keys = excepted.keySet(); + for (Map.Entry<TopiaMetadataEntity, Collection<TopiaMetadataEntityPath>> entry : paths.asMap().entrySet()) { + if (!keys.contains(entry.getKey().getType())) { + + int actualPathsCount = entry.getValue().stream().map(TopiaMetadataEntityPath::getLinks).mapToInt(List::size).sum(); + System.err.printf("%s=%d%n", ObserveEntityEnum.valueOf(entry.getKey().getType()), actualPathsCount); + } + } + Assert.assertEquals(excepted.size(), paths.asMap().size()); + // at the moment only two entities with two paths (ll_logbook_Sample and ll_logbook_SamplePart) + Assert.assertEquals(excepted.size() + 2, paths.size()); + } +} ===================================== pom.xml ===================================== @@ -174,7 +174,7 @@ <lib.version.h2>1.4.196</lib.version.h2> <lib.version.nuiton.utils>3.0</lib.version.nuiton.utils> -<!-- <lib.version.java4all.topia>1.26-SNAPSHOT</lib.version.java4all.topia>--> + <lib.version.java4all.topia>1.27-SNAPSHOT</lib.version.java4all.topia> <!-- <lib.version.java4all.eugene>3.0-alpha-34-SNAPSHOT</lib.version.java4all.eugene>--> <!-- <lib.version.java4all.jaxx>3.0-alpha-79-SNAPSHOT</lib.version.java4all.jaxx>--> <!--<lib.version.java4all.application-context>1.0.3-SNAPSHOT</lib.version.java4all.application-context>--> ===================================== server-core/src/main/filtered-resources/mapping ===================================== @@ -192,6 +192,7 @@ POST /api/v1/data/ps/common/TripGearUseFeaturesService/save DELETE /api/v1/data/ps/common/TripService/delete v1.data.ps.common.TripServiceRestApi.delete GET /api/v1/data/ps/common/TripService/exists v1.data.ps.common.TripServiceRestApi.exists GET /api/v1/data/ps/common/TripService/getAllTrip v1.data.ps.common.TripServiceRestApi.getAllTrip +GET /api/v1/data/ps/common/TripService/getLogbookWeightCategoryByListAndTrip v1.data.ps.common.TripServiceRestApi.getLogbookWeightCategoryByListAndTrip GET /api/v1/data/ps/common/TripService/getMatchingTripsVesselWithinDateRange v1.data.ps.common.TripServiceRestApi.getMatchingTripsVesselWithinDateRange GET /api/v1/data/ps/common/TripService/getSpeciesByListAndTrip v1.data.ps.common.TripServiceRestApi.getSpeciesByListAndTrip GET /api/v1/data/ps/common/TripService/getTripMap v1.data.ps.common.TripServiceRestApi.getTripMap ===================================== services-api/src/main/java/fr/ird/observe/services/service/data/ps/common/TripService.java ===================================== @@ -24,10 +24,19 @@ package fr.ird.observe.services.service.data.ps.common; import fr.ird.observe.dto.data.ps.common.TripDto; import fr.ird.observe.dto.data.ps.common.TripReference; +import fr.ird.observe.dto.reference.ReferentialDtoReferenceSet; +import fr.ird.observe.dto.referential.ps.logbook.WeightCategoryReference; +import fr.ird.observe.services.spi.ReadDataPermission; +import io.ultreia.java4all.http.spi.Get; +import io.ultreia.java4all.http.spi.Nullable; /** * @author Tony Chemit - dev(a)tchemit.fr */ public interface TripService extends fr.ird.observe.services.service.data.TripService<TripDto, TripReference> { + @Get + @ReadDataPermission + ReferentialDtoReferenceSet<WeightCategoryReference> getLogbookWeightCategoryByListAndTrip(@Nullable String tripId, String speciesListId); + } ===================================== services-local/src/main/java/fr/ird/observe/services/local/service/data/ps/common/TripServiceLocal.java ===================================== @@ -23,6 +23,7 @@ package fr.ird.observe.services.local.service.data.ps.common; */ import com.google.common.collect.ImmutableSet; +import fr.ird.observe.dto.IdDto; import fr.ird.observe.dto.data.TripAware; import fr.ird.observe.dto.data.TripMapConfigDto; import fr.ird.observe.dto.data.TripMapDto; @@ -33,10 +34,13 @@ import fr.ird.observe.dto.form.Form; import fr.ird.observe.dto.reference.DataDtoReferenceSet; import fr.ird.observe.dto.reference.ReferentialDtoReferenceSet; import fr.ird.observe.dto.referential.common.SpeciesReference; +import fr.ird.observe.dto.referential.ps.logbook.WeightCategoryReference; import fr.ird.observe.dto.result.SaveResultDto; import fr.ird.observe.entities.data.ps.common.Trip; import fr.ird.observe.entities.referential.common.Ocean; import fr.ird.observe.entities.referential.common.Program; +import fr.ird.observe.entities.referential.ps.logbook.WeightCategory; +import fr.ird.observe.entities.referential.ps.logbook.WeightCategoryTopiaDao; import fr.ird.observe.services.local.ObserveServiceContextLocal; import fr.ird.observe.services.local.service.ObserveServiceLocal; import fr.ird.observe.services.service.data.ps.common.TripService; @@ -50,6 +54,7 @@ import java.util.Comparator; import java.util.Date; import java.util.LinkedHashSet; import java.util.List; +import java.util.stream.Collectors; /** * @author Tony Chemit - dev(a)tchemit.fr @@ -121,6 +126,18 @@ public class TripServiceLocal extends ObserveServiceLocal implements TripService return getSpeciesByListAndOcean(speciesListId, ocean); } + @Override + public ReferentialDtoReferenceSet<WeightCategoryReference> getLogbookWeightCategoryByListAndTrip(String tripId, String speciesListId) { + Ocean ocean = null; + if (tripId != null) { + Trip trip = Trip.loadEntity(getApplicationLocale(), getTopiaPersistenceContext(), tripId); + ocean = trip.getOcean(); + } + List<String> speciesByListAndOcean = getSpeciesByListAndOcean(speciesListId, ocean).stream().map(IdDto::getId).collect(Collectors.toList()); + WeightCategoryTopiaDao weightCategoryList = WeightCategory.getDao(getTopiaPersistenceContext()); + return WeightCategory.toReferenceSet(getReferentialLocale(), weightCategoryList.streamAll().filter(c -> c.getSpecies() == null || speciesByListAndOcean.contains(c.getSpecies().getTopiaId())), now()); + } + @Override public Form<TripDto> preCreate(String programId) { Trip trip = Trip.newEntity(now()); ===================================== services-local/src/test/java/fr/ird/observe/services/local/service/data/TripManagementServiceLocalTest.java ===================================== @@ -96,7 +96,7 @@ public class TripManagementServiceLocalTest extends ServiceLocalTestSupport { Assert.assertNotNull(result); DataDtoReferenceSet<TripReference> allTripSeineAfter = tripService.getAllTrip(); - Assert.assertTrue(allTripSeineBefore.size() == allTripSeineAfter.size() + 1); + Assert.assertEquals(allTripSeineBefore.size(), allTripSeineAfter.size() + 1); } @Test ===================================== templates/pom.xml ===================================== @@ -63,7 +63,10 @@ <groupId>org.nuiton</groupId> <artifactId>nuiton-decorator</artifactId> </dependency> - + <dependency> + <groupId>io.ultreia.java4all.topia</groupId> + <artifactId>persistence</artifactId> + </dependency> <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-lang3</artifactId> ===================================== templates/src/main/java/fr/ird/observe/toolkit/templates/GeneratePersistence.java ===================================== @@ -22,6 +22,9 @@ package fr.ird.observe.toolkit.templates; * #L% */ +import fr.ird.observe.toolkit.templates.entity.EntityLastUpdateDateFieldSqlScriptGenerator; +import fr.ird.observe.toolkit.templates.entity.EntityLastUpdateDateTableSqlScriptGenerator; +import fr.ird.observe.toolkit.templates.entity.EntityPathsGenerator; import fr.ird.observe.toolkit.templates.entity.EntityTransformer; import org.codehaus.plexus.component.annotations.Component; import org.nuiton.eugene.Template; @@ -31,6 +34,7 @@ import org.nuiton.topia.templates.EntityHibernateMappingTransformer; import org.nuiton.topia.templates.TopiaEntityDaoTransformer; import org.nuiton.topia.templates.TopiaEntityEnumTransformer; import org.nuiton.topia.templates.TopiaGenerator; +import org.nuiton.topia.templates.TopiaMetadataModelClassGenerator; import org.nuiton.topia.templates.TopiaMetadataModelGenerator; import org.nuiton.topia.templates.TopiaPersistenceContextTransformer; @@ -55,6 +59,10 @@ public class GeneratePersistence extends TopiaGenerator { ApplicationContextTransformer.class, TopiaPersistenceContextTransformer.class, TopiaEntityDaoTransformer.class, + EntityPathsGenerator.class, + EntityLastUpdateDateFieldSqlScriptGenerator.class, + EntityLastUpdateDateTableSqlScriptGenerator.class, + TopiaMetadataModelClassGenerator.class, TopiaMetadataModelGenerator.class ); } ===================================== templates/src/main/java/fr/ird/observe/toolkit/templates/dto/DtoTransformer.java ===================================== @@ -62,6 +62,7 @@ import org.nuiton.eugene.models.object.xml.ObjectModelParameterImpl; import java.util.Arrays; import java.util.Collection; import java.util.Date; +import java.util.LinkedHashMap; import java.util.LinkedHashSet; import java.util.LinkedList; import java.util.Map; @@ -317,7 +318,7 @@ public class DtoTransformer extends BeanTransformer implements TemplateContract private Map<String, String> getFormProperties(ObjectModelClass input, ObjectModelClass output) { Collection<ObjectModelAttribute> attributes = new LinkedList<>(input.getAttributes()); attributes.addAll(input.getAllOtherAttributes()); - Map<String, String> properties = new TreeMap<>(); + Map<String, String> properties = new LinkedHashMap<>(); for (ObjectModelAttribute attr : attributes) { if (!attr.isNavigable()) { ===================================== toolbox-maven-plugin/src/main/java/fr/ird/observe/maven/plugins/toolbox/GenerateEntityUpdateSqlFilesMojo.java → templates/src/main/java/fr/ird/observe/toolkit/templates/entity/EntityLastUpdateDateFieldSqlScriptGenerator.java ===================================== @@ -1,8 +1,8 @@ -package fr.ird.observe.maven.plugins.toolbox; +package fr.ird.observe.toolkit.templates.entity; /*- * #%L - * ObServe Toolkit :: Maven plugin + * ObServe Toolkit :: Templates * %% * Copyright (C) 2008 - 2020 IRD, Code Lutin, Ultreia.io * %% @@ -22,129 +22,73 @@ package fr.ird.observe.maven.plugins.toolbox; * #L% */ - import com.google.common.collect.ImmutableList; import fr.ird.observe.spi.context.DtoEntityContext; -import org.apache.maven.plugins.annotations.LifecyclePhase; -import org.apache.maven.plugins.annotations.Mojo; -import org.apache.maven.plugins.annotations.Parameter; -import org.apache.maven.plugins.annotations.ResolutionScope; -import org.nuiton.topia.persistence.internal.support.TopiaMetadataModelSupportImpl; +import org.codehaus.plexus.component.annotations.Component; +import org.nuiton.eugene.Template; +import org.nuiton.eugene.models.object.ObjectModelClass; +import org.nuiton.eugene.models.object.ObjectModelClassifier; import org.nuiton.topia.persistence.metadata.TopiaMetadataEntity; import org.nuiton.topia.persistence.metadata.TopiaMetadataEntityPath; import org.nuiton.topia.persistence.metadata.TopiaMetadataLink; -import org.nuiton.topia.persistence.metadata.TopiaMetadataModel; import org.nuiton.topia.persistence.metadata.TopiaMetadataReverseAssociation; -import org.nuiton.topia.persistence.script.SqlScriptWriter; +import org.nuiton.topia.templates.TopiaMetadataModelGeneratorSupport; -import java.io.File; import java.io.IOException; -import java.net.URLClassLoader; -import java.nio.file.Path; +import java.io.Writer; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.Optional; -@Mojo(name = "generate-entity-update-sql-files", threadSafe = true, defaultPhase = LifecyclePhase.COMPILE, requiresDependencyResolution = ResolutionScope.COMPILE) -public class GenerateEntityUpdateSqlFilesMojo extends ToolboxMojoSupport { - private static final String UPDATE_LAST_UPDATE_DATE_TABLE_SQL = "UPDATE common.lastUpdateDate SET lastUpdateDate = '%%1$s'::timestamp WHERE type ='%s'"; +/** + * Created on 13/09/2020. + * + * @author Tony Chemit - dev(a)tchemit.fr + * @since 1.27 + */ +@Component(role = Template.class, hint = "org.nuiton.topia.templates.EntityLastUpdateDateFieldSqlScriptGenerator") +public class EntityLastUpdateDateFieldSqlScriptGenerator extends TopiaMetadataModelGeneratorSupport { + private static final String UPDATE_LAST_UPDATE_DATE_FIELD_SQL_START = "UPDATE %s.%s SET lastUpdateDate = '%%1$s'::timestamp, topiaVersion = topiaVersion + 1"; private static final String UPDATE_LAST_UPDATE_DATE_FIELD_SQL_WHERE_EQUALS = " WHERE %s = '%%2$s'"; private static final String UPDATE_LAST_UPDATE_DATE_FIELD_SQL_WHERE_SELECT = " WHERE topiaId = ( %s )"; private static final String UPDATE_LAST_UPDATE_DATA_FIELD_SQL_SELECT_START = "SELECT %3$s FROM %1$s.%2$s %2$s"; private static final String UPDATE_LAST_UPDATE_DATA_FIELD_SQL_INNER_JOIN_REVERSE = " INNER JOIN %1$s.%2$s %2$s ON %2$s.%3$s = %4$s.%5$s"; private static final String UPDATE_LAST_UPDATE_DATA_FIELD_SQL_INNER_JOIN_SIMPLE = " INNER JOIN %1$s.%2$s %2$s ON %2$s.%3$s = %4$s.topiaId"; - /** - * Verbose flag. - */ - @Parameter(property = "generateEntityUpdateSqlFiles.verbose", defaultValue = "${maven.verbose}") - private boolean verbose; - /** - * Skip flag. - */ - @Parameter(property = "generateEntityUpdateSqlFiles.skip", defaultValue = "false") - private boolean skip; - - /** - * Where to generate files. - */ - @Parameter(property = "generateEntityUpdateSqlFiles.outputDirectory", defaultValue = "${project.build.directory}/classes/", required = true) - private File outputDirectory; - - @Override - public boolean isVerbose() { - return verbose; - } - - @Override - public void setVerbose(boolean verbose) { - this.verbose = verbose; - } - - @Override - protected Path createOutputFile() { - return null; - } @Override - public boolean isSkip() { - return skip; + public String getFilenameForClassifier(ObjectModelClassifier classifier) { + return super.getFilenameForClassifier(classifier) + DtoEntityContext.LAST_UPDATE_DATE_SQL_SCRIPT_FIELD_CLASSIFIER; } @Override - protected void doAction() throws Exception { - URLClassLoader urlClassLoader = initClassLoader(getProject(), outputDirectory, true, false, true, true, true); - - Thread thread = Thread.currentThread(); - ClassLoader contextClassLoader = thread.getContextClassLoader(); - thread.setContextClassLoader(urlClassLoader); - try { - TopiaMetadataModelSupportImpl model = (TopiaMetadataModelSupportImpl) urlClassLoader.loadClass("fr.ird.observe.entities.ObserveTopiaMetadataModelSupport").newInstance(); - TopiaMetadataModel metadataModel = model.getMetadataModel(); - Iterator<TopiaMetadataEntity> iterator = metadataModel.streamWithoutAbstract().iterator(); - while (iterator.hasNext()) { - TopiaMetadataEntity topiaMetadataEntity = iterator.next(); - processEntity(metadataModel, topiaMetadataEntity); - } - } finally { - thread.setContextClassLoader(contextClassLoader); + public void generateFromClass(Writer output, ObjectModelClass input) throws IOException { + TopiaMetadataEntity entity = getEntityEnumName(input); + if (entity != null && !entity.isAbstract()) { + processEntity(entity, output); } } - protected void processEntity(TopiaMetadataModel metadataModel, TopiaMetadataEntity topiaMetadataEntity) throws IOException { - - String fullyQualifiedName = topiaMetadataEntity.getFullyQualifiedName(); - Path directory = outputDirectory.toPath(); - String[] parts = fullyQualifiedName.split("\\."); - String simpleName = parts[parts.length - 1]; - for (int i = 0; i < parts.length - 1; i++) { - directory = directory.resolve(parts[i]); - } - createDirectoryIfNecessary(directory.toFile()); + protected void processEntity(TopiaMetadataEntity entity, Writer output) throws IOException { ImmutableList<TopiaMetadataEntity> types; ImmutableList<TopiaMetadataLink> links; - Optional<TopiaMetadataEntityPath> optionalDataEntityPath = metadataModel.getDataEntityPath(topiaMetadataEntity); - if (optionalDataEntityPath.isPresent()) { - TopiaMetadataEntityPath dataEntityPath = optionalDataEntityPath.get(); - links = dataEntityPath.getLinks(); - types = TopiaMetadataEntityPath.getTypes(dataEntityPath); + Optional<TopiaMetadataEntityPath> optionalPath = getAllPaths(EntityLastUpdateDateTableSqlScriptGenerator::rejectType).getEntityPathsForEntryPoint(entity); + if (optionalPath.isPresent()) { + TopiaMetadataEntityPath path = optionalPath.get(); + links = path.getLinks(); + types = path.getTypes(); } else { // limit case, only one type - types = ImmutableList.of(topiaMetadataEntity); + types = ImmutableList.of(entity); // and no link links = ImmutableList.of(); } - { - ImmutableList<String> requests = generateLastUpdateDateFieldRequests(types, links); - generate(directory.resolve(simpleName + DtoEntityContext.LAST_UPDATE_DATE_SQL_SCRIPT_FIELD_CLASSIFIER), requests); - } - { - ImmutableList<String> requests = generateLastUpdateDateTableRequests(types); - generate(directory.resolve(simpleName + DtoEntityContext.LAST_UPDATE_DATE_SQL_SCRIPT_TABLE_CLASSIFIER), requests); - } + ImmutableList<String> requests = generateLastUpdateDateFieldRequests(types, links); + generate(output, requests); + } private ImmutableList<String> generateLastUpdateDateFieldRequests(ImmutableList<TopiaMetadataEntity> types, ImmutableList<TopiaMetadataLink> links) { @@ -170,15 +114,6 @@ public class GenerateEntityUpdateSqlFilesMojo extends ToolboxMojoSupport { return builder.build(); } - private ImmutableList<String> generateLastUpdateDateTableRequests(ImmutableList<TopiaMetadataEntity> types) { - ImmutableList.Builder<String> builder = ImmutableList.builder(); - for (TopiaMetadataEntity type : types.reverse()) { - String tableSql = String.format(UPDATE_LAST_UPDATE_DATE_TABLE_SQL, type.getFullyQualifiedName()); - builder.add(tableSql + ";"); - } - return builder.build(); - } - private String generateLastUpdateDateFieldRequest(TopiaMetadataEntity type, List<TopiaMetadataLink> inProcess) { String sql = String.format(UPDATE_LAST_UPDATE_DATE_FIELD_SQL_START, type.getDbSchemaName(), type.getDbTableName()); if (inProcess == null) { @@ -223,7 +158,7 @@ public class GenerateEntityUpdateSqlFilesMojo extends ToolboxMojoSupport { tableOwner = firstLink.getTarget(); selectColumn = firstLink.getTarget().getDbColumnName(firstLink.getOwner().getDbTableName()); } - return String.format(UPDATE_LAST_UPDATE_DATA_FIELD_SQL_SELECT_START, tableOwner.getDbSchemaName(), tableOwner.getDbTableName(), tableOwner.getDbTableName() +"."+ selectColumn); + return String.format(UPDATE_LAST_UPDATE_DATA_FIELD_SQL_SELECT_START, tableOwner.getDbSchemaName(), tableOwner.getDbTableName(), tableOwner.getDbTableName() + "." + selectColumn); } private String appendInnerJoin(TopiaMetadataLink lastLink, TopiaMetadataLink nextLink) { @@ -246,10 +181,4 @@ public class GenerateEntityUpdateSqlFilesMojo extends ToolboxMojoSupport { return finalizeRequest(targetColumn); } - private void generate(Path file, ImmutableList<String> requests) throws IOException { - getLog().debug(String.format("Will write %d requests in file: %s", requests.size(), file)); - try (SqlScriptWriter sqlScriptWriter = SqlScriptWriter.of(file)) { - requests.forEach(sqlScriptWriter::writeSql); - } - } } ===================================== templates/src/main/java/fr/ird/observe/toolkit/templates/entity/EntityLastUpdateDateTableSqlScriptGenerator.java ===================================== @@ -0,0 +1,93 @@ +package fr.ird.observe.toolkit.templates.entity; + +/*- + * #%L + * ObServe Toolkit :: Templates + * %% + * Copyright (C) 2008 - 2020 IRD, Code Lutin, Ultreia.io + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU 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 General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + +import com.google.common.collect.ImmutableList; +import fr.ird.observe.spi.context.DtoEntityContext; +import org.codehaus.plexus.component.annotations.Component; +import org.nuiton.eugene.Template; +import org.nuiton.eugene.models.object.ObjectModelClass; +import org.nuiton.eugene.models.object.ObjectModelClassifier; +import org.nuiton.topia.persistence.metadata.TopiaMetadataEntity; +import org.nuiton.topia.persistence.metadata.TopiaMetadataEntityPath; +import org.nuiton.topia.templates.TopiaMetadataModelGeneratorSupport; + +import java.io.IOException; +import java.io.Writer; +import java.util.Optional; + +/** + * Created on 13/09/2020. + * + * @author Tony Chemit - dev(a)tchemit.fr + * @since 1.27 + */ +@Component(role = Template.class, hint = "org.nuiton.topia.templates.EntityLastUpdateDateTableSqlScriptGenerator") +public class EntityLastUpdateDateTableSqlScriptGenerator extends TopiaMetadataModelGeneratorSupport { + + private static final String UPDATE_LAST_UPDATE_DATE_TABLE_SQL = "UPDATE common.lastUpdateDate SET lastUpdateDate = '%%1$s'::timestamp WHERE type ='%s'"; + + protected static boolean rejectType(TopiaMetadataEntity entity) { + return entity.isAbstract() || entity.getFullyQualifiedName().contains(".referential"); + } + + @Override + public String getFilenameForClassifier(ObjectModelClassifier classifier) { + return super.getFilenameForClassifier(classifier) + DtoEntityContext.LAST_UPDATE_DATE_SQL_SCRIPT_TABLE_CLASSIFIER; + } + + @Override + public void generateFromClass(Writer output, ObjectModelClass input) throws IOException { + TopiaMetadataEntity entity = getEntityEnumName(input); + if (entity != null && !entity.isAbstract()) { + processEntity(entity, output); + } + } + + protected void processEntity(TopiaMetadataEntity entity, Writer output) throws IOException { + + ImmutableList<TopiaMetadataEntity> types; + Optional<TopiaMetadataEntityPath> optionalPath = getAllPaths(EntityLastUpdateDateTableSqlScriptGenerator::rejectType).getEntityPathsForEntryPoint(entity); + if (optionalPath.isPresent()) { + TopiaMetadataEntityPath path = optionalPath.get(); + types = path.getTypes(); + } else { + // limit case, only one type + types = ImmutableList.of(entity); + // and no link + } + ImmutableList<String> requests = generateLastUpdateDateTableRequests(types); + generate(output, requests); + + } + + private ImmutableList<String> generateLastUpdateDateTableRequests(ImmutableList<TopiaMetadataEntity> types) { + ImmutableList.Builder<String> builder = ImmutableList.builder(); + for (TopiaMetadataEntity type : types.reverse()) { + String tableSql = String.format(UPDATE_LAST_UPDATE_DATE_TABLE_SQL, type.getFullyQualifiedName()); + builder.add(tableSql + ";"); + } + return builder.build(); + } + +} ===================================== persistence/src/main/java/fr/ird/observe/entities/ObserveTopiaMetadataModelSupport.java → templates/src/main/java/fr/ird/observe/toolkit/templates/entity/EntityPathsGenerator.java ===================================== @@ -1,8 +1,8 @@ -package fr.ird.observe.entities; +package fr.ird.observe.toolkit.templates.entity; /*- * #%L - * ObServe :: Persistence + * ObServe Toolkit :: Templates * %% * Copyright (C) 2008 - 2020 IRD, Code Lutin, Ultreia.io * %% @@ -22,10 +22,23 @@ package fr.ird.observe.entities; * #L% */ -import org.nuiton.topia.persistence.internal.support.TopiaMetadataModelSupportImpl; +import org.codehaus.plexus.component.annotations.Component; +import org.nuiton.eugene.Template; +import org.nuiton.topia.persistence.metadata.TopiaMetadataEntity; +import org.nuiton.topia.templates.TopiaMetadataEntityPathsGeneratorSupport; -public class ObserveTopiaMetadataModelSupport extends TopiaMetadataModelSupportImpl { - public ObserveTopiaMetadataModelSupport() { - super("fr.ird.observe.entities", "Observe", new ObserveTopiaApplicationContext.ObserveDataEntityPathsBuilder()); +/** + * Created on 13/09/2020. + * + * @author Tony Chemit - dev(a)tchemit.fr + * @since 8.1.0 + */ +@Component(role = Template.class, hint = "org.nuiton.topia.templates.EntityPathsGenerator") +public class EntityPathsGenerator extends TopiaMetadataEntityPathsGeneratorSupport { + + @Override + protected boolean rejectType(TopiaMetadataEntity entity) { + return EntityLastUpdateDateTableSqlScriptGenerator.rejectType(entity); } + } ===================================== test/src/main/java/fr/ird/observe/test/ObserveFixtures.java ===================================== @@ -78,10 +78,10 @@ public class ObserveFixtures { public static final ImmutableMap<String, Long> TRIP_LONGLINE_1_TABLES_COUNT = loadFixturesMapCount("count-data-longline-1"); public static final ImmutableMap<String, Long> TRIP_LONGLINE_2_TABLES_COUNT = loadFixturesMapCount("count-data-longline-2"); public static final ImmutableMap<String, Long> TRIP_LONGLINE_3_TABLES_COUNT = loadFixturesMapCount("count-data-longline-3"); + public static final ImmutableMap<String, Long> PERSISTENCE_ENTITY_PATHS = loadFixturesMapCount("entity-paths"); + private static final ImmutableMap<String, String> GLOBAL = loadFixturesMap("global"); - public static final int PERSISTENCE_PS_DATA_PATH = Integer.parseInt(GLOBAL.get("PERSISTENCE_PS_DATA_PATH")); - public static final int PERSISTENCE_LL_DATA_PATH = Integer.parseInt(GLOBAL.get("PERSISTENCE_LL_DATA_PATH")); - public static final int PERSISTENCE_DATA_PATH = PERSISTENCE_PS_DATA_PATH+PERSISTENCE_LL_DATA_PATH; + public static final int PERSISTENCE_DATA_PATH = PERSISTENCE_ENTITY_PATHS.size(); public static final String TRIP_SEINE_ID_1 = GLOBAL.get("TRIP_SEINE_ID_1"); public static final String TRIP_SEINE_ID_2 = GLOBAL.get("TRIP_SEINE_ID_2"); public static final String TRIP_SEINE_ID_3 = GLOBAL.get("TRIP_SEINE_ID_3"); ===================================== test/src/main/resources/fixtures/entity-paths.properties ===================================== @@ -0,0 +1,81 @@ +### +# #%L +# ObServe :: Test +# %% +# Copyright (C) 2008 - 2020 IRD, Code Lutin, Ultreia.io +# %% +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU 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 General Public +# License along with this program. If not, see +# <http://www.gnu.org/licenses/gpl-3.0.html>. +# #L% +### +ll_observation_Activity=1 +ll_observation_Set=2 +ll_observation_Encounter=2 +ll_observation_SensorUsed=2 +ll_observation_BaitsComposition=3 +ll_observation_FloatlinesComposition=3 +ll_observation_BranchlinesComposition=3 +ll_observation_HooksComposition=3 +ll_observation_Catch=3 +ll_observation_Section=3 +ll_observation_Tdr=3 +ll_observation_Basket=4 +ll_observation_SizeMeasure=4 +ll_observation_WeightMeasure=4 +ll_observation_Branchline=5 +ll_logbook_Activity=1 +ll_logbook_Set=2 +ll_logbook_BaitsComposition=3 +ll_logbook_FloatlinesComposition=3 +ll_logbook_HooksComposition=3 +ll_logbook_Catch=3 +ll_logbook_BranchlinesComposition=3 +ll_common_GearUseFeatures=1 +ll_common_GearUseFeaturesMeasurement=2 +ll_landing_Landing=1 +ll_landing_LandingPart=2 +ll_logbook_Sample=3 +ll_logbook_SamplePart=5 +ps_observation_Route=1 +ps_observation_Activity=2 +ps_observation_FloatingObject=3 +ps_observation_Set=3 +ps_observation_Catch=4 +ps_observation_Sample=4 +ps_observation_SchoolEstimate=4 +ps_observation_NonTargetCatchRelease=4 +ps_observation_ObjectSchoolEstimate=4 +ps_observation_ObjectObservedSpecies=4 +ps_observation_TransmittingBuoy=4 +ps_observation_FloatingObjectPart=4 +ps_observation_Size=5 +ps_logbook_Route=1 +ps_logbook_Activity=2 +ps_logbook_FloatingObject=3 +ps_logbook_Set=3 +ps_logbook_Catch=4 +ps_logbook_TransmittingBuoy=4 +ps_logbook_FloatingObjectPart=4 +ps_landing_Landing=1 +ps_wellplan_WellPlan=1 +ps_logbook_Sample=1 +ps_logbook_SampleSpecies=2 +ps_logbook_SampleSpeciesSize=3 +ps_localmarket_Batch=1 +ps_localmarket_Survey=1 +ps_localmarket_Sample=1 +ps_localmarket_SurveyPart=2 +ps_localmarket_SamplePart=2 +ps_common_GearUseFeatures=1 +ps_common_GearUseFeaturesMeasurement=2 ===================================== test/src/main/resources/fixtures/global.properties ===================================== @@ -56,7 +56,4 @@ VALIDATOR_CREATE_REFERENTIAL_COUNT_REAL=87 VALIDATOR_UPDATE_REFERENTIAL_COUNT_REAL=87 VALIDATOR_UPDATE_ENTITY_DATA_COUNT=40 -ENTITIES_LIMIT_SIZE=100 -# for fr.ird.observe.entities.ObserveTopiaMetadataModelSupportTest -PERSISTENCE_PS_DATA_PATH=32 -PERSISTENCE_LL_DATA_PATH=28 \ No newline at end of file +ENTITIES_LIMIT_SIZE=100 \ No newline at end of file ===================================== toolbox-maven-plugin/pom.xml ===================================== @@ -86,10 +86,6 @@ <groupId>io.ultreia.java4all</groupId> <artifactId>application-context</artifactId> </dependency> - <dependency> - <groupId>io.ultreia.java4all.topia</groupId> - <artifactId>persistence</artifactId> - </dependency> <dependency> <groupId>com.google.auto.service</groupId> <artifactId>auto-service-annotations</artifactId> View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/afaf0e4f6cb60cc6d0a3de85… -- View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/afaf0e4f6cb60cc6d0a3de85… You're receiving this email because of your account on gitlab.com.
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 260
  • 261
  • 262
  • 263
  • 264
  • 265
  • 266
  • ...
  • 720
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.