Search in sources :

Example 11 with Relations

use of se.inera.intyg.webcert.web.web.controller.api.dto.Relations in project webcert by sklintyg.

the class CertificateRelationServiceImpl method getRelations.

@Override
public Relations getRelations(String intygsId) {
    Relations relations = new Relations();
    Optional<WebcertCertificateRelation> parentRelation = findParentRelation(intygsId);
    parentRelation.ifPresent(relations::setParent);
    List<WebcertCertificateRelation> childRelations = findChildRelations(intygsId);
    relations.setLatestChildRelations(prepareChildRelationDataForFrontend(childRelations));
    return relations;
}
Also used : WebcertCertificateRelation(se.inera.intyg.webcert.common.model.WebcertCertificateRelation) Relations(se.inera.intyg.webcert.web.web.controller.api.dto.Relations)

Example 12 with Relations

use of se.inera.intyg.webcert.web.web.controller.api.dto.Relations in project webcert by sklintyg.

the class UtkastModuleApiControllerTest method testGetDraft.

@Test
public void testGetDraft() {
    String intygTyp = "fk7263";
    String intygId = "intyg1";
    setupUser(AuthoritiesConstants.PRIVILEGE_SKRIVA_INTYG, intygTyp, false, AuthoritiesConstants.FEATURE_HANTERA_INTYGSUTKAST);
    when(utkastService.getDraft(CERTIFICATE_ID, intygTyp)).thenReturn(buildUtkast(intygTyp, intygId));
    when(certificateRelationService.getRelations(eq(intygId))).thenReturn(new Relations());
    Response response = moduleApiController.getDraft(intygTyp, CERTIFICATE_ID, request);
    verify(utkastService).getDraft(CERTIFICATE_ID, intygTyp);
    assertEquals(OK.getStatusCode(), response.getStatus());
}
Also used : Response(javax.ws.rs.core.Response) SaveDraftResponse(se.inera.intyg.webcert.web.service.utkast.dto.SaveDraftResponse) Relations(se.inera.intyg.webcert.web.web.controller.api.dto.Relations) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) Test(org.junit.Test)

Example 13 with Relations

use of se.inera.intyg.webcert.web.web.controller.api.dto.Relations in project webcert by sklintyg.

the class CopyCompletionUtkastBuilderTest method createIntygContentHolder.

private IntygContentHolder createIntygContentHolder() throws Exception {
    List<Status> status = new ArrayList<>();
    status.add(new Status(CertificateState.RECEIVED, "HSVARD", LocalDateTime.now()));
    status.add(new Status(CertificateState.SENT, "FKASSA", LocalDateTime.now()));
    Fk7263Utlatande utlatande = new CustomObjectMapper().readValue(new ClassPathResource("IntygDraftServiceImplTest/utlatande.json").getFile(), Fk7263Utlatande.class);
    return IntygContentHolder.builder().setContents("<external-json/>").setUtlatande(utlatande).setStatuses(status).setRevoked(false).setRelations(new Relations()).setDeceased(false).setSekretessmarkering(false).setPatientNameChangedInPU(false).setPatientAddressChangedInPU(false).build();
}
Also used : ValidationStatus(se.inera.intyg.common.support.modules.support.api.dto.ValidationStatus) Status(se.inera.intyg.common.support.model.Status) Fk7263Utlatande(se.inera.intyg.common.fk7263.model.internal.Fk7263Utlatande) CustomObjectMapper(se.inera.intyg.common.util.integration.json.CustomObjectMapper) ArrayList(java.util.ArrayList) Relations(se.inera.intyg.webcert.web.web.controller.api.dto.Relations) ClassPathResource(org.springframework.core.io.ClassPathResource)

Example 14 with Relations

use of se.inera.intyg.webcert.web.web.controller.api.dto.Relations in project webcert by sklintyg.

the class CreateRenewalCopyUtkastBuilderImplTest method createIntygContentHolder.

private IntygContentHolder createIntygContentHolder() throws Exception {
    List<Status> status = new ArrayList<>();
    status.add(new Status(CertificateState.RECEIVED, "HSVARD", LocalDateTime.now()));
    status.add(new Status(CertificateState.SENT, "FKASSA", LocalDateTime.now()));
    Fk7263Utlatande utlatande = new CustomObjectMapper().readValue(new ClassPathResource("IntygDraftServiceImplTest/utlatande.json").getFile(), Fk7263Utlatande.class);
    return IntygContentHolder.builder().setContents("<external-json/>").setUtlatande(utlatande).setStatuses(status).setRevoked(false).setRelations(new Relations()).setDeceased(false).setSekretessmarkering(false).setPatientNameChangedInPU(false).setPatientAddressChangedInPU(false).build();
}
Also used : ValidationStatus(se.inera.intyg.common.support.modules.support.api.dto.ValidationStatus) Status(se.inera.intyg.common.support.model.Status) Fk7263Utlatande(se.inera.intyg.common.fk7263.model.internal.Fk7263Utlatande) CustomObjectMapper(se.inera.intyg.common.util.integration.json.CustomObjectMapper) ArrayList(java.util.ArrayList) Relations(se.inera.intyg.webcert.web.web.controller.api.dto.Relations) ClassPathResource(org.springframework.core.io.ClassPathResource)

Example 15 with Relations

use of se.inera.intyg.webcert.web.web.controller.api.dto.Relations in project webcert by sklintyg.

the class CreateUtkastFromTemplateBuilderTest method createIntygContentHolder.

private IntygContentHolder createIntygContentHolder() throws Exception {
    List<Status> status = new ArrayList<>();
    status.add(new Status(CertificateState.RECEIVED, "HSVARD", LocalDateTime.now()));
    status.add(new Status(CertificateState.SENT, "SKV", LocalDateTime.now()));
    DbUtlatande utlatande = new CustomObjectMapper().readValue(new ClassPathResource("IntygDraftServiceImplTest/db-utlatande.json").getFile(), DbUtlatande.class);
    return IntygContentHolder.builder().setContents("<external-json/>").setUtlatande(utlatande).setStatuses(status).setRevoked(false).setRelations(new Relations()).setDeceased(false).setSekretessmarkering(false).setPatientNameChangedInPU(false).setPatientAddressChangedInPU(false).build();
}
Also used : Status(se.inera.intyg.common.support.model.Status) ValidationStatus(se.inera.intyg.common.support.modules.support.api.dto.ValidationStatus) DbUtlatande(se.inera.intyg.common.db.model.internal.DbUtlatande) CustomObjectMapper(se.inera.intyg.common.util.integration.json.CustomObjectMapper) ArrayList(java.util.ArrayList) Relations(se.inera.intyg.webcert.web.web.controller.api.dto.Relations) ClassPathResource(org.springframework.core.io.ClassPathResource)

Aggregations

Relations (se.inera.intyg.webcert.web.web.controller.api.dto.Relations)27 Test (org.junit.Test)12 IntygRelations (se.inera.intyg.clinicalprocess.healthcond.certificate.listrelationsforcertificate.v1.IntygRelations)11 ListRelationsForCertificateType (se.inera.intyg.clinicalprocess.healthcond.certificate.listrelationsforcertificate.v1.ListRelationsForCertificateType)7 Patient (se.inera.intyg.common.support.model.common.internal.Patient)7 WebcertCertificateRelation (se.inera.intyg.webcert.common.model.WebcertCertificateRelation)7 ClassPathResource (org.springframework.core.io.ClassPathResource)6 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)5 Personnummer (se.inera.intyg.schemas.contract.Personnummer)5 ArrayList (java.util.ArrayList)4 ListRelationsForCertificateResponseType (se.inera.intyg.clinicalprocess.healthcond.certificate.listrelationsforcertificate.v1.ListRelationsForCertificateResponseType)4 Fk7263Utlatande (se.inera.intyg.common.fk7263.model.internal.Fk7263Utlatande)4 Status (se.inera.intyg.common.support.model.Status)4 Response (javax.ws.rs.core.Response)3 Before (org.junit.Before)3 Utlatande (se.inera.intyg.common.support.model.common.internal.Utlatande)3 ModuleNotFoundException (se.inera.intyg.common.support.modules.registry.ModuleNotFoundException)3 CertificateResponse (se.inera.intyg.common.support.modules.support.api.dto.CertificateResponse)3 ValidationStatus (se.inera.intyg.common.support.modules.support.api.dto.ValidationStatus)3 ModuleException (se.inera.intyg.common.support.modules.support.api.exception.ModuleException)3