Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe

Commits:

12 changed files:

Changes:

  • client/src/main/java/fr/ird/observe/client/ui/admin/consolidate/ConsolidateUIHandler.java
    ... ... @@ -79,14 +79,14 @@ public class ConsolidateUIHandler extends AdminTabUIHandler<ConsolidateUI> imple
    79 79
     
    
    80 80
             getStepModel().setSource(getModel().getConfigModel().getSafeLocalSource(false));
    
    81 81
     
    
    82
    -        Set<DataDtoReference<?,?>> trips = getModel().getSelectDataModel().getSelectionDataModel().getSelectedData();
    
    82
    +        Set<DataDtoReference<?, ?>> trips = getModel().getSelectDataModel().getSelectionDataModel().getSelectedData();
    
    83 83
             ImmutableSet<String> tripIds = ImmutableSet.copyOf(trips.stream()
    
    84 84
                                                                        .filter(input -> IdHelper.isTripSeineId(input.getId()))
    
    85 85
                                                                        .map(DataDtoReference::getId)
    
    86 86
                                                                        .collect(Collectors.toSet()));
    
    87 87
     
    
    88 88
             ProgressModel progressModel = getStepModel().getProgressModel();
    
    89
    -        progressModel.setStepsCount(tripIds.size());
    
    89
    +        progressModel.setStepsCount(tripIds.size() + 1);
    
    90 90
     
    
    91 91
             try (ObserveSwingDataSource dataSource = getStepModel().getSource()) {
    
    92 92
     
    

  • client/src/main/java/fr/ird/observe/client/ui/admin/export/ExportUIHandler.java
    ... ... @@ -125,7 +125,7 @@ public class ExportUIHandler extends AdminTabUIHandler<ExportUI> implements UIHa
    125 125
     
    
    126 126
             UIHelper.setTableColumnRenderer(table4, 0, UIHelper.newBooleanTableCellRenderer(renderer5));
    
    127 127
             UIHelper.setTableColumnRenderer(table4, 1, UIHelper.newReferentialReferenceDecorateTableCellRenderer(renderer5, ProgramReference.class));
    
    128
    -        UIHelper.setTableColumnRenderer(table4, 2, UIHelper.newDecorateTableCellRenderer(renderer5, DataDtoReference.class, DecoratorService.TRIP_CONTEXT));
    
    128
    +        UIHelper.setTableColumnRenderer(table4, 2, UIHelper.newDecorateTableCellRenderer(renderer5, TripSeineReference.class, DecoratorService.TRIP_CONTEXT));
    
    129 129
             UIHelper.setTableColumnRenderer(table4, 3, UIHelper.newBooleanTableCellRenderer(renderer5));
    
    130 130
             UIHelper.setTableColumnEditor(table4, 0, MyDefaultCellEditor.newBooleanEditor(false));
    
    131 131
     
    

  • client/src/main/java/fr/ird/observe/client/ui/content/ContentUIHandler.java
    ... ... @@ -659,6 +659,7 @@ public abstract class ContentUIHandler<E extends IdDto, U extends ContentUI<E, U
    659 659
         public <F extends IdDto> void loadReferentialReferenceSetsInModel(FormDefinition<F> formDefinition) {
    
    660 660
             loadReferentialReferenceSetsInModel(formDefinition, true);
    
    661 661
         }
    
    662
    +
    
    662 663
         protected <F extends IdDto> void loadReferentialReferenceSetsInModel(FormDefinition<F> formDefinition, boolean clear) {
    
    663 664
     
    
    664 665
             Class<F> dtoType = formDefinition.getType();
    

  • client/src/main/java/fr/ird/observe/client/ui/util/UIHelper.java
    ... ... @@ -95,7 +95,7 @@ public class UIHelper extends SwingUtil {
    95 95
     
    
    96 96
         public static final Icon ICON_MODE_READ = SwingUtil.getUIManagerActionIcon("mode-read");
    
    97 97
         public static final Icon ICON_MODE_CREATE = SwingUtil.getUIManagerActionIcon("mode-create");
    
    98
    -    public static final Icon ICON_MODE_UPDATE= SwingUtil.getUIManagerActionIcon("mode-update");
    
    98
    +    public static final Icon ICON_MODE_UPDATE = SwingUtil.getUIManagerActionIcon("mode-update");
    
    99 99
     
    
    100 100
         /**
    
    101 101
          * Components which must NOT be blocked by any layer in ui.
    
    ... ... @@ -414,27 +414,39 @@ public class UIHelper extends SwingUtil {
    414 414
     
    
    415 415
     
    
    416 416
         public static DecoratorTableCellRenderer newDecorateTableCellRenderer(
    
    417
    -            TableCellRenderer renderer, Class<?> entityClass) {
    
    418
    -        Decorator<?> decorator = ObserveSwingApplicationContext.get().getDecoratorService().getDecoratorByType(entityClass);
    
    417
    +            TableCellRenderer renderer, Class<?> type) {
    
    418
    +        Objects.requireNonNull(renderer);
    
    419
    +        Objects.requireNonNull(type);
    
    420
    +        Decorator<?> decorator = ObserveSwingApplicationContext.get().getDecoratorService().getDecoratorByType(type);
    
    421
    +        Objects.requireNonNull(decorator, "cant find decorator for " + type.getName());
    
    419 422
             return new DecoratorTableCellRenderer(renderer, decorator);
    
    420 423
         }
    
    421 424
     
    
    422 425
         public static DecoratorTableCellRenderer newDecorateTableCellRenderer(
    
    423
    -            TableCellRenderer renderer, Class<?> entityClass, String context) {
    
    424
    -        Decorator<?> decorator = ObserveSwingApplicationContext.get().getDecoratorService().getDecoratorByType(entityClass, context);
    
    426
    +            TableCellRenderer renderer, Class<?> type, String context) {
    
    427
    +        Objects.requireNonNull(renderer);
    
    428
    +        Objects.requireNonNull(type);
    
    429
    +        Decorator<?> decorator = ObserveSwingApplicationContext.get().getDecoratorService().getDecoratorByType(type, context);
    
    430
    +        Objects.requireNonNull(decorator, "cant find decorator for " + type.getName() + " - " + context);
    
    425 431
             return new DecoratorTableCellRenderer(renderer, decorator);
    
    426 432
         }
    
    427 433
     
    
    428 434
         public static <T extends DataDtoReference> DecoratorTableCellRenderer newDataReferenceDecorateTableCellRenderer(TableCellRenderer renderer,
    
    429 435
                                                                                                                         Class<T> referenceType,
    
    430 436
                                                                                                                         String context) {
    
    437
    +        Objects.requireNonNull(renderer);
    
    438
    +        Objects.requireNonNull(referenceType);
    
    431 439
             Decorator<?> decorator = ObserveSwingApplicationContext.get().getDecoratorService().getDataReferenceDecorator(referenceType, context);
    
    440
    +        Objects.requireNonNull(decorator, "cant find decorator for " + referenceType.getName() + " - " + context);
    
    432 441
             return new DecoratorTableCellRenderer(renderer, decorator);
    
    433 442
         }
    
    434 443
     
    
    435 444
         public static <T extends ReferentialDtoReference> DecoratorTableCellRenderer newReferentialReferenceDecorateTableCellRenderer(TableCellRenderer renderer,
    
    436 445
                                                                                                                                       Class<T> referenceType) {
    
    446
    +        Objects.requireNonNull(renderer);
    
    447
    +        Objects.requireNonNull(referenceType);
    
    437 448
             Decorator<?> decorator = ObserveSwingApplicationContext.get().getDecoratorService().getReferentialReferenceDecorator(referenceType);
    
    449
    +        Objects.requireNonNull(decorator, "cant find decorator for " + referenceType.getName());
    
    438 450
             return new DecoratorTableCellRenderer(renderer, decorator);
    
    439 451
         }
    
    440 452
     
    

  • services-client/src/test/java/fr/ird/observe/services/client/service/ReferenceValuesSetServiceClientTest.java
    ... ... @@ -33,7 +33,6 @@ import fr.ird.observe.services.service.referential.ReferenceSetsRequest;
    33 33
     import fr.ird.observe.services.service.referential.ReferentialService;
    
    34 34
     import fr.ird.observe.spi.DtoModelHelper;
    
    35 35
     import fr.ird.observe.spi.map.ImmutableDtoMap;
    
    36
    -import fr.ird.observe.spi.map.ImmutableDtoMapDtoSimplifiedName;
    
    37 36
     import java.util.Date;
    
    38 37
     import org.junit.Assert;
    
    39 38
     import org.junit.Before;
    
    ... ... @@ -68,7 +67,7 @@ public class ReferenceValuesSetServiceClientTest extends ServiceClientTestSuppor
    68 67
             //FIXME
    
    69 68
             ReferenceSetsRequest<TripSeineDto> request = new ReferenceSetsRequest<>();
    
    70 69
             request.setRequestName(requestName);
    
    71
    -        request.setLastUpdateDates(ImmutableDtoMapDtoSimplifiedName.<Date>builder().build());
    
    70
    +        request.setLastUpdateDates(ImmutableDtoMap.<Date>builder().build());
    
    72 71
     
    
    73 72
             ImmutableSet<ReferentialDtoReferenceSet<?>> referenceSetResult = service.getReferentialReferenceSets(request);
    
    74 73
             Assert.assertNotNull(referenceSetResult);
    

  • services-local/src/main/java/fr/ird/observe/services/local/service/referential/ReferentialServiceLocal.java
    ... ... @@ -61,7 +61,7 @@ import fr.ird.observe.spi.DtoModelHelper;
    61 61
     import fr.ird.observe.spi.context.ReferentialDtoEntityContext;
    
    62 62
     import fr.ird.observe.spi.context.ReferentialEntityContext;
    
    63 63
     import fr.ird.observe.spi.context.ReferentialReferenceEntityContext;
    
    64
    -import fr.ird.observe.spi.map.ImmutableDtoMapDtoSimplifiedName;
    
    64
    +import fr.ird.observe.spi.map.ImmutableDtoMap;
    
    65 65
     import fr.ird.observe.spi.map.ImmutableSetDtoMap;
    
    66 66
     import java.util.Arrays;
    
    67 67
     import java.util.Collections;
    
    ... ... @@ -143,7 +143,7 @@ public class ReferentialServiceLocal extends ObserveServiceLocal implements Refe
    143 143
     
    
    144 144
                 FormDefinition<D> requestDefinition = optionalRequestDefinition.get();
    
    145 145
     
    
    146
    -            ImmutableDtoMapDtoSimplifiedName<Date> lastUpdateDates = request.getLastUpdateDates();
    
    146
    +            ImmutableDtoMap<Date> lastUpdateDates = request.getLastUpdateDates();
    
    147 147
                 Objects.requireNonNull(lastUpdateDates);
    
    148 148
     
    
    149 149
                 for (Class propertyType : requestDefinition.getPropertiesTypes()) {
    

  • services-local/src/main/java/fr/ird/observe/services/local/service/referential/ReferentialShellBuilder.java
    ... ... @@ -22,9 +22,8 @@ package fr.ird.observe.services.local.service.referential;
    22 22
      * #L%
    
    23 23
      */
    
    24 24
     
    
    25
    -import com.google.common.cache.LoadingCache;
    
    26
    -import fr.ird.observe.dto.reference.ReferentialDtoReference;
    
    27 25
     import fr.ird.observe.entities.referentiel.ObserveReferentialEntity;
    
    26
    +import fr.ird.observe.spi.DbModelHelper;
    
    28 27
     import fr.ird.observe.spi.map.ImmutableSetDtoMap;
    
    29 28
     import java.util.Set;
    
    30 29
     import java.util.TreeSet;
    
    ... ... @@ -43,36 +42,31 @@ public class ReferentialShellBuilder {
    43 42
             return new ReferentialShellBuilder(incomingReferentialIds);
    
    44 43
         }
    
    45 44
     
    
    46
    -    private final GetEntityReferentialsShellVisitor visitor;
    
    45
    +    private final GetEntityReferentialShellVisitor visitor;
    
    47 46
     
    
    48
    -    public ReferentialShellBuilder scan(TopiaEntity entity) {
    
    47
    +    void scan(TopiaEntity entity) {
    
    49 48
             entity.accept(visitor);
    
    50
    -        return this;
    
    51 49
         }
    
    52 50
     
    
    53 51
         public ImmutableSetDtoMap<String> build() {
    
    54
    -        return visitor.missingreferentialIds.build();
    
    52
    +        return visitor.missingReferentialIds.build();
    
    55 53
         }
    
    56 54
     
    
    57 55
         private ReferentialShellBuilder(ImmutableSetDtoMap<String> incomingReferentialIds) {
    
    58
    -        visitor = new GetEntityReferentialsShellVisitor(incomingReferentialIds);
    
    56
    +        visitor = new GetEntityReferentialShellVisitor(incomingReferentialIds);
    
    59 57
         }
    
    60 58
     
    
    61
    -    private static class GetEntityReferentialsShellVisitor implements TopiaEntityVisitor {
    
    59
    +    private static class GetEntityReferentialShellVisitor implements TopiaEntityVisitor {
    
    62 60
     
    
    63 61
             private final Set<String> hitIds;
    
    64 62
             private final ImmutableSetDtoMap<String> incomingReferentialIds;
    
    65
    -        private final ImmutableSetDtoMap.Builder<String> missingreferentialIds;
    
    66
    -        private final LoadingCache<Class<? extends ObserveReferentialEntity>, Class<? extends ReferentialDtoReference>> typeCache;
    
    63
    +        private final ImmutableSetDtoMap.Builder<String> missingReferentialIds;
    
    67 64
     
    
    68
    -        public GetEntityReferentialsShellVisitor(ImmutableSetDtoMap<String> incomingReferentialIds) {
    
    65
    +        GetEntityReferentialShellVisitor(ImmutableSetDtoMap<String> incomingReferentialIds) {
    
    69 66
                 this.incomingReferentialIds = incomingReferentialIds;
    
    70 67
     
    
    71
    -            //FIXME Use our many class mapping api...
    
    72
    -            this.typeCache = null;
    
    73
    -
    
    74 68
                 this.hitIds = new TreeSet<>();
    
    75
    -            this.missingreferentialIds = ImmutableSetDtoMap.builder();
    
    69
    +            this.missingReferentialIds = ImmutableSetDtoMap.builder();
    
    76 70
             }
    
    77 71
     
    
    78 72
             @Override
    
    ... ... @@ -83,9 +77,9 @@ public class ReferentialShellBuilder {
    83 77
                         return;
    
    84 78
                     }
    
    85 79
                     hitIds.add(topiaId);
    
    86
    -                Class<? extends ReferentialDtoReference> dtoType = typeCache.getUnchecked(((ObserveReferentialEntity) entity).getClass());
    
    80
    +                Class<?> dtoType = DbModelHelper.fromReferentialEntity((ObserveReferentialEntity) entity).toReferenceType();
    
    87 81
                     if (!incomingReferentialIds.containsEntry(dtoType, topiaId)) {
    
    88
    -                    missingreferentialIds.put(dtoType, topiaId);
    
    82
    +                    missingReferentialIds.put(dtoType, topiaId);
    
    89 83
                     }
    
    90 84
                 }
    
    91 85
             }
    
    ... ... @@ -117,7 +111,6 @@ public class ReferentialShellBuilder {
    117 111
             @Override
    
    118 112
             public void clear() {
    
    119 113
                 hitIds.clear();
    
    120
    -            typeCache.invalidateAll();
    
    121 114
             }
    
    122 115
         }
    
    123 116
     
    

  • services/src/main/java/fr/ird/observe/services/service/referential/ObserveReferentialCache.java
    ... ... @@ -30,7 +30,6 @@ import fr.ird.observe.dto.reference.ReferentialDtoReferenceSet;
    30 30
     import fr.ird.observe.dto.referential.ReferentialDto;
    
    31 31
     import fr.ird.observe.spi.DtoModelHelper;
    
    32 32
     import fr.ird.observe.spi.map.ImmutableDtoMap;
    
    33
    -import fr.ird.observe.spi.map.ImmutableDtoMapDtoSimplifiedName;
    
    34 33
     import fr.ird.observe.spi.map.MutableDtoMap;
    
    35 34
     import java.io.Closeable;
    
    36 35
     import java.io.Serializable;
    
    ... ... @@ -94,7 +93,7 @@ public class ObserveReferentialCache implements Closeable, Serializable {
    94 93
                 FormDefinition<D> formDefinition = optionalRequestDefinition.get();
    
    95 94
                 log.info(String.format("Loading %d referential dependencies for: %s", formDefinition.getProperties().size(), dtoType.getName()));
    
    96 95
     
    
    97
    -            ImmutableDtoMapDtoSimplifiedName<Date> lastUpdateDates = getLastUpdateDates(formDefinition);
    
    96
    +            ImmutableDtoMap<Date> lastUpdateDates = getLastUpdateDates(formDefinition);
    
    98 97
     
    
    99 98
                 ReferenceSetsRequest<D> request = new ReferenceSetsRequest<>();
    
    100 99
                 request.setRequestName(dtoType);
    
    ... ... @@ -126,9 +125,9 @@ public class ObserveReferentialCache implements Closeable, Serializable {
    126 125
          * @param formDefinition la définition de requète
    
    127 126
          * @return le dictionnaire des dates de dernières mises à jour pour chaque ensemble de référentiels
    
    128 127
          */
    
    129
    -    private ImmutableDtoMapDtoSimplifiedName<Date> getLastUpdateDates(FormDefinition<?> formDefinition) {
    
    128
    +    private ImmutableDtoMap<Date> getLastUpdateDates(FormDefinition<?> formDefinition) {
    
    130 129
     
    
    131
    -        ImmutableDtoMapDtoSimplifiedName.Builder<Date> builder = ImmutableDtoMapDtoSimplifiedName.builder();
    
    130
    +        ImmutableDtoMap.Builder<Date> builder = ImmutableDtoMap.builder();
    
    132 131
     
    
    133 132
             for (Class type : formDefinition.getPropertiesTypes()) {
    
    134 133
     
    

  • services/src/main/java/fr/ird/observe/services/service/referential/ReferenceSetsRequest.java
    ... ... @@ -24,7 +24,7 @@ package fr.ird.observe.services.service.referential;
    24 24
     
    
    25 25
     import fr.ird.observe.dto.IdDto;
    
    26 26
     import fr.ird.observe.dto.ObserveDto;
    
    27
    -import fr.ird.observe.spi.map.ImmutableDtoMapDtoSimplifiedName;
    
    27
    +import fr.ird.observe.spi.map.ImmutableDtoMap;
    
    28 28
     import java.util.Date;
    
    29 29
     
    
    30 30
     /**
    
    ... ... @@ -39,7 +39,7 @@ public class ReferenceSetsRequest<D extends IdDto> implements ObserveDto {
    39 39
     
    
    40 40
         private Class<D> requestName;
    
    41 41
     
    
    42
    -    private ImmutableDtoMapDtoSimplifiedName<Date> lastUpdateDates;
    
    42
    +    private ImmutableDtoMap<Date> lastUpdateDates;
    
    43 43
     
    
    44 44
         public Class<D> getDtoType() {
    
    45 45
             return requestName;
    
    ... ... @@ -49,11 +49,11 @@ public class ReferenceSetsRequest<D extends IdDto> implements ObserveDto {
    49 49
             this.requestName = requestName;
    
    50 50
         }
    
    51 51
     
    
    52
    -    public ImmutableDtoMapDtoSimplifiedName<Date> getLastUpdateDates() {
    
    52
    +    public ImmutableDtoMap<Date> getLastUpdateDates() {
    
    53 53
             return lastUpdateDates;
    
    54 54
         }
    
    55 55
     
    
    56
    -    public void setLastUpdateDates(ImmutableDtoMapDtoSimplifiedName<Date> lastUpdateDates) {
    
    56
    +    public void setLastUpdateDates(ImmutableDtoMap<Date> lastUpdateDates) {
    
    57 57
             this.lastUpdateDates = lastUpdateDates;
    
    58 58
         }
    
    59 59
     
    

  • validation/src/main/resources/i18n/validation_en_GB.properties
    ... ... @@ -498,8 +498,8 @@ observe.validation.nonTargetCatchRelease.required.speciesGroupReleaseMode=Releas
    498 498
     observe.validation.nonTargetCatchRelease.required.status=Status not filled.
    
    499 499
     observe.validation.nonTargetLength.desactivated.sizeMeasureType=Selected size measure type is disabled.
    
    500 500
     observe.validation.nonTargetLength.desactivated.speciesFate=Selected species fate is disabled.
    
    501
    -observe.validation.nonTargetLength.required.sizeMeasureType=Size measure type is mandatory.
    
    502 501
     observe.validation.nonTargetLength.null.speciesFate=Species fate should be filled.
    
    502
    +observe.validation.nonTargetLength.required.sizeMeasureType=Size measure type is mandatory.
    
    503 503
     observe.validation.nonTargetSample.bound.length=Length must be bound between %s and %s.
    
    504 504
     observe.validation.nonTargetSample.bound.weight=Weight must be bound between %s and %s.
    
    505 505
     observe.validation.nonTargetSample.comment.tobig=Comment size can not exceed 1024 characters.
    

  • validation/src/main/resources/i18n/validation_es_ES.properties
    ... ... @@ -498,8 +498,8 @@ observe.validation.nonTargetCatchRelease.required.speciesGroupReleaseMode=Mode d
    498 498
     observe.validation.nonTargetCatchRelease.required.status=État à la libération non renseigné. \#TODO
    
    499 499
     observe.validation.nonTargetLength.desactivated.sizeMeasureType=Selected size mesure type is disabled. \#TODO
    
    500 500
     observe.validation.nonTargetLength.desactivated.speciesFate=El objectFate de fauna seleccionado está desactivado.
    
    501
    -observe.validation.nonTargetLength.required.sizeMeasureType=Es obligatoria especificar el size measure type \#TODO
    
    502 501
     observe.validation.nonTargetLength.null.speciesFate=Futuro de fauna no establecida.
    
    502
    +observe.validation.nonTargetLength.required.sizeMeasureType=Es obligatoria especificar el size measure type \#TODO
    
    503 503
     observe.validation.nonTargetSample.bound.length=La talla para esta especie debe estar comprendida entre %1$s y %2$s.
    
    504 504
     observe.validation.nonTargetSample.bound.weight=La peso para esta especie debe estar comprendida entre %1$s y %2$s.
    
    505 505
     observe.validation.nonTargetSample.comment.tobig=La longitud del campo comentarios está limitada a 1024 carácteres.
    

  • validation/src/main/resources/i18n/validation_fr_FR.properties
    ... ... @@ -498,8 +498,8 @@ observe.validation.nonTargetCatchRelease.required.speciesGroupReleaseMode=Mode d
    498 498
     observe.validation.nonTargetCatchRelease.required.status=État à la libération non renseigné.
    
    499 499
     observe.validation.nonTargetLength.desactivated.sizeMeasureType=Le type de mesure sélectionné est désactivé.
    
    500 500
     observe.validation.nonTargetLength.desactivated.speciesFate=Le devenir faune sélectionné est désactivé.
    
    501
    -observe.validation.nonTargetLength.required.sizeMeasureType=Le type de mesure est obligatoire.
    
    502 501
     observe.validation.nonTargetLength.null.speciesFate=La sélection d'un devenir faune est conseillée.
    
    502
    +observe.validation.nonTargetLength.required.sizeMeasureType=Le type de mesure est obligatoire.
    
    503 503
     observe.validation.nonTargetSample.bound.length=La taille pour cette espèce doit être comprise entre %1$s et %2$s.
    
    504 504
     observe.validation.nonTargetSample.bound.weight=Le poids pour cette espèce doit être compris entre %1$s et %2$s.
    
    505 505
     observe.validation.nonTargetSample.comment.tobig=La taille du commentaire est limitée à 1024 caractères.