Skip to content

Commit

Permalink
Merge branch 'release/v1.22.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
bot committed Sep 9, 2022
2 parents 1fa4112 + 4061037 commit 94ba0d1
Show file tree
Hide file tree
Showing 24 changed files with 271 additions and 515 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,20 @@

Note: version releases in the 0.x.y range may introduce breaking changes.

## [1.22.0]
### Added
### Fixed
- Folder creation
- fix not unique rows in matrix formate ([#390](https://github.com/ehrbase/openEHR_SDK/pull/390))

## [1.21.0]
### Added
- Get items from current folder ([#385](https://github.com/ehrbase/openEHR_SDK/pull/385))
### Fixed
- Removed caching of root folders to prevent false conflicts and memory leaks ([#385](https://github.com/ehrbase/openEHR_SDK/pull/385))
- new Matrix serialisation use rm-model for index and fix section handling ([#386](https://github.com/ehrbase/openEHR_SDK/pull/386))


## [1.20.0]
### Added
- Add spotless plugin, Add codestyle check to workflows ([#368](https://github.com/ehrbase/openEHR_SDK/pull/368))
Expand Down Expand Up @@ -196,3 +203,4 @@ Note: version releases in the 0.x.y range may introduce breaking changes.

[1.20.0]: https://github.com/ehrbase/openEHR_SDK/compare/v1.19.0...v1.20.0
[1.21.0]: https://github.com/ehrbase/openEHR_SDK/compare/v1.20.0...v1.21.0
[1.22.0]: https://github.com/ehrbase/openEHR_SDK/compare/v1.21.0...v1.22.0
2 changes: 1 addition & 1 deletion aql/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<parent>
<groupId>org.ehrbase.openehr.sdk</groupId>
<artifactId>root</artifactId>
<version>1.21.0</version>
<version>1.22.0</version>
</parent>

<artifactId>aql</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<artifactId>bom</artifactId>
<groupId>org.ehrbase.openehr.sdk</groupId>
<version>1.21.0</version>
<version>1.22.0</version>
<packaging>pom</packaging>

<name>openEHR SDK</name>
Expand Down
2 changes: 1 addition & 1 deletion building/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<parent>
<groupId>org.ehrbase.openehr.sdk</groupId>
<artifactId>root</artifactId>
<version>1.21.0</version>
<version>1.22.0</version>
</parent>

<artifactId>building</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<parent>
<groupId>org.ehrbase.openehr.sdk</groupId>
<artifactId>root</artifactId>
<version>1.21.0</version>
<version>1.22.0</version>
</parent>

<artifactId>client</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,10 @@ public FolderDAO getFolder(String path) {
}

synchronized void syncFromDb() {
if (root == null) {
try {
retrieveRootFolder();
} catch (WrongStatusCodeException e) {
createRootFolder();
}
try {
retrieveRootFolder();
} catch (WrongStatusCodeException e) {
createRootFolder();
}
}

Expand Down Expand Up @@ -119,7 +117,9 @@ private void copyToFolder(Folder folder, DirectoryResponseData responseData) {
private void retrieveRootFolder() throws WrongStatusCodeException {
Optional<DirectoryResponseData> directoryResponseData =
defaultRestClient.httpGet(resolve(StringUtils.EMPTY), DirectoryResponseData.class);
root = initRootFolder();
if (root == null) {
root = initRootFolder();
}
copyToFolder(
root, directoryResponseData.orElseThrow(() -> new WrongStatusCodeException("Not Found", 404, 200)));
rootVersion = new VersionUid(root.getUid().toString());
Expand Down
2 changes: 1 addition & 1 deletion example-generator/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>root</artifactId>
<groupId>org.ehrbase.openehr.sdk</groupId>
<version>1.21.0</version>
<version>1.22.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion generator-maven-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>root</artifactId>
<groupId>org.ehrbase.openehr.sdk</groupId>
<version>1.21.0</version>
<version>1.22.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion generator/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<parent>
<groupId>org.ehrbase.openehr.sdk</groupId>
<artifactId>root</artifactId>
<version>1.21.0</version>
<version>1.22.0</version>
</parent>

<artifactId>generator</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion opt-1.4/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<parent>
<groupId>org.ehrbase.openehr.sdk</groupId>
<artifactId>root</artifactId>
<version>1.21.0</version>
<version>1.22.0</version>
</parent>

<artifactId>opt-1.4</artifactId>
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@
<parent>
<groupId>org.ehrbase.openehr.sdk</groupId>
<artifactId>bom</artifactId>
<version>1.21.0</version>
<version>1.22.0</version>
<relativePath>./bom/pom.xml</relativePath>
</parent>

<groupId>org.ehrbase.openehr.sdk</groupId>
<artifactId>root</artifactId>
<version>1.21.0</version>
<version>1.22.0</version>
<packaging>pom</packaging>


Expand Down
2 changes: 1 addition & 1 deletion response-dto/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<parent>
<groupId>org.ehrbase.openehr.sdk</groupId>
<artifactId>root</artifactId>
<version>1.21.0</version>
<version>1.22.0</version>
</parent>

<artifactId>response-dto</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion serialisation/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<parent>
<groupId>org.ehrbase.openehr.sdk</groupId>
<artifactId>root</artifactId>
<version>1.21.0</version>
<version>1.22.0</version>
</parent>

<artifactId>serialisation</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
import org.apache.commons.csv.CSVFormat;
Expand Down Expand Up @@ -140,7 +141,29 @@ private List<Row> flatten(Map<Entity, Map<Index, Map<AqlPath, Object>>> map) {

private List<Row> toRows(Entity entity, Map<Index, Map<AqlPath, Object>> map) {

return map.entrySet().stream().map(e -> toRow(entity, e)).collect(Collectors.toList());
// Make the row unique on archetype + entity_path + entity_index + field_idx
Map<String, Map<AqlPath, Map<List<Integer>, Map<List<Integer>, Optional<Row>>>>> collect =
map.entrySet().stream()
.map(e -> toRow(entity, e))
.collect(Collectors.groupingBy(
Row::getArchetypeId,
Collectors.groupingBy(
Row::getEntityPath,
Collectors.groupingBy(
r -> Arrays.asList(r.getEntityIdx()),
Collectors.groupingBy(
r -> Arrays.asList(r.getFieldIdx()),
Collectors.reducing((r1, r2) -> {
r1.getFields().putAll(r2.getFields());
return r1;
}))))));

return collect.values().stream()
.flatMap(m -> m.values().stream())
.flatMap(m -> m.values().stream())
.flatMap(m -> m.values().stream())
.flatMap(Optional::stream)
.collect(Collectors.toList());
}

private Row toRow(Entity entity, Map.Entry<Index, Map<AqlPath, Object>> e) {
Expand Down Expand Up @@ -291,7 +314,6 @@ public <T extends RMObject> T unmarshal(String value, Class<T> clazz) {

private void encode(Row row) {

row.setEntityPath(encoder.encode(row.getEntityPath()));
row.setFields(row.getFields().entrySet().stream()
.collect(Collectors.toMap(
e -> encoder.encode(e.getKey()),
Expand All @@ -304,7 +326,6 @@ private void encode(Row row) {

private void decode(Row row) {

row.setEntityPath(encoder.decode(row.getEntityPath()));
row.setFields(row.getFields().entrySet().stream()
.collect(Collectors.toMap(
e -> encoder.decode(e.getKey()),
Expand Down
Loading

0 comments on commit 94ba0d1

Please sign in to comment.