Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe
Commits:
-
e8ee529f
by Tony Chemit at 2021-01-21T18:19:47+01:00
7 changed files:
- client/datasource/editor/ps/src/main/i18n/getters/jaxx.getter
- client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/observation/SetNonTargetCatchReleaseUI.jcss
- client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/observation/SetNonTargetCatchReleaseUIModelStates.java
- client/i18n/src/main/i18n/translations/observe_en_GB.properties
- client/i18n/src/main/i18n/translations/observe_es_ES.properties
- client/i18n/src/main/i18n/translations/observe_fr_FR.properties
- models/persistence/src/main/java/fr/ird/observe/entities/data/ps/observation/SetImpl.java
Changes:
| ... | ... | @@ -89,7 +89,6 @@ observe.data.ps.observation.NonTargetCatchRelease.length |
| 89 | 89 |
observe.data.ps.observation.NonTargetCatchRelease.message.cantAdd
|
| 90 | 90 |
observe.data.ps.observation.NonTargetCatchRelease.releasingTime
|
| 91 | 91 |
observe.data.ps.observation.NonTargetCatchRelease.speciesGroupReleaseMode
|
| 92 |
-observe.data.ps.observation.NonTargetCatchRelease.table.deleteExtraMessage
|
|
| 93 | 92 |
observe.data.ps.observation.NonTargetLength.count
|
| 94 | 93 |
observe.data.ps.observation.NonTargetLength.length
|
| 95 | 94 |
observe.data.ps.observation.NonTargetLength.picturesReferences
|
| ... | ... | @@ -20,10 +20,6 @@ |
| 20 | 20 |
* #L%
|
| 21 | 21 |
*/
|
| 22 | 22 |
|
| 23 |
-#tableModel {
|
|
| 24 |
- deleteExtraMessage:{t("observe.data.ps.observation.NonTargetCatchRelease.table.deleteExtraMessage")};
|
|
| 25 |
-}
|
|
| 26 |
- |
|
| 27 | 23 |
#editorPanel {
|
| 28 | 24 |
_focusComponent:{species};
|
| 29 | 25 |
}
|
| ... | ... | @@ -27,7 +27,9 @@ import fr.ird.observe.client.constants.AcquisitionMode; |
| 27 | 27 |
import fr.ird.observe.client.datasource.api.cache.ReferencesCache;
|
| 28 | 28 |
import fr.ird.observe.client.datasource.api.cache.ReferencesFilterHelper;
|
| 29 | 29 |
import fr.ird.observe.dto.data.ps.observation.NonTargetCatchReleaseDto;
|
| 30 |
+import fr.ird.observe.dto.data.ps.observation.SetNonTargetCatchReleaseDto;
|
|
| 30 | 31 |
import fr.ird.observe.dto.referential.common.SpeciesGroupDto;
|
| 32 |
+import fr.ird.observe.dto.referential.common.SpeciesReference;
|
|
| 31 | 33 |
import fr.ird.observe.navigation.select.ProjectSelectModel;
|
| 32 | 34 |
import fr.ird.observe.services.ObserveServicesProvider;
|
| 33 | 35 |
import io.ultreia.java4all.bean.spi.GenerateJavaBeanDefinition;
|
| ... | ... | @@ -47,7 +49,7 @@ public class SetNonTargetCatchReleaseUIModelStates extends GeneratedSetNonTarget |
| 47 | 49 |
|
| 48 | 50 |
@Override
|
| 49 | 51 |
public void onAfterInitAddReferentialFilters(ClientConfig clientConfig, ProjectSelectModel observeSelectModel, ObserveServicesProvider servicesProvider, ReferencesCache referenceCache) {
|
| 50 |
- referenceCache.addReferentialFilter(NonTargetCatchReleaseDto.PROPERTY_SPECIES, ReferencesFilterHelper.newSubList(getBean().getAvailableSpeciesIds()));
|
|
| 52 |
+ referenceCache.addReferentialFilter(NonTargetCatchReleaseDto.PROPERTY_SPECIES, ReferencesFilterHelper.<SetNonTargetCatchReleaseDto, SpeciesReference>newSubList(SetNonTargetCatchReleaseDto::getAvailableSpeciesIds));
|
|
| 51 | 53 |
}
|
| 52 | 54 |
|
| 53 | 55 |
public Map<String, SpeciesGroupDto> getSpeciesGroupDtoMap() {
|
| ... | ... | @@ -58,5 +60,4 @@ public class SetNonTargetCatchReleaseUIModelStates extends GeneratedSetNonTarget |
| 58 | 60 |
public void initDefault(NonTargetCatchReleaseDto newTableBean) {
|
| 59 | 61 |
newTableBean.setAcquisitionMode(AcquisitionMode.individual.ordinal());
|
| 60 | 62 |
}
|
| 61 |
- |
|
| 62 | 63 |
}
|
| ... | ... | @@ -943,7 +943,6 @@ observe.data.ps.observation.NonTargetCatchRelease.releasingTime.short=Releasing |
| 943 | 943 |
observe.data.ps.observation.NonTargetCatchRelease.sex.short=Sex
|
| 944 | 944 |
observe.data.ps.observation.NonTargetCatchRelease.species.short=Species
|
| 945 | 945 |
observe.data.ps.observation.NonTargetCatchRelease.speciesGroupReleaseMode.short=Mode
|
| 946 |
-observe.data.ps.observation.NonTargetCatchRelease.table.deleteExtraMessage=\nIf you delete this catches released, samples using this species will also be deleted.
|
|
| 947 | 946 |
observe.data.ps.observation.NonTargetLength.count.short=Count
|
| 948 | 947 |
observe.data.ps.observation.NonTargetLength.length.short=Length
|
| 949 | 948 |
observe.data.ps.observation.NonTargetLength.picturesReferences=Pictures references
|
| ... | ... | @@ -943,7 +943,6 @@ observe.data.ps.observation.NonTargetCatchRelease.releasingTime.short=Tiempo de |
| 943 | 943 |
observe.data.ps.observation.NonTargetCatchRelease.sex.short=Sexo
|
| 944 | 944 |
observe.data.ps.observation.NonTargetCatchRelease.species.short=Especie
|
| 945 | 945 |
observe.data.ps.observation.NonTargetCatchRelease.speciesGroupReleaseMode.short=Modo
|
| 946 |
-observe.data.ps.observation.NonTargetCatchRelease.table.deleteExtraMessage=\nLa eliminación de una captura de fauna puede tener como consecuencia la eliminación de muestreo(s) de la especie. \#TODO
|
|
| 947 | 946 |
observe.data.ps.observation.NonTargetLength.count.short=Grupo de tallas
|
| 948 | 947 |
observe.data.ps.observation.NonTargetLength.length.short=Talla
|
| 949 | 948 |
observe.data.ps.observation.NonTargetLength.picturesReferences=Referencia foto
|
| ... | ... | @@ -925,11 +925,11 @@ observe.data.ps.observation.NonTargetCatch.meanLengthComputed.observed.tip=La ta |
| 925 | 925 |
observe.data.ps.observation.NonTargetCatch.meanWeight.short=Poids moy
|
| 926 | 926 |
observe.data.ps.observation.NonTargetCatch.meanWeightComputed.computed.tip=Le poids moyen a été calculé (%s)
|
| 927 | 927 |
observe.data.ps.observation.NonTargetCatch.meanWeightComputed.observed.tip=Le poids moyen a été observé
|
| 928 |
-observe.data.ps.observation.NonTargetCatch.message.table.will.delete.nonTargetSample=En confirmant la sauvegarde des objets vont être supprimés\!\n\nLes espèces suivantes ne seront plus utilisables dans des échantillonages ou les espèces libérées \:\n%1$s\nCela entrainera la suppression des données saisies liées à ces espèces
|
|
| 928 |
+observe.data.ps.observation.NonTargetCatch.message.will.delete.sub.data=En confirmant la sauvegarde des objets vont être supprimés\!\n\nLes espèces suivantes ne seront plus utilisables dans des échantillonnages ou les espèces libérées \:\n%1$s\nCela entrainera la suppression des données saisies liées à ces espèces
|
|
| 929 |
+observe.data.ps.observation.NonTargetCatch.message.will.delete.sub.data.for.species=\nLe fait de supprimer cette capture rend indisponible l'espèce (%s) sur les libérations ou les échantillons.\nLes libérations ou échantillons utilisant cette espèce seront alors supprimer.
|
|
| 929 | 930 |
observe.data.ps.observation.NonTargetCatch.reasonForDiscard.short=Raison rejet
|
| 930 | 931 |
observe.data.ps.observation.NonTargetCatch.species.short=Espèce de faune
|
| 931 | 932 |
observe.data.ps.observation.NonTargetCatch.speciesFate.short=Devenir
|
| 932 |
-observe.data.ps.observation.NonTargetCatch.table.deleteExtraMessage=\nLe fait de supprimer une capture de faune peut entrainer la suppression d'échantillonnage(s) sur l'espèce.
|
|
| 933 | 933 |
observe.data.ps.observation.NonTargetCatch.totalCount.short=Nombre
|
| 934 | 934 |
observe.data.ps.observation.NonTargetCatch.totalCountComputed.computed.tip=Le nombre estimé a été calculé (%s)
|
| 935 | 935 |
observe.data.ps.observation.NonTargetCatch.totalCountComputed.observed.tip=Le nombre estimé a été observé
|
| ... | ... | @@ -943,7 +943,6 @@ observe.data.ps.observation.NonTargetCatchRelease.releasingTime.short=Moment |
| 943 | 943 |
observe.data.ps.observation.NonTargetCatchRelease.sex.short=Sexe
|
| 944 | 944 |
observe.data.ps.observation.NonTargetCatchRelease.species.short=Espèce
|
| 945 | 945 |
observe.data.ps.observation.NonTargetCatchRelease.speciesGroupReleaseMode.short=Mode
|
| 946 |
-observe.data.ps.observation.NonTargetCatchRelease.table.deleteExtraMessage=\nLe fait de supprimer une capture de faune peut entrainer la suppression d'échantillonnage(s) sur l'espèce. \#TODO
|
|
| 947 | 946 |
observe.data.ps.observation.NonTargetLength.count.short=Effectif
|
| 948 | 947 |
observe.data.ps.observation.NonTargetLength.length.short=Longueur
|
| 949 | 948 |
observe.data.ps.observation.NonTargetLength.picturesReferences=référence photo
|
| ... | ... | @@ -100,7 +100,7 @@ public class SetImpl extends SetAbstract { |
| 100 | 100 |
|
| 101 | 101 |
@Override
|
| 102 | 102 |
public boolean canUseNonTargetCatchRelease() {
|
| 103 |
- return isNonTargetCatchReleaseNotEmpty() && getNonTargetCatch().stream().anyMatch(t -> isSpeciesGroupRelease(t.getSpecies()));
|
|
| 103 |
+ return isNonTargetCatchNotEmpty() && getNonTargetCatch().stream().anyMatch(t -> isSpeciesGroupRelease(t.getSpecies()));
|
|
| 104 | 104 |
}
|
| 105 | 105 |
|
| 106 | 106 |
public boolean isSpeciesGroupRelease(Species species) {
|
| ... | ... | @@ -136,6 +136,10 @@ public class SetImpl extends SetAbstract { |
| 136 | 136 |
toSetNonTargetCatchDto(referentialLocale, (SetNonTargetCatchDto) dto);
|
| 137 | 137 |
return;
|
| 138 | 138 |
}
|
| 139 |
+ if (dto instanceof SetNonTargetCatchReleaseDto) {
|
|
| 140 |
+ toSetNonTargetCatchReleaseDto(referentialLocale, (SetNonTargetCatchReleaseDto) dto);
|
|
| 141 |
+ return;
|
|
| 142 |
+ }
|
|
| 139 | 143 |
super.toDto(referentialLocale, dto);
|
| 140 | 144 |
if (dto instanceof SetDto) {
|
| 141 | 145 |
((SetDto) dto).setDiscardedTargetSampleEnabled(canUseDiscardedTargetSample());
|
| ... | ... | @@ -143,9 +147,6 @@ public class SetImpl extends SetAbstract { |
| 143 | 147 |
((SetDto) dto).setNonTargetSampleEnabled(canUseNonTargetSample());
|
| 144 | 148 |
((SetDto) dto).setSetNonTargetCatchReleaseEnabled(canUseNonTargetCatchRelease());
|
| 145 | 149 |
}
|
| 146 |
- if (dto instanceof SetNonTargetCatchReleaseDto) {
|
|
| 147 |
- ((SetNonTargetCatchReleaseDto) dto).setAvailableSpeciesIds(getNonTargetCatch().stream().map(NonTargetCatch::getSpecies).filter(this::isSpeciesGroupRelease).map(Species::getTopiaId).distinct().collect(ImmutableSet.toImmutableSet()));
|
|
| 148 |
- }
|
|
| 149 | 150 |
if (dto instanceof NonTargetSampleDto) {
|
| 150 | 151 |
((NonTargetSampleDto) dto).setAvailableSpeciesIds(getNonTargetCatch().stream().map(NonTargetCatch::getSpecies).map(Species::getTopiaId).distinct().collect(ImmutableSet.toImmutableSet()));
|
| 151 | 152 |
((NonTargetSampleDto) dto).setAvailableSpeciesFateIds(getNonTargetCatch().stream().map(NonTargetCatch::getSpeciesFate).map(SpeciesFate::getTopiaId).distinct().collect(ImmutableSet.toImmutableSet()));
|
| ... | ... | @@ -160,10 +161,6 @@ public class SetImpl extends SetAbstract { |
| 160 | 161 |
|
| 161 | 162 |
@Override
|
| 162 | 163 |
public <D extends DataDto> void fromDto(ReferentialLocale referentialLocale, D dto) {
|
| 163 |
- if (dto instanceof SetDiscardedTargetCatchDto) {
|
|
| 164 |
- fromSetDiscardedTargetCatchDto(referentialLocale, (SetDiscardedTargetCatchDto) dto);
|
|
| 165 |
- return;
|
|
| 166 |
- }
|
|
| 167 | 164 |
if (dto instanceof SetKeptTargetCatchDto) {
|
| 168 | 165 |
fromSetKeptTargetCatchDto(referentialLocale, (SetKeptTargetCatchDto) dto);
|
| 169 | 166 |
return;
|
| ... | ... | @@ -206,7 +203,7 @@ public class SetImpl extends SetAbstract { |
| 206 | 203 |
dtoList.forEach(catchDto -> {
|
| 207 | 204 |
SpeciesReference species = catchDto.getSpecies();
|
| 208 | 205 |
boolean hasSample = speciesId.contains(species.getId());
|
| 209 |
- catchDto.set(KeptTargetCatchDto.PROPERTY_HAS_SAMPLE, hasSample);
|
|
| 206 |
+ catchDto.setHasSample(hasSample);
|
|
| 210 | 207 |
});
|
| 211 | 208 |
}
|
| 212 | 209 |
}
|
| ... | ... | @@ -224,7 +221,7 @@ public class SetImpl extends SetAbstract { |
| 224 | 221 |
dtoList.forEach(catchDto -> {
|
| 225 | 222 |
SpeciesReference species = catchDto.getSpecies();
|
| 226 | 223 |
boolean hasSample = speciesId.contains(species.getId());
|
| 227 |
- catchDto.set(KeptTargetCatchDto.PROPERTY_HAS_SAMPLE, hasSample);
|
|
| 224 |
+ catchDto.setHasSample(hasSample);
|
|
| 228 | 225 |
});
|
| 229 | 226 |
}
|
| 230 | 227 |
}
|
| ... | ... | @@ -255,6 +252,12 @@ public class SetImpl extends SetAbstract { |
| 255 | 252 |
}
|
| 256 | 253 |
}
|
| 257 | 254 |
|
| 255 |
+ private void toSetNonTargetCatchReleaseDto(ReferentialLocale referentialLocale, SetNonTargetCatchReleaseDto dto) {
|
|
| 256 |
+ // do normal copy
|
|
| 257 |
+ super.toDto(referentialLocale, dto);
|
|
| 258 |
+ dto.setAvailableSpeciesIds(getNonTargetCatch().stream().map(NonTargetCatch::getSpecies).filter(this::isSpeciesGroupRelease).map(Species::getTopiaId).distinct().collect(ImmutableSet.toImmutableSet()));
|
|
| 259 |
+ }
|
|
| 260 |
+ |
|
| 258 | 261 |
private void fromSetKeptTargetCatchDto(ReferentialLocale referentialLocale, SetKeptTargetCatchDto dto) {
|
| 259 | 262 |
// keep other catches
|
| 260 | 263 |
List<TargetCatch> otherTargetCatches = getTargetCatch(true);
|
| ... | ... | @@ -272,23 +275,6 @@ public class SetImpl extends SetAbstract { |
| 272 | 275 |
otherTargetCatches.forEach(this::addTargetCatch);
|
| 273 | 276 |
}
|
| 274 | 277 |
|
| 275 |
- private void fromSetDiscardedTargetCatchDto(ReferentialLocale referentialLocale, SetDiscardedTargetCatchDto dto) {
|
|
| 276 |
- // keep other catches
|
|
| 277 |
- List<TargetCatch> otherTargetCatches = getTargetCatch(false);
|
|
| 278 |
- // do normal copy
|
|
| 279 |
- super.fromDto(referentialLocale, dto);
|
|
| 280 |
- // delete any sample which not using the given species ids
|
|
| 281 |
- TargetSample targetSample = getTargetSample(true);
|
|
| 282 |
- if (targetSample != null) {
|
|
| 283 |
- List<DiscardedTargetCatchDto> targetCatch = dto.getTargetCatch();
|
|
| 284 |
- Set<String> speciesIds = DtoReferenceAware.ids(targetCatch.stream().map(DiscardedTargetCatchDto::getSpecies));
|
|
| 285 |
- // remove sample from species ids
|
|
| 286 |
- targetSample.getTargetLength().removeIf(targetLength -> !speciesIds.contains(targetLength.getSpecies().getTopiaId()));
|
|
| 287 |
- }
|
|
| 288 |
- // push back other catches
|
|
| 289 |
- otherTargetCatches.forEach(this::addTargetCatch);
|
|
| 290 |
- }
|
|
| 291 |
- |
|
| 292 | 278 |
private List<TargetCatch> getTargetCatch(boolean discarded) {
|
| 293 | 279 |
return super.getTargetCatch().stream().filter(c -> c != null && Objects.equals(discarded, c.isDiscarded())).collect(Collectors.toList());
|
| 294 | 280 |
}
|