Search in sources :

Example 1 with GetPrivatePractitionerType

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

the class GetPrivatePractitionerResponderTest method noPersonIdThrowsException.

@Test(expected = IllegalArgumentException.class)
public void noPersonIdThrowsException() {
    GetPrivatePractitionerType request = new GetPrivatePractitionerType();
    ws.getPrivatePractitioner(null, request);
}
Also used : GetPrivatePractitionerType(se.riv.infrastructure.directory.privatepractitioner.getprivatepractitionerresponder.v1.GetPrivatePractitionerType) Test(org.junit.Test)

Example 2 with GetPrivatePractitionerType

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

the class GetPrivatePractitionerResponderTest method defaultRequest.

private GetPrivatePractitionerType defaultRequest() {
    GetPrivatePractitionerType request = new GetPrivatePractitionerType();
    request.setPersonalIdentityNumber(PERSONNUMMER);
    return request;
}
Also used : GetPrivatePractitionerType(se.riv.infrastructure.directory.privatepractitioner.getprivatepractitionerresponder.v1.GetPrivatePractitionerType)

Example 3 with GetPrivatePractitionerType

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

the class PPServiceImpl method createPrivatePractitionerType.

private GetPrivatePractitionerType createPrivatePractitionerType(String hsaIdentityNumber, String personalIdentityNumber) {
    GetPrivatePractitionerType ppType = new GetPrivatePractitionerType();
    ppType.setPersonHsaId(hsaIdentityNumber);
    ppType.setPersonalIdentityNumber(personalIdentityNumber);
    return ppType;
}
Also used : GetPrivatePractitionerType(se.riv.infrastructure.directory.privatepractitioner.getprivatepractitionerresponder.v1.GetPrivatePractitionerType)

Example 4 with GetPrivatePractitionerType

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

the class GetPrivatePractitionerResponderStub method getGetPrivatePractitionerResponseTypeForPnr.

private GetPrivatePractitionerResponseType getGetPrivatePractitionerResponseTypeForPnr(GetPrivatePractitionerType parameters) {
    String id = parameters.getPersonalIdentityNumber();
    Personnummer personnummer = Personnummer.createPersonnummer(id).orElse(null);
    GetPrivatePractitionerResponseType response = new GetPrivatePractitionerResponseType();
    // if matching -- create error response
    if (PERSONNUMMER_ERROR_RESPONSE.equals(id)) {
        response.setHoSPerson(null);
        response.setResultCode(ResultCodeEnum.ERROR);
        response.setResultText("FAILURE: an error occured while trying to get private practitioner with personal identity number: " + Personnummer.getPersonnummerHashSafe(personnummer) + " exists.");
        return response;
    }
    // if matching -- throw exception
    if (PERSONNUMMER_THROW_EXCEPTION.equals(id)) {
        throw new SOAPFaultException(createSOAPFault());
    }
    HoSPersonType person = personStub.get(id);
    if (person == null) {
        response.setResultCode(ResultCodeEnum.INFO);
        response.setResultText("No private practitioner with personal identity number: " + Personnummer.getPersonnummerHashSafe(personnummer) + " exists.");
    } else {
        response.setHoSPerson(person);
        response.setResultCode(ResultCodeEnum.OK);
    }
    return response;
}
Also used : Personnummer(se.inera.intyg.schemas.contract.Personnummer) GetPrivatePractitionerResponseType(se.riv.infrastructure.directory.privatepractitioner.getprivatepractitionerresponder.v1.GetPrivatePractitionerResponseType) HoSPersonType(se.riv.infrastructure.directory.privatepractitioner.v1.HoSPersonType) SOAPFaultException(javax.xml.ws.soap.SOAPFaultException)

Example 5 with GetPrivatePractitionerType

use of se.riv.infrastructure.directory.privatepractitioner.getprivatepractitionerresponder.v1.GetPrivatePractitionerType 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)

Aggregations

GetPrivatePractitionerType (se.riv.infrastructure.directory.privatepractitioner.getprivatepractitionerresponder.v1.GetPrivatePractitionerType)6 GetPrivatePractitionerResponseType (se.riv.infrastructure.directory.privatepractitioner.getprivatepractitionerresponder.v1.GetPrivatePractitionerResponseType)4 Test (org.junit.Test)3 HoSPersonType (se.riv.infrastructure.directory.privatepractitioner.v1.HoSPersonType)3 SOAPFaultException (javax.xml.ws.soap.SOAPFaultException)2 Personnummer (se.inera.intyg.schemas.contract.Personnummer)1 ObjectCreator (se.inera.intyg.webcert.integration.pp.util.ObjectCreator)1