Skip to content

Commit

Permalink
merging dev into uat (#186)
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 Sep 23, 2024
1 parent b6fe4a6 commit ae74425
Show file tree
Hide file tree
Showing 6 changed files with 15,397 additions and 15,397 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.09% |
| :heavy_check_mark: Number of Lines Covered | 2269 |
| :x: Number of Lines Missed | 195 |
| Total Number of Lines | 2464 |
| Code Coverage % | 92.07% |
| :heavy_check_mark: Number of Lines Covered | 2276 |
| :x: Number of Lines Missed | 196 |
| Total Number of Lines | 2472 |


## 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.26.0
version: v1.26.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.26.0</version>
<version>1.26.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 @@ -144,6 +144,7 @@ public Uni<ResourceEntity> createResource(ResourceEntity resourceEntity, File fi
@WithTransaction
public Uni<List<String>> createResourceMultiple(List<ResourceEntity> resourceEntityList, List<ResourceCreationDto> resourceCreationDtoList) {
List<String> errors = new ArrayList<>();
List<String> uploadedFiles = new ArrayList<>();
return Multi.createFrom().items(resourceEntityList.stream())
.onItem().transformToUniAndConcatenate(resourceEntity -> {
int index = resourceEntityList.indexOf(resourceEntity);
Expand All @@ -169,6 +170,7 @@ public Uni<List<String>> createResourceMultiple(List<ResourceEntity> resourceEnt
errors.add(String.format("%s-Problema di sincronizzazione sulla creazione della risorsa", filename));
return Uni.createFrom().nullItem();
}
uploadedFiles.add(optionalResource.get().getStorageKey());
return Uni.createFrom().item(optionalResource.get());
}));
});
Expand All @@ -179,12 +181,22 @@ public Uni<List<String>> createResourceMultiple(List<ResourceEntity> resourceEnt
});
})
.collect().asList()
.onItem().transform(resourceDTOList -> {
.onItem().transformToUni(resourceDTOList -> {
if (!errors.isEmpty()) {
throw new AtmLayerException("Errore nel caricamento dovuto ai seguenti file: " + String.join(", ", errors),
Response.Status.BAD_REQUEST, RESOURCES_CREATION_ERROR);
return deleteResourcesFromStorage(uploadedFiles, errors);
}
return errors; // This will be empty if no errors occurred
return Uni.createFrom().item(errors); // This will be empty if no errors occurred
});
}

public Uni<List<String>> deleteResourcesFromStorage(List<String> storageKeys, List<String> errorMessages){
return Multi.createFrom().items(storageKeys.stream())
.onItem().transformToUniAndConcatenate(uploadedStorageKey -> resourceEntityStorageService.delete(uploadedStorageKey)
.onItem().transform(objectStoreResponse -> String.format("Deleted %s",objectStoreResponse.getStorageKey())))
.collect().asList()
.onItem().transform(deletedKeys -> {
throw new AtmLayerException("Errore nel caricamento dovuto ai seguenti file: " + String.join(", ", errorMessages),
Response.Status.BAD_REQUEST, RESOURCES_CREATION_ERROR);
});
}

Expand Down
Loading

0 comments on commit ae74425

Please sign in to comment.