@@ -212,14 +212,18 @@ private BundleEntryComponent toOrganizationAffiliationEntry(OrganizationAffiliat
212
212
else
213
213
throw new IllegalStateException ("OrganizationAffiliation with participating organization expected" );
214
214
215
+ String endpointIdentifier ;
215
216
if (affiliation .hasEndpoint ())
216
217
{
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 )));
222
224
}
225
+ else
226
+ throw new IllegalStateException ("OrganizationAffiliation with endpoint expected" );
223
227
224
228
BundleEntryComponent entry = new BundleEntryComponent ();
225
229
entry .setFullUrl (uuid );
@@ -228,7 +232,8 @@ private BundleEntryComponent toOrganizationAffiliationEntry(OrganizationAffiliat
228
232
.setUrl ("OrganizationAffiliation?primary-organization:identifier="
229
233
+ NamingSystems .OrganizationIdentifier .SID + "|" + primaryOrganizatioIdentifier
230
234
+ "&participating-organization:identifier=" + NamingSystems .OrganizationIdentifier .SID + "|"
231
- + participatingOrganizationIdentifier );
235
+ + participatingOrganizationIdentifier + "&endpoint:identifier="
236
+ + NamingSystems .EndpointIdentifier .SID + "|" + endpointIdentifier );
232
237
return entry ;
233
238
}
234
239
}
0 commit comments