Search in sources :

Example 1 with RestfulServer

use of ca.uhn.fhir.rest.server.RestfulServer in project gpconnect-demonstrator by nhsconnect.

the class PatientJwtValidator method getPatientResourceBinding.

private ResourceBinding getPatientResourceBinding(IRestfulServerDefaults defaultServer) {
    ResourceBinding resourceBinding = null;
    if (defaultServer instanceof RestfulServer) {
        RestfulServer restfulServer = (RestfulServer) defaultServer;
        // if we get more than one Patient binding then return null
        resourceBinding = restfulServer.getResourceBindings().stream().filter(currentResourceBinding -> "Patient".equalsIgnoreCase(currentResourceBinding.getResourceName())).collect(Collectors.reducing((a, b) -> null)).orElse(null);
    }
    return resourceBinding;
}
Also used : BaseMethodBinding(ca.uhn.fhir.rest.server.method.BaseMethodBinding) IParameter(ca.uhn.fhir.rest.server.method.IParameter) IdDt(ca.uhn.fhir.model.primitive.IdDt) RestfulServer(ca.uhn.fhir.rest.server.RestfulServer) InvalidRequestException(ca.uhn.fhir.rest.server.exceptions.InvalidRequestException) ResourceBinding(ca.uhn.fhir.rest.server.ResourceBinding) Autowired(org.springframework.beans.factory.annotation.Autowired) ParameterUtil(ca.uhn.fhir.rest.param.ParameterUtil) Collectors(java.util.stream.Collectors) IssueType(org.hl7.fhir.dstu3.model.OperationOutcome.IssueType) Value(org.springframework.beans.factory.annotation.Value) OperationOutcomeFactory(uk.gov.hscic.OperationOutcomeFactory) RuleBuilder(ca.uhn.fhir.rest.server.interceptor.auth.RuleBuilder) List(java.util.List) Component(org.springframework.stereotype.Component) RequestTypeEnum(ca.uhn.fhir.rest.api.RequestTypeEnum) RequestDetails(ca.uhn.fhir.rest.api.server.RequestDetails) PatientResourceProvider(uk.gov.hscic.patient.PatientResourceProvider) IRestfulServerDefaults(ca.uhn.fhir.rest.server.IRestfulServerDefaults) IAuthRule(ca.uhn.fhir.rest.server.interceptor.auth.IAuthRule) SystemCode(uk.gov.hscic.SystemCode) ResourceNotFoundException(ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException) AuthorizationInterceptor(ca.uhn.fhir.rest.server.interceptor.auth.AuthorizationInterceptor) RestfulServer(ca.uhn.fhir.rest.server.RestfulServer) ResourceBinding(ca.uhn.fhir.rest.server.ResourceBinding)

Aggregations

IdDt (ca.uhn.fhir.model.primitive.IdDt)1 RequestTypeEnum (ca.uhn.fhir.rest.api.RequestTypeEnum)1 RequestDetails (ca.uhn.fhir.rest.api.server.RequestDetails)1 ParameterUtil (ca.uhn.fhir.rest.param.ParameterUtil)1 IRestfulServerDefaults (ca.uhn.fhir.rest.server.IRestfulServerDefaults)1 ResourceBinding (ca.uhn.fhir.rest.server.ResourceBinding)1 RestfulServer (ca.uhn.fhir.rest.server.RestfulServer)1 InvalidRequestException (ca.uhn.fhir.rest.server.exceptions.InvalidRequestException)1 ResourceNotFoundException (ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException)1 AuthorizationInterceptor (ca.uhn.fhir.rest.server.interceptor.auth.AuthorizationInterceptor)1 IAuthRule (ca.uhn.fhir.rest.server.interceptor.auth.IAuthRule)1 RuleBuilder (ca.uhn.fhir.rest.server.interceptor.auth.RuleBuilder)1 BaseMethodBinding (ca.uhn.fhir.rest.server.method.BaseMethodBinding)1 IParameter (ca.uhn.fhir.rest.server.method.IParameter)1 List (java.util.List)1 Collectors (java.util.stream.Collectors)1 IssueType (org.hl7.fhir.dstu3.model.OperationOutcome.IssueType)1 Autowired (org.springframework.beans.factory.annotation.Autowired)1 Value (org.springframework.beans.factory.annotation.Value)1 Component (org.springframework.stereotype.Component)1