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