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

Commits:

18 changed files:

Changes:

  • client/core/src/main/java/fr/ird/observe/client/action/api/FeedBackBuilder.java
    ... ... @@ -113,6 +113,9 @@ public class FeedBackBuilder {
    113 113
         }
    
    114 114
     
    
    115 115
         private void copyDirectoryToZip(Path rootFile, ZipOutputStream zipOutputStream) throws IOException {
    
    116
    +        if (Files.notExists(rootFile )) {
    
    117
    +            return;
    
    118
    +        }
    
    116 119
             Path rootFileParent = rootFile.getParent();
    
    117 120
             Files.walk(rootFile).filter(Files::isRegularFile).forEach(p -> copyFileToZip(rootFileParent, p, zipOutputStream));
    
    118 121
         }
    

  • client/core/src/main/java/fr/ird/observe/client/datasource/api/ObserveSwingDataSource.java
    ... ... @@ -56,7 +56,6 @@ import fr.ird.observe.services.ObserveServicesProviderSupport;
    56 56
     import fr.ird.observe.services.service.BabModelVersionException;
    
    57 57
     import fr.ird.observe.services.service.DataSourceService;
    
    58 58
     import fr.ird.observe.services.service.DatabaseConnexionNotAuthorizedException;
    
    59
    -import fr.ird.observe.services.service.DatabaseDestroyNotAuthorizedException;
    
    60 59
     import fr.ird.observe.services.service.DatabaseNotFoundException;
    
    61 60
     import fr.ird.observe.services.service.ObserveService;
    
    62 61
     import fr.ird.observe.services.service.referential.ObserveReferentialCache;
    
    ... ... @@ -81,6 +80,7 @@ import javax.swing.BoundedRangeModel;
    81 80
     import javax.swing.Icon;
    
    82 81
     import javax.swing.JOptionPane;
    
    83 82
     import javax.swing.event.EventListenerList;
    
    83
    +import java.io.File;
    
    84 84
     import java.nio.file.Files;
    
    85 85
     import java.nio.file.Path;
    
    86 86
     import java.util.Iterator;
    
    ... ... @@ -206,7 +206,7 @@ public class ObserveSwingDataSource extends ObserveServicesProviderSupport imple
    206 206
         }
    
    207 207
     
    
    208 208
         public void open() throws DatabaseConnexionNotAuthorizedException, DatabaseNotFoundException, BabModelVersionException, IncompatibleDataSourceCreateConfigurationException, DataSourceCreateWithNoReferentialImportException {
    
    209
    -        checkIsNotAlreadyOpen();
    
    209
    +        checkIsNotOpen();
    
    210 210
             fireNewMessage(t("observe.ui.datasource.storage.message.opening", getLabel()));
    
    211 211
             fireOpening();
    
    212 212
             DataSourceService dataSourceService = servicesProvider.getDataSourceService();
    
    ... ... @@ -218,7 +218,7 @@ public class ObserveSwingDataSource extends ObserveServicesProviderSupport imple
    218 218
         public void create(DataSourceCreateConfigurationDto createDto)
    
    219 219
                 throws IncompatibleDataSourceCreateConfigurationException, DataSourceCreateWithNoReferentialImportException,
    
    220 220
                 DatabaseNotFoundException, DatabaseConnexionNotAuthorizedException, BabModelVersionException {
    
    221
    -        checkIsNotAlreadyOpen();
    
    221
    +        checkIsNotOpen();
    
    222 222
             fireNewMessage(t("observe.ui.datasource.storage.message.creating", getLabel()));
    
    223 223
             fireOpening();
    
    224 224
             DataSourceService dataSourceService = servicesProvider.getDataSourceService();
    
    ... ... @@ -256,24 +256,14 @@ public class ObserveSwingDataSource extends ObserveServicesProviderSupport imple
    256 256
             }
    
    257 257
         }
    
    258 258
     
    
    259
    -    public void destroy() throws DatabaseDestroyNotAuthorizedException {
    
    260
    -        checkIsOpen();
    
    259
    +    public void destroy() {
    
    260
    +        checkIsNotOpen();
    
    261 261
             fireNewMessage(t("observe.ui.datasource.storage.message.destroying", getLabel()));
    
    262
    -        fireClosing();
    
    263
    -        referentialCache.close();
    
    264 262
             try {
    
    265
    -            DataSourceService dataSourceService = servicesProvider.getDataSourceService();
    
    266
    -            dataSourceService.destroy();
    
    263
    +            destroy0();
    
    267 264
             } finally {
    
    268 265
                 ObserveUtil.cleanMemory();
    
    269
    -            try {
    
    270
    -                servicesProvider.close();
    
    271
    -            } catch (Exception e) {
    
    272
    -                log.error("Could not close properly services provider", e);
    
    273
    -            }
    
    274
    -            setConnection(null);
    
    275 266
                 fireNewMessage(t("observe.ui.datasource.storage.message.destroyed", getLabel()));
    
    276
    -            fireClosed();
    
    277 267
             }
    
    278 268
         }
    
    279 269
     
    
    ... ... @@ -370,7 +360,7 @@ public class ObserveSwingDataSource extends ObserveServicesProviderSupport imple
    370 360
         }
    
    371 361
     
    
    372 362
         public ObserveDataSourceInformation checkCanConnect(boolean canBeEmpty) throws DatabaseConnexionNotAuthorizedException, DatabaseNotFoundException {
    
    373
    -        checkIsNotAlreadyOpen();
    
    363
    +        checkIsNotOpen();
    
    374 364
             DataSourceService dataSourceService = servicesProvider.getDataSourceService();
    
    375 365
             ObserveDataSourceInformation dataSourceInformation = canBeEmpty ? dataSourceService.checkCanConnectOrBeEmpty(getConfiguration()) : dataSourceService.checkCanConnect(getConfiguration());
    
    376 366
             setOwner(dataSourceInformation.isOwner());
    
    ... ... @@ -495,12 +485,6 @@ public class ObserveSwingDataSource extends ObserveServicesProviderSupport imple
    495 485
             }
    
    496 486
         }
    
    497 487
     
    
    498
    -    private void checkIsNotAlreadyOpen() {
    
    499
    -        if (isOpen()) {
    
    500
    -            throw new IllegalStateException("Connection is already open");
    
    501
    -        }
    
    502
    -    }
    
    503
    -
    
    504 488
         private void checkIsNotOpen() {
    
    505 489
             if (isOpen()) {
    
    506 490
                 throw new IllegalStateException("Connection is open");
    
    ... ... @@ -614,4 +598,18 @@ public class ObserveSwingDataSource extends ObserveServicesProviderSupport imple
    614 598
         public String getSummaryText() {
    
    615 599
             return ObserveSwingDataSourceTemplate.generate(this);
    
    616 600
         }
    
    601
    +
    
    602
    +
    
    603
    +    public void destroy0() {
    
    604
    +
    
    605
    +        if (!isLocal()) {
    
    606
    +            throw new IllegalStateException("CAN NOT DESTROY A NONE LOCAL DATABASE");
    
    607
    +        }
    
    608
    +        ObserveDataSourceConfigurationTopiaH2 dataSourceConfigurationH2 = (ObserveDataSourceConfigurationTopiaH2) getConfiguration();
    
    609
    +        File databaseFile = dataSourceConfigurationH2.getDatabaseFile();
    
    610
    +        if (!databaseFile.delete()) {
    
    611
    +            throw new IllegalStateException("could not delete " + databaseFile);
    
    612
    +        }
    
    613
    +    }
    
    614
    +
    
    617 615
     }

  • client/core/src/main/java/fr/ird/observe/client/datasource/h2/backup/BackupsManager.java
    ... ... @@ -100,11 +100,12 @@ public class BackupsManager implements Closeable {
    100 100
                     DataSourceCreateConfigurationDto createDto = new DataSourceCreateConfigurationDto();
    
    101 101
                     createDto.setImportDatabase(TopiaSqlScript.of(backupStorage.getFile().toURI()));
    
    102 102
     
    
    103
    -                ObserveSwingDataSource dataSource = dataSourcesManager.newTemporaryH2DataSource("check-" + backupStorage.getName());
    
    104
    -                try {
    
    105
    -                    dataSource.create(createDto);
    
    106
    -                } finally {
    
    107
    -                    dataSource.destroy();
    
    103
    +                try (ObserveSwingDataSource dataSource = dataSourcesManager.newTemporaryH2DataSource("check-" + backupStorage.getName())) {
    
    104
    +                    try {
    
    105
    +                        dataSource.create(createDto);
    
    106
    +                    } finally {
    
    107
    +                        dataSource.destroy();
    
    108
    +                    }
    
    108 109
                     }
    
    109 110
     
    
    110 111
                     backupStorage.setVerified(true);
    

  • client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/DataSourceEditorHelper.java
    ... ... @@ -204,6 +204,7 @@ public class DataSourceEditorHelper {
    204 204
                     if (response == 1) {
    
    205 205
                         // creation de la base locale
    
    206 206
                         initMode = DataSourceInitMode.CREATE;
    
    207
    +                    dbModes.add(DataSourceConnectMode.LOCAL);
    
    207 208
                         title = I18n.n("observe.runner.initStorage.title.create.local.db");
    
    208 209
                     } else {
    
    209 210
                         // connexion à une base distante
    

  • client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/loading/close/CloseDataSourceAction.java
    ... ... @@ -48,7 +48,7 @@ public class CloseDataSourceAction extends ActionWithSteps<LoadingDataSourceCont
    48 48
             boolean currentDataSourceIsLocal = currentDataSource != null && currentDataSource.isLocal();
    
    49 49
             boolean doBackupLocal = localStorageExist && model.isDoBackup();
    
    50 50
             boolean doDestroyLocal = localStorageExist && model.getChooseDb().getInitModel().isOnCreateMode();
    
    51
    -        boolean doOpenLocal = (currentDataSourceIsLocal || localStorageExist) && (doBackupLocal || doDestroyLocal);
    
    51
    +        boolean doOpenLocal = !currentDataSourceIsLocal && doBackupLocal;
    
    52 52
             boolean doCloseCurrentDataSource = currentDataSource != null && !doOpenLocal;
    
    53 53
     
    
    54 54
             return ImmutableList.of(
    
    ... ... @@ -56,10 +56,10 @@ public class CloseDataSourceAction extends ActionWithSteps<LoadingDataSourceCont
    56 56
                     new OpenLocalDataSourceActionStep(actionContext, doOpenLocal),
    
    57 57
                     // Backup local data source
    
    58 58
                     new BackupLocalDataSourceActionStep(actionContext, doBackupLocal),
    
    59
    -                // Destroy local data source
    
    60
    -                new DestroyLocalDataSourceActionStep(actionContext, doDestroyLocal),
    
    61 59
                     // Close local data source
    
    62 60
                     new CloseLocalDataSourceActionStep(actionContext, doOpenLocal),
    
    61
    +                // Destroy local data source
    
    62
    +                new DestroyLocalDataSourceActionStep(actionContext, doDestroyLocal),
    
    63 63
                     // Close current data source
    
    64 64
                     new CloseCurrentDataSourceActionStep(actionContext, doCloseCurrentDataSource));
    
    65 65
         }
    

  • client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/loading/close/DestroyLocalDataSourceActionStep.java
    ... ... @@ -56,7 +56,7 @@ public class DestroyLocalDataSourceActionStep extends CloseDataSourceActionStepS
    56 56
         }
    
    57 57
     
    
    58 58
         @Override
    
    59
    -    public void doAction0(ActionWithSteps<LoadingDataSourceContext> mainAction) throws Exception {
    
    59
    +    public void doAction0(ActionWithSteps<LoadingDataSourceContext> mainAction) {
    
    60 60
             ObserveSwingDataSource localDataSource = Objects.requireNonNull(actionContext.getLocalDataSource());
    
    61 61
             log.info(String.format("Destroy local data source %s", localDataSource));
    
    62 62
             try {
    

  • client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/loading/open/OpenDataSourceActionStep.java
    ... ... @@ -92,7 +92,7 @@ public class OpenDataSourceActionStep extends OpenDataSourceActionStepSupport {
    92 92
             newDataSource.setProgressModel(actionContext.getProgressModel());
    
    93 93
     
    
    94 94
             DataSourceInitModel initModel = model.getChooseDb().getInitModel();
    
    95
    -        boolean useLocalDataSource = initModel.isOnConnectModeLocal();
    
    95
    +        boolean useLocalDataSource = initModel.isOnConnectMode() && initModel.isOnConnectModeLocal();
    
    96 96
     
    
    97 97
             if (useLocalDataSource) {
    
    98 98
                 // try an explicit data source migration
    
    ... ... @@ -105,7 +105,7 @@ public class OpenDataSourceActionStep extends OpenDataSourceActionStepSupport {
    105 105
                     log.error(String.format("could not get local data source information: %s", newDataSource), e);
    
    106 106
                     throw e;
    
    107 107
                 }
    
    108
    -
    
    108
    +            //FIXME Add User to migrate or cancel
    
    109 109
                 try {
    
    110 110
                     newDataSource.migrateData(dataSourceInformation, config.getModelVersion());
    
    111 111
                     incrementsProgress();
    

  • client/datasource/editor/spi/src/main/java/fr/ird/observe/client/datasource/editor/spi/content/data/simple/ContentSimpleUIDescriptor.java
    ... ... @@ -108,4 +108,9 @@ public class ContentSimpleUIDescriptor implements ContentUIDescriptor {
    108 108
         public void setCapabilitiesDescriptor(Map<String, List<CapabilityDescriptor>> capabilities) {
    
    109 109
             capabilitiesDescriptor = capabilities;
    
    110 110
         }
    
    111
    +
    
    112
    +    @Override
    
    113
    +    public String getReferenceProperty() {
    
    114
    +        return "getParentReference()";
    
    115
    +    }
    
    111 116
     }

  • client/datasource/editor/spi/src/main/java/fr/ird/observe/client/datasource/editor/spi/content/data/simple/GenerateContentSimpleUINavigationScope.java
    ... ... @@ -48,10 +48,15 @@ public class GenerateContentSimpleUINavigationScope extends GenerateContentSimpl
    48 48
     
    
    49 49
             @Override
    
    50 50
             public Builder createBuilder(String contentUiType, String nodeType) {
    
    51
    -            String selectTypeName = generator.detectCapabilities.parentRelations.get(generator.packageName + "." + nodeType).replace(generator.packageName, generator.dtoPackage).replace("UINavigationNode", "Dto");
    
    52
    -            return newBuilder(contentUiType, nodeType)
    
    51
    +            String parentNode = generator.detectCapabilities.parentRelations.get(generator.packageName + "." + nodeType).replace("UINavigationNode", "Dto");
    
    52
    +            String selectTypeName = parentNode.replace(generator.packageName, generator.dtoPackage);
    
    53
    +
    
    54
    +            if (selectTypeName.startsWith(parentNode)) {
    
    55
    +                // parent node is not in this package
    
    56
    +                selectTypeName = null;
    
    57
    +            }
    
    58
    +            Builder builder = newBuilder(contentUiType, nodeType)
    
    53 59
                         .setModule()
    
    54
    -                    .setSubNode()
    
    55 60
                         .setDtoTypeFromNodeType()
    
    56 61
                         .setMainDtoTypeFromDtoType()
    
    57 62
                         .setDtoReferenceTypeFromMainDtoType()
    
    ... ... @@ -60,6 +65,10 @@ public class GenerateContentSimpleUINavigationScope extends GenerateContentSimpl
    60 65
                         .setNodeDataTypeFromDtoType()
    
    61 66
                         .setServiceTypeFromDtoType()
    
    62 67
                         .setServiceParentTypeFromParentType();
    
    68
    +            if (selectTypeName != null) {
    
    69
    +                builder.setSubNode();
    
    70
    +            }
    
    71
    +            return builder;
    
    63 72
             }
    
    64 73
     
    
    65 74
             @Override
    

  • client/datasource/editor/spi/src/main/java/fr/ird/observe/client/datasource/editor/spi/content/helper/ContentUIHandlerHelper.java
    ... ... @@ -256,7 +256,7 @@ public class ContentUIHandlerHelper extends ContentUIHelperSupport {
    256 256
                 serviceParentMethod = serviceParentMethodPrefix + StringUtils.capitalize(serviceParentType.getSimpleName());
    
    257 257
             }
    
    258 258
             if (extraType == null) {
    
    259
    -            if (editNode != null && selectNode != null && selectNode.getType().equals(editNode.getType())) {
    
    259
    +            if (generator.getDescriptor().getContentNodeType() != ContentNodeType.SIMPLE && editNode != null && selectNode != null && selectNode.getType().equals(editNode.getType())) {
    
    260 260
                     imports.add(MoveAction.class.getName());
    
    261 261
                     imports.add(MoveRequestBuilder.class.getName());
    
    262 262
                     String methodName = "getBrothers";
    

  • pom.xml
    ... ... @@ -24,7 +24,7 @@
    24 24
       <parent>
    
    25 25
         <groupId>io.ultreia.maven</groupId>
    
    26 26
         <artifactId>pom</artifactId>
    
    27
    -    <version>2021.22</version>
    
    27
    +    <version>2021.23</version>
    
    28 28
       </parent>
    
    29 29
     
    
    30 30
       <groupId>fr.ird.observe</groupId>
    
    ... ... @@ -151,7 +151,7 @@
    151 151
         <maven.build.timestamp.format>dd/MM/yyyy HH:mm z</maven.build.timestamp.format>
    
    152 152
         <buildDate>${maven.build.timestamp}</buildDate>
    
    153 153
     
    
    154
    -    <toolkit.version>5.0.12</toolkit.version>
    
    154
    +    <toolkit.version>5.0.13</toolkit.version>
    
    155 155
     
    
    156 156
         <lib.version.ognl>3.1.28</lib.version.ognl>
    
    157 157
         <!--can't use 1.4.197 (date has changed + blob also)-->
    

  • server/core/src/main/filtered-resources/mapping
    ... ... @@ -59,7 +59,6 @@ GET /api/v1/DataSourceService/checkCanConnect
    59 59
     GET    /api/v1/DataSourceService/checkCanConnectOrBeEmpty                                                                            v1.DataSourceServiceRestApi.checkCanConnectOrBeEmpty
    
    60 60
     GET    /api/v1/DataSourceService/close                                                                                               v1.DataSourceServiceRestApi.close
    
    61 61
     GET    /api/v1/DataSourceService/create                                                                                              v1.DataSourceServiceRestApi.create
    
    62
    -GET    /api/v1/DataSourceService/destroy                                                                                             v1.DataSourceServiceRestApi.destroy
    
    63 62
     GET    /api/v1/DataSourceService/generateHomeId                                                                                      v1.DataSourceServiceRestApi.generateHomeId
    
    64 63
     GET    /api/v1/DataSourceService/getUsers                                                                                            v1.DataSourceServiceRestApi.getUsers
    
    65 64
     GET    /api/v1/DataSourceService/isIdValid                                                                                           v1.DataSourceServiceRestApi.isIdValid
    

  • services/api-test/pom.xml
    ... ... @@ -126,10 +126,6 @@
    126 126
           <artifactId>junit</artifactId>
    
    127 127
           <scope>provided</scope>
    
    128 128
         </dependency>
    
    129
    -    <dependency>
    
    130
    -      <groupId>fr.ird.observe</groupId>
    
    131
    -      <artifactId>toolkit-persistence</artifactId>
    
    132
    -    </dependency>
    
    133 129
       </dependencies>
    
    134 130
     
    
    135 131
       <build>
    
    ... ... @@ -137,6 +133,7 @@
    137 133
           <plugin>
    
    138 134
             <groupId>io.ultreia.java4all.http</groupId>
    
    139 135
             <artifactId>http-maven-plugin</artifactId>
    
    136
    +        <version>${lib.version.java4all.http}</version>
    
    140 137
             <executions>
    
    141 138
               <execution>
    
    142 139
                 <id>default-generate-api-test</id>
    

  • services/api-test/src/main/java/fr/ird/observe/services/service/DataSourceServiceFixtures.java
    ... ... @@ -90,14 +90,6 @@ public class DataSourceServiceFixtures extends GeneratedDataSourceServiceFixture
    90 90
             super.create(service);
    
    91 91
         }
    
    92 92
     
    
    93
    -    @Override
    
    94
    -    public void destroy(DataSourceService service) {
    
    95
    -        // FIXME:Test Remove super method invocation and implements fixture
    
    96
    -        // actual = service.destroy(getProperty("destroy.id"));
    
    97
    -        // Assert.assertNotNull(actual);
    
    98
    -        super.destroy(service);
    
    99
    -    }
    
    100
    -
    
    101 93
         @Override
    
    102 94
         public void getUsers(DataSourceService service) {
    
    103 95
             // FIXME:Test Remove super method invocation and implements fixture
    

  • services/api-test/src/main/java/fr/ird/observe/services/service/data/DataFileServiceFixtures.java
    ... ... @@ -23,9 +23,8 @@ package fr.ird.observe.services.service.data;
    23 23
      */
    
    24 24
     
    
    25 25
     
    
    26
    +import fr.ird.observe.dto.DataNotFoundException;
    
    26 27
     import fr.ird.observe.dto.data.DataFileDto;
    
    27
    -import fr.ird.observe.entities.DataNotFoundException;
    
    28
    -import fr.ird.observe.services.service.DataFileNotFoundException;
    
    29 28
     import org.junit.Assert;
    
    30 29
     
    
    31 30
     public class DataFileServiceFixtures extends GeneratedDataFileServiceFixtures {
    
    ... ... @@ -34,7 +33,7 @@ public class DataFileServiceFixtures extends GeneratedDataFileServiceFixtures {
    34 33
         public void getDataFile(DataFileService service) {
    
    35 34
     
    
    36 35
             try {
    
    37
    -            service.getDataFile(getProperty("getDataFile.id")+"Fake"+System.nanoTime());
    
    36
    +            service.getDataFile(getProperty("getDataFile.id") + "Fake" + System.nanoTime());
    
    38 37
                 Assert.fail("Should not find a data file for a fake id");
    
    39 38
             } catch (DataNotFoundException e) {
    
    40 39
                 // fine :)
    
    ... ... @@ -49,12 +48,12 @@ public class DataFileServiceFixtures extends GeneratedDataFileServiceFixtures {
    49 48
             DataFileDto actual = service.getDataFile(getProperty("getDataFile.id"));
    
    50 49
             Assert.assertNotNull(actual);
    
    51 50
             Assert.assertNotNull(actual.getContent());
    
    52
    -        Assert.assertEquals(getIntegerProperty("getDataFile.length"),actual.getContent().length);
    
    51
    +        Assert.assertEquals(getIntegerProperty("getDataFile.length"), actual.getContent().length);
    
    53 52
     
    
    54 53
             actual = service.getDataFile(getProperty("getDataFile.id.sensorUsed"));
    
    55 54
             Assert.assertNotNull(actual);
    
    56 55
             Assert.assertNotNull(actual.getContent());
    
    57
    -        Assert.assertEquals(getIntegerProperty("getDataFile.sensorUsed.length"),actual.getContent().length);
    
    56
    +        Assert.assertEquals(getIntegerProperty("getDataFile.sensorUsed.length"), actual.getContent().length);
    
    58 57
     
    
    59 58
         }
    
    60 59
     
    

  • services/local-impl/src/main/java/fr/ird/observe/services/local/service/DataSourceServiceLocalSupport.java
    ... ... @@ -46,7 +46,6 @@ import fr.ird.observe.services.local.ObserveSecurityHelper;
    46 46
     import fr.ird.observe.services.service.BabModelVersionException;
    
    47 47
     import fr.ird.observe.services.service.DataSourceService;
    
    48 48
     import fr.ird.observe.services.service.DatabaseConnexionNotAuthorizedException;
    
    49
    -import fr.ird.observe.services.service.DatabaseDestroyNotAuthorizedException;
    
    50 49
     import fr.ird.observe.services.service.DatabaseNotFoundException;
    
    51 50
     import fr.ird.observe.services.service.sql.AddSqlScriptProducerRequest;
    
    52 51
     import fr.ird.observe.services.service.sql.SqlScriptProducerService;
    
    ... ... @@ -263,23 +262,23 @@ public class DataSourceServiceLocalSupport extends ObserveServiceLocal implement
    263 262
             Optional<ObserveTopiaApplicationContext> optionalTopiaApplicationContext = ObserveTopiaApplicationContextFactory.getTopiaApplicationContextIfPresent(dataSourceConfiguration);
    
    264 263
             close(dataSourceConfiguration, optionalTopiaApplicationContext.orElse(null));
    
    265 264
         }
    
    266
    -
    
    267
    -    @Override
    
    268
    -    public void destroy() throws DatabaseDestroyNotAuthorizedException {
    
    269
    -        ObserveDataSourceConfigurationTopiaSupport dataSourceConfiguration = (ObserveDataSourceConfigurationTopiaSupport) serviceContext.getServiceInitializer().optionalConfiguration().orElseThrow(IllegalStateException::new);
    
    270
    -        if (!dataSourceConfiguration.isLocal()) {
    
    271
    -            throw new DatabaseDestroyNotAuthorizedException(getApplicationLocale());
    
    272
    -        }
    
    273
    -
    
    274
    -        Optional<ObserveTopiaApplicationContext> optionalTopiaApplicationContext = ObserveTopiaApplicationContextFactory.getTopiaApplicationContextIfPresent(dataSourceConfiguration);
    
    275
    -        close(dataSourceConfiguration, optionalTopiaApplicationContext.orElse(null));
    
    276
    -
    
    277
    -        ObserveDataSourceConfigurationTopiaH2 dataSourceConfigurationH2 = (ObserveDataSourceConfigurationTopiaH2) dataSourceConfiguration;
    
    278
    -        File databaseFile = dataSourceConfigurationH2.getDatabaseFile();
    
    279
    -        if (!databaseFile.delete()) {
    
    280
    -            throw new IllegalStateException("could not delete " + databaseFile);
    
    281
    -        }
    
    282
    -    }
    
    265
    +//
    
    266
    +//    @Override
    
    267
    +//    public void destroy() throws DatabaseDestroyNotAuthorizedException {
    
    268
    +//        ObserveDataSourceConfigurationTopiaSupport dataSourceConfiguration = (ObserveDataSourceConfigurationTopiaSupport) serviceContext.getServiceInitializer().optionalConfiguration().orElseThrow(IllegalStateException::new);
    
    269
    +//        if (!dataSourceConfiguration.isLocal()) {
    
    270
    +//            throw new DatabaseDestroyNotAuthorizedException(getApplicationLocale());
    
    271
    +//        }
    
    272
    +//
    
    273
    +//        Optional<ObserveTopiaApplicationContext> optionalTopiaApplicationContext = ObserveTopiaApplicationContextFactory.getTopiaApplicationContextIfPresent(dataSourceConfiguration);
    
    274
    +//        close(dataSourceConfiguration, optionalTopiaApplicationContext.orElse(null));
    
    275
    +//
    
    276
    +//        ObserveDataSourceConfigurationTopiaH2 dataSourceConfigurationH2 = (ObserveDataSourceConfigurationTopiaH2) dataSourceConfiguration;
    
    277
    +//        File databaseFile = dataSourceConfigurationH2.getDatabaseFile();
    
    278
    +//        if (!databaseFile.delete()) {
    
    279
    +//            throw new IllegalStateException("could not delete " + databaseFile);
    
    280
    +//        }
    
    281
    +//    }
    
    283 282
     
    
    284 283
         @Override
    
    285 284
         public void backup(File backupFile) {
    

  • services/local-impl/src/main/java/fr/ird/observe/services/local/service/ObserveServiceLocal.java
    ... ... @@ -36,7 +36,7 @@ import fr.ird.observe.dto.reference.ReferentialDtoReferenceSet;
    36 36
     import fr.ird.observe.dto.referential.ReferentialDto;
    
    37 37
     import fr.ird.observe.dto.referential.ReferentialLocale;
    
    38 38
     import fr.ird.observe.dto.result.SaveResultDto;
    
    39
    -import fr.ird.observe.entities.DataNotFoundException;
    
    39
    +import fr.ird.observe.dto.DataNotFoundException;
    
    40 40
     import fr.ird.observe.entities.Entity;
    
    41 41
     import fr.ird.observe.entities.ObserveTopiaApplicationContext;
    
    42 42
     import fr.ird.observe.entities.ObserveTopiaApplicationContextFactory;
    

  • services/local-impl/src/main/java/fr/ird/observe/services/local/service/data/ll/logbook/ActivitySampleServiceLocalSupport.java
    ... ... @@ -29,7 +29,7 @@ import fr.ird.observe.dto.data.ll.logbook.ActivitySampleDto;
    29 29
     import fr.ird.observe.dto.data.ll.logbook.ActivitySampleReference;
    
    30 30
     import fr.ird.observe.dto.reference.DataDtoReferenceSet;
    
    31 31
     import fr.ird.observe.dto.result.SaveResultDto;
    
    32
    -import fr.ird.observe.entities.DataNotFoundException;
    
    32
    +import fr.ird.observe.dto.DataNotFoundException;
    
    33 33
     import fr.ird.observe.entities.Entity;
    
    34 34
     import fr.ird.observe.entities.ReplicateDataEngine;
    
    35 35
     import fr.ird.observe.entities.data.TripAware;