Package dev.dsf.fhir.webservice.impl
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 Summary
FieldsModifier and TypeFieldDescriptionprotected final AuthorizationRuleProviderprotected final Dprotected final intprotected final EventGeneratorprotected final EventHandlerprotected final ExceptionHandlerprotected final HistoryServiceprotected final ParameterConverterprotected final ReferenceCleanerprotected final ReferenceExtractorprotected final ReferenceResolverprotected final Stringprotected final ResponseGeneratorprotected final Stringprotected final ResourceValidatorFields inherited from class dev.dsf.fhir.webservice.base.AbstractBasicService
currentIdentityProvider -
Constructor Summary
ConstructorsConstructorDescriptionAbstractResourceServiceImpl(String path, Class<R> resourceType, String serverBase, int defaultPageCount, D dao, ResourceValidator validator, EventHandler eventHandler, ExceptionHandler exceptionHandler, EventGenerator eventGenerator, ResponseGenerator responseGenerator, ParameterConverter parameterConverter, ReferenceExtractor referenceExtractor, ReferenceResolver referenceResolver, ReferenceCleaner referenceCleaner, AuthorizationRuleProvider authorizationRuleProvider, HistoryService historyService) -
Method Summary
Modifier and TypeMethodDescriptionvoidprotected booleancheckReferenceAfterCreate(R created, ResourceReference ref) Override this method to exclude references from being checked after a create, add similar rule toCheckReferencesCommandprotected booleancheckReferenceAfterUpdate(R updated, ResourceReference ref) Override this method to exclude references from being checked after an update, add similar rule toCheckReferencesCommandjakarta.ws.rs.core.Responsestandard and conditional createjakarta.ws.rs.core.Responsedelete(jakarta.ws.rs.core.UriInfo uri, jakarta.ws.rs.core.HttpHeaders headers) conditional deletejakarta.ws.rs.core.Responsestandard deletejakarta.ws.rs.core.ResponsedeletePermanently(String deletePath, String id, jakarta.ws.rs.core.UriInfo uri, jakarta.ws.rs.core.HttpHeaders headers) protected jakarta.ws.rs.core.MediaTypegetMediaTypeForRead(jakarta.ws.rs.core.UriInfo uri, jakarta.ws.rs.core.HttpHeaders headers) protected jakarta.ws.rs.core.MediaTypegetMediaTypeForVRead(jakarta.ws.rs.core.UriInfo uri, jakarta.ws.rs.core.HttpHeaders headers) jakarta.ws.rs.core.ResponsegetValidateExisting(String validate, String id, jakarta.ws.rs.core.UriInfo uri, jakarta.ws.rs.core.HttpHeaders headers) jakarta.ws.rs.core.ResponsegetValidateNew(String validate, jakarta.ws.rs.core.UriInfo uri, jakarta.ws.rs.core.HttpHeaders headers) jakarta.ws.rs.core.Responsehistory(jakarta.ws.rs.core.UriInfo uri, jakarta.ws.rs.core.HttpHeaders headers) jakarta.ws.rs.core.Responsejakarta.ws.rs.core.ResponsepostValidateExisting(String validate, String id, org.hl7.fhir.r4.model.Parameters parameters, jakarta.ws.rs.core.UriInfo uri, jakarta.ws.rs.core.HttpHeaders headers) jakarta.ws.rs.core.ResponsepostValidateNew(String validate, org.hl7.fhir.r4.model.Parameters parameters, jakarta.ws.rs.core.UriInfo uri, jakarta.ws.rs.core.HttpHeaders headers) Override to modify the given resource before db insert, throwWebApplicationExceptionto interrupt the normal flowOverride to perform actions pre delete, throwWebApplicationExceptionto interrupt the normal flow.Override to modify the given resource before db update, throwWebApplicationExceptionto interrupt the normal flow.jakarta.ws.rs.core.Responseread by idjakarta.ws.rs.core.Responsesearch(jakarta.ws.rs.core.UriInfo uri, jakarta.ws.rs.core.HttpHeaders headers) search by request parameterjakarta.ws.rs.core.Responseupdate(String id, R resource, jakarta.ws.rs.core.UriInfo uri, jakarta.ws.rs.core.HttpHeaders headers) standard updatejakarta.ws.rs.core.Responseconditional updatejakarta.ws.rs.core.Responsevread(String id, long version, jakarta.ws.rs.core.UriInfo uri, jakarta.ws.rs.core.HttpHeaders headers) read by id and versionMethods inherited from class dev.dsf.fhir.webservice.base.AbstractBasicService
getCurrentIdentity, setCurrentIdentityProviderMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface dev.dsf.fhir.webservice.base.BasicService
setCurrentIdentityProvider
-
Field Details
-
resourceType
-
resourceTypeName
-
serverBase
-
defaultPageCount
protected final int defaultPageCount -
dao
-
validator
-
eventHandler
-
exceptionHandler
-
eventGenerator
-
responseGenerator
-
parameterConverter
-
referenceExtractor
-
referenceResolver
-
referenceCleaner
-
authorizationRuleProvider
-
historyService
-
-
Constructor Details
-
AbstractResourceServiceImpl
public AbstractResourceServiceImpl(String path, Class<R> resourceType, String serverBase, int defaultPageCount, D dao, ResourceValidator validator, EventHandler eventHandler, ExceptionHandler exceptionHandler, EventGenerator eventGenerator, ResponseGenerator responseGenerator, ParameterConverter parameterConverter, ReferenceExtractor referenceExtractor, ReferenceResolver referenceResolver, ReferenceCleaner referenceCleaner, AuthorizationRuleProvider authorizationRuleProvider, HistoryService historyService)
-
-
Method Details
-
afterPropertiesSet
- Specified by:
afterPropertiesSetin interfaceorg.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:BasicResourceServicestandard and conditional create- Specified by:
createin interfaceBasicResourceService<D extends ResourceDao<R>>- Parameters:
resource- notnulluri- notnullheaders- notnull- Returns:
Responsedefined in https://www.hl7.org/fhir/http.html#create
-
checkReferenceAfterCreate
Override this method to exclude references from being checked after a create, add similar rule toCheckReferencesCommand- Parameters:
created- notnullref- notnull- Returns:
- true if a reference should be checked
- See Also:
-
preCreate
Override to modify the given resource before db insert, throwWebApplicationExceptionto interrupt the normal flow- Parameters:
resource- notnull- Returns:
- if not null, the returned
Consumerwill be called after the create operation and before returning to the client, theConsumercan throw aWebApplicationExceptionto interrupt the normal flow, theConsumerwill 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:BasicResourceServiceread by id- Specified by:
readin interfaceBasicResourceService<D extends ResourceDao<R>>- Parameters:
id- notnulluri- notnullheaders- notnull- Returns:
Responsedefined 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:BasicResourceServiceread by id and version- Specified by:
vreadin interfaceBasicResourceService<D extends ResourceDao<R>>- Parameters:
id- notnullversion->0uri- notnullheaders- notnull- Returns:
Responsedefined 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:
historyin interfaceBasicResourceService<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:
historyin interfaceBasicResourceService<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:BasicResourceServicestandard update- Specified by:
updatein interfaceBasicResourceService<D extends ResourceDao<R>>- Parameters:
id- notnullresource- notnulluri- notnullheaders- notnull- Returns:
Responsedefined in https://www.hl7.org/fhir/http.html#update
-
checkReferenceAfterUpdate
Override this method to exclude references from being checked after an update, add similar rule toCheckReferencesCommand- Parameters:
updated- notnullref- notnull- Returns:
- true if a reference should be checked
- See Also:
-
preUpdate
Override to modify the given resource before db update, throwWebApplicationExceptionto interrupt the normal flow. Path id vs. resource.id.idPart is checked before this method is called- Parameters:
resource- notnull- Returns:
- if not null, the returned
Consumerwill be called after the update operation and before returning to the client, theConsumercan throw aWebApplicationExceptionto interrupt the normal flow, theConsumerwill 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:BasicResourceServiceconditional update- Specified by:
updatein interfaceBasicResourceService<D extends ResourceDao<R>>- Parameters:
resource- notnulluri- notnullheaders- notnull- Returns:
Responsedefined 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:BasicResourceServicestandard delete- Specified by:
deletein interfaceBasicResourceService<D extends ResourceDao<R>>- Parameters:
id- notnulluri- notnullheaders- notnull- Returns:
Responsedefined in https://www.hl7.org/fhir/http.html#delete
-
preDelete
Override to perform actions pre delete, throwWebApplicationExceptionto interrupt the normal flow.- Parameters:
id- of the resource to be deleted- Returns:
- if not null, the returned
Consumerwill be called after the create operation and before returning to the client, theConsumercan throw aWebApplicationExceptionto interrupt the normal flow, theConsumerwill 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:BasicResourceServiceconditional delete- Specified by:
deletein interfaceBasicResourceService<D extends ResourceDao<R>>- Parameters:
uri- notnullheaders- notnull- Returns:
Responsedefined 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:BasicResourceServicesearch by request parameter- Specified by:
searchin interfaceBasicResourceService<D extends ResourceDao<R>>- Parameters:
uri- notnullheaders- notnull- Returns:
Responsedefined 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:
postValidateNewin interfaceBasicResourceService<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:
getValidateNewin interfaceBasicResourceService<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:
postValidateExistingin interfaceBasicResourceService<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:
getValidateExistingin interfaceBasicResourceService<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:
deletePermanentlyin interfaceBasicResourceService<D extends ResourceDao<R>>
-