Tony CHEMIT pushed to branch develop-7.x at ultreiaio / ird-observe
Commits:
-
5602e3fd
by Tony Chemit at 2020-07-02T10:02:45+02:00
12 changed files:
- client-configuration/src/main/config/Client.ini
- client-configuration/src/main/i18n/getters/config.getter
- client-configuration/src/main/java/fr/ird/observe/client/configuration/ClientConfig.java
- client-core/src/main/java/fr/ird/observe/client/ui/content/data/seine/NonTargetCatchReleaseUIHandler.java
- − dto/src/main/java/fr/ird/observe/dto/referential/SpeciesGroupHelper.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
- services-local/src/main/java/fr/ird/observe/services/local/service/data/seine/NonTargetCatchReleaseServiceLocal.java
- services-local/src/main/java/fr/ird/observe/services/local/service/referential/ReferentialServiceLocal.java
- services/src/main/java/fr/ird/observe/services/service/data/seine/NonTargetCatchReleaseService.java
- services/src/main/java/fr/ird/observe/services/service/referential/ReferentialService.java
Changes:
| ... | ... | @@ -395,6 +395,14 @@ key = speciesList.longline.depredator |
| 395 | 395 |
type = string
|
| 396 | 396 |
defaultValue = "fr.ird.observe.entities.referentiel.SpeciesList#1239832675370#0.5"
|
| 397 | 397 |
|
| 398 |
+[option nonTargetCatchReleaseSpeciesGroups]
|
|
| 399 |
+description = observe.config.nonTargetCatchRelease.speciesGroups
|
|
| 400 |
+key = ui.data.ps.observation.nonTargetCatchRelease.speciesGroups
|
|
| 401 |
+type = String[]
|
|
| 402 |
+defaultValue = "fr.ird.observe.entities.referentiel.SpeciesGroup#1445863056144#0.9820877553253712,fr.ird.observe.entities.referentiel.SpeciesGroup#1239832683690#0.24333033683679461,fr.ird.observe.entities.referentiel.SpeciesGroup#1446014286433#0.6480183366605247,fr.ird.observe.entities.referentiel.SpeciesGroup#1239832683689#0.7120116158620075,fr.ird.observe.entities.referentiel.SpeciesGroup#1239832683690#0.9204972827240977"
|
|
| 403 |
+transient = true
|
|
| 404 |
+final = true
|
|
| 405 |
+ |
|
| 398 | 406 |
[option mapBackgroundColor]
|
| 399 | 407 |
description = observe.config.map.background.description
|
| 400 | 408 |
key = map.background.color
|
| ... | ... | @@ -53,6 +53,7 @@ observe.config.map.layer7.description |
| 53 | 53 |
observe.config.map.layer8.description
|
| 54 | 54 |
observe.config.map.layer9.description
|
| 55 | 55 |
observe.config.map.style.description
|
| 56 |
+observe.config.nonTargetCatchRelease.speciesGroups
|
|
| 56 | 57 |
observe.config.observation.activitysDetaillees
|
| 57 | 58 |
observe.config.observation.fauneAssociee
|
| 58 | 59 |
observe.config.observation.floatingObject
|
| ... | ... | @@ -527,6 +527,11 @@ public class ClientConfig extends GeneratedClientConfig implements NavigationTre |
| 527 | 527 |
}
|
| 528 | 528 |
}
|
| 529 | 529 |
|
| 530 |
+ public ImmutableSet<String> getNonTargetCatchReleaseSpeciesGroupsIds() {
|
|
| 531 |
+ List<String> ids = get().getOptionAsList(ClientConfigOption.NON_TARGET_CATCH_RELEASE_SPECIES_GROUPS.getKey()).getOption();
|
|
| 532 |
+ return ImmutableSet.copyOf(ids);
|
|
| 533 |
+ }
|
|
| 534 |
+ |
|
| 530 | 535 |
//////////////////////////////////////////////////
|
| 531 | 536 |
// Toutes les étapes d'actions
|
| 532 | 537 |
//////////////////////////////////////////////////
|
| ... | ... | @@ -21,6 +21,7 @@ |
| 21 | 21 |
*/
|
| 22 | 22 |
package fr.ird.observe.client.ui.content.data.seine;
|
| 23 | 23 |
|
| 24 |
+import com.google.common.collect.ImmutableSet;
|
|
| 24 | 25 |
import fr.ird.observe.client.constants.AcquisitionMode;
|
| 25 | 26 |
import fr.ird.observe.client.db.constants.DataContextType;
|
| 26 | 27 |
import fr.ird.observe.client.ui.content.ContentMode;
|
| ... | ... | @@ -42,8 +43,8 @@ import fr.ird.observe.dto.referential.seine.NonTargetCatchReleaseConformityRefer |
| 42 | 43 |
import fr.ird.observe.dto.referential.seine.NonTargetCatchReleaseStatusReference;
|
| 43 | 44 |
import fr.ird.observe.dto.referential.seine.NonTargetCatchReleasingTimeReference;
|
| 44 | 45 |
import fr.ird.observe.dto.result.SaveResultDto;
|
| 45 |
-import org.apache.logging.log4j.Logger;
|
|
| 46 | 46 |
import org.apache.logging.log4j.LogManager;
|
| 47 |
+import org.apache.logging.log4j.Logger;
|
|
| 47 | 48 |
import org.nuiton.jaxx.runtime.spi.UIHandler;
|
| 48 | 49 |
import org.nuiton.validator.NuitonValidatorScope;
|
| 49 | 50 |
|
| ... | ... | @@ -85,8 +86,11 @@ public class NonTargetCatchReleaseUIHandler extends ContentTableUIHandler<SetSei |
| 85 | 86 |
updateSpecies(species);
|
| 86 | 87 |
}
|
| 87 | 88 |
};
|
| 89 |
+ |
|
| 88 | 90 |
addReferentialFilter(NonTargetCatchReleaseDto.PROPERTY_SPECIES, incomingReferences -> {
|
| 89 |
- ReferentialDtoReferenceSet<SpeciesReference> sampleSpecies = getNonTargetCatchReleaseService().getSampleSpecies(getSelectedParentId());
|
|
| 91 |
+ ImmutableSet<String> speciesGroupIds = ui.getConfig().getNonTargetCatchReleaseSpeciesGroupsIds();
|
|
| 92 |
+// ImmutableSet<String> speciesGroupIds = ObserveSwingApplicationContext.get().getConfig().getNonTargetCatchReleaseSpeciesGroupsIds();
|
|
| 93 |
+ ReferentialDtoReferenceSet<SpeciesReference> sampleSpecies = getNonTargetCatchReleaseService().getSampleSpecies(getSelectedParentId(), speciesGroupIds);
|
|
| 90 | 94 |
return new LinkedList<>(sampleSpecies.toSet());
|
| 91 | 95 |
});
|
| 92 | 96 |
}
|
| ... | ... | @@ -177,8 +181,8 @@ public class NonTargetCatchReleaseUIHandler extends ContentTableUIHandler<SetSei |
| 177 | 181 |
super.afterInit(ui);
|
| 178 | 182 |
|
| 179 | 183 |
speciesGroupDtoMap = new TreeMap<>();
|
| 180 |
- |
|
| 181 |
- getReferentialService().loadSensibleSpeciesGroup().forEach(id -> speciesGroupDtoMap.put(id.getId(), id));
|
|
| 184 |
+ ImmutableSet<String> speciesGroupIds = ui.getConfig().getNonTargetCatchReleaseSpeciesGroupsIds();
|
|
| 185 |
+ getReferentialService().loadSensibleSpeciesGroup(speciesGroupIds).forEach(id -> speciesGroupDtoMap.put(id.getId(), id));
|
|
| 182 | 186 |
|
| 183 | 187 |
}
|
| 184 | 188 |
|
| 1 |
-package fr.ird.observe.dto.referential;
|
|
| 2 |
- |
|
| 3 |
-/*-
|
|
| 4 |
- * #%L
|
|
| 5 |
- * ObServe :: Dto
|
|
| 6 |
- * %%
|
|
| 7 |
- * Copyright (C) 2008 - 2020 IRD, Code Lutin, Ultreia.io
|
|
| 8 |
- * %%
|
|
| 9 |
- * This program is free software: you can redistribute it and/or modify
|
|
| 10 |
- * it under the terms of the GNU General Public License as
|
|
| 11 |
- * published by the Free Software Foundation, either version 3 of the
|
|
| 12 |
- * License, or (at your option) any later version.
|
|
| 13 |
- *
|
|
| 14 |
- * This program is distributed in the hope that it will be useful,
|
|
| 15 |
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
| 16 |
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
| 17 |
- * GNU General Public License for more details.
|
|
| 18 |
- *
|
|
| 19 |
- * You should have received a copy of the GNU General Public
|
|
| 20 |
- * License along with this program. If not, see
|
|
| 21 |
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
|
|
| 22 |
- * #L%
|
|
| 23 |
- */
|
|
| 24 |
- |
|
| 25 |
-import java.util.Arrays;
|
|
| 26 |
-import java.util.List;
|
|
| 27 |
- |
|
| 28 |
-public class SpeciesGroupHelper extends GeneratedSpeciesGroupHelper {
|
|
| 29 |
- //FIXME PROTECTED-ID
|
|
| 30 |
- public static final List<String> SPECIES_GROUP_IDS = Arrays.asList(
|
|
| 31 |
- "fr.ird.observe.entities.referentiel.SpeciesGroup#1445863056144#0.9820877553253712",
|
|
| 32 |
- "fr.ird.observe.entities.referentiel.SpeciesGroup#1239832683690#0.24333033683679461",
|
|
| 33 |
- "fr.ird.observe.entities.referentiel.SpeciesGroup#1446014286433#0.6480183366605247",
|
|
| 34 |
- "fr.ird.observe.entities.referentiel.SpeciesGroup#1239832683689#0.7120116158620075"
|
|
| 35 |
- );
|
|
| 36 |
-}
|
| ... | ... | @@ -1756,6 +1756,7 @@ observe.config.map.layer7.description=File (shapefile) for layer 7 of map |
| 1756 | 1756 |
observe.config.map.layer8.description=File (shapefile) for layer 8 of map
|
| 1757 | 1757 |
observe.config.map.layer9.description=File (shapefile) for layer 9 of map
|
| 1758 | 1758 |
observe.config.map.style.description=File of styles used in map
|
| 1759 |
+observe.config.nonTargetCatchRelease.speciesGroups=Species groups authorized in NonTargetCatchRelease form
|
|
| 1759 | 1760 |
observe.config.observation.activitysDetaillees=Observation of detailled activities
|
| 1760 | 1761 |
observe.config.observation.fauneAssociee=Observation of non target
|
| 1761 | 1762 |
observe.config.observation.floatingObject=Observation of floating objects
|
| ... | ... | @@ -1756,6 +1756,7 @@ observe.config.map.layer7.description=Archivo (shapeFiles) del séptimo calco de |
| 1756 | 1756 |
observe.config.map.layer8.description=Archivo (shapeFiles) del octavo calco del mapa
|
| 1757 | 1757 |
observe.config.map.layer9.description=Archivo (shapeFiles) del noveno calco del mapa
|
| 1758 | 1758 |
observe.config.map.style.description=Archivo de los estilos a aplicar sobre los calcos del mapa
|
| 1759 |
+observe.config.nonTargetCatchRelease.speciesGroups=Species groups authorized in NonTargetCatchRelease form \#TODO
|
|
| 1759 | 1760 |
observe.config.observation.activitysDetaillees=Observación de actividades detalladas
|
| 1760 | 1761 |
observe.config.observation.fauneAssociee=Observación de Fauna asociada
|
| 1761 | 1762 |
observe.config.observation.floatingObject=Observación de objetos flotantes
|
| ... | ... | @@ -1756,6 +1756,7 @@ observe.config.map.layer7.description=Fichier (Shape Files) du septième calque |
| 1756 | 1756 |
observe.config.map.layer8.description=Fichier (Shape Files) du huitième calque de la carte
|
| 1757 | 1757 |
observe.config.map.layer9.description=Fichier (Shape Files) du neuvième calque de la carte
|
| 1758 | 1758 |
observe.config.map.style.description=Fichier des style à appliquer sur les calques de la carte
|
| 1759 |
+observe.config.nonTargetCatchRelease.speciesGroups=Groupes d'espèces autorisés dans le formulaire des espèces accessoires sensibles libérées
|
|
| 1759 | 1760 |
observe.config.observation.activitysDetaillees=Observation des activités détaillées
|
| 1760 | 1761 |
observe.config.observation.fauneAssociee=Observation des Faunes associées
|
| 1761 | 1762 |
observe.config.observation.floatingObject=Observation des objets flottants
|
| ... | ... | @@ -22,11 +22,11 @@ package fr.ird.observe.services.local.service.data.seine; |
| 22 | 22 |
* #L%
|
| 23 | 23 |
*/
|
| 24 | 24 |
|
| 25 |
+import com.google.common.collect.ImmutableSet;
|
|
| 25 | 26 |
import fr.ird.observe.dto.data.seine.SetSeineNonTargetCatchReleaseDto;
|
| 26 | 27 |
import fr.ird.observe.dto.form.Form;
|
| 27 | 28 |
import fr.ird.observe.dto.reference.ReferentialDtoReferenceSet;
|
| 28 | 29 |
import fr.ird.observe.dto.referential.SpeciesReference;
|
| 29 |
-import fr.ird.observe.dto.referential.SpeciesGroupHelper;
|
|
| 30 | 30 |
import fr.ird.observe.dto.result.SaveResultDto;
|
| 31 | 31 |
import fr.ird.observe.entities.seine.NonTargetCatch;
|
| 32 | 32 |
import fr.ird.observe.entities.seine.SetSeine;
|
| ... | ... | @@ -45,7 +45,7 @@ public class NonTargetCatchReleaseServiceLocal extends ObserveServiceLocal imple |
| 45 | 45 |
private static final Logger log = LogManager.getLogger(NonTargetCatchReleaseServiceLocal.class);
|
| 46 | 46 |
|
| 47 | 47 |
@Override
|
| 48 |
- public ReferentialDtoReferenceSet<SpeciesReference> getSampleSpecies(String setSeineId) {
|
|
| 48 |
+ public ReferentialDtoReferenceSet<SpeciesReference> getSampleSpecies(String setSeineId, ImmutableSet<String> speciesGroupIds) {
|
|
| 49 | 49 |
if (log.isTraceEnabled()) {
|
| 50 | 50 |
log.trace("getSampleSpecies(" + setSeineId + ")");
|
| 51 | 51 |
}
|
| ... | ... | @@ -55,7 +55,7 @@ public class NonTargetCatchReleaseServiceLocal extends ObserveServiceLocal imple |
| 55 | 55 |
return SPECIES_SPI.toReferentialReferenceSet(setSeine.getNonTargetCatch().stream()
|
| 56 | 56 |
.map(NonTargetCatch::getSpecies)
|
| 57 | 57 |
.distinct()
|
| 58 |
- .filter(s -> SpeciesGroupHelper.SPECIES_GROUP_IDS.contains(s.getSpeciesGroup().getTopiaId()))
|
|
| 58 |
+ .filter(s -> speciesGroupIds.contains(s.getSpeciesGroup().getTopiaId()))
|
|
| 59 | 59 |
.collect(Collectors.toList()), getReferentialLocale(), null);
|
| 60 | 60 |
}
|
| 61 | 61 |
|
| ... | ... | @@ -43,7 +43,6 @@ import fr.ird.observe.dto.referential.ReferentialDto; |
| 43 | 43 |
import fr.ird.observe.dto.referential.ReferentialLocale;
|
| 44 | 44 |
import fr.ird.observe.dto.referential.SpeciesDto;
|
| 45 | 45 |
import fr.ird.observe.dto.referential.SpeciesGroupDto;
|
| 46 |
-import fr.ird.observe.dto.referential.SpeciesGroupHelper;
|
|
| 47 | 46 |
import fr.ird.observe.dto.referential.seine.ObservedSystemReference;
|
| 48 | 47 |
import fr.ird.observe.dto.result.SaveResultDto;
|
| 49 | 48 |
import fr.ird.observe.entities.ObserveDataEntity;
|
| ... | ... | @@ -168,10 +167,10 @@ public class ReferentialServiceLocal extends ObserveServiceLocal implements Refe |
| 168 | 167 |
}
|
| 169 | 168 |
|
| 170 | 169 |
@Override
|
| 171 |
- public ImmutableSet<SpeciesGroupDto> loadSensibleSpeciesGroup() {
|
|
| 170 |
+ public ImmutableSet<SpeciesGroupDto> loadSensibleSpeciesGroup(ImmutableSet<String> ids) {
|
|
| 172 | 171 |
ImmutableSet.Builder<SpeciesGroupDto> result = ImmutableSet.builder();
|
| 173 |
- for (String speciesGroupId : SpeciesGroupHelper.SPECIES_GROUP_IDS) {
|
|
| 174 |
- result.add(loadSpeciesGroup(speciesGroupId));
|
|
| 172 |
+ for (String id : ids) {
|
|
| 173 |
+ result.add(loadSpeciesGroup(id));
|
|
| 175 | 174 |
}
|
| 176 | 175 |
return result.build();
|
| 177 | 176 |
}
|
| ... | ... | @@ -22,6 +22,7 @@ package fr.ird.observe.services.service.data.seine; |
| 22 | 22 |
* #L%
|
| 23 | 23 |
*/
|
| 24 | 24 |
|
| 25 |
+import com.google.common.collect.ImmutableSet;
|
|
| 25 | 26 |
import fr.ird.observe.dto.data.seine.SetSeineNonTargetCatchReleaseDto;
|
| 26 | 27 |
import fr.ird.observe.dto.form.Form;
|
| 27 | 28 |
import fr.ird.observe.dto.reference.ReferentialDtoReferenceSet;
|
| ... | ... | @@ -41,7 +42,7 @@ public interface NonTargetCatchReleaseService extends ObserveService { |
| 41 | 42 |
|
| 42 | 43 |
@Get
|
| 43 | 44 |
@ReadDataPermission
|
| 44 |
- ReferentialDtoReferenceSet<SpeciesReference> getSampleSpecies(String setSeineId);
|
|
| 45 |
+ ReferentialDtoReferenceSet<SpeciesReference> getSampleSpecies(String setSeineId, ImmutableSet<String> speciesGroupIds);
|
|
| 45 | 46 |
|
| 46 | 47 |
@Get
|
| 47 | 48 |
@ReadDataPermission
|
| ... | ... | @@ -85,7 +85,7 @@ public interface ReferentialService extends ObserveService { |
| 85 | 85 |
|
| 86 | 86 |
@ReadReferentialPermission
|
| 87 | 87 |
@Get
|
| 88 |
- ImmutableSet<SpeciesGroupDto> loadSensibleSpeciesGroup();
|
|
| 88 |
+ ImmutableSet<SpeciesGroupDto> loadSensibleSpeciesGroup(ImmutableSet<String> ids);
|
|
| 89 | 89 |
//FIXME charger cela dans le cache côté applicatif
|
| 90 | 90 |
|
| 91 | 91 |
@ReadReferentialPermission
|