Skip to content

Commit 9be438c

Browse files
committed
reworked OrganizationAffiliation allow-list generation
Only first endpoint now selected for bundle (only one endpoint allowed by dsf). Endpoint identifier now part of the conditional update url in the allow-list bundle.
1 parent c140e58 commit 9be438c

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

src/main/java/dev/dsf/bpe/service/UpdateAllowList.java

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -212,14 +212,18 @@ private BundleEntryComponent toOrganizationAffiliationEntry(OrganizationAffiliat
212212
else
213213
throw new IllegalStateException("OrganizationAffiliation with participating organization expected");
214214

215+
String endpointIdentifier;
215216
if (affiliation.hasEndpoint())
216217
{
217-
List<Reference> endpoints = affiliation.getEndpoint().stream()
218-
.map(e -> tempIdsByTypeAndId.get(e.getReference()))
219-
.map(tempId -> new Reference().setType("Endpoint").setReference(tempId))
220-
.collect(Collectors.toList());
221-
affiliation.setEndpoint(endpoints);
218+
String ref = affiliation.getEndpointFirstRep().getReference();
219+
endpointIdentifier = identifierByTypeAndId.get(ref);
220+
String endpointTempId = tempIdsByTypeAndId.get(ref);
221+
222+
affiliation.setEndpoint(
223+
Collections.singletonList(new Reference().setType("Endpoint").setReference(endpointTempId)));
222224
}
225+
else
226+
throw new IllegalStateException("OrganizationAffiliation with endpoint expected");
223227

224228
BundleEntryComponent entry = new BundleEntryComponent();
225229
entry.setFullUrl(uuid);
@@ -228,7 +232,8 @@ private BundleEntryComponent toOrganizationAffiliationEntry(OrganizationAffiliat
228232
.setUrl("OrganizationAffiliation?primary-organization:identifier="
229233
+ NamingSystems.OrganizationIdentifier.SID + "|" + primaryOrganizatioIdentifier
230234
+ "&participating-organization:identifier=" + NamingSystems.OrganizationIdentifier.SID + "|"
231-
+ participatingOrganizationIdentifier);
235+
+ participatingOrganizationIdentifier + "&endpoint:identifier="
236+
+ NamingSystems.EndpointIdentifier.SID + "|" + endpointIdentifier);
232237
return entry;
233238
}
234239
}

0 commit comments

Comments
 (0)