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

Commits:

10 changed files:

Changes:

  • models/persistence/src/main/java/fr/ird/observe/entities/data/ll/observation/SetImpl.java
    ... ... @@ -25,12 +25,15 @@ package fr.ird.observe.entities.data.ll.observation;
    25 25
     import fr.ird.observe.dto.data.DataDto;
    
    26 26
     import fr.ird.observe.dto.data.ll.observation.BasketReference;
    
    27 27
     import fr.ird.observe.dto.data.ll.observation.BranchlineReference;
    
    28
    +import fr.ird.observe.dto.data.ll.observation.LonglinePositionAware;
    
    28 29
     import fr.ird.observe.dto.data.ll.observation.LonglinePositionContainerAware;
    
    29 30
     import fr.ird.observe.dto.data.ll.observation.SectionReference;
    
    30 31
     import fr.ird.observe.dto.referential.ReferentialLocale;
    
    31 32
     
    
    33
    +import java.util.LinkedHashMap;
    
    32 34
     import java.util.LinkedList;
    
    33 35
     import java.util.List;
    
    36
    +import java.util.Map;
    
    34 37
     
    
    35 38
     public class SetImpl extends SetAbstract {
    
    36 39
     
    
    ... ... @@ -48,6 +51,8 @@ public class SetImpl extends SetAbstract {
    48 51
         private void loadDtoReferenceParents(LonglinePositionContainerAware dto, ReferentialLocale referentialLocale) {
    
    49 52
             List<SectionReference> sections = new LinkedList<>();
    
    50 53
             List<BasketReference> baskets = new LinkedList<>();
    
    54
    +        Map<String, BasketReference> basketsParents = new LinkedHashMap<>();
    
    55
    +        Map<String, BranchlineReference> branchlinesParents = new LinkedHashMap<>();
    
    51 56
             List<BranchlineReference> branchlines = new LinkedList<>();
    
    52 57
             getSection().forEach(section -> {
    
    53 58
                 section.setParentId(getTopiaId());
    
    ... ... @@ -59,15 +64,31 @@ public class SetImpl extends SetAbstract {
    59 64
                     basket.setParentId(sectionId);
    
    60 65
                     BasketReference basketReference = basket.toReference(referentialLocale);
    
    61 66
                     baskets.add(basketReference);
    
    67
    +                basketsParents.put(basketId, basketReference);
    
    62 68
                     basket.getBranchline().forEach(branchline -> {
    
    63 69
                         branchline.setParentId(basketId);
    
    64 70
                         BranchlineReference branchlineReference = branchline.toReference(referentialLocale);
    
    65 71
                         branchlines.add(branchlineReference);
    
    72
    +                    branchlinesParents.put(branchline.getTopiaId(), branchlineReference);
    
    66 73
                     });
    
    67 74
                 });
    
    68 75
             });
    
    69 76
             dto.setSections(sections);
    
    70 77
             dto.setBaskets(baskets);
    
    71 78
             dto.setBranchlines(branchlines);
    
    79
    +        for (LonglinePositionAware datum : dto.getData()) {
    
    80
    +            BranchlineReference branchline = datum.getBranchline();
    
    81
    +            if (branchline != null) {
    
    82
    +                BranchlineReference branchlineWithParentId = branchlinesParents.get(branchline.getId());
    
    83
    +                datum.setBranchline(branchlineWithParentId);
    
    84
    +            } else {
    
    85
    +                BasketReference basket = datum.getBasket();
    
    86
    +                if (basket != null) {
    
    87
    +                    BasketReference basketWithParentId = basketsParents.get(basket.getId());
    
    88
    +                    datum.setBasket(basketWithParentId);
    
    89
    +                }
    
    90
    +            }
    
    91
    +        }
    
    92
    +
    
    72 93
         }
    
    73 94
     }

  • models/persistence/src/main/resources/db/migration/8.0/60_ll_common_fill-common.sql
    ... ... @@ -71,8 +71,7 @@ INSERT INTO ll_common.onboardprocessing(topiaid, topiaversion, topiacreatedate,
    71 71
     INSERT INTO ll_common.onboardprocessing(topiaid, topiaversion, topiacreatedate, lastupdatedate, code, status, needcomment, uri, label1, label2, label3, label4, label5, label6, label7, label8, homeid) VALUES ('fr.ird.referential.ll.common.OnBoardProcessing#1464000000000#0.22', 1, '2020-10-21 00:00:00', '2020-10-21 00:00:00', 'FILLET', 1, false, null, 'Filleted', 'Filet', 'Filleted #TODO', null, null, null, null, null, null);
    
    72 72
     INSERT INTO ll_common.onboardprocessing(topiaid, topiaversion, topiacreatedate, lastupdatedate, code, status, needcomment, uri, label1, label2, label3, label4, label5, label6, label7, label8, homeid) VALUES ('fr.ird.referential.ll.common.OnBoardProcessing#1464000000000#0.23', 1, '2020-10-21 00:00:00', '2020-10-21 00:00:00', 'GIL', 1, false, null, 'Gilled', 'Sans branchies', 'Gilled #TODO', null, null, null, null, null, null);
    
    73 73
     INSERT INTO ll_common.OnBoardProcessing(topiaid, topiaversion, topiacreatedate, lastupdatedate, code, uri, homeid, needcomment, status, label1, label2, label3, label4, label5, label6, label7, label8) VALUES ('fr.ird.referential.ll.common.OnBoardProcessing#1609847952719#0.41927756421927587', 1, '2021-01-05 11:57:13.019', '2021-01-05 11:59:12.746', 'SALT', null, null, FALSE, 1, 'Salted', 'Salé', 'Salado', null, null, null, null, null);
    
    74
    -INSERT INTO ll_common.OnBoardProcessing(topiaid, topiaversion, topiacreatedate, lastupdatedate, code, uri, homeid, needcomment, status, label1, label2, label3, label4, label5, label6, label7, label8) VALUES ('fr.ird.referential.ll.common.OnBoardProcessing#1609848016239#0.8310203513100917', 1, '2021-01-05 11:59:25.268', '2021-01-05 12:00:16.241', 'LIVE', null, null, FALSE, 1, 'Kept alive', 'Gardé vivant', 'Mantenido vivo', null, null, null, null, null);
    
    75
    -INSERT INTO ll_common.OnBoardProcessing(topiaid, topiaversion, topiacreatedate, lastupdatedate, code, uri, homeid, needcomment, status, label1, label2, label3, label4, label5, label6, label7, label8) VALUES ('fr.ird.referential.ll.common.OnBoardProcessing#1609848457257#0.12756593660166082', 1, '2021-01-05 12:00:19.234', '2021-01-05 12:07:37.259', 'DEAD', null, null, FALSE, 1, 'Kept dead', 'Conservé mort', 'Mantenido muerto', null, null, null, null, null);
    
    74
    +
    
    76 75
     INSERT INTO ll_common.linetype (topiaId, topiaVersion, topiaCreateDate, lastUpdateDate, status, needComment, code, label1, label2, label3) values ('fr.ird.referential.ll.common.LineType#1239832686157#0.9', 0, ${CURRENT_DATE}, ${CURRENT_TIMESTAMP}, 1, false, 'UNK', 'Unknown', 'Inconnu', 'Desconocido');
    
    77 76
     
    
    78 77
     UPDATE ll_common.trip SET observationsAvailability = TRUE;
    

  • models/persistence/src/test/resources/fixtures/persistence/count-referential-longline.properties
    ... ... @@ -47,6 +47,6 @@ ll_common.weightcategory=0
    47 47
     ll_landing.company=30
    
    48 48
     ll_landing.datasource=20
    
    49 49
     ll_common.triptype=2
    
    50
    -ll_common.onboardprocessing=16
    
    50
    +ll_common.onboardprocessing=14
    
    51 51
     ll_landing.conservation=3
    
    52 52
     ll_common.weightdeterminationmethod=0

  • models/persistence/src/test/resources/fixtures/persistence/entity-tables-count-referential.properties
    ... ... @@ -57,7 +57,7 @@ fr.ird.observe.entities.referential.ll.common.LightsticksType=2
    57 57
     fr.ird.observe.entities.referential.ll.common.LineType=9
    
    58 58
     fr.ird.observe.entities.referential.ll.common.MitigationType=15
    
    59 59
     fr.ird.observe.entities.referential.ll.common.ObservationMethod=2
    
    60
    -fr.ird.observe.entities.referential.ll.common.OnBoardProcessing=16
    
    60
    +fr.ird.observe.entities.referential.ll.common.OnBoardProcessing=14
    
    61 61
     fr.ird.observe.entities.referential.ll.common.SettingShape=6
    
    62 62
     fr.ird.observe.entities.referential.ll.common.TripType=2
    
    63 63
     fr.ird.observe.entities.referential.ll.common.VesselActivity=27
    

  • tests/test/src/main/resources/db/8.0/dataForTestLongline.sql.gz
    No preview for this file type
  • tests/test/src/main/resources/db/8.0/dataForTestSeine.sql.gz
    No preview for this file type
  • tests/test/src/main/resources/db/8.0/empty_h2.sql.gz
    No preview for this file type
  • tests/test/src/main/resources/db/8.0/empty_pg.sql.gz
    No preview for this file type
  • tests/test/src/main/resources/db/8.0/referentiel.sql.gz
    No preview for this file type
  • tests/test/src/main/resources/fixtures/global.properties
    ... ... @@ -35,5 +35,5 @@ SPECIES_GROUP_ID=fr.ird.referential.common.SpeciesGroup#1239832683689#0.71201161
    35 35
     # for fr.ird.observe.spi.DbModelHelperTest
    
    36 36
     REFERENCE_DATA_COUNT=53
    
    37 37
     # for fr.ird.observe.services.local.service.referential.differential.DifferentialModelTest
    
    38
    -REFERENTIAL_COUNT=3034
    
    38
    +REFERENTIAL_COUNT=3032
    
    39 39
     ENTITIES_LIMIT_SIZE=100