use of se.inera.intyg.webcert.persistence.utkast.model.VardpersonReferens in project webcert by sklintyg.
the class UpdateUserUtil method createVardpersonFromWebCertUser.
public static VardpersonReferens createVardpersonFromWebCertUser(WebCertUser user) {
VardpersonReferens vardPerson = new VardpersonReferens();
vardPerson.setNamn(user.getNamn());
vardPerson.setHsaId(user.getHsaId());
return vardPerson;
}
use of se.inera.intyg.webcert.persistence.utkast.model.VardpersonReferens in project webcert by sklintyg.
the class AbstractUtkastBuilder method populateUtkastWithVardenhetAndHoSPerson.
private void populateUtkastWithVardenhetAndHoSPerson(Utkast utkast, AbstractCreateCopyRequest copyRequest) {
Vardenhet vardenhet = copyRequest.getHosPerson().getVardenhet();
utkast.setEnhetsId(vardenhet.getEnhetsid());
utkast.setEnhetsNamn(vardenhet.getEnhetsnamn());
Vardgivare vardgivare = vardenhet.getVardgivare();
utkast.setVardgivarId(vardgivare.getVardgivarid());
utkast.setVardgivarNamn(vardgivare.getVardgivarnamn());
VardpersonReferens creator = UpdateUserUtil.createVardpersonFromHosPerson(copyRequest.getHosPerson());
utkast.setSenastSparadAv(creator);
utkast.setSkapadAv(creator);
}
use of se.inera.intyg.webcert.persistence.utkast.model.VardpersonReferens in project webcert by sklintyg.
the class IntygServiceTest method setupIntygstjanstResponse.
@Before
public void setupIntygstjanstResponse() throws Exception {
vardpersonReferens = new VardpersonReferens();
vardpersonReferens.setHsaId(HSA_ID);
vardpersonReferens.setNamn(CREATED_BY_NAME);
json = FileUtils.getStringFromFile(new ClassPathResource("IntygServiceTest/utlatande.json").getFile());
Fk7263Utlatande utlatande = objectMapper.readValue(json, Fk7263Utlatande.class);
CertificateMetaData metaData = new CertificateMetaData();
metaData.setStatus(new ArrayList<>());
CertificateResponse certificateResponse = new CertificateResponse(json, utlatande, metaData, false);
when(moduleFacade.getCertificate(any(String.class), any(String.class))).thenReturn(certificateResponse);
when(moduleFacade.getUtlatandeFromInternalModel(anyString(), anyString())).thenReturn(utlatande);
}
use of se.inera.intyg.webcert.persistence.utkast.model.VardpersonReferens in project webcert by sklintyg.
the class CreateDraftCertificateResponderImplTest method testCreateDraftCertificateSuccess.
@Test
public void testCreateDraftCertificateSuccess() {
CreateNewDraftRequest draftRequest = createCreateNewDraftRequest(createVardenhet(createVardgivare()));
CreateDraftCertificateType certificateType = createCertificateType();
VardpersonReferens vardperson = createVardpersonReferens(certificateType.getIntyg().getSkapadAv().getPersonalId().getRoot(), certificateType.getIntyg().getSkapadAv().getFullstandigtNamn());
Utkast utkast = createUtkast(UTKAST_ID, Long.parseLong(UTKAST_VERSION), UTKAST_TYPE, UtkastStatus.DRAFT_INCOMPLETE, UTKAST_JSON, vardperson);
when(mockValidator.validate(any(Intyg.class))).thenReturn(new ResultValidator());
when(mockRequestBuilder.buildCreateNewDraftRequest(any(Intyg.class), any(IntygUser.class))).thenReturn(draftRequest);
when(mockUtkastService.createNewDraft(any(CreateNewDraftRequest.class))).thenReturn(utkast);
when(takService.verifyTakningForCareUnit(any(String.class), any(String.class), any(SchemaVersion.class), any(IntygUser.class))).thenReturn(new TakResult(true, Lists.emptyList()));
when(patientDetailsResolver.getSekretessStatus(any(Personnummer.class))).thenReturn(eq(SekretessStatus.FALSE));
CreateDraftCertificateResponseType response = responder.createDraftCertificate(LOGICAL_ADDR, certificateType);
verify(mockUtkastService).createNewDraft(any(CreateNewDraftRequest.class));
verify(mockIntegreradeEnheterService).putIntegreradEnhet(any(IntegreradEnhetEntry.class), eq(false), eq(true));
verify(takService).verifyTakningForCareUnit(any(String.class), eq(UTKAST_TYPE), eq(SchemaVersion.VERSION_3), any(IntygUser.class));
assertNotNull(response);
assertEquals(response.getResult().getResultCode(), ResultCodeType.OK);
assertEquals(response.getIntygsId().getRoot(), UNIT_HSAID);
assertEquals(response.getIntygsId().getExtension(), UTKAST_ID);
}
use of se.inera.intyg.webcert.persistence.utkast.model.VardpersonReferens in project webcert by sklintyg.
the class CreateDraftCertificateResponderImplTest method testCreateDraftCertificateVardenhetAlredyExistsInRegistry.
@Test
public void testCreateDraftCertificateVardenhetAlredyExistsInRegistry() {
CreateNewDraftRequest draftRequest = createCreateNewDraftRequest(createVardenhet(createVardgivare()));
CreateDraftCertificateType certificateType = createCertificateType();
VardpersonReferens vardperson = createVardpersonReferens(certificateType.getIntyg().getSkapadAv().getPersonalId().getRoot(), certificateType.getIntyg().getSkapadAv().getFullstandigtNamn());
Utkast utkast = createUtkast(UTKAST_ID, Long.parseLong(UTKAST_VERSION), UTKAST_TYPE, UtkastStatus.DRAFT_INCOMPLETE, UTKAST_JSON, vardperson);
when(mockValidator.validate(any(Intyg.class))).thenReturn(new ResultValidator());
when(mockRequestBuilder.buildCreateNewDraftRequest(any(Intyg.class), any(IntygUser.class))).thenReturn(draftRequest);
when(mockUtkastService.createNewDraft(any(CreateNewDraftRequest.class))).thenReturn(utkast);
when(takService.verifyTakningForCareUnit(any(String.class), any(String.class), any(SchemaVersion.class), any(IntygUser.class))).thenReturn(new TakResult(true, Lists.emptyList()));
CreateDraftCertificateResponseType response = responder.createDraftCertificate(LOGICAL_ADDR, certificateType);
verify(mockUtkastService).createNewDraft(any(CreateNewDraftRequest.class));
verify(mockIntegreradeEnheterService).putIntegreradEnhet(any(IntegreradEnhetEntry.class), eq(false), eq(true));
assertNotNull(response);
assertEquals(response.getResult().getResultCode(), ResultCodeType.OK);
assertEquals(response.getIntygsId().getExtension(), UTKAST_ID);
}
Aggregations