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