Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe
Commits:
-
0c820790
by Tony CHEMIT at 2018-04-01T09:22:55Z
-
1491da9a
by Tony CHEMIT at 2018-04-01T09:22:59Z
-
9f65eea2
by Tony CHEMIT at 2018-04-01T09:22:59Z
-
4cd6cb75
by Tony CHEMIT at 2018-04-01T09:22:59Z
30 changed files:
- client/src/main/ftl/dataSourceConnectionReport_en.ftl
- client/src/main/ftl/dataSourceConnectionReport_es.ftl
- client/src/main/ftl/dataSourceConnectionReport_fr.ftl
- client/src/main/java/fr/ird/observe/client/ui/admin/save/SaveLocalUIHandler.java
- client/src/main/java/fr/ird/observe/client/ui/content/data/longline/LonglinePositionHelper.java
- client/src/main/java/fr/ird/observe/client/ui/storage/StorageUIHandler.java
- client/src/main/java/fr/ird/observe/client/ui/storage/StorageUIModel.java
- dto/src/main/java/fr/ird/observe/binder/data/longline/BasketDtoReferenceBinder.java
- dto/src/main/java/fr/ird/observe/binder/data/longline/BranchlineDtoReferenceBinder.java
- − dto/src/main/java/fr/ird/observe/dto/data/longline/BasketWithSectionIdDto.java
- dto/src/main/java/fr/ird/observe/dto/data/longline/BasketWithSectionIdReference.java
- − dto/src/main/java/fr/ird/observe/dto/data/longline/BranchlineWithBasketIdDto.java
- dto/src/main/java/fr/ird/observe/dto/data/longline/BranchlineWithBasketIdReference.java
- dto/src/main/models/Observe.model
- persistence/pom.xml
- persistence/src/main/java/fr/ird/observe/binder/data/longline/BasketEntityReferenceBinder.java
- persistence/src/main/java/fr/ird/observe/binder/data/longline/BranchlineEntityReferenceBinder.java
- persistence/src/main/java/fr/ird/observe/persistence/ObserveTopiaApplicationContext.java
- persistence/src/main/java/fr/ird/observe/persistence/ObserveTopiaConfiguration.java
- + persistence/src/main/resources/hibernate.properties
- services-local/src/main/java/fr/ird/observe/services/local/ObserveJdbcHelper.java
- services-local/src/main/java/fr/ird/observe/services/local/ObserveServiceContextLocal.java
- services-local/src/main/java/fr/ird/observe/services/local/service/DataSourceServiceLocal.java
- services-local/src/main/java/fr/ird/observe/services/local/service/ObserveServiceLocal.java
- services-local/src/main/java/fr/ird/observe/services/local/service/data/TripManagementServiceLocal.java
- services-local/src/main/java/fr/ird/observe/services/local/service/data/longline/LonglinePositionSetDtoHelper.java
- services-local/src/main/java/fr/ird/observe/services/local/service/referential/ReferentialServiceLocal.java
- services-local/src/test/java/fr/ird/observe/services/local/service/sql/MigrateTestsDatabases.java
- services-local/src/test/java/fr/ird/observe/services/local/service/sql/SqlScriptProducerServiceLocalTest.java
- services/src/main/java/fr/ird/observe/services/service/sql/AddSqlScriptProducerRequest.java
Changes:
| ... | ... | @@ -57,14 +57,14 @@ |
| 57 | 57 |
|
| 58 | 58 |
<li>
|
| 59 | 59 |
<!--FIXME Bavencoff 17/03/2016 use decorator-->
|
| 60 |
- [${program.getPropertyValue("gearTypePrefix")}] Programme ${program.getPropertyValue("label")}
|
|
| 60 |
+ [${program.getGearTypePrefix()}] Programme ${program.getLabel()}
|
|
| 61 | 61 |
<ul>
|
| 62 | 62 |
|
| 63 | 63 |
<#list selectDataModel.getSelectedTripsByProgram(program) as trip>
|
| 64 | 64 |
|
| 65 | 65 |
<li>
|
| 66 | 66 |
<!--FIXME Bavencoff 17/03/2016 use decorator-->
|
| 67 |
- ${trip.getPropertyValue("startDate")?date?string.short} - ${trip.getPropertyValue("endDate")?date?string.short} - ${trip.getPropertyValue("vessel")} - ${trip.getPropertyValue("observer")}
|
|
| 67 |
+ ${trip.getStartDate()?date?string.short} - ${trip.getEndDate()?date?string.short} - ${trip.getVesselLabel()} - ${trip.getObserverLabel()}
|
|
| 68 | 68 |
</li>
|
| 69 | 69 |
|
| 70 | 70 |
</#list>
|
| ... | ... | @@ -62,14 +62,14 @@ |
| 62 | 62 |
|
| 63 | 63 |
<li>
|
| 64 | 64 |
<!--FIXME Bavencoff 17/03/2016 use decorator-->
|
| 65 |
- [${program.getPropertyValue("gearTypePrefix")}] Programa ${program.getPropertyValue("label")}
|
|
| 65 |
+ [${program.getGearTypePrefix()}] Programa ${program.getLabel()}
|
|
| 66 | 66 |
<ul>
|
| 67 | 67 |
|
| 68 | 68 |
<#list selectDataModel.getSelectedTripsByProgram(program) as trip>
|
| 69 | 69 |
|
| 70 | 70 |
<li>
|
| 71 | 71 |
<!--FIXME Bavencoff 17/03/2016 use decorator-->
|
| 72 |
- ${trip.getPropertyValue("startDate")?date?string.short} - ${trip.getPropertyValue("endDate")?date?string.short} - ${trip.getPropertyValue("vessel")} - ${trip.getPropertyValue("observer")}
|
|
| 72 |
+ ${trip.getStartDate()?date?string.short} - ${trip.getEndDate()?date?string.short} - ${trip.getVesselLabel()} - ${trip.getObserverLabel()}
|
|
| 73 | 73 |
</li>
|
| 74 | 74 |
|
| 75 | 75 |
</#list>
|
| ... | ... | @@ -57,14 +57,14 @@ |
| 57 | 57 |
|
| 58 | 58 |
<li>
|
| 59 | 59 |
<!--FIXME Bavencoff 17/03/2016 use decorator-->
|
| 60 |
- [${program.getPropertyValue("gearTypePrefix")}] Programme ${program.getPropertyValue("label")}
|
|
| 60 |
+ [${program.getGearTypePrefix()}] Programme ${program.getLabel()}
|
|
| 61 | 61 |
<ul>
|
| 62 | 62 |
|
| 63 | 63 |
<#list selectDataModel.getSelectedTripsByProgram(program) as trip>
|
| 64 | 64 |
|
| 65 | 65 |
<li>
|
| 66 | 66 |
<!--FIXME Bavencoff 17/03/2016 use decorator-->
|
| 67 |
- ${trip.getPropertyValue("startDate")?date?string.short} - ${trip.getPropertyValue("endDate")?date?string.short} - ${trip.getPropertyValue("vessel")} - ${trip.getPropertyValue("observer")}
|
|
| 67 |
+ ${trip.getStartDate()?date?string.short} - ${trip.getEndDate()?date?string.short} - ${trip.getVesselLabel()} - ${trip.getObserverLabel()}
|
|
| 68 | 68 |
</li>
|
| 69 | 69 |
|
| 70 | 70 |
</#list>
|
| ... | ... | @@ -140,7 +140,7 @@ public class SaveLocalUIHandler extends AdminTabUIHandler<SaveLocalUI> implement |
| 140 | 140 |
File backupFile = stepModel.getBackupFile();
|
| 141 | 141 |
|
| 142 | 142 |
SqlScriptProducerService dumpService = source.getSqlScriptProducerService();
|
| 143 |
- AddSqlScriptProducerRequest request = AddSqlScriptProducerRequest.forH2().addSchema().addReferential().addAllData();
|
|
| 143 |
+ AddSqlScriptProducerRequest request = AddSqlScriptProducerRequest.forH2(source.getVersion()).addSchema().addReferential().addAllData();
|
|
| 144 | 144 |
byte[] dump = dumpService.produceAddSqlScript(request).getSqlCode();
|
| 145 | 145 |
|
| 146 | 146 |
try (FileOutputStream outputStream = new FileOutputStream(backupFile)) {
|
| ... | ... | @@ -268,39 +268,31 @@ public class LonglinePositionHelper<D extends LonglinePositionAwareDto> { |
| 268 | 268 |
|
| 269 | 269 |
}
|
| 270 | 270 |
|
| 271 |
- protected SectionReference getSection(BasketReference basket) {
|
|
| 272 |
- |
|
| 273 |
- String sectionId = ((BasketWithSectionIdReference) basket).getSectionId();
|
|
| 274 |
- |
|
| 271 |
+ private SectionReference getSection(BasketReference basket) {
|
|
| 272 |
+ String sectionId = basket.getSectionId();
|
|
| 275 | 273 |
return sectionUniverse.stream()
|
| 276 | 274 |
.filter(s -> sectionId.equals(s.getId()))
|
| 277 | 275 |
.findFirst()
|
| 278 | 276 |
.orElse(null);
|
| 279 |
- |
|
| 280 | 277 |
}
|
| 281 | 278 |
|
| 282 |
- protected BasketReference getBasket(BranchlineReference branchline) {
|
|
| 283 |
- |
|
| 284 |
- String basketId = ((BranchlineWithBasketIdReference) branchline).getBasketId();
|
|
| 285 |
- |
|
| 279 |
+ private BasketReference getBasket(BranchlineReference branchline) {
|
|
| 280 |
+ String basketId = branchline.getBasketId();
|
|
| 286 | 281 |
return basketUniverse.stream()
|
| 287 | 282 |
.filter(b -> basketId.equals(b.getId()))
|
| 288 | 283 |
.findFirst()
|
| 289 | 284 |
.orElse(null);
|
| 290 |
- |
|
| 291 | 285 |
}
|
| 292 | 286 |
|
| 293 |
- protected List<BasketReference> getBaskets(SectionReference section) {
|
|
| 294 |
- |
|
| 287 |
+ private List<BasketReference> getBaskets(SectionReference section) {
|
|
| 295 | 288 |
return basketUniverse.stream()
|
| 296 |
- .filter(b -> section.getId().equals(((BasketWithSectionIdReference) b).getSectionId()))
|
|
| 289 |
+ .filter(b -> section.getId().equals(b.getSectionId()))
|
|
| 297 | 290 |
.collect(Collectors.toList());
|
| 298 | 291 |
}
|
| 299 | 292 |
|
| 300 |
- protected List<BranchlineReference> getBranchlines(BasketReference basket) {
|
|
| 301 |
- |
|
| 293 |
+ private List<BranchlineReference> getBranchlines(BasketReference basket) {
|
|
| 302 | 294 |
return branchlineUniverse.stream()
|
| 303 |
- .filter(b -> basket.getId().equals(((BranchlineWithBasketIdReference) b).getBasketId()))
|
|
| 295 |
+ .filter(b -> basket.getId().equals(b.getBasketId()))
|
|
| 304 | 296 |
.collect(Collectors.toList());
|
| 305 | 297 |
}
|
| 306 | 298 |
|
| ... | ... | @@ -655,7 +655,7 @@ public class StorageUIHandler implements UIHandler<StorageUI> { |
| 655 | 655 |
log.debug(dst);
|
| 656 | 656 |
}
|
| 657 | 657 |
|
| 658 |
- AddSqlScriptProducerRequest request = AddSqlScriptProducerRequest.forH2().addSchema().addReferential().addAllData();
|
|
| 658 |
+ AddSqlScriptProducerRequest request = AddSqlScriptProducerRequest.forH2(ObserveSwingApplicationContext.get().getConfig().getModelVersion()).addSchema().addReferential().addAllData();
|
|
| 659 | 659 |
byte[] dataDump = dumpProducerService.produceAddSqlScript(request).getSqlCode();
|
| 660 | 660 |
|
| 661 | 661 |
try (FileOutputStream outputStream = new FileOutputStream(dst)) {
|
| ... | ... | @@ -1546,7 +1546,7 @@ public class StorageUIModel extends WizardModel<StorageStep> { |
| 1546 | 1546 |
|
| 1547 | 1547 |
SqlScriptProducerService dumpService = source.getSqlScriptProducerService();
|
| 1548 | 1548 |
|
| 1549 |
- AddSqlScriptProducerRequest request = AddSqlScriptProducerRequest.forH2().addSchema().addReferential();
|
|
| 1549 |
+ AddSqlScriptProducerRequest request = AddSqlScriptProducerRequest.forH2(source.getVersion()).addSchema().addReferential();
|
|
| 1550 | 1550 |
byte[] dump = dumpService.produceAddSqlScript(request).getSqlCode();
|
| 1551 | 1551 |
|
| 1552 | 1552 |
result.setImportDatabase(dump);
|
| ... | ... | @@ -41,7 +41,7 @@ public class BasketDtoReferenceBinder extends DataDtoReferenceBinder<BasketDto, |
| 41 | 41 |
@Override
|
| 42 | 42 |
public BasketReference toReference(ReferentialLocale referentialLocale, BasketDto dto) {
|
| 43 | 43 |
|
| 44 |
- return new BasketReference(dto, dto.getSettingIdentifier(), dto.getHaulingIdentifier());
|
|
| 44 |
+ return new BasketReference(dto, dto.getSettingIdentifier(), dto.getHaulingIdentifier(), null);
|
|
| 45 | 45 |
|
| 46 | 46 |
}
|
| 47 | 47 |
}
|
| ... | ... | @@ -41,7 +41,7 @@ public class BranchlineDtoReferenceBinder extends DataDtoReferenceBinder<Branchl |
| 41 | 41 |
@Override
|
| 42 | 42 |
public BranchlineReference toReference(ReferentialLocale referentialLocale, BranchlineDto dto) {
|
| 43 | 43 |
|
| 44 |
- return new BranchlineReference(dto, dto.getSettingIdentifier(), dto.getHaulingIdentifier());
|
|
| 44 |
+ return new BranchlineReference(dto, dto.getSettingIdentifier(), dto.getHaulingIdentifier(), null);
|
|
| 45 | 45 |
|
| 46 | 46 |
}
|
| 47 | 47 |
}
|
| 1 |
-package fr.ird.observe.dto.data.longline;
|
|
| 2 |
- |
|
| 3 |
-/*-
|
|
| 4 |
- * #%L
|
|
| 5 |
- * ObServe :: Dto
|
|
| 6 |
- * %%
|
|
| 7 |
- * Copyright (C) 2008 - 2017 IRD, Code Lutin, Ultreia.io
|
|
| 8 |
- * %%
|
|
| 9 |
- * This program is free software: you can redistribute it and/or modify
|
|
| 10 |
- * it under the terms of the GNU General Public License as
|
|
| 11 |
- * published by the Free Software Foundation, either version 3 of the
|
|
| 12 |
- * License, or (at your option) any later version.
|
|
| 13 |
- *
|
|
| 14 |
- * This program is distributed in the hope that it will be useful,
|
|
| 15 |
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
| 16 |
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
| 17 |
- * GNU General Public License for more details.
|
|
| 18 |
- *
|
|
| 19 |
- * You should have received a copy of the GNU General Public
|
|
| 20 |
- * License along with this program. If not, see
|
|
| 21 |
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
|
|
| 22 |
- * #L%
|
|
| 23 |
- */
|
|
| 24 |
- |
|
| 25 |
-public class BasketWithSectionIdDto extends BasketDto {
|
|
| 26 |
- |
|
| 27 |
- private static final long serialVersionUID = 3690753995685507632L;
|
|
| 28 |
- |
|
| 29 |
- public static final String PROPERTY_SECTION_ID = "sectionId";
|
|
| 30 |
-}
|
| ... | ... | @@ -34,10 +34,11 @@ public class BasketWithSectionIdReference extends BasketReference { |
| 34 | 34 |
private final String sectionId;
|
| 35 | 35 |
|
| 36 | 36 |
public BasketWithSectionIdReference(DtoReferenceAware dto, Integer settingIdentifier, Integer haulingIdentifier, String sectionId) {
|
| 37 |
- super(dto, settingIdentifier, haulingIdentifier);
|
|
| 37 |
+ super(dto, settingIdentifier, haulingIdentifier, sectionId);
|
|
| 38 | 38 |
this.sectionId = sectionId;
|
| 39 | 39 |
}
|
| 40 | 40 |
|
| 41 |
+ @Override
|
|
| 41 | 42 |
public String getSectionId() {
|
| 42 | 43 |
return sectionId;
|
| 43 | 44 |
}
|
| 1 |
-package fr.ird.observe.dto.data.longline;
|
|
| 2 |
- |
|
| 3 |
-/*-
|
|
| 4 |
- * #%L
|
|
| 5 |
- * ObServe :: Dto
|
|
| 6 |
- * %%
|
|
| 7 |
- * Copyright (C) 2008 - 2017 IRD, Code Lutin, Ultreia.io
|
|
| 8 |
- * %%
|
|
| 9 |
- * This program is free software: you can redistribute it and/or modify
|
|
| 10 |
- * it under the terms of the GNU General Public License as
|
|
| 11 |
- * published by the Free Software Foundation, either version 3 of the
|
|
| 12 |
- * License, or (at your option) any later version.
|
|
| 13 |
- *
|
|
| 14 |
- * This program is distributed in the hope that it will be useful,
|
|
| 15 |
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
| 16 |
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
| 17 |
- * GNU General Public License for more details.
|
|
| 18 |
- *
|
|
| 19 |
- * You should have received a copy of the GNU General Public
|
|
| 20 |
- * License along with this program. If not, see
|
|
| 21 |
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
|
|
| 22 |
- * #L%
|
|
| 23 |
- */
|
|
| 24 |
- |
|
| 25 |
-public class BranchlineWithBasketIdDto extends BranchlineDto {
|
|
| 26 |
- |
|
| 27 |
- private static final long serialVersionUID = 7018072108318352694L;
|
|
| 28 |
- |
|
| 29 |
- public static final String PROPERTY_BASKET_ID = "basketId";
|
|
| 30 |
- |
|
| 31 |
-}
|
| ... | ... | @@ -10,12 +10,12 @@ package fr.ird.observe.dto.data.longline; |
| 10 | 10 |
* it under the terms of the GNU General Public License as
|
| 11 | 11 |
* published by the Free Software Foundation, either version 3 of the
|
| 12 | 12 |
* License, or (at your option) any later version.
|
| 13 |
- *
|
|
| 13 |
+ *
|
|
| 14 | 14 |
* This program is distributed in the hope that it will be useful,
|
| 15 | 15 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 16 | 16 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 17 | 17 |
* GNU General Public License for more details.
|
| 18 |
- *
|
|
| 18 |
+ *
|
|
| 19 | 19 |
* You should have received a copy of the GNU General Public
|
| 20 | 20 |
* License along with this program. If not, see
|
| 21 | 21 |
* <http://www.gnu.org/licenses/gpl-3.0.html>.
|
| ... | ... | @@ -34,11 +34,12 @@ public class BranchlineWithBasketIdReference extends BranchlineReference { |
| 34 | 34 |
private final String basketId;
|
| 35 | 35 |
|
| 36 | 36 |
public BranchlineWithBasketIdReference(DtoReferenceAware dto, Integer settingIdentifier, Integer haulingIdentifier, String basketId) {
|
| 37 |
- super(dto, settingIdentifier, haulingIdentifier);
|
|
| 37 |
+ super(dto, settingIdentifier, haulingIdentifier, basketId);
|
|
| 38 | 38 |
|
| 39 | 39 |
this.basketId = basketId;
|
| 40 | 40 |
}
|
| 41 | 41 |
|
| 42 |
+ @Override
|
|
| 42 | 43 |
public String getBasketId() {
|
| 43 | 44 |
return basketId;
|
| 44 | 45 |
}
|
| ... | ... | @@ -109,14 +109,15 @@ individualWeight + {*:1} Float |
| 109 | 109 |
baitSettingStatus {*:1} fr.ird.observe.dto.referential.longline.BaitSettingStatusReference
|
| 110 | 110 |
baitType {*:1} fr.ird.observe.dto.referential.longline.BaitTypeReference
|
| 111 | 111 |
|
| 112 |
-data.longline.Basket > data.Data >> data.longline.LonglineCompositionDto | references=settingIdentifier,haulingIdentifier
|
|
| 112 |
+data.longline.Basket > data.Data >> data.longline.LonglineCompositionDto | references=settingIdentifier,haulingIdentifier,sectionId
|
|
| 113 | 113 |
settingIdentifier + {*:1} Integer
|
| 114 | 114 |
haulingIdentifier + {*:1} Integer
|
| 115 | 115 |
floatline1Length + {*:1} Float
|
| 116 | 116 |
floatline2Length + {*:1} Float
|
| 117 | 117 |
branchline + {*} data.longline.Branchline | ordered unique
|
| 118 |
+section + {*:1} fr.ird.observe.dto.data.longline.SectionReference
|
|
| 118 | 119 |
|
| 119 |
-data.longline.Branchline > data.Commentable >> data.longline.LonglineCompositionDto | references=settingIdentifier,haulingIdentifier
|
|
| 120 |
+data.longline.Branchline > data.Commentable >> data.longline.LonglineCompositionDto | references=settingIdentifier,haulingIdentifier,basketId
|
|
| 120 | 121 |
settingIdentifier + {*:1} Integer
|
| 121 | 122 |
haulingIdentifier + {*:1} Integer
|
| 122 | 123 |
depthRecorder + {*:1} Boolean
|
| ... | ... | @@ -139,6 +140,7 @@ hookType {*:0..1} fr.ird.observe.dto.referential.longline.HookTypeReference |
| 139 | 140 |
tracelineType {*:0..1} fr.ird.observe.dto.referential.longline.LineTypeReference
|
| 140 | 141 |
topType {*:0..1} fr.ird.observe.dto.referential.longline.LineTypeReference
|
| 141 | 142 |
baitType {*:0..1} fr.ird.observe.dto.referential.longline.BaitTypeReference
|
| 143 |
+basket + {*:1} fr.ird.observe.dto.data.longline.BasketReference
|
|
| 142 | 144 |
|
| 143 | 145 |
data.longline.BranchlinesComposition > data.Data | references=topTypeLabel,tracelineTypeLabel,length,proportion
|
| 144 | 146 |
length + {*:1} Float
|
| ... | ... | @@ -133,6 +133,11 @@ |
| 133 | 133 |
<artifactId>hibernate-core</artifactId>
|
| 134 | 134 |
</dependency>
|
| 135 | 135 |
<dependency>
|
| 136 |
+ <groupId>net.bytebuddy</groupId>
|
|
| 137 |
+ <artifactId>byte-buddy</artifactId>
|
|
| 138 |
+ <scope>runtime</scope>
|
|
| 139 |
+ </dependency>
|
|
| 140 |
+ <dependency>
|
|
| 136 | 141 |
<groupId>com.zaxxer</groupId>
|
| 137 | 142 |
<artifactId>HikariCP</artifactId>
|
| 138 | 143 |
<scope>runtime</scope>
|
| ... | ... | @@ -140,6 +145,7 @@ |
| 140 | 145 |
<dependency>
|
| 141 | 146 |
<groupId>org.hibernate</groupId>
|
| 142 | 147 |
<artifactId>hibernate-hikaricp</artifactId>
|
| 148 |
+ <scope>runtime</scope>
|
|
| 143 | 149 |
</dependency>
|
| 144 | 150 |
|
| 145 | 151 |
<!-- test -->
|
| ... | ... | @@ -277,6 +283,26 @@ |
| 277 | 283 |
</executions>
|
| 278 | 284 |
</plugin>
|
| 279 | 285 |
|
| 286 |
+ <plugin>
|
|
| 287 |
+ <groupId>org.hibernate.orm.tooling</groupId>
|
|
| 288 |
+ <artifactId>hibernate-enhance-maven-plugin</artifactId>
|
|
| 289 |
+ <version>${lib.version.hibernate}</version>
|
|
| 290 |
+ <executions>
|
|
| 291 |
+ <execution>
|
|
| 292 |
+ <configuration>
|
|
| 293 |
+ <failOnError>true</failOnError>
|
|
| 294 |
+ <enableLazyInitialization>true</enableLazyInitialization>
|
|
| 295 |
+ <enableDirtyTracking>true</enableDirtyTracking>
|
|
| 296 |
+ <enableAssociationManagement>true</enableAssociationManagement>
|
|
| 297 |
+ <enableExtendedEnhancement>false</enableExtendedEnhancement>
|
|
| 298 |
+ </configuration>
|
|
| 299 |
+ <goals>
|
|
| 300 |
+ <goal>enhance</goal>
|
|
| 301 |
+ </goals>
|
|
| 302 |
+ </execution>
|
|
| 303 |
+ </executions>
|
|
| 304 |
+ </plugin>
|
|
| 305 |
+ |
|
| 280 | 306 |
</plugins>
|
| 281 | 307 |
</build>
|
| 282 | 308 |
</project>
|
| ... | ... | @@ -27,6 +27,7 @@ import fr.ird.observe.dto.referential.ReferentialLocale; |
| 27 | 27 |
import fr.ird.observe.dto.data.longline.BasketDto;
|
| 28 | 28 |
import fr.ird.observe.dto.data.longline.BasketReference;
|
| 29 | 29 |
import fr.ird.observe.entities.longline.Basket;
|
| 30 |
+import fr.ird.observe.entities.longline.Section;
|
|
| 30 | 31 |
|
| 31 | 32 |
/**
|
| 32 | 33 |
* Created on 24/11/15.
|
| ... | ... | @@ -39,10 +40,13 @@ public class BasketEntityReferenceBinder extends DataEntityReferenceBinderSuppor |
| 39 | 40 |
super(BasketDto.class, BasketReference.class, Basket.class);
|
| 40 | 41 |
}
|
| 41 | 42 |
|
| 43 |
+ public BasketReference toReference(Basket entity, Section section) {
|
|
| 44 |
+ return new BasketReference(entity, entity.getSettingIdentifier(), entity.getHaulingIdentifier(), section.getTopiaId());
|
|
| 45 |
+ }
|
|
| 46 |
+ |
|
| 42 | 47 |
@Override
|
| 43 | 48 |
public BasketReference toReference(ReferentialLocale referentialLocale, Basket entity) {
|
| 44 |
- |
|
| 45 |
- return new BasketReference(entity, entity.getSettingIdentifier(), entity.getHaulingIdentifier());
|
|
| 49 |
+ return new BasketReference(entity, entity.getSettingIdentifier(), entity.getHaulingIdentifier(), null);
|
|
| 46 | 50 |
|
| 47 | 51 |
}
|
| 48 | 52 |
}
|
| ... | ... | @@ -23,9 +23,10 @@ package fr.ird.observe.binder.data.longline; |
| 23 | 23 |
*/
|
| 24 | 24 |
|
| 25 | 25 |
import fr.ird.observe.binder.data.DataEntityReferenceBinderSupport;
|
| 26 |
-import fr.ird.observe.dto.referential.ReferentialLocale;
|
|
| 27 | 26 |
import fr.ird.observe.dto.data.longline.BranchlineDto;
|
| 28 | 27 |
import fr.ird.observe.dto.data.longline.BranchlineReference;
|
| 28 |
+import fr.ird.observe.dto.referential.ReferentialLocale;
|
|
| 29 |
+import fr.ird.observe.entities.longline.Basket;
|
|
| 29 | 30 |
import fr.ird.observe.entities.longline.Branchline;
|
| 30 | 31 |
|
| 31 | 32 |
/**
|
| ... | ... | @@ -39,10 +40,13 @@ public class BranchlineEntityReferenceBinder extends DataEntityReferenceBinderSu |
| 39 | 40 |
super(BranchlineDto.class, BranchlineReference.class, Branchline.class);
|
| 40 | 41 |
}
|
| 41 | 42 |
|
| 43 |
+ public BranchlineReference toReference(Branchline entity, Basket basket) {
|
|
| 44 |
+ return new BranchlineReference(entity, entity.getSettingIdentifier(), entity.getHaulingIdentifier(), basket.getTopiaId());
|
|
| 45 |
+ }
|
|
| 46 |
+ |
|
| 42 | 47 |
@Override
|
| 43 | 48 |
public BranchlineReference toReference(ReferentialLocale referentialLocale, Branchline entity) {
|
| 44 |
- |
|
| 45 |
- return new BranchlineReference(entity, entity.getSettingIdentifier(), entity.getHaulingIdentifier());
|
|
| 49 |
+ return new BranchlineReference(entity, entity.getSettingIdentifier(), entity.getHaulingIdentifier(), null);
|
|
| 46 | 50 |
|
| 47 | 51 |
}
|
| 48 | 52 |
}
|
| ... | ... | @@ -279,33 +279,6 @@ public class ObserveTopiaApplicationContext extends AbstractObserveTopiaApplicat |
| 279 | 279 |
log.info(String.format("For TripSeine, found %d tables to use.", tripSeineTables.size()));
|
| 280 | 280 |
}
|
| 281 | 281 |
return tripSeineTables;
|
| 282 |
- |
|
| 283 |
- /*
|
|
| 284 |
- return TopiaSqlTables.builder(filterTable, ObserveEntityEnum.TripSeine) // → TripSeine
|
|
| 285 |
- .addAndEnterJoinTable(ObserveEntityEnum.GearUseFeaturesSeine) // → GearUseFeaturesSeine
|
|
| 286 |
- .addJoinTable(ObserveEntityEnum.GearUseFeaturesMeasurementSeine)
|
|
| 287 |
- .backToParent() // ← TripSeine
|
|
| 288 |
- .addAndEnterJoinTable(ObserveEntityEnum.Route) // → Route
|
|
| 289 |
- .addAndEnterJoinTable(ObserveEntityEnum.ActivitySeine) // → ActivitySeine
|
|
| 290 |
- .addAndEnterReverseJoinTable(ObserveEntityEnum.SetSeine) // → SetSeine
|
|
| 291 |
- .addJoinTable(ObserveEntityEnum.SchoolEstimate)
|
|
| 292 |
- .addJoinTable(ObserveEntityEnum.NonTargetCatch)
|
|
| 293 |
- .addJoinTable(ObserveEntityEnum.TargetCatch)
|
|
| 294 |
- .addAndEnterJoinTable(ObserveEntityEnum.TargetSample) // → TargetSample
|
|
| 295 |
- .addJoinTable(ObserveEntityEnum.TargetLength)
|
|
| 296 |
- .backToParent() // ← SetSeine
|
|
| 297 |
- .addAndEnterJoinTable(ObserveEntityEnum.NonTargetSample) // → NonTargetSample
|
|
| 298 |
- .addJoinTable(ObserveEntityEnum.NonTargetLength)
|
|
| 299 |
- .backToParent() // ← SetSeine
|
|
| 300 |
- .backToParent() // ← ActivitySeine
|
|
| 301 |
- .addAssociationTable(ObserveEntityEnum.ObservedSystem.name(), true)
|
|
| 302 |
- .addAndEnterJoinTable(ObserveEntityEnum.FloatingObject) // → FloatingObject
|
|
| 303 |
- .addJoinTable(ObserveEntityEnum.ObjectObservedSpecies)
|
|
| 304 |
- .addJoinTable(ObserveEntityEnum.ObjectSchoolEstimate)
|
|
| 305 |
- .addJoinTable(ObserveEntityEnum.TransmittingBuoy)
|
|
| 306 |
- .build();
|
|
| 307 |
- */
|
|
| 308 |
- |
|
| 309 | 282 |
}
|
| 310 | 283 |
|
| 311 | 284 |
public TopiaSqlTables getTripLonglineTables() {
|
| ... | ... | @@ -346,43 +319,9 @@ public class ObserveTopiaApplicationContext extends AbstractObserveTopiaApplicat |
| 346 | 319 |
null);
|
| 347 | 320 |
|
| 348 | 321 |
tripLonglineTables.replaceTable("observe_longline.branchline", branchlineTable);
|
| 349 |
- |
|
| 350 |
- |
|
| 351 | 322 |
}
|
| 352 | 323 |
return tripLonglineTables;
|
| 353 |
- |
|
| 354 |
- /*
|
|
| 355 |
- return TopiaSqlTables.builder(filterTable, ObserveEntityEnum.TripLongline) // → TripLongline
|
|
| 356 |
- .addAndEnterJoinTable(ObserveEntityEnum.GearUseFeaturesLongline) // → GearUseFeaturesLongline
|
|
| 357 |
- .addJoinTable(ObserveEntityEnum.GearUseFeaturesMeasurementLongline)
|
|
| 358 |
- .backToParent() // ← TripLongline
|
|
| 359 |
- .addAndEnterJoinTable(ObserveEntityEnum.ActivityLongline) // → ActivityLongline
|
|
| 360 |
- .addAndEnterReverseJoinTable(ObserveEntityEnum.SetLongline) // → SetLongline
|
|
| 361 |
- .addJoinTable(ObserveEntityEnum.BaitsComposition)
|
|
| 362 |
- .addJoinTable(ObserveEntityEnum.FloatlinesComposition)
|
|
| 363 |
- .addJoinTable(ObserveEntityEnum.HooksComposition)
|
|
| 364 |
- .addJoinTable(ObserveEntityEnum.BranchlinesComposition)
|
|
| 365 |
- .addAssociationTable(ObserveEntityEnum.MitigationType.name(), true)
|
|
| 366 |
- .addAndEnterJoinTable(ObserveEntityEnum.Section) // → Section
|
|
| 367 |
- .addAndEnterJoinTable(ObserveEntityEnum.Basket) // → Basket
|
|
| 368 |
- .addJoinTable(ObserveEntityEnum.Branchline)
|
|
| 369 |
- .backToParent() // ← Section
|
|
| 370 |
- .backToParent() // ← SetLongline
|
|
| 371 |
- .addAndEnterJoinTable(ObserveEntityEnum.CatchLongline) // → CatchLongline
|
|
| 372 |
- .addJoinTable(ObserveEntityEnum.SizeMeasure)
|
|
| 373 |
- .addJoinTable(ObserveEntityEnum.WeightMeasure)
|
|
| 374 |
- .addAssociationTable("Predator", true)
|
|
| 375 |
- .backToParent() // ← SetLongline
|
|
| 376 |
- .addAndEnterJoinTable(ObserveEntityEnum.Tdr) // → Tdr
|
|
| 377 |
- .addJoinTable(ObserveEntityEnum.TdrRecord)
|
|
| 378 |
- .addAssociationTable(ObserveEntityEnum.Species.name(), true)
|
|
| 379 |
- .backToParent() // ← SetLongline
|
|
| 380 |
- .backToParent() // ← ActivityLongline
|
|
| 381 |
- .addJoinTable(ObserveEntityEnum.Encounter)
|
|
| 382 |
- .addJoinTable(ObserveEntityEnum.SensorUsed)
|
|
| 383 |
- .build();
|
|
| 384 |
- */
|
|
| 385 |
- }
|
|
| 324 |
+}
|
|
| 386 | 325 |
|
| 387 | 326 |
public TopiaSqlTables getReferentialTables() {
|
| 388 | 327 |
|
| ... | ... | @@ -391,139 +330,9 @@ public class ObserveTopiaApplicationContext extends AbstractObserveTopiaApplicat |
| 391 | 330 |
referentialTables = topiaSqlTablesFactory.newReplicateEntityTables(
|
| 392 | 331 |
new TripReplicateTablesPredicate(),
|
| 393 | 332 |
Entities.REFERENCE_ENTITIES);
|
| 394 |
-// ObserveEntityEnum.VesselSizeCategory,
|
|
| 395 |
-// ObserveEntityEnum.Country,
|
|
| 396 |
-// ObserveEntityEnum.Harbour,
|
|
| 397 |
-// ObserveEntityEnum.VesselType,
|
|
| 398 |
-// ObserveEntityEnum.Vessel,
|
|
| 399 |
-// ObserveEntityEnum.Ocean,
|
|
| 400 |
-// ObserveEntityEnum.SpeciesGroup,
|
|
| 401 |
-// ObserveEntityEnum.Species,
|
|
| 402 |
-// ObserveEntityEnum.Sex,
|
|
| 403 |
-// ObserveEntityEnum.FpaZone,
|
|
| 404 |
-// ObserveEntityEnum.SpeciesList,
|
|
| 405 |
-// ObserveEntityEnum.Person,
|
|
| 406 |
-// ObserveEntityEnum.Organism,
|
|
| 407 |
-// ObserveEntityEnum.LengthWeightParameter,
|
|
| 408 |
-// ObserveEntityEnum.Program,
|
|
| 409 |
-// ObserveEntityEnum.GearCaracteristicType,
|
|
| 410 |
-// ObserveEntityEnum.GearCaracteristic,
|
|
| 411 |
-// ObserveEntityEnum.Gear,
|
|
| 412 |
-// ObserveEntityEnum.LastUpdateDate,
|
|
| 413 |
-// ObserveEntityEnum.VesselActivitySeine,
|
|
| 414 |
-// ObserveEntityEnum.SurroundingActivity,
|
|
| 415 |
-// ObserveEntityEnum.ReasonForNullSet,
|
|
| 416 |
-// ObserveEntityEnum.ReasonForNoFishing,
|
|
| 417 |
-// ObserveEntityEnum.SpeciesFate,
|
|
| 418 |
-// ObserveEntityEnum.ObjectFate,
|
|
| 419 |
-// ObserveEntityEnum.WeightCategory,
|
|
| 420 |
-// ObserveEntityEnum.DetectionMode,
|
|
| 421 |
-// ObserveEntityEnum.TransmittingBuoyOperation,
|
|
| 422 |
-// ObserveEntityEnum.ObjectOperation,
|
|
| 423 |
-// ObserveEntityEnum.ReasonForDiscard,
|
|
| 424 |
-// ObserveEntityEnum.SpeciesStatus,
|
|
| 425 |
-// ObserveEntityEnum.ObservedSystem,
|
|
| 426 |
-// ObserveEntityEnum.TransmittingBuoyType,
|
|
| 427 |
-// ObserveEntityEnum.ObjectType,
|
|
| 428 |
-// ObserveEntityEnum.Wind,
|
|
| 429 |
-// ObserveEntityEnum.BaitHaulingStatus,
|
|
| 430 |
-// ObserveEntityEnum.BaitSettingStatus,
|
|
| 431 |
-// ObserveEntityEnum.BaitType,
|
|
| 432 |
-// ObserveEntityEnum.CatchFateLongline,
|
|
| 433 |
-// ObserveEntityEnum.EncounterType,
|
|
| 434 |
-// ObserveEntityEnum.Healthness,
|
|
| 435 |
-// ObserveEntityEnum.HookPosition,
|
|
| 436 |
-// ObserveEntityEnum.HookSize,
|
|
| 437 |
-// ObserveEntityEnum.HookType,
|
|
| 438 |
-// ObserveEntityEnum.ItemVerticalPosition,
|
|
| 439 |
-// ObserveEntityEnum.ItemHorizontalPosition,
|
|
| 440 |
-// ObserveEntityEnum.LightsticksColor,
|
|
| 441 |
-// ObserveEntityEnum.LightsticksType,
|
|
| 442 |
-// ObserveEntityEnum.LineType,
|
|
| 443 |
-// ObserveEntityEnum.MaturityStatus,
|
|
| 444 |
-// ObserveEntityEnum.MitigationType,
|
|
| 445 |
-// ObserveEntityEnum.SensorBrand,
|
|
| 446 |
-// ObserveEntityEnum.SensorDataFormat,
|
|
| 447 |
-// ObserveEntityEnum.SensorType,
|
|
| 448 |
-// ObserveEntityEnum.SettingShape,
|
|
| 449 |
-// ObserveEntityEnum.SizeMeasureType,
|
|
| 450 |
-// ObserveEntityEnum.StomacFullness,
|
|
| 451 |
-// ObserveEntityEnum.TripType,
|
|
| 452 |
-// ObserveEntityEnum.VesselActivityLongline,
|
|
| 453 |
-// ObserveEntityEnum.WeightMeasureType);
|
|
| 454 | 333 |
}
|
| 455 | 334 |
log.info(String.format("For Referential, found %d tables to use.", referentialTables.size()));
|
| 456 | 335 |
return referentialTables;
|
| 457 |
- |
|
| 458 |
- /*
|
|
| 459 |
- |
|
| 460 |
- return TopiaSqlTables.builder()
|
|
| 461 |
- .addMainTable(ObserveEntityEnum.VesselSizeCategory) // → VesselSizeCategory
|
|
| 462 |
- .addMainTable(ObserveEntityEnum.Country) // → Country
|
|
| 463 |
- .addMainTable(ObserveEntityEnum.Harbour) // → Harbour
|
|
| 464 |
- .addMainTable(ObserveEntityEnum.VesselType) // → VesselType
|
|
| 465 |
- .addMainTable(ObserveEntityEnum.Vessel) // → Vessel
|
|
| 466 |
- .addMainTable(ObserveEntityEnum.Ocean) // → Ocean
|
|
| 467 |
- .addMainTable(ObserveEntityEnum.SpeciesGroup) // → SpeciesGroup
|
|
| 468 |
- .addMainTable(ObserveEntityEnum.Species) // → Species
|
|
| 469 |
- .addAssociationTable(ObserveEntityEnum.Ocean.name(), false)
|
|
| 470 |
- .addMainTable(ObserveEntityEnum.Sex) // → Sex
|
|
| 471 |
- .addMainTable(ObserveEntityEnum.FpaZone) // → FpaZone
|
|
| 472 |
- .addMainTable(ObserveEntityEnum.SpeciesList) // → SpeciesList
|
|
| 473 |
- .addAssociationTable(ObserveEntityEnum.Species.name(), false)
|
|
| 474 |
- .addMainTable(ObserveEntityEnum.Person) // → Person
|
|
| 475 |
- .addMainTable(ObserveEntityEnum.Organism) // → Organism
|
|
| 476 |
- .addMainTable(ObserveEntityEnum.LengthWeightParameter) // → LengthWeightParameter
|
|
| 477 |
- .addMainTable(ObserveEntityEnum.Program) // → Program
|
|
| 478 |
- .addMainTable(ObserveEntityEnum.GearCaracteristicType) // → GearCaracteristicType
|
|
| 479 |
- .addMainTable(ObserveEntityEnum.GearCaracteristic) // → GearCaracteristic
|
|
| 480 |
- .addMainTable(ObserveEntityEnum.Gear) // → Gear
|
|
| 481 |
- .addAssociationTable(ObserveEntityEnum.GearCaracteristic.name(), false)
|
|
| 482 |
- .addMainTable(ObserveEntityEnum.LastUpdateDate) // → LastUpdateDate
|
|
| 483 |
- .addMainTable(ObserveEntityEnum.VesselActivitySeine) // → VesselActivitySeine
|
|
| 484 |
- .addMainTable(ObserveEntityEnum.SurroundingActivity) // → SurroundingActivity
|
|
| 485 |
- .addMainTable(ObserveEntityEnum.ReasonForNullSet) // → ReasonForNullSet
|
|
| 486 |
- .addMainTable(ObserveEntityEnum.ReasonForNoFishing) // → ReasonForNoFishing
|
|
| 487 |
- .addMainTable(ObserveEntityEnum.SpeciesFate) // → SpeciesFate
|
|
| 488 |
- .addMainTable(ObserveEntityEnum.ObjectFate) // → ObjectFate
|
|
| 489 |
- .addMainTable(ObserveEntityEnum.WeightCategory) // → WeightCategory
|
|
| 490 |
- .addMainTable(ObserveEntityEnum.DetectionMode) // → DetectionMode
|
|
| 491 |
- .addMainTable(ObserveEntityEnum.TransmittingBuoyOperation) // → TransmittingBuoyOperation
|
|
| 492 |
- .addMainTable(ObserveEntityEnum.ObjectOperation) // → ObjectOperation
|
|
| 493 |
- .addMainTable(ObserveEntityEnum.ReasonForDiscard) // → ReasonForDiscard
|
|
| 494 |
- .addMainTable(ObserveEntityEnum.SpeciesStatus) // → SpeciesStatus
|
|
| 495 |
- .addMainTable(ObserveEntityEnum.ObservedSystem) // → ObservedSystem
|
|
| 496 |
- .addMainTable(ObserveEntityEnum.TransmittingBuoyType) // → TransmittingBuoyType
|
|
| 497 |
- .addMainTable(ObserveEntityEnum.ObjectType) // → ObjectType
|
|
| 498 |
- .addMainTable(ObserveEntityEnum.Wind) // → Wind
|
|
| 499 |
- .addMainTable(ObserveEntityEnum.BaitHaulingStatus) // → BaitHaulingStatus
|
|
| 500 |
- .addMainTable(ObserveEntityEnum.BaitSettingStatus) // → BaitSettingStatus
|
|
| 501 |
- .addMainTable(ObserveEntityEnum.BaitType) // → BaitType
|
|
| 502 |
- .addMainTable(ObserveEntityEnum.CatchFateLongline) // → CatchFateLongline
|
|
| 503 |
- .addMainTable(ObserveEntityEnum.EncounterType) // → EncounterType
|
|
| 504 |
- .addMainTable(ObserveEntityEnum.Healthness) // → Healthness
|
|
| 505 |
- .addMainTable(ObserveEntityEnum.HookPosition) // → HookPosition
|
|
| 506 |
- .addMainTable(ObserveEntityEnum.HookSize) // → HookSize
|
|
| 507 |
- .addMainTable(ObserveEntityEnum.HookType) // → HookType
|
|
| 508 |
- .addMainTable(ObserveEntityEnum.ItemVerticalPosition) // → ItemVerticalPosition
|
|
| 509 |
- .addMainTable(ObserveEntityEnum.ItemHorizontalPosition) // → ItemHorizontalPosition
|
|
| 510 |
- .addMainTable(ObserveEntityEnum.LightsticksColor) // → LightsticksColor
|
|
| 511 |
- .addMainTable(ObserveEntityEnum.LightsticksType) // → LightsticksType
|
|
| 512 |
- .addMainTable(ObserveEntityEnum.LineType) // → LineType
|
|
| 513 |
- .addMainTable(ObserveEntityEnum.MaturityStatus) // → MaturityStatus
|
|
| 514 |
- .addMainTable(ObserveEntityEnum.MitigationType) // → MitigationType
|
|
| 515 |
- .addMainTable(ObserveEntityEnum.SensorBrand) // → SensorBrand
|
|
| 516 |
- .addMainTable(ObserveEntityEnum.SensorDataFormat) // → SensorDataFormat
|
|
| 517 |
- .addMainTable(ObserveEntityEnum.SensorType) // → SensorType
|
|
| 518 |
- .addMainTable(ObserveEntityEnum.SettingShape) // → SettingShape
|
|
| 519 |
- .addMainTable(ObserveEntityEnum.SizeMeasureType) // → SizeMeasureType
|
|
| 520 |
- .addMainTable(ObserveEntityEnum.StomacFullness) // → StomacFullness
|
|
| 521 |
- .addMainTable(ObserveEntityEnum.TripType) // → TripType
|
|
| 522 |
- .addMainTable(ObserveEntityEnum.VesselActivityLongline) // → VesselActivityLongline
|
|
| 523 |
- .addMainTable(ObserveEntityEnum.WeightMeasureType) // → WeightMeasureType
|
|
| 524 |
- |
|
| 525 |
- .build();
|
|
| 526 |
-*/
|
|
| 527 | 336 |
}
|
| 528 | 337 |
|
| 529 | 338 |
public <E extends ObserveReferentialEntity> TopiaSqlTables getReferentialTable(Class<E> entityType) {
|
| ... | ... | @@ -22,7 +22,11 @@ package fr.ird.observe.persistence; |
| 22 | 22 |
* #L%
|
| 23 | 23 |
*/
|
| 24 | 24 |
|
| 25 |
-import org.hibernate.hikaricp.internal.HikariCPConnectionProvider;
|
|
| 25 |
+import java.io.IOException;
|
|
| 26 |
+import java.io.InputStream;
|
|
| 27 |
+import java.util.Map;
|
|
| 28 |
+import java.util.Properties;
|
|
| 29 |
+import java.util.TreeMap;
|
|
| 26 | 30 |
import org.nuiton.topia.persistence.BeanTopiaConfiguration;
|
| 27 | 31 |
import org.nuiton.topia.persistence.HibernateAvailableSettings;
|
| 28 | 32 |
import org.nuiton.topia.persistence.jdbc.JdbcConfiguration;
|
| ... | ... | @@ -36,27 +40,37 @@ public class ObserveTopiaConfiguration extends BeanTopiaConfiguration { |
| 36 | 40 |
|
| 37 | 41 |
private static final long serialVersionUID = 1L;
|
| 38 | 42 |
|
| 39 |
- protected final boolean h2Configuration;
|
|
| 43 |
+ private final boolean h2Configuration;
|
|
| 40 | 44 |
protected final boolean showSql;
|
| 45 |
+ private static final Map<String, String> HIBERNATE_GLOBAL_PROPERTIES;
|
|
| 46 |
+ |
|
| 47 |
+ static {
|
|
| 48 |
+ |
|
| 49 |
+ Properties p = new Properties();
|
|
| 50 |
+ try (InputStream stream = ObserveTopiaPersistenceContext.class.getResourceAsStream("/hibernate.properties")) {
|
|
| 51 |
+ try {
|
|
| 52 |
+ p.load(stream);
|
|
| 53 |
+ } catch (IOException e) {
|
|
| 54 |
+ throw new IllegalStateException(e);
|
|
| 55 |
+ }
|
|
| 56 |
+ } catch (IOException e) {
|
|
| 57 |
+ throw new IllegalStateException(e);
|
|
| 58 |
+ }
|
|
| 59 |
+ HIBERNATE_GLOBAL_PROPERTIES = new TreeMap<>();
|
|
| 60 |
+ for (String s : p.stringPropertyNames()) {
|
|
| 61 |
+ HIBERNATE_GLOBAL_PROPERTIES.put(s, p.getProperty(s));
|
|
| 62 |
+ }
|
|
| 63 |
+ |
|
| 64 |
+ }
|
|
| 41 | 65 |
|
| 42 | 66 |
public ObserveTopiaConfiguration(JdbcConfiguration jdbcConfiguration, boolean h2Configuration, boolean showSql) {
|
| 43 | 67 |
super(jdbcConfiguration);
|
| 44 | 68 |
this.h2Configuration = h2Configuration;
|
| 45 | 69 |
this.showSql = showSql;
|
| 46 | 70 |
if (showSql) {
|
| 47 |
- hibernateExtraConfiguration.put("hibernate.show_sql", Boolean.TRUE.toString());
|
|
| 71 |
+ hibernateExtraConfiguration.put(HibernateAvailableSettings.SHOW_SQL, Boolean.TRUE.toString());
|
|
| 48 | 72 |
}
|
| 49 |
- |
|
| 50 |
- hibernateExtraConfiguration.put(HibernateAvailableSettings.CONNECTION_PROVIDER, HikariCPConnectionProvider.class.getName());
|
|
| 51 |
- hibernateExtraConfiguration.put("hibernate.hikari.minimumIdle", "2");
|
|
| 52 |
- hibernateExtraConfiguration.put("hibernate.hikari.maximumPoolSize", "20");
|
|
| 53 |
- hibernateExtraConfiguration.put("hibernate.hikari.autoCommit", "false");
|
|
| 54 |
- hibernateExtraConfiguration.put("hibernate.hikari.registerMbeans", "true");
|
|
| 55 |
- |
|
| 56 |
-// hibernateExtraConfiguration.put(HibernateAvailableSettings.CONNECTION_PROVIDER, "org.hibernate.c3p0.internal.C3P0ConnectionProvider");
|
|
| 57 |
-// hibernateExtraConfiguration.put(HibernateAvailableSettings.C3P0_MAX_SIZE, "500");
|
|
| 58 |
-// hibernateExtraConfiguration.put(HibernateAvailableSettings.C3P0_MAX_STATEMENTS, "500");
|
|
| 59 |
-// hibernateExtraConfiguration.put(HibernateAvailableSettings.C3P0_TIMEOUT, "100");
|
|
| 73 |
+ hibernateExtraConfiguration.putAll(HIBERNATE_GLOBAL_PROPERTIES);
|
|
| 60 | 74 |
}
|
| 61 | 75 |
|
| 62 | 76 |
public boolean isH2Configuration() {
|
| 1 |
+###
|
|
| 2 |
+# #%L
|
|
| 3 |
+# ObServe :: Persistence
|
|
| 4 |
+# %%
|
|
| 5 |
+# Copyright (C) 2008 - 2018 IRD, Code Lutin, Ultreia.io
|
|
| 6 |
+# %%
|
|
| 7 |
+# This program is free software: you can redistribute it and/or modify
|
|
| 8 |
+# it under the terms of the GNU General Public License as
|
|
| 9 |
+# published by the Free Software Foundation, either version 3 of the
|
|
| 10 |
+# License, or (at your option) any later version.
|
|
| 11 |
+#
|
|
| 12 |
+# This program is distributed in the hope that it will be useful,
|
|
| 13 |
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
| 14 |
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
| 15 |
+# GNU General Public License for more details.
|
|
| 16 |
+#
|
|
| 17 |
+# You should have received a copy of the GNU General Public
|
|
| 18 |
+# License along with this program. If not, see
|
|
| 19 |
+# <http://www.gnu.org/licenses/gpl-3.0.html>.
|
|
| 20 |
+# #L%
|
|
| 21 |
+###
|
|
| 22 |
+hibernate.bytecode.provider=bytebuddy
|
|
| 23 |
+hibernate.use_sql_comments=false
|
|
| 24 |
+hibernate.format_sql=false
|
|
| 25 |
+hibernate.connection.provider_class=org.hibernate.hikaricp.internal.HikariCPConnectionProvider
|
|
| 26 |
+hibernate.hikari.minimumIdle=2
|
|
| 27 |
+hibernate.hikari.maximumPoolSize=20
|
|
| 28 |
+hibernate.hikari.autoCommit=false
|
|
| 29 |
+#hibernate.hikari.registerMbeans=true
|
| ... | ... | @@ -68,13 +68,20 @@ public class ObserveJdbcHelper extends JdbcHelper { |
| 68 | 68 |
|
| 69 | 69 |
while (observerDataPrivilege.next()) {
|
| 70 | 70 |
String security = observerDataPrivilege.getString("PRIVILEGE");
|
| 71 |
+ String grantor = observerDataPrivilege.getString("GRANTOR");
|
|
| 71 | 72 |
String grantee = observerDataPrivilege.getString("GRANTEE");
|
| 72 | 73 |
// Il se peut que le login soit echappe sous la forme \"login\"
|
| 74 |
+ grantor= grantor.replaceAll("\\\\\"", "");
|
|
| 73 | 75 |
grantee = grantee.replaceAll("\\\\\"", "");
|
| 74 | 76 |
if (log.isDebugEnabled()) {
|
| 75 | 77 |
log.debug(String.format("(security %s) - grantee (%s)", security, grantee));
|
| 76 | 78 |
}
|
| 77 |
- if (grantee.equals(jdbcConfiguration.getJdbcConnectionUser())) {
|
|
| 79 |
+ if (grantor.equals(jdbcConfiguration.getJdbcConnectionUser())) {
|
|
| 80 |
+ if (log.isDebugEnabled()) {
|
|
| 81 |
+ log.debug("for " + tableName + " table " + grantor + '/' + security);
|
|
| 82 |
+ }
|
|
| 83 |
+ tablePrivileges.add(security);
|
|
| 84 |
+ } else if (grantee.equals(jdbcConfiguration.getJdbcConnectionUser())) {
|
|
| 78 | 85 |
if (log.isDebugEnabled()) {
|
| 79 | 86 |
log.debug("for " + tableName + " table " + grantee + '/' + security);
|
| 80 | 87 |
}
|
| ... | ... | @@ -88,7 +88,7 @@ public class ObserveServiceContextLocal { |
| 88 | 88 |
return observeServiceInitializer.withDataSourceConnection();
|
| 89 | 89 |
}
|
| 90 | 90 |
|
| 91 |
- Optional<ObserveDataSourceConnectionTopia> getDataSourceConnection() {
|
|
| 91 |
+ public Optional<ObserveDataSourceConnectionTopia> getDataSourceConnection() {
|
|
| 92 | 92 |
//noinspection unchecked
|
| 93 | 93 |
return (Optional) observeServiceInitializer.getDataSourceConnection();
|
| 94 | 94 |
}
|
| ... | ... | @@ -10,12 +10,12 @@ package fr.ird.observe.services.local.service; |
| 10 | 10 |
* it under the terms of the GNU General Public License as
|
| 11 | 11 |
* published by the Free Software Foundation, either version 3 of the
|
| 12 | 12 |
* License, or (at your option) any later version.
|
| 13 |
- *
|
|
| 13 |
+ *
|
|
| 14 | 14 |
* This program is distributed in the hope that it will be useful,
|
| 15 | 15 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 16 | 16 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 17 | 17 |
* GNU General Public License for more details.
|
| 18 |
- *
|
|
| 18 |
+ *
|
|
| 19 | 19 |
* You should have received a copy of the GNU General Public
|
| 20 | 20 |
* License along with this program. If not, see
|
| 21 | 21 |
* <http://www.gnu.org/licenses/gpl-3.0.html>.
|
| ... | ... | @@ -26,7 +26,6 @@ import com.google.common.base.Joiner; |
| 26 | 26 |
import com.google.common.base.Preconditions;
|
| 27 | 27 |
import com.google.common.collect.ImmutableSet;
|
| 28 | 28 |
import com.google.common.collect.Sets;
|
| 29 |
-import fr.ird.observe.spi.DbModelHelper;
|
|
| 30 | 29 |
import fr.ird.observe.dto.db.ObserveDbUserDto;
|
| 31 | 30 |
import fr.ird.observe.dto.reference.ReferentialDtoReference;
|
| 32 | 31 |
import fr.ird.observe.entities.referentiel.ObserveReferentialEntity;
|
| ... | ... | @@ -55,13 +54,7 @@ import fr.ird.observe.services.service.DatabaseDestroyNotAuthorizedException; |
| 55 | 54 |
import fr.ird.observe.services.service.DatabaseNotFoundException;
|
| 56 | 55 |
import fr.ird.observe.services.service.sql.AddSqlScriptProducerRequest;
|
| 57 | 56 |
import fr.ird.observe.services.service.sql.SqlScriptProducerService;
|
| 58 |
-import java.io.File;
|
|
| 59 |
-import java.io.IOException;
|
|
| 60 |
-import java.nio.file.Files;
|
|
| 61 |
-import java.util.Optional;
|
|
| 62 |
-import java.util.Set;
|
|
| 63 |
-import java.util.UUID;
|
|
| 64 |
-import java.util.stream.Collectors;
|
|
| 57 |
+import fr.ird.observe.spi.DbModelHelper;
|
|
| 65 | 58 |
import org.apache.commons.logging.Log;
|
| 66 | 59 |
import org.apache.commons.logging.LogFactory;
|
| 67 | 60 |
import org.nuiton.topia.persistence.jdbc.JdbcHelper;
|
| ... | ... | @@ -69,7 +62,15 @@ import org.nuiton.topia.persistence.metadata.TopiaMetadataEntity; |
| 69 | 62 |
import org.nuiton.topia.persistence.metadata.TopiaMetadataModel;
|
| 70 | 63 |
import org.nuiton.topia.persistence.metadata.TopiaMetadataModelVisitor;
|
| 71 | 64 |
import org.nuiton.version.Version;
|
| 65 |
+import org.nuiton.version.Versions;
|
|
| 72 | 66 |
|
| 67 |
+import java.io.File;
|
|
| 68 |
+import java.io.IOException;
|
|
| 69 |
+import java.nio.file.Files;
|
|
| 70 |
+import java.util.Optional;
|
|
| 71 |
+import java.util.Set;
|
|
| 72 |
+import java.util.UUID;
|
|
| 73 |
+import java.util.stream.Collectors;
|
|
| 73 | 74 |
|
| 74 | 75 |
import static org.nuiton.i18n.I18n.l;
|
| 75 | 76 |
|
| ... | ... | @@ -234,7 +235,7 @@ public class DataSourceServiceLocal extends ObserveServiceLocal implements DataS |
| 234 | 235 |
temporaryTopiaApplicationContext.getMigrationService().runSchemaMigration();
|
| 235 | 236 |
|
| 236 | 237 |
SqlScriptProducerService dumpProducerService = serviceContext.newService(temporaryConfiguration, SqlScriptProducerService.class);
|
| 237 |
- AddSqlScriptProducerRequest request = AddSqlScriptProducerRequest.forPostgres().addSchema().addReferential().addAllData();
|
|
| 238 |
+ AddSqlScriptProducerRequest request = AddSqlScriptProducerRequest.forPostgres(dataSourceConfiguration.getModelVersion()).addSchema().addReferential().addAllData();
|
|
| 238 | 239 |
byte[] dump = dumpProducerService.produceAddSqlScript(request).getSqlCode();
|
| 239 | 240 |
topiaApplicationContext.executeSqlStatements(dump);
|
| 240 | 241 |
topiaApplicationContext.getMigrationService().createSchemaIfNotExist();
|
| ... | ... | @@ -283,11 +284,12 @@ public class DataSourceServiceLocal extends ObserveServiceLocal implements DataS |
| 283 | 284 |
|
| 284 | 285 |
ObserveDataSourceConfiguration importDataSourceConfiguration = dataSourceCreateConfiguration.getImportReferentialDataSourceConfiguration();
|
| 285 | 286 |
|
| 287 |
+ Version dbVersion = Versions.valueOf(topiaApplicationContext.getModelVersion());
|
|
| 286 | 288 |
AddSqlScriptProducerRequest request;
|
| 287 | 289 |
if (((ObserveDataSourceConfigurationTopiaSupport) dataSourceConfiguration).isH2Database()) {
|
| 288 |
- request = AddSqlScriptProducerRequest.forH2();
|
|
| 290 |
+ request = AddSqlScriptProducerRequest.forH2(dbVersion);
|
|
| 289 | 291 |
} else {
|
| 290 |
- request = AddSqlScriptProducerRequest.forPostgres();
|
|
| 292 |
+ request = AddSqlScriptProducerRequest.forPostgres(dbVersion);
|
|
| 291 | 293 |
}
|
| 292 | 294 |
request.addReferential();
|
| 293 | 295 |
|
| ... | ... | @@ -319,12 +321,12 @@ public class DataSourceServiceLocal extends ObserveServiceLocal implements DataS |
| 319 | 321 |
|
| 320 | 322 |
ObserveDataSourceConfiguration importDataSourceConfiguration = dataSourceCreateConfiguration.getImportDataDataSourceConfiguration();
|
| 321 | 323 |
|
| 322 |
- |
|
| 324 |
+ Version dbVersion = Versions.valueOf(topiaApplicationContext.getModelVersion());
|
|
| 323 | 325 |
AddSqlScriptProducerRequest request;
|
| 324 | 326 |
if (((ObserveDataSourceConfigurationTopiaSupport) dataSourceConfiguration).isH2Database()) {
|
| 325 |
- request = AddSqlScriptProducerRequest.forH2();
|
|
| 327 |
+ request = AddSqlScriptProducerRequest.forH2(dbVersion);
|
|
| 326 | 328 |
} else {
|
| 327 |
- request = AddSqlScriptProducerRequest.forPostgres();
|
|
| 329 |
+ request = AddSqlScriptProducerRequest.forPostgres(dbVersion);
|
|
| 328 | 330 |
}
|
| 329 | 331 |
|
| 330 | 332 |
if (!referantialImported) {
|
| ... | ... | @@ -612,8 +614,8 @@ public class DataSourceServiceLocal extends ObserveServiceLocal implements DataS |
| 612 | 614 |
|
| 613 | 615 |
if (log.isDebugEnabled()) {
|
| 614 | 616 |
log.debug("User can write referential : " + writeReferential + ", " +
|
| 615 |
- "read data : " + readData + ", " +
|
|
| 616 |
- "write data : " + writeData + ".");
|
|
| 617 |
+ "read data : " + readData + ", " +
|
|
| 618 |
+ "write data : " + writeData + ".");
|
|
| 617 | 619 |
}
|
| 618 | 620 |
|
| 619 | 621 |
ObserveMigrationConfigurationProvider observeMigrationConfigurationProvider = ObserveMigrationConfigurationProvider.get();
|
| ... | ... | @@ -166,9 +166,7 @@ import org.nuiton.topia.persistence.TopiaNoResultException; |
| 166 | 166 |
*/
|
| 167 | 167 |
public abstract class ObserveServiceLocal implements ObserveService {
|
| 168 | 168 |
|
| 169 |
- /**
|
|
| 170 |
- * Logger.
|
|
| 171 |
- */
|
|
| 169 |
+ /** Logger. */
|
|
| 172 | 170 |
private static final Log log = LogFactory.getLog(ObserveServiceLocal.class);
|
| 173 | 171 |
|
| 174 | 172 |
protected static final DataDtoEntityPersistenceContext<TripSeineDto, TripSeineReference, TripSeine, TripSeineTopiaDao> TRIP_SEINE_SPI =
|
| ... | ... | @@ -289,21 +287,6 @@ public abstract class ObserveServiceLocal implements ObserveService { |
| 289 | 287 |
return serviceContext.getTopiaPersistenceContext();
|
| 290 | 288 |
}
|
| 291 | 289 |
|
| 292 |
-// protected <D extends IdDto, E extends ObserveEntity> void deleteEntity(Class<D> dtoType, Class<E> entityType, Iterable<String> ids) {
|
|
| 293 |
-// ObserveTopiaPersistenceContext persistenceContext = serviceContext.getTopiaPersistenceContext();
|
|
| 294 |
-// TopiaDao<E> dao = persistenceContext.getDao(entityType);
|
|
| 295 |
-// for (String id : ids) {
|
|
| 296 |
-// E entity = dao.forTopiaIdEquals(id).findUniqueOrNull();
|
|
| 297 |
-// if (entity == null) {
|
|
| 298 |
-// throw new DataNotFoundException(dtoType, id);
|
|
| 299 |
-// }
|
|
| 300 |
-// dao.delete(entity);
|
|
| 301 |
-// }
|
|
| 302 |
-//
|
|
| 303 |
-// updateLastUpdateDate(entityType);
|
|
| 304 |
-//
|
|
| 305 |
-// }
|
|
| 306 |
- |
|
| 307 | 290 |
public <E extends ObserveEntity> void updateLastUpdateDate(Class<E> entityType) {
|
| 308 | 291 |
getTopiaPersistenceContext().updateLastUpdateDate(entityType, now());
|
| 309 | 292 |
}
|
| ... | ... | @@ -331,35 +314,6 @@ public abstract class ObserveServiceLocal implements ObserveService { |
| 331 | 314 |
|
| 332 | 315 |
}
|
| 333 | 316 |
|
| 334 |
- // protected <E extends ObserveDataEntity, D extends DataDto> Form<D> dataEntityToForm(Class<D> dtoType, E entity) {
|
|
| 335 |
-//
|
|
| 336 |
-// D dto = DbModelHelper.fromDataDto(dtoType).toDto(serviceContext.getReferentialLocale(), dtoType, entity);
|
|
| 337 |
-// return Form.newFormDto(dtoType, dto);
|
|
| 338 |
-//
|
|
| 339 |
-// }
|
|
| 340 |
-//
|
|
| 341 |
-//
|
|
| 342 |
-// protected <E extends ObserveDataEntity, D extends DataDto> void copyDataDtoToEntity(D dto, E entity) {
|
|
| 343 |
-//
|
|
| 344 |
-// DbModelHelper.fromDataDto(dto).copyToEntity(serviceContext.getReferentialLocale(), dto, entity);
|
|
| 345 |
-//
|
|
| 346 |
-// }
|
|
| 347 |
- |
|
| 348 |
-//
|
|
| 349 |
-// protected <E extends ObserveDataEntity, D extends DataDto> E loadOrCreateEntityFromDataDto(D dto) {
|
|
| 350 |
-//
|
|
| 351 |
-// Class<E> entityType = DbModelHelper.fromDataDto(dto).toEntityType();
|
|
| 352 |
-//
|
|
| 353 |
-// E entity;
|
|
| 354 |
-// if (dto.isPersisted()) {
|
|
| 355 |
-// entity = loadEntity(dto.get(), dto.getId());
|
|
| 356 |
-// } else {
|
|
| 357 |
-// entity = getTopiaPersistenceContext().newEntity(entityType);
|
|
| 358 |
-// }
|
|
| 359 |
-// return entity;
|
|
| 360 |
-// }
|
|
| 361 |
- |
|
| 362 |
- |
|
| 363 | 317 |
protected <E extends ObserveEntity, D extends IdDto> void checkLastUpdateDate(E entity, D dto) {
|
| 364 | 318 |
|
| 365 | 319 |
if (entity.isPersisted()) {
|
| ... | ... | @@ -382,14 +336,6 @@ public abstract class ObserveServiceLocal implements ObserveService { |
| 382 | 336 |
return serviceContext.now();
|
| 383 | 337 |
}
|
| 384 | 338 |
|
| 385 |
- // protected <D extends DataDto, E extends ObserveDataEntity> D loadEntityToDataDto(Class<D> dtoType, String id) {
|
|
| 386 |
-//
|
|
| 387 |
-// E entity = loadEntity(dtoType, id);
|
|
| 388 |
-// DataEntityDtoBinderSupport<D, E> binder = DbModelHelper.fromDataDto(dtoType).toEntityBinder();
|
|
| 389 |
-// return binder.toDto(getReferentialLocale(), entity);
|
|
| 390 |
-//
|
|
| 391 |
-// }
|
|
| 392 |
-//
|
|
| 393 | 339 |
public <D extends ReferentialDto, E extends ObserveReferentialEntity> D loadEntityToReferentialDto(ReferentialEntityDtoBinderSupport<D, E> binder, String id) {
|
| 394 | 340 |
|
| 395 | 341 |
E entity = loadEntity(binder.getDtoType(), id);
|
| ... | ... | @@ -397,29 +343,6 @@ public abstract class ObserveServiceLocal implements ObserveService { |
| 397 | 343 |
|
| 398 | 344 |
}
|
| 399 | 345 |
|
| 400 |
-// protected <D extends DataDto, R extends DataDtoReference<D, R>, E extends ObserveDataEntity> R loadEntityToDataReferenceDto(Class<D> dtoType, String id) {
|
|
| 401 |
-//
|
|
| 402 |
-// E entity = loadEntity(dtoType, id);
|
|
| 403 |
-//
|
|
| 404 |
-// DataEntityReferenceBinderSupport<D, R, E> dataBinderFromDto = DbModelHelper.fromDataDto(dtoType).toEntityReferenceBinder();
|
|
| 405 |
-// return dataBinderFromDto.toReference(getReferentialLocale(), entity);
|
|
| 406 |
-//
|
|
| 407 |
-// }
|
|
| 408 |
- |
|
| 409 |
-// protected <E extends ObserveEntity> boolean existsEntity(Class<E> entityType, String id) {
|
|
| 410 |
-// ObserveTopiaPersistenceContext persistenceContext = serviceContext.getTopiaPersistenceContext();
|
|
| 411 |
-// TopiaDao<E> dao = persistenceContext.getDao(entityType);
|
|
| 412 |
-// return dao.forTopiaIdEquals(id).exists();
|
|
| 413 |
-// }
|
|
| 414 |
- |
|
| 415 |
-// protected <D extends DataDto, R extends DataDtoReference<D, R>, E extends ObserveDataEntity> R toReference(Class<R> referenceType, E entity) {
|
|
| 416 |
-//
|
|
| 417 |
-// DataEntityReferenceBinderSupport<D, R, E> binder = DbModelHelper.fromDataReference(referenceType).toEntityReferenceBinder();
|
|
| 418 |
-//
|
|
| 419 |
-// return binder.toReference(getReferentialLocale(), entity);
|
|
| 420 |
-//
|
|
| 421 |
-// }
|
|
| 422 |
- |
|
| 423 | 346 |
protected <D extends DataDto, E extends ObserveDataEntity, R extends DataDtoReference<D, R>> DataDtoReferenceSet<R> toDataReferenceSet(DataEntityReferenceBinderSupport<D, R, E> binder, Collection<E> entities) {
|
| 424 | 347 |
|
| 425 | 348 |
ReferentialLocale referentialLocale = getReferentialLocale();
|
| ... | ... | @@ -455,13 +378,13 @@ public abstract class ObserveServiceLocal implements ObserveService { |
| 455 | 378 |
protected DataFileDto newDataFileDto(Blob data, String dataFilename) {
|
| 456 | 379 |
DataFileDto dto = new DataFileDto();
|
| 457 | 380 |
try {
|
| 458 |
- // on copie le blob pour supprimer le lien entre la blob venant de la base et la connexion à la base
|
|
| 381 |
+ // copy blob
|
|
| 459 | 382 |
int length = (int) data.length();
|
| 460 | 383 |
byte[] bytes = data.getBytes(1, length);
|
| 461 | 384 |
dto.setContent(bytes);
|
| 462 | 385 |
} catch (SQLException e) {
|
| 463 | 386 |
if (log.isErrorEnabled()) {
|
| 464 |
- log.error("unable to read blod from " + dataFilename, e);
|
|
| 387 |
+ log.error("unable to read blob from " + dataFilename, e);
|
|
| 465 | 388 |
}
|
| 466 | 389 |
}
|
| 467 | 390 |
dto.setName(dataFilename);
|
| ... | ... | @@ -44,6 +44,7 @@ import java.util.TreeSet; |
| 44 | 44 |
import org.apache.commons.logging.Log;
|
| 45 | 45 |
import org.apache.commons.logging.LogFactory;
|
| 46 | 46 |
import org.nuiton.util.StringUtil;
|
| 47 |
+import org.nuiton.version.Version;
|
|
| 47 | 48 |
|
| 48 | 49 |
/**
|
| 49 | 50 |
* Created on 20/07/16.
|
| ... | ... | @@ -76,9 +77,9 @@ public class TripManagementServiceLocal extends ObserveServiceLocal implements T |
| 76 | 77 |
if (log.isInfoEnabled()) {
|
| 77 | 78 |
log.info("Start export of trip: " + tripId);
|
| 78 | 79 |
}
|
| 80 |
+ Version dbVersion = serviceContext.getDataSourceConnection().orElseThrow(IllegalStateException::new).getVersion();
|
|
| 79 | 81 |
|
| 80 |
- AddSqlScriptProducerRequest request;
|
|
| 81 |
- request = (exportRequest.isForPG() ? AddSqlScriptProducerRequest.forPostgres() : AddSqlScriptProducerRequest.forH2())
|
|
| 82 |
+ AddSqlScriptProducerRequest request = (exportRequest.isForPG() ? AddSqlScriptProducerRequest.forPostgres(dbVersion) : AddSqlScriptProducerRequest.forH2(dbVersion))
|
|
| 82 | 83 |
.dataIdsToAdd(ImmutableSet.of(tripId));
|
| 83 | 84 |
AddSqlScriptProducerResult producerResult = sqlScriptProducerService.produceAddSqlScript(request);
|
| 84 | 85 |
byte[] tripContent = producerResult.getSqlCode();
|
| ... | ... | @@ -10,22 +10,23 @@ package fr.ird.observe.services.local.service.data.longline; |
| 10 | 10 |
* it under the terms of the GNU General Public License as
|
| 11 | 11 |
* published by the Free Software Foundation, either version 3 of the
|
| 12 | 12 |
* License, or (at your option) any later version.
|
| 13 |
- *
|
|
| 13 |
+ *
|
|
| 14 | 14 |
* This program is distributed in the hope that it will be useful,
|
| 15 | 15 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 16 | 16 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 17 | 17 |
* GNU General Public License for more details.
|
| 18 |
- *
|
|
| 18 |
+ *
|
|
| 19 | 19 |
* You should have received a copy of the GNU General Public
|
| 20 | 20 |
* License along with this program. If not, see
|
| 21 | 21 |
* <http://www.gnu.org/licenses/gpl-3.0.html>.
|
| 22 | 22 |
* #L%
|
| 23 | 23 |
*/
|
| 24 | 24 |
|
| 25 |
+import fr.ird.observe.binder.data.longline.BasketEntityReferenceBinder;
|
|
| 26 |
+import fr.ird.observe.binder.data.longline.BranchlineEntityReferenceBinder;
|
|
| 27 |
+import fr.ird.observe.binder.data.longline.SectionEntityReferenceBinder;
|
|
| 25 | 28 |
import fr.ird.observe.dto.data.longline.BasketReference;
|
| 26 |
-import fr.ird.observe.dto.data.longline.BasketWithSectionIdReference;
|
|
| 27 | 29 |
import fr.ird.observe.dto.data.longline.BranchlineReference;
|
| 28 |
-import fr.ird.observe.dto.data.longline.BranchlineWithBasketIdReference;
|
|
| 29 | 30 |
import fr.ird.observe.dto.data.longline.LonglinePositionAwareDto;
|
| 30 | 31 |
import fr.ird.observe.dto.data.longline.LonglinePositionSetDto;
|
| 31 | 32 |
import fr.ird.observe.dto.data.longline.SectionReference;
|
| ... | ... | @@ -39,27 +40,30 @@ import fr.ird.observe.entities.longline.SetLongline; |
| 39 | 40 |
*/
|
| 40 | 41 |
class LonglinePositionSetDtoHelper {
|
| 41 | 42 |
|
| 43 |
+ private static final SectionEntityReferenceBinder SECTION_BINDER = new SectionEntityReferenceBinder();
|
|
| 44 |
+ private static final BasketEntityReferenceBinder BASKET_BINDER = new BasketEntityReferenceBinder();
|
|
| 45 |
+ private static final BranchlineEntityReferenceBinder BRANCHLINE_BINDER = new BranchlineEntityReferenceBinder();
|
|
| 46 |
+ |
|
| 47 |
+ |
|
| 42 | 48 |
// constitution des références des position sur la ligne
|
| 43 | 49 |
static void loadPositionSet(SetLongline setLongline, LonglinePositionSetDto target) {
|
| 44 | 50 |
|
| 45 | 51 |
for (Section section : setLongline.getSection()) {
|
| 46 | 52 |
|
| 47 |
- SectionReference sectionRef = toSectionReference(section);
|
|
| 53 |
+ SectionReference sectionReference = SECTION_BINDER.toReference(null, section);
|
|
| 48 | 54 |
|
| 49 |
- target.addSections(sectionRef);
|
|
| 55 |
+ target.addSections(sectionReference);
|
|
| 50 | 56 |
|
| 51 | 57 |
for (Basket basket : section.getBasket()) {
|
| 52 | 58 |
|
| 53 |
- BasketWithSectionIdReference basketRef = toBasketReference(basket, section);
|
|
| 59 |
+ BasketReference basketReference = BASKET_BINDER.toReference(basket, section);
|
|
| 54 | 60 |
|
| 55 |
- target.addBaskets(basketRef);
|
|
| 61 |
+ target.addBaskets(basketReference);
|
|
| 56 | 62 |
|
| 57 | 63 |
for (Branchline branchline : basket.getBranchline()) {
|
| 58 | 64 |
|
| 59 |
- BranchlineWithBasketIdReference branchlineRef = toBranchlineReference(branchline, basket);
|
|
| 60 |
- |
|
| 61 |
- target.addBranchlines(branchlineRef);
|
|
| 62 |
- |
|
| 65 |
+ BranchlineReference branchlineReference = BRANCHLINE_BINDER.toReference(branchline, basket);
|
|
| 66 |
+ target.addBranchlines(branchlineReference);
|
|
| 63 | 67 |
}
|
| 64 | 68 |
|
| 65 | 69 |
}
|
| ... | ... | @@ -74,21 +78,21 @@ class LonglinePositionSetDtoHelper { |
| 74 | 78 |
|
| 75 | 79 |
if (basketRef != null) {
|
| 76 | 80 |
|
| 77 |
- BasketReference basketRefWithSection = positionSetDto.getBaskets().stream()
|
|
| 81 |
+ BasketReference basketReference = positionSetDto.getBaskets().stream()
|
|
| 78 | 82 |
.filter(b -> basketRef.getId().equals(b.getId()))
|
| 79 | 83 |
.findFirst()
|
| 80 | 84 |
.orElse(null);
|
| 81 | 85 |
|
| 82 |
- positionDto.setBasket(basketRefWithSection);
|
|
| 86 |
+ positionDto.setBasket(basketReference);
|
|
| 83 | 87 |
|
| 84 | 88 |
}
|
| 85 | 89 |
|
| 86 |
- BranchlineReference branchlineRef = positionDto.getBranchline();
|
|
| 90 |
+ BranchlineReference branchlineReference = positionDto.getBranchline();
|
|
| 87 | 91 |
|
| 88 |
- if (branchlineRef != null) {
|
|
| 92 |
+ if (branchlineReference != null) {
|
|
| 89 | 93 |
|
| 90 | 94 |
BranchlineReference branchlineRefWithSection = positionSetDto.getBranchlines().stream()
|
| 91 |
- .filter(b -> branchlineRef.getId().equals(b.getId()))
|
|
| 95 |
+ .filter(b -> branchlineReference.getId().equals(b.getId()))
|
|
| 92 | 96 |
.findFirst()
|
| 93 | 97 |
.orElse(null);
|
| 94 | 98 |
|
| ... | ... | @@ -97,19 +101,4 @@ class LonglinePositionSetDtoHelper { |
| 97 | 101 |
}
|
| 98 | 102 |
}
|
| 99 | 103 |
|
| 100 |
- private static SectionReference toSectionReference(Section section) {
|
|
| 101 |
- |
|
| 102 |
- return new SectionReference(section, section.getSettingIdentifier(), section.getHaulingIdentifier());
|
|
| 103 |
- }
|
|
| 104 |
- |
|
| 105 |
- private static BasketWithSectionIdReference toBasketReference(Basket basket, Section section) {
|
|
| 106 |
- |
|
| 107 |
- return new BasketWithSectionIdReference(basket, basket.getSettingIdentifier(), basket.getHaulingIdentifier(), section.getTopiaId());
|
|
| 108 |
- }
|
|
| 109 |
- |
|
| 110 |
- private static BranchlineWithBasketIdReference toBranchlineReference(Branchline branchline, Basket basket) {
|
|
| 111 |
- |
|
| 112 |
- return new BranchlineWithBasketIdReference(branchline, branchline.getSettingIdentifier(), branchline.getHaulingIdentifier(), basket.getTopiaId());
|
|
| 113 |
- }
|
|
| 114 |
- |
|
| 115 | 104 |
}
|
| ... | ... | @@ -10,12 +10,12 @@ package fr.ird.observe.services.local.service.referential; |
| 10 | 10 |
* it under the terms of the GNU General Public License as
|
| 11 | 11 |
* published by the Free Software Foundation, either version 3 of the
|
| 12 | 12 |
* License, or (at your option) any later version.
|
| 13 |
- *
|
|
| 13 |
+ *
|
|
| 14 | 14 |
* This program is distributed in the hope that it will be useful,
|
| 15 | 15 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 16 | 16 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 17 | 17 |
* GNU General Public License for more details.
|
| 18 |
- *
|
|
| 18 |
+ *
|
|
| 19 | 19 |
* You should have received a copy of the GNU General Public
|
| 20 | 20 |
* License along with this program. If not, see
|
| 21 | 21 |
* <http://www.gnu.org/licenses/gpl-3.0.html>.
|
| ... | ... | @@ -63,6 +63,14 @@ import fr.ird.observe.spi.context.ReferentialEntityContext; |
| 63 | 63 |
import fr.ird.observe.spi.context.ReferentialReferenceEntityContext;
|
| 64 | 64 |
import fr.ird.observe.spi.map.ImmutableDtoMap;
|
| 65 | 65 |
import fr.ird.observe.spi.map.ImmutableSetDtoMap;
|
| 66 |
+import org.apache.commons.logging.Log;
|
|
| 67 |
+import org.apache.commons.logging.LogFactory;
|
|
| 68 |
+import org.nuiton.topia.persistence.TopiaDao;
|
|
| 69 |
+import org.nuiton.topia.persistence.TopiaEntity;
|
|
| 70 |
+import org.nuiton.topia.persistence.metadata.TopiaMetadataModel;
|
|
| 71 |
+import org.nuiton.version.Version;
|
|
| 72 |
+import org.nuiton.version.Versions;
|
|
| 73 |
+ |
|
| 66 | 74 |
import java.util.Arrays;
|
| 67 | 75 |
import java.util.Collections;
|
| 68 | 76 |
import java.util.Date;
|
| ... | ... | @@ -71,11 +79,6 @@ import java.util.List; |
| 71 | 79 |
import java.util.Objects;
|
| 72 | 80 |
import java.util.Optional;
|
| 73 | 81 |
import java.util.Set;
|
| 74 |
-import org.apache.commons.logging.Log;
|
|
| 75 |
-import org.apache.commons.logging.LogFactory;
|
|
| 76 |
-import org.nuiton.topia.persistence.TopiaDao;
|
|
| 77 |
-import org.nuiton.topia.persistence.TopiaEntity;
|
|
| 78 |
-import org.nuiton.topia.persistence.metadata.TopiaMetadataModel;
|
|
| 79 | 82 |
|
| 80 | 83 |
/**
|
| 81 | 84 |
* Created on 16/08/15.
|
| ... | ... | @@ -84,14 +87,13 @@ import org.nuiton.topia.persistence.metadata.TopiaMetadataModel; |
| 84 | 87 |
*/
|
| 85 | 88 |
public class ReferentialServiceLocal extends ObserveServiceLocal implements ReferentialService {
|
| 86 | 89 |
|
| 87 |
- private static final Log log = LogFactory.getLog(ReferentialServiceLocal.class);
|
|
| 88 | 90 |
public static final List<String> SPECIES_GROUP_IDS = Arrays.asList(
|
| 89 | 91 |
"fr.ird.observe.entities.referentiel.SpeciesGroup#1445863056144#0.9820877553253712",
|
| 90 | 92 |
"fr.ird.observe.entities.referentiel.SpeciesGroup#1239832683690#0.24333033683679461",
|
| 91 | 93 |
"fr.ird.observe.entities.referentiel.SpeciesGroup#1446014286433#0.6480183366605247",
|
| 92 | 94 |
"fr.ird.observe.entities.referentiel.SpeciesGroup#1239832683689#0.7120116158620075"
|
| 93 | 95 |
);
|
| 94 |
- |
|
| 96 |
+ private static final Log log = LogFactory.getLog(ReferentialServiceLocal.class);
|
|
| 95 | 97 |
|
| 96 | 98 |
@Override
|
| 97 | 99 |
public <D extends ReferentialDto, R extends ReferentialDtoReference<D, R>> ReferentialDtoReferenceSet<R> getReferenceSet(Class<R> type, Date lastUpdateDate) {
|
| ... | ... | @@ -387,7 +389,8 @@ public class ReferentialServiceLocal extends ObserveServiceLocal implements Refe |
| 387 | 389 |
|
| 388 | 390 |
boolean h2 = serviceContext.getDataSourceConfiguration().orElseThrow(IllegalStateException::new).isH2Database();
|
| 389 | 391 |
|
| 390 |
- AddSqlScriptProducerRequest addRequest = h2 ? AddSqlScriptProducerRequest.forH2() : AddSqlScriptProducerRequest.forPostgres();
|
|
| 392 |
+ Version dbVersion = Versions.valueOf(serviceContext.getTopiaApplicationContext().getModelVersion());
|
|
| 393 |
+ AddSqlScriptProducerRequest addRequest = h2 ? AddSqlScriptProducerRequest.forH2(dbVersion) : AddSqlScriptProducerRequest.forPostgres(dbVersion);
|
|
| 391 | 394 |
for (Class<? extends ReferentialDtoReference> dtoType : missingReferentialIds.referentialReferenceTypes()) {
|
| 392 | 395 |
Set<String> ids = missingReferentialIds.get(dtoType);
|
| 393 | 396 |
addRequest.referentialIdsToAdd(dtoType, ids);
|
| ... | ... | @@ -91,7 +91,7 @@ public class MigrateTestsDatabases extends ServiceLocalTestSupport { |
| 91 | 91 |
@CopyDatabaseConfiguration
|
| 92 | 92 |
@Test
|
| 93 | 93 |
public void migrateReferentielDb() throws IOException, IncompatibleDataSourceCreateConfigurationException, DataSourceCreateWithNoReferentialImportException, BabModelVersionException, DatabaseConnexionNotAuthorizedException, DatabaseNotFoundException {
|
| 94 |
- AddSqlScriptProducerRequest request = AddSqlScriptProducerRequest.forH2().addSchema().addReferential().addAllData();
|
|
| 94 |
+ AddSqlScriptProducerRequest request = AddSqlScriptProducerRequest.forH2(ObserveTestConfiguration.getModelVersion()).addSchema().addReferential().addAllData();
|
|
| 95 | 95 |
dataSourceService.migrateData(localTestMethodResource.getDataSourceConfiguration());
|
| 96 | 96 |
migrate(service.produceAddSqlScript(request));
|
| 97 | 97 |
}
|
| ... | ... | @@ -100,7 +100,7 @@ public class MigrateTestsDatabases extends ServiceLocalTestSupport { |
| 100 | 100 |
@CopyDatabaseConfiguration
|
| 101 | 101 |
@Test
|
| 102 | 102 |
public void migrateDataForTestSeineDb() throws IOException, IncompatibleDataSourceCreateConfigurationException, DataSourceCreateWithNoReferentialImportException, BabModelVersionException, DatabaseConnexionNotAuthorizedException, DatabaseNotFoundException {
|
| 103 |
- AddSqlScriptProducerRequest request = AddSqlScriptProducerRequest.forH2().addSchema().addReferential().addAllData();
|
|
| 103 |
+ AddSqlScriptProducerRequest request = AddSqlScriptProducerRequest.forH2(ObserveTestConfiguration.getModelVersion()).addSchema().addReferential().addAllData();
|
|
| 104 | 104 |
dataSourceService.migrateData(localTestMethodResource.getDataSourceConfiguration());
|
| 105 | 105 |
migrate(service.produceAddSqlScript(request));
|
| 106 | 106 |
}
|
| ... | ... | @@ -109,7 +109,7 @@ public class MigrateTestsDatabases extends ServiceLocalTestSupport { |
| 109 | 109 |
@CopyDatabaseConfiguration
|
| 110 | 110 |
@Test
|
| 111 | 111 |
public void migrateDataForTestLonglineDb() throws IOException, IncompatibleDataSourceCreateConfigurationException, DataSourceCreateWithNoReferentialImportException, BabModelVersionException, DatabaseConnexionNotAuthorizedException, DatabaseNotFoundException {
|
| 112 |
- AddSqlScriptProducerRequest request = AddSqlScriptProducerRequest.forH2().addSchema().addReferential().addAllData();
|
|
| 112 |
+ AddSqlScriptProducerRequest request = AddSqlScriptProducerRequest.forH2(ObserveTestConfiguration.getModelVersion()).addSchema().addReferential().addAllData();
|
|
| 113 | 113 |
dataSourceService.migrateData(localTestMethodResource.getDataSourceConfiguration());
|
| 114 | 114 |
migrate(service.produceAddSqlScript(request));
|
| 115 | 115 |
}
|
| ... | ... | @@ -118,7 +118,7 @@ public class MigrateTestsDatabases extends ServiceLocalTestSupport { |
| 118 | 118 |
@CopyDatabaseConfiguration
|
| 119 | 119 |
@Test
|
| 120 | 120 |
public void migrateEmptyH2Db() throws IOException, IncompatibleDataSourceCreateConfigurationException, DataSourceCreateWithNoReferentialImportException, BabModelVersionException, DatabaseConnexionNotAuthorizedException, DatabaseNotFoundException {
|
| 121 |
- AddSqlScriptProducerRequest request = AddSqlScriptProducerRequest.forH2().addSchema();
|
|
| 121 |
+ AddSqlScriptProducerRequest request = AddSqlScriptProducerRequest.forH2(ObserveTestConfiguration.getModelVersion()).addSchema();
|
|
| 122 | 122 |
dataSourceService.migrateData(localTestMethodResource.getDataSourceConfiguration());
|
| 123 | 123 |
migrate(service.produceAddSqlScript(request));
|
| 124 | 124 |
}
|
| ... | ... | @@ -127,7 +127,7 @@ public class MigrateTestsDatabases extends ServiceLocalTestSupport { |
| 127 | 127 |
@CopyDatabaseConfiguration
|
| 128 | 128 |
@Test
|
| 129 | 129 |
public void migrateEmptyPgDb() throws IOException {
|
| 130 |
- AddSqlScriptProducerRequest request = AddSqlScriptProducerRequest.forPostgres().addSchema();
|
|
| 130 |
+ AddSqlScriptProducerRequest request = AddSqlScriptProducerRequest.forPostgres(ObserveTestConfiguration.getModelVersion()).addSchema();
|
|
| 131 | 131 |
dataSourceService.migrateData(localTestMethodResource.getDataSourceConfiguration());
|
| 132 | 132 |
migrate(DatabaseName.empty_pg.name(), service.produceAddSqlScript(request));
|
| 133 | 133 |
}
|
| ... | ... | @@ -38,6 +38,7 @@ import org.junit.Before; |
| 38 | 38 |
import org.junit.Test;
|
| 39 | 39 |
import org.nuiton.util.StringUtil;
|
| 40 | 40 |
import org.nuiton.util.TimeLog;
|
| 41 |
+import org.nuiton.version.Version;
|
|
| 41 | 42 |
|
| 42 | 43 |
/**
|
| 43 | 44 |
* Created on 31/12/15.
|
| ... | ... | @@ -49,9 +50,11 @@ public class SqlScriptProducerServiceLocalTest extends ServiceLocalTestSupport { |
| 49 | 50 |
private static final TimeLog timeLog = new TimeLog(SqlScriptProducerServiceLocalTest.class, 10, 1000);
|
| 50 | 51 |
|
| 51 | 52 |
protected SqlScriptProducerService service;
|
| 53 |
+ private Version dbVersion;
|
|
| 52 | 54 |
|
| 53 | 55 |
@Before
|
| 54 | 56 |
public void setUp() throws Exception {
|
| 57 |
+ dbVersion = localTestMethodResource.getDbVersion();
|
|
| 55 | 58 |
service = localTestMethodResource.newService(SqlScriptProducerService.class);
|
| 56 | 59 |
}
|
| 57 | 60 |
|
| ... | ... | @@ -59,8 +62,8 @@ public class SqlScriptProducerServiceLocalTest extends ServiceLocalTestSupport { |
| 59 | 62 |
@Test
|
| 60 | 63 |
public void testProduceSchema() throws Exception {
|
| 61 | 64 |
|
| 62 |
- produce(AddSqlScriptProducerRequest.forH2().addSchema());
|
|
| 63 |
- produce(AddSqlScriptProducerRequest.forPostgres().addSchema());
|
|
| 65 |
+ produce(AddSqlScriptProducerRequest.forH2(dbVersion).addSchema());
|
|
| 66 |
+ produce(AddSqlScriptProducerRequest.forPostgres(dbVersion).addSchema());
|
|
| 64 | 67 |
|
| 65 | 68 |
}
|
| 66 | 69 |
|
| ... | ... | @@ -68,7 +71,7 @@ public class SqlScriptProducerServiceLocalTest extends ServiceLocalTestSupport { |
| 68 | 71 |
@Test
|
| 69 | 72 |
public void testProduceReferential() throws Exception {
|
| 70 | 73 |
|
| 71 |
- produce(AddSqlScriptProducerRequest.forPostgres().addSchema().addReferential());
|
|
| 74 |
+ produce(AddSqlScriptProducerRequest.forPostgres(dbVersion).addSchema().addReferential());
|
|
| 72 | 75 |
|
| 73 | 76 |
}
|
| 74 | 77 |
|
| ... | ... | @@ -76,7 +79,7 @@ public class SqlScriptProducerServiceLocalTest extends ServiceLocalTestSupport { |
| 76 | 79 |
@Test
|
| 77 | 80 |
public void testProduceSomeReferential() throws Exception {
|
| 78 | 81 |
|
| 79 |
- produce(AddSqlScriptProducerRequest.forPostgres().addSchema().referentialIdsToAdd(ProgramReference.class, ImmutableSet.of(ObserveFixtures.PROGRAM_ID)));
|
|
| 82 |
+ produce(AddSqlScriptProducerRequest.forPostgres(dbVersion).addSchema().referentialIdsToAdd(ProgramReference.class, ImmutableSet.of(ObserveFixtures.PROGRAM_ID)));
|
|
| 80 | 83 |
|
| 81 | 84 |
}
|
| 82 | 85 |
|
| ... | ... | @@ -85,7 +88,7 @@ public class SqlScriptProducerServiceLocalTest extends ServiceLocalTestSupport { |
| 85 | 88 |
public void testProduceTripSeine() throws Exception {
|
| 86 | 89 |
|
| 87 | 90 |
// produce(AddSqlScriptProducerRequest.forPostgres().addSchema().addReferential().addAllData());
|
| 88 |
- produce(AddSqlScriptProducerRequest.forPostgres().addSchema().addReferential().dataIdsToAdd(ObserveFixtures.TRIP_SEINE_IDS));
|
|
| 91 |
+ produce(AddSqlScriptProducerRequest.forPostgres(dbVersion).addSchema().addReferential().dataIdsToAdd(ObserveFixtures.TRIP_SEINE_IDS));
|
|
| 89 | 92 |
|
| 90 | 93 |
}
|
| 91 | 94 |
|
| ... | ... | @@ -93,7 +96,7 @@ public class SqlScriptProducerServiceLocalTest extends ServiceLocalTestSupport { |
| 93 | 96 |
@Test
|
| 94 | 97 |
public void testProduceTripLongline() throws Exception {
|
| 95 | 98 |
|
| 96 |
- produce(AddSqlScriptProducerRequest.forH2().addSchema().addReferential().addAllData());
|
|
| 99 |
+ produce(AddSqlScriptProducerRequest.forH2(dbVersion).addSchema().addReferential().addAllData());
|
|
| 97 | 100 |
// produce(AddSqlScriptProducerRequest.forH2().addSchema().addReferential().dataIdsToAdd(ObserveFixtures.TRIP_LONGLINE_IDS));
|
| 98 | 101 |
|
| 99 | 102 |
}
|
| ... | ... | @@ -31,6 +31,7 @@ import fr.ird.observe.dto.ObserveDto; |
| 31 | 31 |
import fr.ird.observe.dto.reference.ReferentialDtoReference;
|
| 32 | 32 |
import java.util.Set;
|
| 33 | 33 |
import java.util.stream.Collectors;
|
| 34 |
+import org.nuiton.version.Version;
|
|
| 34 | 35 |
|
| 35 | 36 |
/**
|
| 36 | 37 |
* Created on 31/12/15.
|
| ... | ... | @@ -40,6 +41,8 @@ import java.util.stream.Collectors; |
| 40 | 41 |
public class AddSqlScriptProducerRequest implements ObserveDto {
|
| 41 | 42 |
|
| 42 | 43 |
private final boolean postgres;
|
| 44 |
+ private final Version dbVersion;
|
|
| 45 |
+ |
|
| 43 | 46 |
private boolean addSchema;
|
| 44 | 47 |
private boolean addReferential;
|
| 45 | 48 |
private boolean addSomeReferential;
|
| ... | ... | @@ -47,12 +50,12 @@ public class AddSqlScriptProducerRequest implements ObserveDto { |
| 47 | 50 |
private ImmutableSet<String> dataIds;
|
| 48 | 51 |
private final ArrayListMultimap<Class<? extends ReferentialDtoReference>, String> referentialIds = ArrayListMultimap.create();
|
| 49 | 52 |
|
| 50 |
- public static AddSqlScriptProducerRequest forH2() {
|
|
| 51 |
- return new AddSqlScriptProducerRequest(false);
|
|
| 53 |
+ public static AddSqlScriptProducerRequest forH2(Version dbVersion) {
|
|
| 54 |
+ return new AddSqlScriptProducerRequest(false, dbVersion);
|
|
| 52 | 55 |
}
|
| 53 | 56 |
|
| 54 |
- public static AddSqlScriptProducerRequest forPostgres() {
|
|
| 55 |
- return new AddSqlScriptProducerRequest(true);
|
|
| 57 |
+ public static AddSqlScriptProducerRequest forPostgres(Version dbVersion) {
|
|
| 58 |
+ return new AddSqlScriptProducerRequest(true, dbVersion);
|
|
| 56 | 59 |
}
|
| 57 | 60 |
|
| 58 | 61 |
public AddSqlScriptProducerRequest addSchema() {
|
| ... | ... | @@ -94,8 +97,13 @@ public class AddSqlScriptProducerRequest implements ObserveDto { |
| 94 | 97 |
return addReferential;
|
| 95 | 98 |
}
|
| 96 | 99 |
|
| 97 |
- protected AddSqlScriptProducerRequest(boolean postgres) {
|
|
| 100 |
+ public Version getDbVersion() {
|
|
| 101 |
+ return dbVersion;
|
|
| 102 |
+ }
|
|
| 103 |
+ |
|
| 104 |
+ protected AddSqlScriptProducerRequest(boolean postgres, Version dbVersion) {
|
|
| 98 | 105 |
this.postgres = postgres;
|
| 106 |
+ this.dbVersion = dbVersion;
|
|
| 99 | 107 |
}
|
| 100 | 108 |
|
| 101 | 109 |
public boolean isAddData() {
|