Skip to content

Commit

Permalink
merging dev into uat (#178)
Browse files Browse the repository at this point in the history
Co-authored-by: adrrossi <[email protected]>
Co-authored-by: GitHub Action <[email protected]>
Co-authored-by: adrrss <[email protected]>
Co-authored-by: SMANUM <[email protected]>
Co-authored-by: GiacomoB <[email protected]>
Co-authored-by: Simone Munao <[email protected]>
Co-authored-by: ElisKina-dev <[email protected]>
Co-authored-by: EmVal <[email protected]>
Co-authored-by: ElisKina-dev <[email protected]>
Co-authored-by: Gabriele Maiocchi <[email protected]>
Co-authored-by: Giacomo Brancazi <[email protected]>
  • Loading branch information
12 people authored Aug 1, 2024
1 parent 896a1a3 commit 3225f42
Show file tree
Hide file tree
Showing 6 changed files with 16,700 additions and 16,691 deletions.
8 changes: 4 additions & 4 deletions _TMP/coverage-results.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@

| Outcome | Value |
|-------------------------|---------------------------------------------------------------------|
| Code Coverage % | 92.07% |
| :heavy_check_mark: Number of Lines Covered | 2265 |
| :x: Number of Lines Missed | 195 |
| Total Number of Lines | 2460 |
| Code Coverage % | 92.04% |
| :heavy_check_mark: Number of Lines Covered | 2266 |
| :x: Number of Lines Missed | 196 |
| Total Number of Lines | 2462 |


## Details:
Expand Down
2 changes: 1 addition & 1 deletion helm-chart/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: v1.20.0
version: v1.20.0-dev.3
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>it.gov.pagopa</groupId>
<artifactId>atm-layer-model</artifactId>
<version>1.20.0</version>
<version>1.20.0-dev.3</version>
<name>atm-layer-model</name>
<properties>
<compiler-plugin.version>3.11.0</compiler-plugin.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,13 +143,11 @@ public Uni<ResourceEntity> createResource(ResourceEntity resourceEntity, File fi
@Override
public Uni<List<String>> createResourceMultiple(List<ResourceEntity> resourceEntityList, List<ResourceCreationDto> resourceCreationDtoList) {
List<String> errors = new ArrayList<>();

return Multi.createFrom().items(resourceEntityList.stream())
.onItem().transformToUniAndConcatenate(resourceEntity -> {
int index = resourceEntityList.indexOf(resourceEntity);
File file = resourceCreationDtoList.get(index).getFile();
String filename = resourceCreationDtoList.get(index).getFilename();

return findBySHA256(resourceEntity.getSha256())
.onItem().transformToUni(x -> {
if (x.isPresent()) {
Expand Down Expand Up @@ -203,25 +201,33 @@ public Uni<ResourceEntity> updateResource(UUID uuid, File file) {
}
ResourceEntity resourceEntity = optionalResource.get();
String newFileSha256 = calculateSha256(file);
if (Objects.equals(resourceEntity.getSha256(), newFileSha256)) {
throw new AtmLayerException("La risorsa è già presente", Response.Status.BAD_REQUEST, RESOURCE_WITH_SAME_SHA256_ALREADY_EXISTS);
}
resourceEntity.setSha256(newFileSha256);
Date date = new Date();
resourceEntity.setLastUpdatedAt(new Timestamp(date.getTime()));
resourceEntity.getResourceFile().setLastUpdatedAt(new Timestamp(date.getTime()));
return resourceEntityRepository.persist(resourceEntity)
.onItem()
.transformToUni(x -> {
String storageKey = resourceEntity.getResourceFile().getStorageKey();
String fileName = FilenameUtils.getBaseName(storageKey);
String extension = FilenameUtils.getExtension(storageKey);
String path = FilenameUtils.getFullPath(storageKey);
return resourceEntityStorageService.uploadFile(file, resourceEntity, CommonUtils.getFilenameWithExtension(fileName, extension), CommonUtils.getPathWithoutFilename(path), false)
// if (Objects.equals(resourceEntity.getSha256(), newFileSha256)) {
// throw new AtmLayerException("La risorsa è già presente", Response.Status.BAD_REQUEST, RESOURCE_WITH_SAME_SHA256_ALREADY_EXISTS);
// }
return findBySHA256(newFileSha256)
.onItem().transformToUni(Unchecked.function(x -> {
if (x.isPresent()) {
throw new AtmLayerException(String.format("Esiste già una risorsa con lo stesso contenuto: %s", x.get().getResourceFile().getStorageKey().substring(15)),
Response.Status.BAD_REQUEST,
RESOURCE_WITH_SAME_SHA256_ALREADY_EXISTS);
}
resourceEntity.setSha256(newFileSha256);
Date date = new Date();
resourceEntity.setLastUpdatedAt(new Timestamp(date.getTime()));
resourceEntity.getResourceFile().setLastUpdatedAt(new Timestamp(date.getTime()));
return resourceEntityRepository.persist(resourceEntity)
.onItem()
.transformToUni(fileUpdated -> this.findByUUID(uuid)
.onItem().transformToUni(optionalResourceUpdated -> Uni.createFrom().item(optionalResource.get())));
});
.transformToUni(savedResource -> {
String storageKey = resourceEntity.getResourceFile().getStorageKey();
String fileName = FilenameUtils.getBaseName(storageKey);
String extension = FilenameUtils.getExtension(storageKey);
String path = FilenameUtils.getFullPath(storageKey);
return resourceEntityStorageService.uploadFile(file, resourceEntity, CommonUtils.getFilenameWithExtension(fileName, extension), CommonUtils.getPathWithoutFilename(path), false)
.onItem()
.transformToUni(fileUpdated -> this.findByUUID(uuid)
.onItem().transformToUni(optionalResourceUpdated -> Uni.createFrom().item(optionalResource.get())));
});
}));
}));
}

Expand Down
Loading

0 comments on commit 3225f42

Please sign in to comment.