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;
}
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());
}
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();
}
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();
}
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();
}
Aggregations