Search in sources :

Example 1 with ListRelationsForCertificateResponseType

use of se.inera.intyg.clinicalprocess.healthcond.certificate.listrelationsforcertificate.v1.ListRelationsForCertificateResponseType in project webcert by sklintyg.

the class IntygRelationHelperImplTest method buildResponseWithParent.

private ListRelationsForCertificateResponseType buildResponseWithParent() {
    ListRelationsForCertificateResponseType resp = new ListRelationsForCertificateResponseType();
    IntygRelations intygRelations = new IntygRelations();
    intygRelations.getRelation().add(buildRelation(INTYG_ID, PARENT_INTYG_1));
    resp.getIntygRelation().add(intygRelations);
    return resp;
}
Also used : ListRelationsForCertificateResponseType(se.inera.intyg.clinicalprocess.healthcond.certificate.listrelationsforcertificate.v1.ListRelationsForCertificateResponseType) IntygRelations(se.inera.intyg.clinicalprocess.healthcond.certificate.listrelationsforcertificate.v1.IntygRelations)

Example 2 with ListRelationsForCertificateResponseType

use of se.inera.intyg.clinicalprocess.healthcond.certificate.listrelationsforcertificate.v1.ListRelationsForCertificateResponseType in project webcert by sklintyg.

the class IntygRelationHelperImplTest method testGetRelationsForIntygNothingInIT.

@Test
public void testGetRelationsForIntygNothingInIT() {
    when(listRelationsForCertificateResponderInterface.listRelationsForCertificate(isNull(), any(ListRelationsForCertificateType.class))).thenReturn(new ListRelationsForCertificateResponseType());
    Relations relationsForIntyg = testee.getRelationsForIntyg(INTYG_ID);
    assertNotNull(relationsForIntyg);
}
Also used : ListRelationsForCertificateResponseType(se.inera.intyg.clinicalprocess.healthcond.certificate.listrelationsforcertificate.v1.ListRelationsForCertificateResponseType) ListRelationsForCertificateType(se.inera.intyg.clinicalprocess.healthcond.certificate.listrelationsforcertificate.v1.ListRelationsForCertificateType) Relations(se.inera.intyg.webcert.web.web.controller.api.dto.Relations) IntygRelations(se.inera.intyg.clinicalprocess.healthcond.certificate.listrelationsforcertificate.v1.IntygRelations) Test(org.junit.Test)

Example 3 with ListRelationsForCertificateResponseType

use of se.inera.intyg.clinicalprocess.healthcond.certificate.listrelationsforcertificate.v1.ListRelationsForCertificateResponseType in project webcert by sklintyg.

the class IntygRelationHelperImplTest method testGetRelationsForIntygNothingInITWithMergeFromWebcert.

@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));
    fr.setReplacedByUtkast(new WebcertCertificateRelation(OTHER_INTYG_ID_2, RelationKod.ERSATT, LocalDateTime.now().minusDays(1), UtkastStatus.DRAFT_COMPLETE));
    fr.setComplementedByIntyg(new WebcertCertificateRelation(OTHER_INTYG_ID_2, RelationKod.KOMPLT, LocalDateTime.now().minusDays(2), UtkastStatus.SIGNED));
    fr.setComplementedByUtkast(new WebcertCertificateRelation(OTHER_INTYG_ID_2, RelationKod.KOMPLT, LocalDateTime.now().minusDays(2), UtkastStatus.DRAFT_INCOMPLETE));
    webcertRelations.setParent(new WebcertCertificateRelation(PARENT_INTYG_1, RelationKod.KOMPLT, LocalDateTime.now().minusDays(3), UtkastStatus.SIGNED));
    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());
}
Also used : ListRelationsForCertificateResponseType(se.inera.intyg.clinicalprocess.healthcond.certificate.listrelationsforcertificate.v1.ListRelationsForCertificateResponseType) ListRelationsForCertificateType(se.inera.intyg.clinicalprocess.healthcond.certificate.listrelationsforcertificate.v1.ListRelationsForCertificateType) WebcertCertificateRelation(se.inera.intyg.webcert.common.model.WebcertCertificateRelation) Relations(se.inera.intyg.webcert.web.web.controller.api.dto.Relations) IntygRelations(se.inera.intyg.clinicalprocess.healthcond.certificate.listrelationsforcertificate.v1.IntygRelations) Test(org.junit.Test)

Example 4 with ListRelationsForCertificateResponseType

use of se.inera.intyg.clinicalprocess.healthcond.certificate.listrelationsforcertificate.v1.ListRelationsForCertificateResponseType in project webcert by sklintyg.

the class IntygRelationHelperImplTest method buildResponse.

private ListRelationsForCertificateResponseType buildResponse() {
    ListRelationsForCertificateResponseType resp = new ListRelationsForCertificateResponseType();
    IntygRelations intygRelations = new IntygRelations();
    IntygId intygId = new IntygId();
    intygId.setExtension(INTYG_ID);
    intygRelations.setIntygsId(intygId);
    intygRelations.getRelation().add(buildRelation(OTHER_INTYG_ID, INTYG_ID));
    resp.getIntygRelation().add(intygRelations);
    return resp;
}
Also used : ListRelationsForCertificateResponseType(se.inera.intyg.clinicalprocess.healthcond.certificate.listrelationsforcertificate.v1.ListRelationsForCertificateResponseType) IntygRelations(se.inera.intyg.clinicalprocess.healthcond.certificate.listrelationsforcertificate.v1.IntygRelations) IntygId(se.riv.clinicalprocess.healthcond.certificate.types.v3.IntygId)

Example 5 with ListRelationsForCertificateResponseType

use of se.inera.intyg.clinicalprocess.healthcond.certificate.listrelationsforcertificate.v1.ListRelationsForCertificateResponseType in project webcert by sklintyg.

the class IntygRelationHelperImpl method getRelationsFromIntygstjanst.

private ListRelationsForCertificateResponseType getRelationsFromIntygstjanst(List<String> intygIds) {
    if (intygIds == null || intygIds.size() == 0) {
        return new ListRelationsForCertificateResponseType();
    }
    ListRelationsForCertificateType request = new ListRelationsForCertificateType();
    request.getIntygsId().addAll(intygIds);
    return listRelationsForCertificateResponderInterface.listRelationsForCertificate(logicalAddress, request);
}
Also used : ListRelationsForCertificateResponseType(se.inera.intyg.clinicalprocess.healthcond.certificate.listrelationsforcertificate.v1.ListRelationsForCertificateResponseType) ListRelationsForCertificateType(se.inera.intyg.clinicalprocess.healthcond.certificate.listrelationsforcertificate.v1.ListRelationsForCertificateType)

Aggregations

ListRelationsForCertificateResponseType (se.inera.intyg.clinicalprocess.healthcond.certificate.listrelationsforcertificate.v1.ListRelationsForCertificateResponseType)7 IntygRelations (se.inera.intyg.clinicalprocess.healthcond.certificate.listrelationsforcertificate.v1.IntygRelations)6 ListRelationsForCertificateType (se.inera.intyg.clinicalprocess.healthcond.certificate.listrelationsforcertificate.v1.ListRelationsForCertificateType)4 Relations (se.inera.intyg.webcert.web.web.controller.api.dto.Relations)4 WebcertCertificateRelation (se.inera.intyg.webcert.common.model.WebcertCertificateRelation)3 Test (org.junit.Test)2 Relation (se.inera.intyg.clinicalprocess.healthcond.certificate.listrelationsforcertificate.v1.Relation)2 ListIntygEntry (se.inera.intyg.webcert.web.web.controller.api.dto.ListIntygEntry)2 Collections (java.util.Collections)1 List (java.util.List)1 Collectors (java.util.stream.Collectors)1 Autowired (org.springframework.beans.factory.annotation.Autowired)1 Value (org.springframework.beans.factory.annotation.Value)1 Service (org.springframework.stereotype.Service)1 ListRelationsForCertificateResponderInterface (se.inera.intyg.clinicalprocess.healthcond.certificate.listrelationsforcertificate.v1.ListRelationsForCertificateResponderInterface)1 RelationKod (se.inera.intyg.common.support.common.enumerations.RelationKod)1 UtkastStatus (se.inera.intyg.webcert.common.model.UtkastStatus)1 CertificateRelationService (se.inera.intyg.webcert.web.service.relation.CertificateRelationService)1 IntygId (se.riv.clinicalprocess.healthcond.certificate.types.v3.IntygId)1