Search in sources :

Example 6 with CreateNewDraftRequest

use of se.inera.intyg.webcert.web.service.utkast.dto.CreateNewDraftRequest in project webcert by sklintyg.

the class CreateDraftCertificateResponderImpl method createNewDraft.

private Utkast createNewDraft(Utlatande utlatandeRequest, IntygUser user) {
    String invokingUserHsaId = utlatandeRequest.getSkapadAv().getPersonalId().getExtension();
    String invokingUnitHsaId = utlatandeRequest.getSkapadAv().getEnhet().getEnhetsId().getExtension();
    LOG.debug("Creating draft for invoker '{}' on unit '{}'", invokingUserHsaId, invokingUnitHsaId);
    // Create draft request
    CreateNewDraftRequest draftRequest = draftRequestBuilder.buildCreateNewDraftRequest(utlatandeRequest, user);
    // Add the creating vardenhet to registry
    addVardenhetToRegistry(draftRequest);
    // Create draft and return its id
    return utkastService.createNewDraft(draftRequest);
}
Also used : CreateNewDraftRequest(se.inera.intyg.webcert.web.service.utkast.dto.CreateNewDraftRequest)

Example 7 with CreateNewDraftRequest

use of se.inera.intyg.webcert.web.service.utkast.dto.CreateNewDraftRequest in project webcert by sklintyg.

the class CreateNewDraftRequestBuilderImpl method buildCreateNewDraftRequest.

@Override
public CreateNewDraftRequest buildCreateNewDraftRequest(Utlatande utlatande, IntygUser user) {
    HoSPersonal hosPerson = createHoSPerson(utlatande.getSkapadAv(), HoSPersonHelper.createVardenhetFromIntygUser(utlatande.getSkapadAv().getEnhet().getEnhetsId().getExtension(), user));
    HoSPersonHelper.enrichHoSPerson(hosPerson, user);
    return new CreateNewDraftRequest(null, utlatande.getTypAvUtlatande().getCode(), null, hosPerson, createPatient(utlatande.getPatient()));
}
Also used : HoSPersonal(se.inera.intyg.common.support.model.common.internal.HoSPersonal) CreateNewDraftRequest(se.inera.intyg.webcert.web.service.utkast.dto.CreateNewDraftRequest)

Example 8 with CreateNewDraftRequest

use of se.inera.intyg.webcert.web.service.utkast.dto.CreateNewDraftRequest in project webcert by sklintyg.

the class CreateDraftCertificateResponderImpl method createNewDraft.

private Utkast createNewDraft(Intyg utkastRequest, IntygUser user) {
    LOG.debug("Creating draft for invoker '{}' on unit '{}'", utkastRequest.getSkapadAv().getPersonalId().getExtension(), utkastRequest.getSkapadAv().getEnhet().getEnhetsId().getExtension());
    // Create draft request
    CreateNewDraftRequest draftRequest = draftRequestBuilder.buildCreateNewDraftRequest(utkastRequest, user);
    // Add the creating vardenhet to registry
    addVardenhetToRegistry(draftRequest);
    // Create draft and return its id
    return utkastService.createNewDraft(draftRequest);
}
Also used : CreateNewDraftRequest(se.inera.intyg.webcert.web.service.utkast.dto.CreateNewDraftRequest)

Example 9 with CreateNewDraftRequest

use of se.inera.intyg.webcert.web.service.utkast.dto.CreateNewDraftRequest in project webcert by sklintyg.

the class UtkastServiceImplTest method testNullReferensNotPersisted.

@Test
public void testNullReferensNotPersisted() throws ModuleNotFoundException, IOException, ModuleException {
    CreateNewDraftRequest request = buildCreateNewDraftRequest();
    request.setReferens(null);
    setupReferensMocks();
    Utkast res = draftService.createNewDraft(request);
    assertNotNull(res.getSkapad());
    verify(referensService, times(0)).saveReferens(INTYG_ID, REFERENS);
}
Also used : CreateNewDraftRequest(se.inera.intyg.webcert.web.service.utkast.dto.CreateNewDraftRequest) Utkast(se.inera.intyg.webcert.persistence.utkast.model.Utkast) Test(org.junit.Test)

Example 10 with CreateNewDraftRequest

use of se.inera.intyg.webcert.web.service.utkast.dto.CreateNewDraftRequest in project webcert by sklintyg.

the class UtkastServiceImplTest method buildCreateNewDraftRequest.

private CreateNewDraftRequest buildCreateNewDraftRequest() {
    CreateNewDraftRequest request = new CreateNewDraftRequest();
    request.setHosPerson(hoSPerson);
    request.setIntygId(INTYG_ID);
    request.setIntygType(INTYG_TYPE);
    request.setPatient(defaultPatient);
    request.setStatus(UtkastStatus.DRAFT_INCOMPLETE);
    return request;
}
Also used : CreateNewDraftRequest(se.inera.intyg.webcert.web.service.utkast.dto.CreateNewDraftRequest)

Aggregations

CreateNewDraftRequest (se.inera.intyg.webcert.web.service.utkast.dto.CreateNewDraftRequest)23 Test (org.junit.Test)14 Utkast (se.inera.intyg.webcert.persistence.utkast.model.Utkast)10 BaseCreateDraftCertificateTest (se.inera.intyg.webcert.web.integration.interactions.createdraftcertificate.BaseCreateDraftCertificateTest)9 HoSPersonal (se.inera.intyg.common.support.model.common.internal.HoSPersonal)4 SchemaVersion (se.inera.intyg.common.support.modules.support.api.notification.SchemaVersion)4 IntygUser (se.inera.intyg.infra.security.common.model.IntygUser)4 TakResult (se.inera.intyg.webcert.integration.tak.model.TakResult)4 VardpersonReferens (se.inera.intyg.webcert.persistence.utkast.model.VardpersonReferens)4 IntegreradEnhetEntry (se.inera.intyg.webcert.web.integration.registry.dto.IntegreradEnhetEntry)4 ResultValidator (se.inera.intyg.webcert.web.integration.validators.ResultValidator)4 Utlatande (se.riv.clinicalprocess.healthcond.certificate.createdraftcertificateresponder.v1.Utlatande)3 CreateDraftCertificateResponseType (se.riv.clinicalprocess.healthcond.certificate.createdraftcertificateresponder.v3.CreateDraftCertificateResponseType)3 CreateDraftCertificateType (se.riv.clinicalprocess.healthcond.certificate.createdraftcertificateresponder.v3.CreateDraftCertificateType)3 Intyg (se.riv.clinicalprocess.healthcond.certificate.createdraftcertificateresponder.v3.Intyg)3 TypAvUtlatande (se.riv.clinicalprocess.healthcond.certificate.types.v1.TypAvUtlatande)3 TypAvIntyg (se.riv.clinicalprocess.healthcond.certificate.types.v3.TypAvIntyg)3 Response (javax.ws.rs.core.Response)2 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)2 QueryIntygResponse (se.inera.intyg.webcert.web.web.controller.api.dto.QueryIntygResponse)2