use of se.inera.intyg.common.support.model.common.internal.HoSPersonal in project webcert by sklintyg.
the class IntygConverterUtilTest method testBuildHosPersonalFromWebCertUser.
@Test
public void testBuildHosPersonalFromWebCertUser() {
final String forskrivarkod = "forskrivarkod";
final String hsaId = "hsaid";
final String namn = "namn";
final String arbetsplatskod = "arbetsplatskod";
final String epost = "epost";
final String enhetsId = "enhetsId";
final String enhetsnamn = "enhetsnamn";
final String postadress = "postadress";
final String postnummer = "postnummer";
final String postort = "postort";
final String telefonnummer = "telefonnummer";
final String vardgivarId = "vardgivarId";
final String vardgivarnamn = "vardgivarnamn";
Vardenhet valdVardenhet = new Vardenhet();
valdVardenhet.setArbetsplatskod(arbetsplatskod);
valdVardenhet.setEpost(epost);
valdVardenhet.setId(enhetsId);
valdVardenhet.setNamn(enhetsnamn);
valdVardenhet.setPostadress(postadress);
valdVardenhet.setPostnummer(postnummer);
valdVardenhet.setPostort(postort);
valdVardenhet.setTelefonnummer(telefonnummer);
Vardgivare valdVardgivare = new Vardgivare();
valdVardgivare.setId(vardgivarId);
valdVardgivare.setNamn(vardgivarnamn);
WebCertUser user = new WebCertUser();
user.setForskrivarkod(forskrivarkod);
user.setHsaId(hsaId);
user.setNamn(namn);
user.setValdVardenhet(valdVardenhet);
user.setValdVardgivare(valdVardgivare);
HoSPersonal result = IntygConverterUtil.buildHosPersonalFromWebCertUser(user, null);
assertEquals(forskrivarkod, result.getForskrivarKod());
assertEquals(hsaId, result.getPersonId());
assertEquals(namn, result.getFullstandigtNamn());
assertEquals(arbetsplatskod, result.getVardenhet().getArbetsplatsKod());
assertEquals(epost, result.getVardenhet().getEpost());
assertEquals(enhetsId, result.getVardenhet().getEnhetsid());
assertEquals(enhetsnamn, result.getVardenhet().getEnhetsnamn());
assertEquals(postadress, result.getVardenhet().getPostadress());
assertEquals(postnummer, result.getVardenhet().getPostnummer());
assertEquals(postort, result.getVardenhet().getPostort());
assertEquals(telefonnummer, result.getVardenhet().getTelefonnummer());
assertEquals(vardgivarId, result.getVardenhet().getVardgivare().getVardgivarid());
assertEquals(vardgivarnamn, result.getVardenhet().getVardgivare().getVardgivarnamn());
}
use of se.inera.intyg.common.support.model.common.internal.HoSPersonal in project webcert by sklintyg.
the class CreateDraftCertificateResponderImplTest method createCreateNewDraftRequest.
private CreateNewDraftRequest createCreateNewDraftRequest(Vardenhet vardenhet) {
CreateNewDraftRequest draftRequest = new CreateNewDraftRequest(UTKAST_ID, null, null, new HoSPersonal(), null);
draftRequest.getHosPerson().setVardenhet(vardenhet);
return draftRequest;
}
use of se.inera.intyg.common.support.model.common.internal.HoSPersonal in project webcert by sklintyg.
the class IntygServiceImpl method sendIntygToCertificateSender.
protected IntygServiceResult sendIntygToCertificateSender(SendIntygConfiguration sendConfig, Utlatande intyg, boolean delay) {
String intygsId = intyg.getId();
String recipient = sendConfig.getRecipient();
String intygsTyp = intyg.getTyp();
HoSPersonal skickatAv = IntygConverterUtil.buildHosPersonalFromWebCertUser(webCertUserService.getUser(), null);
try {
LOG.debug("Sending intyg {} of type {} to recipient {}", intygsId, intygsTyp, recipient);
// Ask the certificateSenderService to post a 'send' message onto the queue.
certificateSenderService.sendCertificate(intygsId, intyg.getGrundData().getPatient().getPersonId(), objectMapper.writeValueAsString(skickatAv), recipient, delay);
// Notify stakeholders when a certificate is sent
notificationService.sendNotificationForIntygSent(intygsId);
return IntygServiceResult.OK;
} catch (WebServiceException wse) {
LOG.error("An WebServiceException occured when trying to send intyg: " + intygsId, wse);
return IntygServiceResult.FAILED;
} catch (RuntimeException e) {
LOG.error("Module problems occured when trying to send intyg " + intygsId, e);
throw new WebCertServiceException(WebCertServiceErrorCodeEnum.MODULE_PROBLEM, e);
} catch (JsonProcessingException e) {
LOG.error("Error writing skickatAv as string when trying to send intyg " + intygsId, e);
throw new WebCertServiceException(WebCertServiceErrorCodeEnum.MODULE_PROBLEM, e);
} catch (CertificateSenderException e) {
throw new WebCertServiceException(WebCertServiceErrorCodeEnum.MODULE_PROBLEM, e);
}
}
Aggregations