Search in sources :

Example 16 with HoSPersonType

use of se.riv.infrastructure.directory.privatepractitioner.v1.HoSPersonType in project webcert by sklintyg.

the class GetPrivatePractitionerResponderStub method getGetPrivatePractitionerResponseTypeForHsaid.

private GetPrivatePractitionerResponseType getGetPrivatePractitionerResponseTypeForHsaid(GetPrivatePractitionerType parameters) {
    String hsa = parameters.getPersonHsaId();
    GetPrivatePractitionerResponseType response = new GetPrivatePractitionerResponseType();
    // if matching -- create error response
    if (PERSONNUMMER_ERROR_RESPONSE.equals(hsa)) {
        response.setHoSPerson(null);
        response.setResultCode(ResultCodeEnum.ERROR);
        response.setResultText("FAILURE: an error occured while trying to get private practitioner with hsa id: " + hsa + " exists.");
        return response;
    }
    // if matching -- throw exception
    if (PERSONNUMMER_THROW_EXCEPTION.equals(hsa)) {
        throw new SOAPFaultException(createSOAPFault());
    }
    HoSPersonType person = personStub.getByHsaId(hsa);
    if (person == null) {
        response.setResultCode(ResultCodeEnum.INFO);
        response.setResultText("No private practitioner with hsa id: " + hsa + " exists.");
    } else {
        response.setHoSPerson(person);
        response.setResultCode(ResultCodeEnum.OK);
    }
    return response;
}
Also used : GetPrivatePractitionerResponseType(se.riv.infrastructure.directory.privatepractitioner.getprivatepractitionerresponder.v1.GetPrivatePractitionerResponseType) HoSPersonType(se.riv.infrastructure.directory.privatepractitioner.v1.HoSPersonType) SOAPFaultException(javax.xml.ws.soap.SOAPFaultException)

Example 17 with HoSPersonType

use of se.riv.infrastructure.directory.privatepractitioner.v1.HoSPersonType in project webcert by sklintyg.

the class PPBootstrapBean method add.

private void add(Resource res) throws IOException {
    LOG.debug("Loading private practitioners from " + res.getFilename());
    HoSPersonType personType = objectMapper.readValue(res.getInputStream(), HoSPersonType.class);
    personStub.add(personType);
    LOG.debug(String.format("Loaded private practitioner %s (%s)", personType.getFullstandigtNamn(), personType.getPersonId().getExtension()));
}
Also used : HoSPersonType(se.riv.infrastructure.directory.privatepractitioner.v1.HoSPersonType)

Example 18 with HoSPersonType

use of se.riv.infrastructure.directory.privatepractitioner.v1.HoSPersonType in project webcert by sklintyg.

the class GetPrivatePractitionerResponderTest method verifyExistingPerson.

@Test
public void verifyExistingPerson() {
    // Given
    ObjectCreator objectCreator = new ObjectCreator();
    HoSPersonType hoSPersonType = objectCreator.getHoSPersonType();
    GetPrivatePractitionerType request = defaultRequest();
    GetPrivatePractitionerResponseType expected = new GetPrivatePractitionerResponseType();
    expected.setResultCode(ResultCodeEnum.OK);
    expected.setHoSPerson(hoSPersonType);
    // When
    when(personStub.get(PERSONNUMMER)).thenReturn(hoSPersonType);
    // Call web service
    GetPrivatePractitionerResponseType actual = ws.getPrivatePractitioner("address", request);
    // Then
    assertTrue(ResultCodeEnum.OK == actual.getResultCode());
    assertEquals(HSAID, actual.getHoSPerson().getHsaId().getExtension());
    assertEquals(PERSONNUMMER, actual.getHoSPerson().getPersonId().getExtension());
    verify(personStub, times(1)).get(PERSONNUMMER);
}
Also used : GetPrivatePractitionerResponseType(se.riv.infrastructure.directory.privatepractitioner.getprivatepractitionerresponder.v1.GetPrivatePractitionerResponseType) HoSPersonType(se.riv.infrastructure.directory.privatepractitioner.v1.HoSPersonType) GetPrivatePractitionerType(se.riv.infrastructure.directory.privatepractitioner.getprivatepractitionerresponder.v1.GetPrivatePractitionerType) ObjectCreator(se.inera.intyg.webcert.integration.pp.util.ObjectCreator) Test(org.junit.Test)

Example 19 with HoSPersonType

use of se.riv.infrastructure.directory.privatepractitioner.v1.HoSPersonType in project webcert by sklintyg.

the class ElegWebCertUserDetailsServiceTest method buildHosPerson.

private HoSPersonType buildHosPerson() {
    HoSPersonType hoSPersonType = new HoSPersonType();
    HsaId hsaId = new HsaId();
    hsaId.setExtension(HSA_ID);
    hoSPersonType.setHsaId(hsaId);
    PersonId personId = new PersonId();
    personId.setExtension(PERSON_ID);
    hoSPersonType.setPersonId(personId);
    EnhetType vardEnhet = new EnhetType();
    vardEnhet.setEnhetsnamn("enhetsNamn");
    HsaId enhetsId = new HsaId();
    enhetsId.setExtension("enhetsId");
    vardEnhet.setEnhetsId(enhetsId);
    VardgivareType vardgivare = new VardgivareType();
    HsaId vardgivareId = new HsaId();
    enhetsId.setExtension("vardgivareId");
    vardgivare.setVardgivareId(vardgivareId);
    vardgivare.setVardgivarenamn("vardgivareName");
    vardEnhet.setVardgivare(vardgivare);
    hoSPersonType.setEnhet(vardEnhet);
    return hoSPersonType;
}
Also used : PersonId(se.riv.infrastructure.directory.privatepractitioner.types.v1.PersonId) HoSPersonType(se.riv.infrastructure.directory.privatepractitioner.v1.HoSPersonType) EnhetType(se.riv.infrastructure.directory.privatepractitioner.v1.EnhetType) VardgivareType(se.riv.infrastructure.directory.privatepractitioner.v1.VardgivareType) HsaId(se.riv.infrastructure.directory.privatepractitioner.types.v1.HsaId)

Aggregations

HoSPersonType (se.riv.infrastructure.directory.privatepractitioner.v1.HoSPersonType)16 Test (org.junit.Test)9 EnhetType (se.riv.infrastructure.directory.privatepractitioner.v1.EnhetType)6 ArrayList (java.util.ArrayList)3 GetPrivatePractitionerResponseType (se.riv.infrastructure.directory.privatepractitioner.getprivatepractitionerresponder.v1.GetPrivatePractitionerResponseType)3 Address (javax.mail.Address)2 MimeMessage (javax.mail.internet.MimeMessage)2 SOAPFaultException (javax.xml.ws.soap.SOAPFaultException)2 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)2 Personnummer (se.inera.intyg.schemas.contract.Personnummer)2 ObjectCreator (se.inera.intyg.webcert.integration.pp.util.ObjectCreator)2 ValidatePrivatePractitionerResponseType (se.riv.infrastructure.directory.privatepractitioner.validateprivatepractitionerresponder.v1.ValidatePrivatePractitionerResponseType)2 MessagingException (javax.mail.MessagingException)1 WebServiceException (javax.xml.ws.WebServiceException)1 MailSendException (org.springframework.mail.MailSendException)1 HsaServiceCallException (se.inera.intyg.infra.integration.hsa.exception.HsaServiceCallException)1 Role (se.inera.intyg.infra.security.common.model.Role)1 GetPrivatePractitionerType (se.riv.infrastructure.directory.privatepractitioner.getprivatepractitionerresponder.v1.GetPrivatePractitionerType)1 HsaId (se.riv.infrastructure.directory.privatepractitioner.types.v1.HsaId)1 PersonId (se.riv.infrastructure.directory.privatepractitioner.types.v1.PersonId)1