use of se.inera.intyg.webcert.web.web.controller.api.dto.ListIntygEntry in project webcert by sklintyg.
the class IntygRelationHelperImpl method decorateIntygListWithRelations.
@Override
public void decorateIntygListWithRelations(List<ListIntygEntry> fullIntygItemList) {
ListRelationsForCertificateResponseType response = getRelationsFromIntygstjanst(fullIntygItemList.stream().map(ListIntygEntry::getIntygId).collect(Collectors.toList()));
if (response != null) {
// Very ugly, iterate over both lists, find matches and create relation(s) on the ListIntygEntries.
for (IntygRelations ir : response.getIntygRelation()) {
for (ListIntygEntry lie : fullIntygItemList) {
if (lie.getIntygId().equals(ir.getIntygsId().getExtension())) {
// Create a Relations instance to hold relations.
lie.setRelations(new Relations());
// Iterate over all relations for this particular intyg
for (Relation r : ir.getRelation()) {
applyRelation(lie.getIntygId(), lie.getRelations(), r);
}
}
}
}
}
// account.
for (ListIntygEntry lie : fullIntygItemList) {
Relations relations = certificateRelationService.getRelations(lie.getIntygId());
mergeRelations(lie.getRelations(), relations);
}
}
Aggregations