Class AbstractResourceServiceImpl<D extends ResourceDao<R>,R extends org.hl7.fhir.r4.model.Resource>

java.lang.Object
dev.dsf.fhir.webservice.base.AbstractBasicService
dev.dsf.fhir.webservice.impl.AbstractResourceServiceImpl<D,R>
All Implemented Interfaces:
BasicService, BasicResourceService<R>, org.springframework.beans.factory.InitializingBean
Direct Known Subclasses:
ActivityDefinitionServiceImpl, BinaryServiceImpl, BundleServiceImpl, CodeSystemServiceImpl, DocumentReferenceServiceImpl, EndpointServiceImpl, GroupServiceImpl, HealthcareServiceServiceImpl, LibraryServiceImpl, LocationServiceImpl, MeasureReportServiceImpl, MeasureServiceImpl, NamingSystemServiceImpl, OrganizationAffiliationServiceImpl, OrganizationServiceImpl, PatientServiceImpl, PractitionerRoleServiceImpl, PractitionerServiceImpl, ProvenanceServiceImpl, QuestionnaireResponseServiceImpl, QuestionnaireServiceImpl, ResearchStudyServiceImpl, StructureDefinitionServiceImpl, SubscriptionServiceImpl, TaskServiceImpl, ValueSetServiceImpl

public abstract class AbstractResourceServiceImpl<D extends ResourceDao<R>,R extends org.hl7.fhir.r4.model.Resource> extends AbstractBasicService implements BasicResourceService<R>, org.springframework.beans.factory.InitializingBean
  • Field Details

  • Constructor Details

  • Method Details

    • afterPropertiesSet

      public void afterPropertiesSet() throws Exception
      Specified by:
      afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
      Throws:
      Exception
    • create

      public jakarta.ws.rs.core.Response create(R resource, jakarta.ws.rs.core.UriInfo uri, jakarta.ws.rs.core.HttpHeaders headers)
      Description copied from interface: BasicResourceService
      standard and conditional create
      Specified by:
      create in interface BasicResourceService<D extends ResourceDao<R>>
      Parameters:
      resource - not null
      uri - not null
      headers - not null
      Returns:
      Response defined in https://www.hl7.org/fhir/http.html#create
    • checkReferenceAfterCreate

      protected boolean checkReferenceAfterCreate(R created, ResourceReference ref)
      Override this method to exclude references from being checked after a create, add similar rule to CheckReferencesCommand
      Parameters:
      created - not null
      ref - not null
      Returns:
      true if a reference should be checked
      See Also:
    • preCreate

      protected Consumer<R> preCreate(R resource) throws jakarta.ws.rs.WebApplicationException
      Override to modify the given resource before db insert, throw WebApplicationException to interrupt the normal flow
      Parameters:
      resource - not null
      Returns:
      if not null, the returned Consumer will be called after the create operation and before returning to the client, the Consumer can throw a WebApplicationException to interrupt the normal flow, the Consumer will be called with the created resource
      Throws:
      jakarta.ws.rs.WebApplicationException - if the normal flow should be interrupted
    • read

      public jakarta.ws.rs.core.Response read(String id, jakarta.ws.rs.core.UriInfo uri, jakarta.ws.rs.core.HttpHeaders headers)
      Description copied from interface: BasicResourceService
      read by id
      Specified by:
      read in interface BasicResourceService<D extends ResourceDao<R>>
      Parameters:
      id - not null
      uri - not null
      headers - not null
      Returns:
      Response defined in https://www.hl7.org/fhir/http.html#read
    • getMediaTypeForRead

      protected jakarta.ws.rs.core.MediaType getMediaTypeForRead(jakarta.ws.rs.core.UriInfo uri, jakarta.ws.rs.core.HttpHeaders headers)
    • vread

      public jakarta.ws.rs.core.Response vread(String id, long version, jakarta.ws.rs.core.UriInfo uri, jakarta.ws.rs.core.HttpHeaders headers)
      Description copied from interface: BasicResourceService
      read by id and version
      Specified by:
      vread in interface BasicResourceService<D extends ResourceDao<R>>
      Parameters:
      id - not null
      version - >0
      uri - not null
      headers - not null
      Returns:
      Response defined in https://www.hl7.org/fhir/http.html#vread
    • getMediaTypeForVRead

      protected jakarta.ws.rs.core.MediaType getMediaTypeForVRead(jakarta.ws.rs.core.UriInfo uri, jakarta.ws.rs.core.HttpHeaders headers)
    • history

      public jakarta.ws.rs.core.Response history(jakarta.ws.rs.core.UriInfo uri, jakarta.ws.rs.core.HttpHeaders headers)
      Specified by:
      history in interface BasicResourceService<D extends ResourceDao<R>>
    • history

      public jakarta.ws.rs.core.Response history(String id, jakarta.ws.rs.core.UriInfo uri, jakarta.ws.rs.core.HttpHeaders headers)
      Specified by:
      history in interface BasicResourceService<D extends ResourceDao<R>>
    • update

      public jakarta.ws.rs.core.Response update(String id, R resource, jakarta.ws.rs.core.UriInfo uri, jakarta.ws.rs.core.HttpHeaders headers)
      Description copied from interface: BasicResourceService
      standard update
      Specified by:
      update in interface BasicResourceService<D extends ResourceDao<R>>
      Parameters:
      id - not null
      resource - not null
      uri - not null
      headers - not null
      Returns:
      Response defined in https://www.hl7.org/fhir/http.html#update
    • checkReferenceAfterUpdate

      protected boolean checkReferenceAfterUpdate(R updated, ResourceReference ref)
      Override this method to exclude references from being checked after an update, add similar rule to CheckReferencesCommand
      Parameters:
      updated - not null
      ref - not null
      Returns:
      true if a reference should be checked
      See Also:
    • preUpdate

      protected Consumer<R> preUpdate(R resource)
      Override to modify the given resource before db update, throw WebApplicationException to interrupt the normal flow. Path id vs. resource.id.idPart is checked before this method is called
      Parameters:
      resource - not null
      Returns:
      if not null, the returned Consumer will be called after the update operation and before returning to the client, the Consumer can throw a WebApplicationException to interrupt the normal flow, the Consumer will be called with the updated resource
      Throws:
      jakarta.ws.rs.WebApplicationException - if the normal flow should be interrupted
    • update

      public jakarta.ws.rs.core.Response update(R resource, jakarta.ws.rs.core.UriInfo uri, jakarta.ws.rs.core.HttpHeaders headers)
      Description copied from interface: BasicResourceService
      conditional update
      Specified by:
      update in interface BasicResourceService<D extends ResourceDao<R>>
      Parameters:
      resource - not null
      uri - not null
      headers - not null
      Returns:
      Response defined in https://www.hl7.org/fhir/http.html#update
    • delete

      public jakarta.ws.rs.core.Response delete(String id, jakarta.ws.rs.core.UriInfo uri, jakarta.ws.rs.core.HttpHeaders headers)
      Description copied from interface: BasicResourceService
      standard delete
      Specified by:
      delete in interface BasicResourceService<D extends ResourceDao<R>>
      Parameters:
      id - not null
      uri - not null
      headers - not null
      Returns:
      Response defined in https://www.hl7.org/fhir/http.html#delete
    • preDelete

      protected Consumer<String> preDelete(String id)
      Override to perform actions pre delete, throw WebApplicationException to interrupt the normal flow.
      Parameters:
      id - of the resource to be deleted
      Returns:
      if not null, the returned Consumer will be called after the create operation and before returning to the client, the Consumer can throw a WebApplicationException to interrupt the normal flow, the Consumer will be called with the id (IdType.getIdPart()) of the deleted resource
      Throws:
      jakarta.ws.rs.WebApplicationException - if the normal flow should be interrupted
    • delete

      public jakarta.ws.rs.core.Response delete(jakarta.ws.rs.core.UriInfo uri, jakarta.ws.rs.core.HttpHeaders headers)
      Description copied from interface: BasicResourceService
      conditional delete
      Specified by:
      delete in interface BasicResourceService<D extends ResourceDao<R>>
      Parameters:
      uri - not null
      headers - not null
      Returns:
      Response defined in https://www.hl7.org/fhir/http.html#delete
    • search

      public jakarta.ws.rs.core.Response search(jakarta.ws.rs.core.UriInfo uri, jakarta.ws.rs.core.HttpHeaders headers)
      Description copied from interface: BasicResourceService
      search by request parameter
      Specified by:
      search in interface BasicResourceService<D extends ResourceDao<R>>
      Parameters:
      uri - not null
      headers - not null
      Returns:
      Response defined in https://www.hl7.org/fhir/http.html#search
    • postValidateNew

      public jakarta.ws.rs.core.Response postValidateNew(String validate, org.hl7.fhir.r4.model.Parameters parameters, jakarta.ws.rs.core.UriInfo uri, jakarta.ws.rs.core.HttpHeaders headers)
      Specified by:
      postValidateNew in interface BasicResourceService<D extends ResourceDao<R>>
    • getValidateNew

      public jakarta.ws.rs.core.Response getValidateNew(String validate, jakarta.ws.rs.core.UriInfo uri, jakarta.ws.rs.core.HttpHeaders headers)
      Specified by:
      getValidateNew in interface BasicResourceService<D extends ResourceDao<R>>
    • postValidateExisting

      public jakarta.ws.rs.core.Response postValidateExisting(String validate, String id, org.hl7.fhir.r4.model.Parameters parameters, jakarta.ws.rs.core.UriInfo uri, jakarta.ws.rs.core.HttpHeaders headers)
      Specified by:
      postValidateExisting in interface BasicResourceService<D extends ResourceDao<R>>
    • getValidateExisting

      public jakarta.ws.rs.core.Response getValidateExisting(String validate, String id, jakarta.ws.rs.core.UriInfo uri, jakarta.ws.rs.core.HttpHeaders headers)
      Specified by:
      getValidateExisting in interface BasicResourceService<D extends ResourceDao<R>>
    • deletePermanently

      public jakarta.ws.rs.core.Response deletePermanently(String deletePath, String id, jakarta.ws.rs.core.UriInfo uri, jakarta.ws.rs.core.HttpHeaders headers)
      Specified by:
      deletePermanently in interface BasicResourceService<D extends ResourceDao<R>>