File tree Expand file tree Collapse file tree 2 files changed +4
-6
lines changed
main/java/de/medizininformatikinitiative/torch/model/management
test/java/de/medizininformatikinitiative/torch/management Expand file tree Collapse file tree 2 files changed +4
-6
lines changed Original file line number Diff line number Diff line change @@ -257,9 +257,7 @@ public Bundle toFhirBundle() {
257
257
bundle .setId (UUID .randomUUID ().toString ());
258
258
259
259
cache .values ().forEach (resource -> {
260
- if (resource .isPresent ()) {
261
- bundle .addEntry (createBundleEntry (resource .get ()));
262
- }
260
+ resource .ifPresent (value -> bundle .addEntry (createBundleEntry (value )));
263
261
}
264
262
);
265
263
return bundle ;
@@ -269,7 +267,7 @@ private Bundle.BundleEntryComponent createBundleEntry(Resource resource) {
269
267
Bundle .BundleEntryComponent entryComponent = new Bundle .BundleEntryComponent ();
270
268
entryComponent .setResource (resource );
271
269
Bundle .BundleEntryRequestComponent request = new Bundle .BundleEntryRequestComponent ();
272
- request .setUrl (resource . getResourceType () + "/" + resource . getId ( ));
270
+ request .setUrl (ResourceUtils . getRelativeURL ( resource ));
273
271
request .setMethod (PUT );
274
272
entryComponent .setRequest (request );
275
273
return entryComponent ;
Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ class ResourceBundleTest {
34
34
35
35
@ BeforeEach
36
36
void setUp () {
37
- patient1 .setId ("patient1" );
37
+ patient1 .setId ("http://blaze.com/fhir/Patient/ patient1" );
38
38
patient2 .setId ("patient2" );
39
39
patient3 .setId ("patient3" );
40
40
Set <String > attributeGroups1 = Set .of ("group1" , "group2" );
@@ -52,7 +52,7 @@ void toFhirBundleTest() {
52
52
cache .put (wrapper1 );
53
53
54
54
var fhirBundle = cache .toFhirBundle ();
55
-
55
+ assertThat ( fhirBundle . getEntry (). getFirst (). getRequest (). getUrl ()). isEqualTo ( "Patient/patient1" );
56
56
assertThat (fhirBundle )
57
57
.containsNEntries (1 )
58
58
.extractResources ()
You can’t perform that action at this time.
0 commit comments