Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe
Commits:
-
b7a9705c
by Tony CHEMIT at 2017-08-19T12:25:40+02:00
-
4a0f6bd7
by Tony CHEMIT at 2017-08-19T12:25:56+02:00
25 changed files:
- client-configuration/src/main/config/Client.ini
- client-configuration/src/main/java/fr/ird/observe/client/configuration/ClientConfig.java
- client-configuration/src/main/resources/i18n/client-configuration_en_GB.properties
- client-configuration/src/main/resources/i18n/client-configuration_es_ES.properties
- client-configuration/src/main/resources/i18n/client-configuration_fr_FR.properties
- client/src/main/java/fr/ird/observe/client/FloatingObjectReferencesManager.java
- client/src/main/java/fr/ird/observe/client/ObserveOpenDataManager.java
- client/src/main/java/fr/ird/observe/client/db/ClientDataContext.java
- client/src/main/java/fr/ird/observe/client/db/ObserveDataSourcesManager.java
- client/src/main/java/fr/ird/observe/client/ui/ObserveMainUIInitializer.java
- client/src/main/java/fr/ird/observe/client/ui/actions/main/global/OpenDataGlobalUIAction.java
- client/src/main/java/fr/ird/observe/client/ui/actions/main/menu/navigation/GotoReferentialCommonAction.java
- client/src/main/java/fr/ird/observe/client/ui/admin/validate/ValidateUIHandler.java
- client/src/main/java/fr/ird/observe/client/ui/content/ref/ReferenceHomeUIModel.java
- client/src/main/java/fr/ird/observe/client/ui/storage/StorageUIHandler.java
- client/src/main/java/fr/ird/observe/client/ui/tree/navigation/NavigationTree.java
- client/src/main/java/fr/ird/observe/client/ui/tree/navigation/nodes/referential/ReferentialsNavigationTreeNodeSupport.java
- common/src/main/java/fr/ird/observe/common/ObserveUtil.java
- server/src/main/filtered-resources/mapping
- services-topia/src/main/java/fr/ird/observe/services/topia/service/data/NavigationServiceTopia.java
- services-topia/src/main/java/fr/ird/observe/services/topia/service/data/seine/FloatingObjectServiceTopia.java
- services/src/main/java/fr/ird/observe/services/decoration/ObserveI18nDecoratorHelper.java
- services/src/main/java/fr/ird/observe/services/service/data/NavigationService.java
- services/src/main/java/fr/ird/observe/services/service/data/seine/FloatingObjectService.java
- services/src/main/java/fr/ird/observe/services/validation/ValidationDataContext.java
Changes:
| ... | ... | @@ -454,6 +454,11 @@ description = observe.config.ui.treeOpenNodes |
| 454 | 454 |
key = ui.treeOpenNodes
|
| 455 | 455 |
type = string
|
| 456 | 456 |
|
| 457 |
+[option treeSelectedNodes]
|
|
| 458 |
+description = observe.config.ui.treeSelectedNodes.description
|
|
| 459 |
+key = ui.treeSelectedNodes
|
|
| 460 |
+type = string
|
|
| 461 |
+ |
|
| 457 | 462 |
[option validationSpeedEnable]
|
| 458 | 463 |
description = observe.config.validation.speedEnable
|
| 459 | 464 |
key = validation.speedEnable
|
| ... | ... | @@ -339,7 +339,19 @@ public class ClientConfig extends GeneratedClientConfig { |
| 339 | 339 |
|
| 340 | 340 |
public void saveTreeOpenNodeIds(String... ids) {
|
| 341 | 341 |
setTreeOpenNodes(StringUtils.join(ids, ","));
|
| 342 |
- saveForUser();
|
|
| 342 |
+ }
|
|
| 343 |
+ |
|
| 344 |
+ public String[] getTreeSelectedNodeIds() {
|
|
| 345 |
+ String ids = getTreeSelectedNodes();
|
|
| 346 |
+ String[] result = null;
|
|
| 347 |
+ if (ids != null) {
|
|
| 348 |
+ result = ids.split(",");
|
|
| 349 |
+ }
|
|
| 350 |
+ return result;
|
|
| 351 |
+ }
|
|
| 352 |
+ |
|
| 353 |
+ public void saveTreeSelectedNodeIds(String... ids) {
|
|
| 354 |
+ setTreeSelectedNodes(StringUtils.join(ids, ","));
|
|
| 343 | 355 |
}
|
| 344 | 356 |
|
| 345 | 357 |
public File newBackupDataFile() {
|
| ... | ... | @@ -86,6 +86,7 @@ observe.config.ui.showNumberEditorButton=Flag sets to true to show button to inv |
| 86 | 86 |
observe.config.ui.showTimeEditorSlider=Show timer slider
|
| 87 | 87 |
observe.config.ui.storeRemoteStorage=Flag sets to true to store in config a remote connexion (except passwords)
|
| 88 | 88 |
observe.config.ui.treeOpenNodes=Opened data from last session
|
| 89 |
+observe.config.ui.treeSelectedNodes.description=Selected nodes on last data source
|
|
| 89 | 90 |
observe.config.validation.lengthWeightEnable=Force validation of species length max
|
| 90 | 91 |
observe.config.validation.speedEnable=Force validation of activities speed
|
| 91 | 92 |
observe.config.validation.speedMaxValue=Max speed value used in activities speed validation
|
| ... | ... | @@ -86,6 +86,7 @@ observe.config.ui.showNumberEditorButton=Para mostrar el botón que permite usar |
| 86 | 86 |
observe.config.ui.showTimeEditorSlider=Para mostrar la regla de edición de las horas
|
| 87 | 87 |
observe.config.ui.storeRemoteStorage=Para activar la copia de seguridad de la configuración de la fuente de datos remota
|
| 88 | 88 |
observe.config.ui.treeOpenNodes=Nudos abiertos del arbol abiertos cuando se cerró la base por última vez
|
| 89 |
+observe.config.ui.treeSelectedNodes.description=Selected nodes on last data source \#TODO
|
|
| 89 | 90 |
observe.config.validation.lengthWeightEnable=Forcer la validation des bormes min/max de taille d'espèce \#TODO
|
| 90 | 91 |
observe.config.validation.speedEnable=Force validation of activities speedTODO
|
| 91 | 92 |
observe.config.validation.speedMaxValue=Max speed value used in activities speed validationTODO
|
| ... | ... | @@ -86,6 +86,7 @@ observe.config.ui.showNumberEditorButton=Pour afficher le bouton qui permet d'ut |
| 86 | 86 |
observe.config.ui.showTimeEditorSlider=Pour afficher la réglette d'édition des heures
|
| 87 | 87 |
observe.config.ui.storeRemoteStorage=Pour activer la sauvegarde de la configuration de la source distante
|
| 88 | 88 |
observe.config.ui.treeOpenNodes=Nœuds de l'arbre ouverts lors de la dernière fermeture de la base
|
| 89 |
+observe.config.ui.treeSelectedNodes.description=Nœuds sélectionnés sur la dernière base ouverte
|
|
| 89 | 90 |
observe.config.validation.lengthWeightEnable=Forcer la validation des bormes min/max de taille d'espèce
|
| 90 | 91 |
observe.config.validation.speedEnable=Forcer la validation des vitesses d'activités
|
| 91 | 92 |
observe.config.validation.speedMaxValue=Vitesse maximale autorisée dans le contrôle des vitesses d'activités
|
| ... | ... | @@ -81,7 +81,7 @@ public class FloatingObjectReferencesManager { |
| 81 | 81 |
public void sanitize(ProgressModel progressModel, ObserveSwingDataSource dataSource) {
|
| 82 | 82 |
|
| 83 | 83 |
ImmutableSet<String> existingIds = getIds();
|
| 84 |
- ImmutableSet<String> ids = dataSource.getFloatingObjectService().retainExistingIds(existingIds);
|
|
| 84 |
+ ImmutableSet<String> ids = dataSource.getNavigationService().retainExistingIds(existingIds);
|
|
| 85 | 85 |
int beforeSize = references.size();
|
| 86 | 86 |
|
| 87 | 87 |
Iterator<FloatingObjectReference> iterator = references.iterator();
|
| ... | ... | @@ -23,12 +23,10 @@ package fr.ird.observe.client; |
| 23 | 23 |
*/
|
| 24 | 24 |
|
| 25 | 25 |
import com.google.common.base.Preconditions;
|
| 26 |
+import com.google.common.collect.ImmutableSet;
|
|
| 26 | 27 |
import fr.ird.observe.client.db.ClientDataContext;
|
| 27 | 28 |
import fr.ird.observe.client.db.ObserveSwingDataSource;
|
| 28 | 29 |
import fr.ird.observe.client.ui.util.ProgressModel;
|
| 29 |
-import fr.ird.observe.services.ObserveServicesProvider;
|
|
| 30 |
-import fr.ird.observe.services.dto.IdHelper;
|
|
| 31 |
-import fr.ird.observe.services.dto.referential.ProgramDto;
|
|
| 32 | 30 |
import java.io.Closeable;
|
| 33 | 31 |
import java.util.Objects;
|
| 34 | 32 |
|
| ... | ... | @@ -47,7 +45,7 @@ public class ObserveOpenDataManager implements Closeable { |
| 47 | 45 |
this.dataContext = dataContext;
|
| 48 | 46 |
}
|
| 49 | 47 |
|
| 50 |
- public boolean canOpenProgram() {
|
|
| 48 |
+ private boolean canOpenProgram() {
|
|
| 51 | 49 |
return !dataContext.isOpenProgram();
|
| 52 | 50 |
}
|
| 53 | 51 |
|
| ... | ... | @@ -290,60 +288,22 @@ public class ObserveOpenDataManager implements Closeable { |
| 290 | 288 |
dataContext.resetOpen();
|
| 291 | 289 |
}
|
| 292 | 290 |
|
| 293 |
- public void sanitizeOpenIds(ProgressModel progressModel, String[] ids) {
|
|
| 291 |
+ public void sanitizeIds(ProgressModel progressModel, String[] ids) {
|
|
| 294 | 292 |
if (ids != null) {
|
| 295 | 293 |
|
| 296 |
- boolean exists = true;
|
|
| 294 |
+ ImmutableSet<String> safeIds = ObserveSwingDataSource.MAIN.getNavigationService().retainExistingIds(ImmutableSet.copyOf(ids));
|
|
| 295 |
+ |
|
| 296 |
+ progressModel.incrementsCurrentStep();
|
|
| 297 | 297 |
|
| 298 | 298 |
for (int i = 0, l = ids.length; i < l; i++) {
|
| 299 | 299 |
String id = ids[i];
|
| 300 |
- |
|
| 301 |
- // si l'id précédent existe, on vérifie l'actuel
|
|
| 302 |
- // sinon, on met à null
|
|
| 303 |
- if (exists) {
|
|
| 304 |
- ObserveServicesProvider servicesProvider = ObserveSwingDataSource.MAIN;
|
|
| 305 |
- if (IdHelper.isProgramId(id)) {
|
|
| 306 |
- |
|
| 307 |
- exists = servicesProvider.getReferentialService().exists(ProgramDto.class, id);
|
|
| 308 |
- |
|
| 309 |
- } else if (IdHelper.isTripSeineId(id)) {
|
|
| 310 |
- |
|
| 311 |
- exists = servicesProvider.getTripSeineService().exists(id);
|
|
| 312 |
- |
|
| 313 |
- } else if (IdHelper.isRouteId(id)) {
|
|
| 314 |
- |
|
| 315 |
- exists = servicesProvider.getRouteService().exists(id);
|
|
| 316 |
- |
|
| 317 |
- } else if (IdHelper.isActivitySeineId(id)) {
|
|
| 318 |
- |
|
| 319 |
- exists = servicesProvider.getActivitySeineService().exists(id);
|
|
| 320 |
- |
|
| 321 |
- } else if (IdHelper.isSetSeineId(id)) {
|
|
| 322 |
- |
|
| 323 |
- exists = servicesProvider.getSetSeineService().exists(id);
|
|
| 324 |
- |
|
| 325 |
- } else if (IdHelper.isFloatingObjectId(id)) {
|
|
| 326 |
- |
|
| 327 |
- exists = servicesProvider.getFloatingObjectService().exists(id);
|
|
| 328 |
- |
|
| 329 |
- } else if (IdHelper.isTripLonglineId(id)) {
|
|
| 330 |
- |
|
| 331 |
- exists = servicesProvider.getTripLonglineService().exists(id);
|
|
| 332 |
- |
|
| 333 |
- } else if (IdHelper.isActivityLonglineId(id)) {
|
|
| 334 |
- |
|
| 335 |
- exists = servicesProvider.getActivityLonglineService().exists(id);
|
|
| 336 |
- |
|
| 337 |
- } else {
|
|
| 338 |
- exists = IdHelper.isSetLonglineId(id) && servicesProvider.getSetLonglineService().exists(id);
|
|
| 339 |
- }
|
|
| 340 |
- }
|
|
| 341 |
- |
|
| 342 |
- if (!exists) {
|
|
| 300 |
+ if (!safeIds.contains(id)) {
|
|
| 343 | 301 |
ids[i] = null;
|
| 344 | 302 |
}
|
| 303 |
+ |
|
| 345 | 304 |
progressModel.incrementsCurrentStep();
|
| 346 | 305 |
}
|
| 347 | 306 |
}
|
| 348 | 307 |
}
|
| 308 |
+ |
|
| 349 | 309 |
}
|
| ... | ... | @@ -23,9 +23,6 @@ package fr.ird.observe.client.db; |
| 23 | 23 |
*/
|
| 24 | 24 |
|
| 25 | 25 |
import fr.ird.observe.client.db.constants.DataContextType;
|
| 26 |
-import fr.ird.observe.services.dto.IdHelper;
|
|
| 27 |
-import fr.ird.observe.services.dto.referential.ProgramDto;
|
|
| 28 |
-import fr.ird.observe.services.dto.seine.RouteDto;
|
|
| 29 | 26 |
import fr.ird.observe.services.validation.ValidationDataContext;
|
| 30 | 27 |
import java.util.ArrayList;
|
| 31 | 28 |
import java.util.Arrays;
|
| ... | ... | @@ -243,18 +240,14 @@ public class ClientDataContext extends ValidationDataContext { |
| 243 | 240 |
firePropertyChange(PROPERTY_ENABLED, oldValue, enabled);
|
| 244 | 241 |
}
|
| 245 | 242 |
|
| 246 |
- public boolean isSelectionChanged() {
|
|
| 243 |
+ private boolean isSelectionChanged() {
|
|
| 247 | 244 |
return selectionChanged;
|
| 248 | 245 |
}
|
| 249 | 246 |
|
| 250 |
- private boolean getSelectionChanged() {
|
|
| 251 |
- return selectionChanged;
|
|
| 252 |
- }
|
|
| 253 |
- |
|
| 254 |
- private void setSelectionChanged(boolean selectionChanged) {
|
|
| 255 |
- boolean oldValue = getSelectionChanged();
|
|
| 256 |
- this.selectionChanged = selectionChanged;
|
|
| 257 |
- firePropertyChange(PROPERTY_SELECTION_CHANGED, oldValue, selectionChanged);
|
|
| 247 |
+ private void setSelectionChanged() {
|
|
| 248 |
+ boolean oldValue = isSelectionChanged();
|
|
| 249 |
+ this.selectionChanged = true;
|
|
| 250 |
+ firePropertyChange(PROPERTY_SELECTION_CHANGED, oldValue, true);
|
|
| 258 | 251 |
}
|
| 259 | 252 |
|
| 260 | 253 |
private static DataContextType[] types;
|
| ... | ... | @@ -299,7 +292,7 @@ public class ClientDataContext extends ValidationDataContext { |
| 299 | 292 |
return null;
|
| 300 | 293 |
}
|
| 301 | 294 |
|
| 302 |
- private String[] getSelectedIds() {
|
|
| 295 |
+ String[] getSelectedIds() {
|
|
| 303 | 296 |
|
| 304 | 297 |
List<String> ids = new ArrayList<>();
|
| 305 | 298 |
|
| ... | ... | @@ -325,61 +318,6 @@ public class ClientDataContext extends ValidationDataContext { |
| 325 | 318 |
return ids.toArray(new String[ids.size()]);
|
| 326 | 319 |
}
|
| 327 | 320 |
|
| 328 |
- public String[] getOpenIds(Class<?> type) {
|
|
| 329 |
- |
|
| 330 |
- String[] result = null;
|
|
| 331 |
- |
|
| 332 |
- if (isOpenProgram()) {
|
|
| 333 |
- |
|
| 334 |
- List<String> ids = new ArrayList<>();
|
|
| 335 |
- ids.add(getOpenProgramId());
|
|
| 336 |
- |
|
| 337 |
- if (!ProgramDto.class.equals(type) && isOpenTrip()) {
|
|
| 338 |
- |
|
| 339 |
- String tripId = getOpenTripId();
|
|
| 340 |
- ids.add(tripId);
|
|
| 341 |
- |
|
| 342 |
- if (IdHelper.isTripSeineId(tripId)) {
|
|
| 343 |
- |
|
| 344 |
- // on a seine trip
|
|
| 345 |
- if (!IdHelper.isTripClass(type) && isOpenRoute()) {
|
|
| 346 |
- |
|
| 347 |
- ids.add(getOpenRouteId());
|
|
| 348 |
- |
|
| 349 |
- if (!RouteDto.class.equals(type) && isOpenActivitySeine()) {
|
|
| 350 |
- |
|
| 351 |
- ids.add(getOpenActivitySeineId());
|
|
| 352 |
- |
|
| 353 |
- if (!IdHelper.isActivityClass(type) && isOpenSetSeine()) {
|
|
| 354 |
- ids.add(getOpenSetSeineId());
|
|
| 355 |
- }
|
|
| 356 |
- }
|
|
| 357 |
- }
|
|
| 358 |
- |
|
| 359 |
- } else {
|
|
| 360 |
- |
|
| 361 |
- // on a longline trip
|
|
| 362 |
- if (!IdHelper.isTripClass(type) && isOpenActivityLongline()) {
|
|
| 363 |
- |
|
| 364 |
- ids.add(getOpenActivityLonglineId());
|
|
| 365 |
- |
|
| 366 |
- if (!IdHelper.isActivityClass(type) && isOpenSetLongline()) {
|
|
| 367 |
- ids.add(getOpenSetLonglineId());
|
|
| 368 |
- }
|
|
| 369 |
- |
|
| 370 |
- }
|
|
| 371 |
- |
|
| 372 |
- }
|
|
| 373 |
- |
|
| 374 |
- }
|
|
| 375 |
- |
|
| 376 |
- result = ids.toArray(new String[ids.size()]);
|
|
| 377 |
- |
|
| 378 |
- }
|
|
| 379 |
- |
|
| 380 |
- return result;
|
|
| 381 |
- }
|
|
| 382 |
- |
|
| 383 | 321 |
public boolean isOpenProgram() {
|
| 384 | 322 |
return openProgramId != null;
|
| 385 | 323 |
}
|
| ... | ... | @@ -430,34 +368,26 @@ public class ClientDataContext extends ValidationDataContext { |
| 430 | 368 |
for (DataContextType entityType : DataContextType.values()) {
|
| 431 | 369 |
if (entityType.acceptType(type)) {
|
| 432 | 370 |
|
| 433 |
- // bon type trouve
|
|
| 434 |
- |
|
| 435 | 371 |
String openId = entityType.getOpenId(this);
|
| 436 | 372 |
String selectedId = entityType.getSelectedId(this);
|
| 437 |
- if (selectedId == null || openId == null) {
|
|
| 373 |
+ return selectedId != null && openId != null && selectedId.equals(openId);
|
|
| 438 | 374 |
|
| 439 |
- // pas selectionne ou rien d'ouvert
|
|
| 440 |
- return false;
|
|
| 441 |
- }
|
|
| 442 |
- |
|
| 443 |
- return selectedId.equals(openId);
|
|
| 444 | 375 |
}
|
| 445 | 376 |
}
|
| 446 | 377 |
|
| 447 |
- // type non trouve
|
|
| 448 | 378 |
return false;
|
| 449 | 379 |
}
|
| 450 | 380 |
|
| 451 | 381 |
public void populateSelectedIds(String... selectedId) {
|
| 452 |
- |
|
| 382 |
+ if (!getEnabled()) {
|
|
| 383 |
+ throw new IllegalStateException(this + " is not enabled");
|
|
| 384 |
+ }
|
|
| 453 | 385 |
List<String> oldSelection = Arrays.asList(getSelectedIds());
|
| 454 | 386 |
|
| 455 | 387 |
if (log.isDebugEnabled()) {
|
| 456 | 388 |
log.debug("old selection = " + oldSelection);
|
| 457 | 389 |
}
|
| 458 | 390 |
|
| 459 |
- // on nettoye toujours toutes les anciennes sélections
|
|
| 460 |
- // avant de positionner les nouvelles
|
|
| 461 | 391 |
resetSelect();
|
| 462 | 392 |
|
| 463 | 393 |
List<String> realSelection = null;
|
| ... | ... | @@ -500,20 +430,12 @@ public class ClientDataContext extends ValidationDataContext { |
| 500 | 430 |
log.info("new selection = " + realSelection);
|
| 501 | 431 |
}
|
| 502 | 432 |
|
| 503 |
- // on change toujours l'état de selection
|
|
| 504 |
- |
|
| 505 |
- setSelectionChanged(true);
|
|
| 433 |
+ setSelectionChanged();
|
|
| 506 | 434 |
}
|
| 507 | 435 |
|
| 508 | 436 |
void populateOpens(String... openIds) {
|
| 509 | 437 |
if (!getEnabled()) {
|
| 510 |
- |
|
| 511 |
- if (log.isWarnEnabled()) {
|
|
| 512 |
- log.warn(this + " is not enabled");
|
|
| 513 |
- }
|
|
| 514 |
- // service non initialisé
|
|
| 515 |
- resetOpen();
|
|
| 516 |
- return;
|
|
| 438 |
+ throw new IllegalStateException(this + " is not enabled");
|
|
| 517 | 439 |
}
|
| 518 | 440 |
|
| 519 | 441 |
List<String> oldSelection = Arrays.asList(getOpenIds());
|
| ... | ... | @@ -605,6 +527,7 @@ public class ClientDataContext extends ValidationDataContext { |
| 605 | 527 |
}
|
| 606 | 528 |
}
|
| 607 | 529 |
|
| 530 |
+ @Override
|
|
| 608 | 531 |
protected void reset() {
|
| 609 | 532 |
resetOpen();
|
| 610 | 533 |
resetSelect();
|
| ... | ... | @@ -629,8 +552,19 @@ public class ClientDataContext extends ValidationDataContext { |
| 629 | 552 |
setOpenActivityLonglineId(null);
|
| 630 | 553 |
}
|
| 631 | 554 |
|
| 632 |
- protected void firePropertyChange(String propertyName, Object newValue) {
|
|
| 633 |
- firePropertyChange(propertyName, null, newValue);
|
|
| 555 |
+ public boolean isSelectedRoute() {
|
|
| 556 |
+ return getSelectedRouteId() != null;
|
|
| 634 | 557 |
}
|
| 635 | 558 |
|
| 636 |
-} //ClientDataContext
|
|
| 559 |
+ public boolean isSelectedSetSeine() {
|
|
| 560 |
+ return getSelectedSetSeineId() != null;
|
|
| 561 |
+ }
|
|
| 562 |
+ |
|
| 563 |
+ public boolean isSelectedSetLongline() {
|
|
| 564 |
+ return getSelectedSetLonglineId() != null;
|
|
| 565 |
+ }
|
|
| 566 |
+ |
|
| 567 |
+ public boolean isSelectedFloatingObject() {
|
|
| 568 |
+ return getSelectedFloatingObjectId()!=null;
|
|
| 569 |
+ }
|
|
| 570 |
+}
|
| ... | ... | @@ -474,7 +474,7 @@ public class ObserveDataSourcesManager implements Closeable { |
| 474 | 474 |
// la base n'a pas pu être chargée proprement
|
| 475 | 475 |
// ceci peut être due a une base dans une version pas
|
| 476 | 476 |
// assez recente, on doit donc refermer cette base
|
| 477 |
- handlingError("Could not obtain open datas from " + source.getLabel(), e);
|
|
| 477 |
+ handlingError("Could not obtain open data from " + source.getLabel(), e);
|
|
| 478 | 478 |
|
| 479 | 479 |
// fermeture de la source
|
| 480 | 480 |
source.close();
|
| ... | ... | @@ -491,10 +491,10 @@ public class ObserveDataSourcesManager implements Closeable { |
| 491 | 491 |
ClientDataContext dataContext = applicationContext.getDataContext();
|
| 492 | 492 |
dataContext.setEnabled(false);
|
| 493 | 493 |
|
| 494 |
- // suppresion des opens dans le context de données
|
|
| 495 | 494 |
applicationContext.getConfig().saveTreeOpenNodeIds(dataContext.getOpenIds());
|
| 496 |
- dataContext.populateOpens();
|
|
| 497 |
- |
|
| 495 |
+ applicationContext.getConfig().saveTreeSelectedNodeIds(dataContext.getSelectedIds());
|
|
| 496 |
+ applicationContext.getConfig().saveForUser();
|
|
| 497 |
+ dataContext.reset();
|
|
| 498 | 498 |
mainUI.getInitializer().cleanNavigationUI(new ProgressModel());
|
| 499 | 499 |
|
| 500 | 500 |
// on met a jour l'état dans la config
|
| ... | ... | @@ -561,9 +561,13 @@ public class ObserveDataSourcesManager implements Closeable { |
| 561 | 561 |
mainUI.getInitializer().cleanNavigationUI(progressModel);
|
| 562 | 562 |
|
| 563 | 563 |
String[] openIds = config.getTreeOpenNodeIds();
|
| 564 |
+ String[] selectedIds = config.getTreeSelectedNodeIds();
|
|
| 564 | 565 |
|
| 566 |
+ if (source.canReadData()) {
|
|
| 567 |
+ applicationContext.getOpenDataManager().sanitizeIds(progressModel, selectedIds);
|
|
| 568 |
+ }
|
|
| 565 | 569 |
if (source.canWriteData()) {
|
| 566 |
- applicationContext.getOpenDataManager().sanitizeOpenIds(progressModel, openIds);
|
|
| 570 |
+ applicationContext.getOpenDataManager().sanitizeIds(progressModel, openIds);
|
|
| 567 | 571 |
}
|
| 568 | 572 |
|
| 569 | 573 |
if (source.canWriteData()) {
|
| ... | ... | @@ -571,6 +575,7 @@ public class ObserveDataSourcesManager implements Closeable { |
| 571 | 575 |
}
|
| 572 | 576 |
|
| 573 | 577 |
dataContext.populateOpens(openIds);
|
| 578 |
+ dataContext.populateSelectedIds(selectedIds);
|
|
| 574 | 579 |
|
| 575 | 580 |
mainUI.getInitializer().loadNavigationUI(progressModel);
|
| 576 | 581 |
|
| ... | ... | @@ -144,7 +144,7 @@ public class ObserveMainUIInitializer { |
| 144 | 144 |
|
| 145 | 145 |
try {
|
| 146 | 146 |
|
| 147 |
- doOpencontent(ui, path, uiClass);
|
|
| 147 |
+ doOpenContent(ui, path, uiClass);
|
|
| 148 | 148 |
|
| 149 | 149 |
} catch (Exception e) {
|
| 150 | 150 |
UIHelper.handlingError(e);
|
| ... | ... | @@ -160,7 +160,7 @@ public class ObserveMainUIInitializer { |
| 160 | 160 |
}
|
| 161 | 161 |
}
|
| 162 | 162 |
|
| 163 |
- private void doOpencontent(ObserveMainUI ui, TreePath path, Class<? extends ContentUI<?, ?>> uiClass) {
|
|
| 163 |
+ private void doOpenContent(ObserveMainUI ui, TreePath path, Class<? extends ContentUI<?, ?>> uiClass) {
|
|
| 164 | 164 |
|
| 165 | 165 |
ContentUIManager manager = ui.getContentUIManager();
|
| 166 | 166 |
|
| ... | ... | @@ -48,7 +48,7 @@ public class OpenDataGlobalUIAction extends GlobalUIActionSupport { |
| 48 | 48 |
UIActionSupport action = null;
|
| 49 | 49 |
if (contentUI instanceof ContentListUI<?, ?, ?>) {
|
| 50 | 50 |
ContentListUI<?, ?, ?> listUI = (ContentListUI<?, ?, ?>) contentUI;
|
| 51 |
- action = (UIActionSupport) listUI.getGotoOpen().getAction();
|
|
| 51 |
+ action = (UIActionSupport) listUI.getReopen().getAction();
|
|
| 52 | 52 |
} else if (contentUI instanceof ContentOpenableUI<?, ?> && !contentUI.getModel().isCreatingMode()) {
|
| 53 | 53 |
ContentOpenableUI<?, ?> openableUI = (ContentOpenableUI<?, ?>) contentUI;
|
| 54 | 54 |
action = (UIActionSupport) openableUI.getReopen().getAction();
|
| ... | ... | @@ -45,7 +45,7 @@ public class GotoReferentialCommonAction extends GotoActionSupport { |
| 45 | 45 |
super(mainUI,
|
| 46 | 46 |
ACTION_NAME,
|
| 47 | 47 |
null,
|
| 48 |
- (int) 'e',
|
|
| 48 |
+ (int) 'E',
|
|
| 49 | 49 |
t("observe.type.reference.common"),
|
| 50 | 50 |
t("observe.action.goto.referentiel.common.tip"),
|
| 51 | 51 |
"navigation.referentiel");
|
| ... | ... | @@ -200,7 +200,7 @@ public class ValidateUIHandler extends AdminTabUIHandler<ValidateUI> implements |
| 200 | 200 |
typeModel.clear();
|
| 201 | 201 |
|
| 202 | 202 |
Set<Class> messageTypes = tabUI.getStepModel().getMessageTypes();
|
| 203 |
- List<Class> classes = ObserveI18nDecoratorHelper.sortTypes(messageTypes);
|
|
| 203 |
+ List<Class> classes = ObserveI18nDecoratorHelper.sortTypes(messageTypes, ObserveSwingApplicationContext.get().getConfig().getLocale());
|
|
| 204 | 204 |
|
| 205 | 205 |
for (Class e : classes) {
|
| 206 | 206 |
typeModel.addElement(e);
|
| ... | ... | @@ -23,6 +23,7 @@ package fr.ird.observe.client.ui.content.ref; |
| 23 | 23 |
*/
|
| 24 | 24 |
|
| 25 | 25 |
import com.google.common.collect.ImmutableList;
|
| 26 |
+import fr.ird.observe.client.ObserveSwingApplicationContext;
|
|
| 26 | 27 |
import fr.ird.observe.client.ui.content.ContentUIModel;
|
| 27 | 28 |
import fr.ird.observe.services.decoration.ObserveI18nDecoratorHelper;
|
| 28 | 29 |
import fr.ird.observe.services.dto.referential.ProgramDto;
|
| ... | ... | @@ -67,7 +68,7 @@ public abstract class ReferenceHomeUIModel extends ContentUIModel<ProgramDto> { |
| 67 | 68 |
|
| 68 | 69 |
protected ReferenceHomeUIModel(List<Class<? extends ReferentialDto>> types, String nodeName) {
|
| 69 | 70 |
super(ProgramDto.class);
|
| 70 |
- this.types = ImmutableList.copyOf(ObserveI18nDecoratorHelper.sortPluralTypes(types));
|
|
| 71 |
+ this.types = ImmutableList.copyOf(ObserveI18nDecoratorHelper.sortPluralTypes(types, ObserveSwingApplicationContext.get().getConfig().getLocale()));
|
|
| 71 | 72 |
this.nodeName = nodeName;
|
| 72 | 73 |
}
|
| 73 | 74 |
|
| ... | ... | @@ -35,7 +35,6 @@ import fr.ird.observe.client.db.ObserveDataSourcesManager; |
| 35 | 35 |
import fr.ird.observe.client.db.ObserveSwingDataSource;
|
| 36 | 36 |
import fr.ird.observe.client.ui.ObserveKeyStrokes;
|
| 37 | 37 |
import fr.ird.observe.client.ui.ObserveMainUI;
|
| 38 |
-import fr.ird.observe.client.ui.util.UIHelper;
|
|
| 39 | 38 |
import fr.ird.observe.client.ui.actions.SelectRadioButtonAction;
|
| 40 | 39 |
import fr.ird.observe.client.ui.storage.tabs.ChooseDbModeUI;
|
| 41 | 40 |
import fr.ird.observe.client.ui.storage.tabs.ConfigUI;
|
| ... | ... | @@ -45,6 +44,7 @@ import fr.ird.observe.client.ui.storage.tabs.SelectDataUI; |
| 45 | 44 |
import fr.ird.observe.client.ui.storage.tabs.StorageTabUI;
|
| 46 | 45 |
import fr.ird.observe.client.ui.tree.selection.SelectionTreeModel;
|
| 47 | 46 |
import fr.ird.observe.client.ui.util.ProgressModel;
|
| 47 |
+import fr.ird.observe.client.ui.util.UIHelper;
|
|
| 48 | 48 |
import fr.ird.observe.services.configuration.ObserveDataSourceConfiguration;
|
| 49 | 49 |
import fr.ird.observe.services.configuration.ObserveDataSourceInformation;
|
| 50 | 50 |
import fr.ird.observe.services.configuration.rest.ObserveDataSourceConfigurationRest;
|
| ... | ... | @@ -398,7 +398,13 @@ public class StorageUIHandler implements UIHandler<StorageUI> { |
| 398 | 398 |
stepsCount += 2;
|
| 399 | 399 |
}
|
| 400 | 400 |
String[] openIds = config.getTreeOpenNodeIds();
|
| 401 |
- stepsCount += openIds.length;
|
|
| 401 |
+ if (openIds != null) {
|
|
| 402 |
+ stepsCount += 1 + openIds.length;
|
|
| 403 |
+ }
|
|
| 404 |
+ String[] selectedIds = config.getTreeSelectedNodeIds();
|
|
| 405 |
+ if (selectedIds != null) {
|
|
| 406 |
+ stepsCount += 1 + selectedIds.length;
|
|
| 407 |
+ }
|
|
| 402 | 408 |
stepsCount += observeContext.getFloatingObjectReferencesManager().getNames().size();
|
| 403 | 409 |
|
| 404 | 410 |
progressModel.installUI(ui.getCONFIRM().getProgressBar());
|
| ... | ... | @@ -232,51 +232,82 @@ public class NavigationTree extends JXTree { |
| 232 | 232 |
|
| 233 | 233 |
} else {
|
| 234 | 234 |
|
| 235 |
- // on trouve le meilleur noeud a selectionner.
|
|
| 236 |
- |
|
| 237 |
- String id = context.getHigherOpenId();
|
|
| 235 |
+ String id = context.getHigherSelectedId();
|
|
| 238 | 236 |
|
| 239 | 237 |
NavigationTreeNodeSupport selectedNode = null;
|
| 240 | 238 |
if (id != null) {
|
| 241 | 239 |
|
| 242 |
- // on se positionne sur la donnée la plus haute ouverte
|
|
| 243 |
- if (context.isOpenTrip()) {
|
|
| 240 |
+ if (context.isSelectedTrip()) {
|
|
| 244 | 241 |
|
| 245 |
- NavigationTreeNodeSupport tripNode = getTripNode(context.getOpenProgramId(), context.getOpenTripId());
|
|
| 246 |
- selectedNode = tripNode;
|
|
| 242 |
+ selectedNode = getTripNode(context.getSelectedProgramId(), context.getSelectedTripId());
|
|
| 247 | 243 |
|
| 248 |
- if (context.isOpenRoute()) {
|
|
| 244 |
+ if (context.isSelectedRoute()) {
|
|
| 249 | 245 |
|
| 250 |
- NavigationTreeNodeSupport routeNode = getRouteNode(tripNode, context.getOpenRouteId());
|
|
| 251 |
- selectedNode = routeNode;
|
|
| 252 |
- if (context.isOpenActivity()) {
|
|
| 246 |
+ selectedNode = getRouteNode(selectedNode, context.getSelectedRouteId());
|
|
| 247 |
+ if (context.isSelectedActivitySeine()) {
|
|
| 253 | 248 |
|
| 254 |
- NavigationTreeNodeSupport activitySeineNode = getActivitySeineNode(routeNode, context.getOpenActivityId());
|
|
| 255 |
- selectedNode = activitySeineNode;
|
|
| 256 |
- if (context.isOpenSet()) {
|
|
| 257 |
- selectedNode = getSetSeineNode(activitySeineNode);
|
|
| 249 |
+ selectedNode = getActivitySeineNode(selectedNode, context.getSelectedActivityId());
|
|
| 250 |
+ if (context.isSelectedSetSeine()) {
|
|
| 251 |
+ selectedNode = getSetSeineNode(selectedNode);
|
|
| 258 | 252 |
|
| 253 |
+ } else if (context.isSelectedFloatingObject()) {
|
|
| 254 |
+ selectedNode = getFloatingObjectNode(selectedNode, context.getSelectedFloatingObjectId());
|
|
| 259 | 255 |
}
|
| 260 | 256 |
}
|
| 261 | 257 |
}
|
| 262 | 258 |
|
| 263 |
- if (context.isOpenActivityLongline()) {
|
|
| 259 |
+ if (context.isSelectedActivityLongline()) {
|
|
| 264 | 260 |
|
| 265 |
- NavigationTreeNodeSupport activityLonglineNode = getActivityLonglineNode(tripNode, context.getOpenActivityId());
|
|
| 266 |
- selectedNode = activityLonglineNode;
|
|
| 267 |
- if (context.isOpenSet()) {
|
|
| 268 |
- selectedNode = getSetLonglineNode(activityLonglineNode);
|
|
| 261 |
+ selectedNode = getActivityLonglineNode(selectedNode, context.getSelectedActivityId());
|
|
| 262 |
+ if (context.isSelectedSetLongline()) {
|
|
| 263 |
+ selectedNode = getSetLonglineNode(selectedNode);
|
|
| 269 | 264 |
|
| 270 | 265 |
}
|
| 271 | 266 |
}
|
| 272 | 267 |
}
|
| 273 | 268 |
|
| 274 | 269 |
} else {
|
| 275 |
- selectedNode = getTreeModel().getRoot();
|
|
| 276 |
- if (!selectedNode.isLeaf()) {
|
|
| 277 |
- selectedNode = (NavigationTreeNodeSupport) selectedNode.getFirstChild();
|
|
| 278 |
- }
|
|
| 279 | 270 |
|
| 271 |
+ id = context.getHigherOpenId();
|
|
| 272 |
+ |
|
| 273 |
+ if (id != null) {
|
|
| 274 |
+ |
|
| 275 |
+ if (context.isOpenTrip()) {
|
|
| 276 |
+ |
|
| 277 |
+ selectedNode = getTripNode(context.getOpenProgramId(), context.getOpenTripId());
|
|
| 278 |
+ |
|
| 279 |
+ if (context.isOpenRoute()) {
|
|
| 280 |
+ |
|
| 281 |
+ selectedNode = getRouteNode(selectedNode, context.getOpenRouteId());
|
|
| 282 |
+ if (context.isOpenActivity()) {
|
|
| 283 |
+ |
|
| 284 |
+ selectedNode = getActivitySeineNode(selectedNode, context.getOpenActivityId());
|
|
| 285 |
+ if (context.isOpenSet()) {
|
|
| 286 |
+ selectedNode = getSetSeineNode(selectedNode);
|
|
| 287 |
+ |
|
| 288 |
+ }
|
|
| 289 |
+ }
|
|
| 290 |
+ }
|
|
| 291 |
+ |
|
| 292 |
+ if (context.isOpenActivityLongline()) {
|
|
| 293 |
+ |
|
| 294 |
+ selectedNode = getActivityLonglineNode(selectedNode, context.getOpenActivityId());
|
|
| 295 |
+ |
|
| 296 |
+ if (context.isOpenSet()) {
|
|
| 297 |
+ selectedNode = getSetLonglineNode(selectedNode);
|
|
| 298 |
+ |
|
| 299 |
+ }
|
|
| 300 |
+ }
|
|
| 301 |
+ }
|
|
| 302 |
+ |
|
| 303 |
+ } else {
|
|
| 304 |
+ |
|
| 305 |
+ selectedNode = getTreeModel().getRoot();
|
|
| 306 |
+ if (!selectedNode.isLeaf()) {
|
|
| 307 |
+ selectedNode = (NavigationTreeNodeSupport) selectedNode.getFirstChild();
|
|
| 308 |
+ }
|
|
| 309 |
+ |
|
| 310 |
+ }
|
|
| 280 | 311 |
}
|
| 281 | 312 |
|
| 282 | 313 |
|
| ... | ... | @@ -585,6 +616,10 @@ public class NavigationTree extends JXTree { |
| 585 | 616 |
return getTreeModel().findNodeByType(activitySeineNode, SetSeineNavigationTreeNode.class);
|
| 586 | 617 |
}
|
| 587 | 618 |
|
| 619 |
+ public NavigationTreeNodeSupport getFloatingObjectNode(NavigationTreeNodeSupport setSeineNode, String floatingObjectId) {
|
|
| 620 |
+ return getTreeModel().findNode(setSeineNode, floatingObjectId);
|
|
| 621 |
+ }
|
|
| 622 |
+ |
|
| 588 | 623 |
public NavigationTreeNodeSupport getSetLonglineNode(NavigationTreeNodeSupport activityLonglineNode) {
|
| 589 | 624 |
return getTreeModel().findNodeByType(activityLonglineNode, SetLonglineNavigationTreeNode.class);
|
| 590 | 625 |
}
|
| ... | ... | @@ -23,6 +23,7 @@ package fr.ird.observe.client.ui.tree.navigation.nodes.referential; |
| 23 | 23 |
*/
|
| 24 | 24 |
|
| 25 | 25 |
import com.google.common.collect.ImmutableSet;
|
| 26 |
+import fr.ird.observe.client.ObserveSwingApplicationContext;
|
|
| 26 | 27 |
import fr.ird.observe.client.ui.tree.navigation.nodes.StringNavigationTreeNodeSupport;
|
| 27 | 28 |
import fr.ird.observe.services.decoration.ObserveI18nDecoratorHelper;
|
| 28 | 29 |
import fr.ird.observe.services.dto.referential.ReferentialDto;
|
| ... | ... | @@ -35,9 +36,9 @@ import fr.ird.observe.services.dto.referential.ReferentialDto; |
| 35 | 36 |
*/
|
| 36 | 37 |
public abstract class ReferentialsNavigationTreeNodeSupport extends StringNavigationTreeNodeSupport {
|
| 37 | 38 |
|
| 38 |
- public ReferentialsNavigationTreeNodeSupport(String name, ImmutableSet<Class<? extends ReferentialDto>> types) {
|
|
| 39 |
+ ReferentialsNavigationTreeNodeSupport(String name, ImmutableSet<Class<? extends ReferentialDto>> types) {
|
|
| 39 | 40 |
super(name, true);
|
| 40 |
- for (Class<? extends ReferentialDto> aClass : ObserveI18nDecoratorHelper.sortPluralTypes(types)) {
|
|
| 41 |
+ for (Class<? extends ReferentialDto> aClass : ObserveI18nDecoratorHelper.sortPluralTypes(types, ObserveSwingApplicationContext.get().getConfig().getLocale())) {
|
|
| 41 | 42 |
ReferentialNavigationTreeNode child = new ReferentialNavigationTreeNode<>(aClass);
|
| 42 | 43 |
add(child);
|
| 43 | 44 |
}
|
| ... | ... | @@ -22,11 +22,13 @@ package fr.ird.observe.common; |
| 22 | 22 |
* #L%
|
| 23 | 23 |
*/
|
| 24 | 24 |
|
| 25 |
+import java.text.Collator;
|
|
| 25 | 26 |
import java.util.ArrayList;
|
| 26 | 27 |
import java.util.Collection;
|
| 27 | 28 |
import java.util.Comparator;
|
| 28 | 29 |
import java.util.HashMap;
|
| 29 | 30 |
import java.util.List;
|
| 31 |
+import java.util.Locale;
|
|
| 30 | 32 |
import java.util.Map;
|
| 31 | 33 |
import java.util.Properties;
|
| 32 | 34 |
import java.util.function.Function;
|
| ... | ... | @@ -54,10 +56,10 @@ public class ObserveUtil { |
| 54 | 56 |
return targetProperties;
|
| 55 | 57 |
}
|
| 56 | 58 |
|
| 57 |
- public static <C extends Class<?>> List<C> sortTypes(Collection<C> types, Function<Class, String> function) {
|
|
| 59 |
+ public static <C extends Class<?>> List<C> sortTypes(Collection<C> types, Function<Class, String> function, Locale locale) {
|
|
| 58 | 60 |
|
| 59 | 61 |
List<C> list = new ArrayList<>(types);
|
| 60 |
- new ClassComparator<C>(function).sort(list);
|
|
| 62 |
+ new ClassComparator<C>(function, locale).sort(list);
|
|
| 61 | 63 |
return list;
|
| 62 | 64 |
|
| 63 | 65 |
}
|
| ... | ... | @@ -67,16 +69,20 @@ public class ObserveUtil { |
| 67 | 69 |
private final Map<Class, String> cache;
|
| 68 | 70 |
private final Function<Class, String> function;
|
| 69 | 71 |
|
| 70 |
- private ClassComparator(Function<Class, String> function) {
|
|
| 72 |
+ private final Collator collator;
|
|
| 73 |
+ |
|
| 74 |
+ private ClassComparator(Function<Class, String> function, Locale locale) {
|
|
| 71 | 75 |
this.cache = new HashMap<>();
|
| 72 | 76 |
this.function = function;
|
| 77 |
+ this.collator = Collator.getInstance(locale);
|
|
| 78 |
+ this.collator.setStrength(Collator.PRIMARY);
|
|
| 73 | 79 |
}
|
| 74 | 80 |
|
| 75 | 81 |
@Override
|
| 76 | 82 |
public int compare(Class o1, Class o2) {
|
| 77 | 83 |
String s1 = getValue(o1);
|
| 78 | 84 |
String s2 = getValue(o2);
|
| 79 |
- return s1.compareTo(s2);
|
|
| 85 |
+ return this.collator.compare(s1, s2);
|
|
| 80 | 86 |
}
|
| 81 | 87 |
|
| 82 | 88 |
String getValue(Class klass) {
|
| ... | ... | @@ -88,4 +94,5 @@ public class ObserveUtil { |
| 88 | 94 |
cache.clear();
|
| 89 | 95 |
}
|
| 90 | 96 |
}
|
| 97 |
+ |
|
| 91 | 98 |
}
|
| ... | ... | @@ -85,6 +85,7 @@ POST /api/v1/actions/synchro/referential/ng/ReferentialSynchronizeService/prod |
| 85 | 85 |
POST /api/v1/actions/validate/ValidateService/validateData v1.actions.validate.ValidateServiceRestApi.validateData
|
| 86 | 86 |
POST /api/v1/actions/validate/ValidateService/validateReferential v1.actions.validate.ValidateServiceRestApi.validateReferential
|
| 87 | 87 |
GET /api/v1/data/NavigationService/getNavigation v1.data.NavigationServiceRestApi.getNavigation
|
| 88 |
+GET /api/v1/data/NavigationService/retainExistingIds v1.data.NavigationServiceRestApi.retainExistingIds
|
|
| 88 | 89 |
POST /api/v1/data/TripManagementService/deleteTrip v1.data.TripManagementServiceRestApi.deleteTrip
|
| 89 | 90 |
POST /api/v1/data/TripManagementService/exportTrip v1.data.TripManagementServiceRestApi.exportTrip
|
| 90 | 91 |
POST /api/v1/data/TripManagementService/importTrip v1.data.TripManagementServiceRestApi.importTrip
|
| ... | ... | @@ -160,7 +161,6 @@ GET /api/v1/data/seine/FloatingObjectService/loadDto |
| 160 | 161 |
GET /api/v1/data/seine/FloatingObjectService/loadForm v1.data.seine.FloatingObjectServiceRestApi.loadForm
|
| 161 | 162 |
GET /api/v1/data/seine/FloatingObjectService/loadReferenceToRead v1.data.seine.FloatingObjectServiceRestApi.loadReferenceToRead
|
| 162 | 163 |
GET /api/v1/data/seine/FloatingObjectService/preCreate v1.data.seine.FloatingObjectServiceRestApi.preCreate
|
| 163 |
-GET /api/v1/data/seine/FloatingObjectService/retainExistingIds v1.data.seine.FloatingObjectServiceRestApi.retainExistingIds
|
|
| 164 | 164 |
POST /api/v1/data/seine/FloatingObjectService/save v1.data.seine.FloatingObjectServiceRestApi.save
|
| 165 | 165 |
POST /api/v1/data/seine/FloatingObjectService/saveParts v1.data.seine.FloatingObjectServiceRestApi.saveParts
|
| 166 | 166 |
GET /api/v1/data/seine/NonTargetCatchReleaseService/getSampleSpecies v1.data.seine.NonTargetCatchReleaseServiceRestApi.getSampleSpecies
|
| ... | ... | @@ -26,6 +26,8 @@ import com.google.common.collect.ArrayListMultimap; |
| 26 | 26 |
import com.google.common.collect.ImmutableMap;
|
| 27 | 27 |
import com.google.common.collect.ImmutableSet;
|
| 28 | 28 |
import com.google.common.collect.Maps;
|
| 29 |
+import fr.ird.observe.persistence.ObserveTopiaPersistenceContext;
|
|
| 30 |
+import fr.ird.observe.services.dto.IdHelper;
|
|
| 29 | 31 |
import fr.ird.observe.services.dto.longline.TripLonglineDto;
|
| 30 | 32 |
import fr.ird.observe.services.dto.longline.TripLonglineHelper;
|
| 31 | 33 |
import fr.ird.observe.services.dto.reference.DataReference;
|
| ... | ... | @@ -112,4 +114,56 @@ public class NavigationServiceTopia extends ObserveServiceTopia implements Navig |
| 112 | 114 |
|
| 113 | 115 |
return new NavigationResult(programsBuilder.build(), tripsSeineByProgram, tripsLonglineByProgram);
|
| 114 | 116 |
}
|
| 117 |
+ |
|
| 118 |
+ @Override
|
|
| 119 |
+ public ImmutableSet<String> retainExistingIds(ImmutableSet<String> ids) {
|
|
| 120 |
+ ImmutableSet.Builder<String> result = ImmutableSet.builder();
|
|
| 121 |
+ |
|
| 122 |
+ ObserveTopiaPersistenceContext topiaPersistenceContext = serviceContext.getTopiaPersistenceContext();
|
|
| 123 |
+ for (String id : ids) {
|
|
| 124 |
+ boolean exists;
|
|
| 125 |
+ if (IdHelper.isProgramId(id)) {
|
|
| 126 |
+ |
|
| 127 |
+ exists = topiaPersistenceContext.getProgramDao().forTopiaIdEquals(id).exists();
|
|
| 128 |
+ |
|
| 129 |
+ } else if (IdHelper.isTripSeineId(id)) {
|
|
| 130 |
+ |
|
| 131 |
+ exists = topiaPersistenceContext.getTripSeineDao().forTopiaIdEquals(id).exists();
|
|
| 132 |
+ |
|
| 133 |
+ } else if (IdHelper.isRouteId(id)) {
|
|
| 134 |
+ |
|
| 135 |
+ exists = topiaPersistenceContext.getRouteDao().forTopiaIdEquals(id).exists();
|
|
| 136 |
+ |
|
| 137 |
+ } else if (IdHelper.isActivitySeineId(id)) {
|
|
| 138 |
+ |
|
| 139 |
+ exists = topiaPersistenceContext.getActivitySeineDao().forTopiaIdEquals(id).exists();
|
|
| 140 |
+ |
|
| 141 |
+ } else if (IdHelper.isSetSeineId(id)) {
|
|
| 142 |
+ |
|
| 143 |
+ exists = topiaPersistenceContext.getSetSeineDao().forTopiaIdEquals(id).exists();
|
|
| 144 |
+ |
|
| 145 |
+ } else if (IdHelper.isFloatingObjectId(id)) {
|
|
| 146 |
+ |
|
| 147 |
+ exists = topiaPersistenceContext.getFloatingObjectDao().forTopiaIdEquals(id).exists();
|
|
| 148 |
+ |
|
| 149 |
+ } else if (IdHelper.isTripLonglineId(id)) {
|
|
| 150 |
+ |
|
| 151 |
+ exists = topiaPersistenceContext.getTripLonglineDao().forTopiaIdEquals(id).exists();
|
|
| 152 |
+ |
|
| 153 |
+ } else if (IdHelper.isActivityLonglineId(id)) {
|
|
| 154 |
+ |
|
| 155 |
+ exists = topiaPersistenceContext.getActivityLonglineDao().forTopiaIdEquals(id).exists();
|
|
| 156 |
+ |
|
| 157 |
+ } else {
|
|
| 158 |
+ exists = IdHelper.isSetLonglineId(id) && topiaPersistenceContext.getSetLonglineDao().forTopiaIdEquals(id).exists();
|
|
| 159 |
+ }
|
|
| 160 |
+ if (exists) {
|
|
| 161 |
+ result.add(id);
|
|
| 162 |
+ }
|
|
| 163 |
+ if (!exists) {
|
|
| 164 |
+ break;
|
|
| 165 |
+ }
|
|
| 166 |
+ }
|
|
| 167 |
+ return result.build();
|
|
| 168 |
+ }
|
|
| 115 | 169 |
}
|
| ... | ... | @@ -99,13 +99,6 @@ public class FloatingObjectServiceTopia extends ObserveServiceTopia implements F |
| 99 | 99 |
}
|
| 100 | 100 |
|
| 101 | 101 |
@Override
|
| 102 |
- public ImmutableSet<String> retainExistingIds(ImmutableSet<String> existingIds) {
|
|
| 103 |
- LinkedHashSet<String> result = new LinkedHashSet<>(getTopiaPersistenceContext().getFloatingObjectDao().findAllIds());
|
|
| 104 |
- result.retainAll(existingIds);
|
|
| 105 |
- return ImmutableSet.copyOf(result);
|
|
| 106 |
- }
|
|
| 107 |
- |
|
| 108 |
- @Override
|
|
| 109 | 102 |
public DataReference<FloatingObjectDto> loadReferenceToRead(String floatingObjectId) {
|
| 110 | 103 |
if (log.isTraceEnabled()) {
|
| 111 | 104 |
log.trace("loadReferenceToRead(" + floatingObjectId + ")");
|
| ... | ... | @@ -28,6 +28,7 @@ import fr.ird.observe.services.dto.ObserveDto; |
| 28 | 28 |
import java.beans.Introspector;
|
| 29 | 29 |
import java.util.Collection;
|
| 30 | 30 |
import java.util.List;
|
| 31 |
+import java.util.Locale;
|
|
| 31 | 32 |
import java.util.function.Function;
|
| 32 | 33 |
import org.apache.commons.lang3.StringUtils;
|
| 33 | 34 |
import org.atteo.evo.inflector.English;
|
| ... | ... | @@ -47,12 +48,12 @@ public class ObserveI18nDecoratorHelper { |
| 47 | 48 |
private static final String OBSERVE_COMMON_PREFIX = "observe.common.";
|
| 48 | 49 |
private static final String OBSERVE_TYPE_PREFIX = "observe.type.";
|
| 49 | 50 |
|
| 50 |
- public static <C extends Class<?>> List<C> sortTypes(Collection<C> types) {
|
|
| 51 |
- return ObserveUtil.sortTypes(types, klass -> t(ObserveI18nDecoratorHelper.getTypeI18nKey(klass)));
|
|
| 51 |
+ public static <C extends Class<?>> List<C> sortTypes(Collection<C> types, Locale locale) {
|
|
| 52 |
+ return ObserveUtil.sortTypes(types, klass -> t(ObserveI18nDecoratorHelper.getTypeI18nKey(klass)), locale);
|
|
| 52 | 53 |
}
|
| 53 | 54 |
|
| 54 |
- public static <C extends Class<?>> List<C> sortPluralTypes(Collection<C> types) {
|
|
| 55 |
- return ObserveUtil.sortTypes(types, klass -> t(ObserveI18nDecoratorHelper.getTypePluralI18nKey(klass)));
|
|
| 55 |
+ public static <C extends Class<?>> List<C> sortPluralTypes(Collection<C> types, Locale locale) {
|
|
| 56 |
+ return ObserveUtil.sortTypes(types, klass -> t(ObserveI18nDecoratorHelper.getTypePluralI18nKey(klass)), locale);
|
|
| 56 | 57 |
}
|
| 57 | 58 |
|
| 58 | 59 |
public static String getPropertyName(Class key) {
|
| ... | ... | @@ -22,7 +22,9 @@ package fr.ird.observe.services.service.data; |
| 22 | 22 |
* #L%
|
| 23 | 23 |
*/
|
| 24 | 24 |
|
| 25 |
+import com.google.common.collect.ImmutableSet;
|
|
| 25 | 26 |
import fr.ird.observe.services.service.ObserveService;
|
| 27 |
+import fr.ird.observe.services.spi.ReadDataPermission;
|
|
| 26 | 28 |
import io.ultreia.java4all.http.spi.Get;
|
| 27 | 29 |
|
| 28 | 30 |
/**
|
| ... | ... | @@ -36,4 +38,7 @@ public interface NavigationService extends ObserveService { |
| 36 | 38 |
@Get
|
| 37 | 39 |
NavigationResult getNavigation(NavigationRequest request);
|
| 38 | 40 |
|
| 41 |
+ @Get
|
|
| 42 |
+ @ReadDataPermission
|
|
| 43 |
+ ImmutableSet<String> retainExistingIds(ImmutableSet<String> ids);
|
|
| 39 | 44 |
}
|
| ... | ... | @@ -59,10 +59,6 @@ public interface FloatingObjectService extends ObserveService { |
| 59 | 59 |
|
| 60 | 60 |
@Get
|
| 61 | 61 |
@ReadDataPermission
|
| 62 |
- ImmutableSet<String> retainExistingIds(ImmutableSet<String> existingIds);
|
|
| 63 |
- |
|
| 64 |
- @Get
|
|
| 65 |
- @ReadDataPermission
|
|
| 66 | 62 |
Form<FloatingObjectDto> loadForm(String floatingObjectId);
|
| 67 | 63 |
|
| 68 | 64 |
@Get
|
| ... | ... | @@ -94,6 +94,10 @@ public class ValidationDataContext extends AbstractSerializableBean { |
| 94 | 94 |
return selectedTripId != null && IdHelper.isSeineId(selectedTripId);
|
| 95 | 95 |
}
|
| 96 | 96 |
|
| 97 |
+ public boolean isSelectedTrip() {
|
|
| 98 |
+ return isSelectedTripLongline() || isSelectedTripSeine();
|
|
| 99 |
+ }
|
|
| 100 |
+ |
|
| 97 | 101 |
public String getSelectedRouteId() {
|
| 98 | 102 |
return selectedRouteId;
|
| 99 | 103 |
}
|