Skip to content

Commit

Permalink
Issue #200 - Expose ruler version via CapabilityStatement
Browse files Browse the repository at this point in the history
  • Loading branch information
sliver007 committed Oct 6, 2020
1 parent 53c0e51 commit e83d4f9
Show file tree
Hide file tree
Showing 6 changed files with 83 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package org.opencds.cqf.dstu3.providers;

import ca.uhn.fhir.jpa.api.config.DaoConfig;
import ca.uhn.fhir.jpa.api.dao.IFhirSystemDao;
import ca.uhn.fhir.jpa.provider.dstu3.JpaConformanceProviderDstu3;
import ca.uhn.fhir.jpa.searchparam.registry.ISearchParamRegistry;
import ca.uhn.fhir.rest.annotation.Metadata;
import ca.uhn.fhir.rest.api.server.RequestDetails;
import ca.uhn.fhir.rest.server.RestfulServer;
import org.hl7.fhir.dstu3.model.*;
import org.opencds.cqf.dstu3.servlet.BaseServlet;

import javax.servlet.http.HttpServletRequest;

public class CqfRulerJpaConformanceProviderDstu3 extends JpaConformanceProviderDstu3 {

public CqfRulerJpaConformanceProviderDstu3(RestfulServer theRestfulServer, IFhirSystemDao<Bundle, Meta> theSystemDao, DaoConfig theDaoConfig, ISearchParamRegistry theSearchParamRegistry) {
super(theRestfulServer, theSystemDao, theDaoConfig, theSearchParamRegistry);
}

@Metadata
@Override
public CapabilityStatement getServerConformance(HttpServletRequest theRequest, RequestDetails theRequestDetails) {
CapabilityStatement retVal;
retVal = super.getServerConformance(theRequest, theRequestDetails);

Extension softwareModuleExtension = new Extension().setUrl("http://hl7.org/fhir/StructureDefinition/capabilitystatement-softwareModule");
Extension softwareModuleNameExtension = new Extension().setUrl("name").setValue(new StringType("CQF Ruler FHIR DSTU3 Server"));
Extension softwareModuleVersionExtension = new Extension().setUrl("version").setValue(new StringType(BaseServlet.class.getPackage().getImplementationVersion()));
softwareModuleExtension.addExtension(softwareModuleNameExtension);
softwareModuleExtension.addExtension(softwareModuleVersionExtension);
retVal.getSoftware().addExtension(softwareModuleExtension);

return retVal;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@
import ca.uhn.fhir.rest.server.RestfulServer;
import org.hl7.fhir.dstu3.model.*;
import org.opencds.cqf.common.config.HapiProperties;
import org.opencds.cqf.dstu3.servlet.BaseServlet;

import javax.servlet.http.HttpServletRequest;

public class OAuthProvider extends JpaConformanceProviderDstu3 {
public class OAuthProvider extends CqfRulerJpaConformanceProviderDstu3 {
public OAuthProvider(RestfulServer theRestfulServer, IFhirSystemDao<Bundle, Meta> theSystemDao, DaoConfig theDaoConfig, ISearchParamRegistry theSearchParamRegistry) {
super(theRestfulServer, theSystemDao, theDaoConfig, theSearchParamRegistry);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ protected void initialize() throws ServletException {
this.setServerConformanceProvider(oauthProvider);
}else {

JpaConformanceProviderDstu3 confProvider = new JpaConformanceProviderDstu3(this, systemDao,
JpaConformanceProviderDstu3 confProvider = new CqfRulerJpaConformanceProviderDstu3(this, systemDao,
appCtx.getBean(DaoConfig.class), appCtx.getBean(ISearchParamRegistry.class));
confProvider.setImplementationDescription("CQF Ruler FHIR DSTU3 Server");
setServerConformanceProvider(confProvider);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package org.opencds.cqf.r4.providers;

import ca.uhn.fhir.jpa.api.config.DaoConfig;
import ca.uhn.fhir.jpa.api.dao.IFhirSystemDao;
import ca.uhn.fhir.jpa.provider.r4.JpaConformanceProviderR4;
import ca.uhn.fhir.jpa.searchparam.registry.ISearchParamRegistry;
import ca.uhn.fhir.rest.annotation.Metadata;
import ca.uhn.fhir.rest.api.server.RequestDetails;
import ca.uhn.fhir.rest.server.RestfulServer;
import org.hl7.fhir.r4.model.Extension;
import org.hl7.fhir.r4.model.StringType;
import org.hl7.fhir.r4.model.Bundle;
import org.hl7.fhir.r4.model.CapabilityStatement;
import org.hl7.fhir.r4.model.Meta;
import org.opencds.cqf.r4.servlet.BaseServlet;


import javax.servlet.http.HttpServletRequest;

public class CqfRulerJpaConformanceProviderR4 extends JpaConformanceProviderR4 {

public CqfRulerJpaConformanceProviderR4(RestfulServer theRestfulServer, IFhirSystemDao<Bundle, Meta> theSystemDao, DaoConfig theDaoConfig, ISearchParamRegistry theSearchParamRegistry) {
super(theRestfulServer, theSystemDao, theDaoConfig, theSearchParamRegistry);
}

@Metadata
@Override
public CapabilityStatement getServerConformance(HttpServletRequest theRequest, RequestDetails theRequestDetails) {
CapabilityStatement retVal;
retVal = super.getServerConformance(theRequest, theRequestDetails);

Extension softwareModuleExtension = new Extension().setUrl("http://hl7.org/fhir/StructureDefinition/capabilitystatement-softwareModule");
Extension softwareModuleNameExtension = new Extension().setUrl("name").setValue(new StringType("CQF Ruler FHIR R4 Server"));
Extension softwareModuleVersionExtension = new Extension().setUrl("version").setValue(new StringType(BaseServlet.class.getPackage().getImplementationVersion()));
softwareModuleExtension.addExtension(softwareModuleNameExtension);
softwareModuleExtension.addExtension(softwareModuleVersionExtension);
retVal.getSoftware().addExtension(softwareModuleExtension);

return retVal;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@
import ca.uhn.fhir.rest.annotation.Metadata;
import ca.uhn.fhir.rest.api.server.RequestDetails;
import ca.uhn.fhir.rest.server.RestfulServer;
import org.opencds.cqf.r4.servlet.BaseServlet;

public class OAuthProvider extends JpaConformanceProviderR4 {
public class OAuthProvider extends CqfRulerJpaConformanceProviderR4 {
/**
* This class is NOT designed to be a real OAuth provider.
* It is designed to provide a capability statement and to pass thru the path to the real oauth verification server.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ protected void initialize() throws ServletException {
this.registerProvider(oauthProvider);
this.setServerConformanceProvider(oauthProvider);
}else {
JpaConformanceProviderR4 confProvider = new JpaConformanceProviderR4(this, systemDao,
JpaConformanceProviderR4 confProvider = new CqfRulerJpaConformanceProviderR4(this, systemDao,
appCtx.getBean(DaoConfig.class), appCtx.getBean(ISearchParamRegistry.class));
confProvider.setImplementationDescription("CQF Ruler FHIR R4 Server");
setServerConformanceProvider(confProvider);
Expand Down

0 comments on commit e83d4f9

Please sign in to comment.