@Test public void testGetRelationsForIntygNothingInITWithMergeFromWebcert() { when(listRelationsForCertificateResponderInterface.listRelationsForCertificate(isNull(), any(ListRelationsForCertificateType.class))).thenReturn(new ListRelationsForCertificateResponseType()); Relations webcertRelations = new Relations(); Relations.FrontendRelations fr = webcertRelations.getLatestChildRelations(); fr.setReplacedByIntyg(new WebcertCertificateRelation(OTHER_INTYG_ID_2, RelationKod.ERSATT, LocalDateTime.now().minusDays(1), UtkastStatus.SIGNED, false)); fr.setReplacedByUtkast(new WebcertCertificateRelation(OTHER_INTYG_ID_2, RelationKod.ERSATT, LocalDateTime.now().minusDays(1), UtkastStatus.DRAFT_COMPLETE, false)); fr.setComplementedByIntyg(new WebcertCertificateRelation(OTHER_INTYG_ID_2, RelationKod.KOMPLT, LocalDateTime.now().minusDays(2), UtkastStatus.SIGNED, false)); fr.setComplementedByUtkast(new WebcertCertificateRelation(OTHER_INTYG_ID_2, RelationKod.KOMPLT, LocalDateTime.now().minusDays(2), UtkastStatus.DRAFT_INCOMPLETE, false)); webcertRelations.setParent( new WebcertCertificateRelation(PARENT_INTYG_1, RelationKod.KOMPLT, LocalDateTime.now().minusDays(3), UtkastStatus.SIGNED, false)); when(certificateRelationService.getRelations(INTYG_ID)).thenReturn(webcertRelations); Relations relationsForIntyg = testee.getRelationsForIntyg(INTYG_ID); assertNotNull(relationsForIntyg); assertFrontendRelations(relationsForIntyg.getLatestChildRelations(), webcertRelations.getLatestChildRelations().getComplementedByIntyg(), webcertRelations.getLatestChildRelations().getComplementedByUtkast(), webcertRelations.getLatestChildRelations().getReplacedByIntyg(), webcertRelations.getLatestChildRelations().getReplacedByUtkast()); }
@Override public Relations getRelationsForIntyg(String intygId) { Relations certificateRelations = new Relations(); ListRelationsForCertificateResponseType response = getRelationsFromIntygstjanst(intygId); response.getIntygRelation().stream() .flatMap(ir -> ir.getRelation().stream()) .forEach(r -> applyRelation(intygId, certificateRelations, r)); Relations webcertRelations = certificateRelationService.getRelations(intygId); mergeRelations(certificateRelations, webcertRelations); return certificateRelations; }
IntygRelationHelperImpl implements IntygRelationHelper { @Override public Relations getRelationsForIntyg(String intygId) { Relations certificateRelations = new Relations(); ListRelationsForCertificateResponseType response = getRelationsFromIntygstjanst(intygId); response.getIntygRelation().stream() .flatMap(ir -> ir.getRelation().stream()) .forEach(r -> applyRelation(intygId, certificateRelations, r)); Relations webcertRelations = certificateRelationService.getRelations(intygId); mergeRelations(certificateRelations, webcertRelations); return certificateRelations; } }
IntygRelationHelperImpl implements IntygRelationHelper { @Override public Relations getRelationsForIntyg(String intygId) { Relations certificateRelations = new Relations(); ListRelationsForCertificateResponseType response = getRelationsFromIntygstjanst(intygId); response.getIntygRelation().stream() .flatMap(ir -> ir.getRelation().stream()) .forEach(r -> applyRelation(intygId, certificateRelations, r)); Relations webcertRelations = certificateRelationService.getRelations(intygId); mergeRelations(certificateRelations, webcertRelations); return certificateRelations; }  }
IntygRelationHelperImpl implements IntygRelationHelper { @Override public Relations getRelationsForIntyg(String intygId) { Relations certificateRelations = new Relations(); ListRelationsForCertificateResponseType response = getRelationsFromIntygstjanst(intygId); response.getIntygRelation().stream() .flatMap(ir -> ir.getRelation().stream()) .forEach(r -> applyRelation(intygId, certificateRelations, r)); Relations webcertRelations = certificateRelationService.getRelations(intygId); mergeRelations(certificateRelations, webcertRelations); return certificateRelations; }  @Override Relations getRelationsForIntyg(String intygId); @Override void decorateIntygListWithRelations(List<ListIntygEntry> fullIntygItemList); }
IntygRelationHelperImpl implements IntygRelationHelper { @Override public Relations getRelationsForIntyg(String intygId) { Relations certificateRelations = new Relations(); ListRelationsForCertificateResponseType response = getRelationsFromIntygstjanst(intygId); response.getIntygRelation().stream() .flatMap(ir -> ir.getRelation().stream()) .forEach(r -> applyRelation(intygId, certificateRelations, r)); Relations webcertRelations = certificateRelationService.getRelations(intygId); mergeRelations(certificateRelations, webcertRelations); return certificateRelations; }  @Override Relations getRelationsForIntyg(String intygId); @Override void decorateIntygListWithRelations(List<ListIntygEntry> fullIntygItemList);  }