-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #227 from DBCG/develop
0.3.0 Release
- Loading branch information
Showing
128 changed files
with
4,115 additions
and
3,138 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,5 +5,4 @@ | |
.project | ||
examples | ||
target | ||
derby.log | ||
!target/jpaserver_derby_files | ||
derby.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
common/src/main/java/org/opencds/cqf/common/helpers/ClientHelper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package org.opencds.cqf.common.helpers; | ||
|
||
import ca.uhn.fhir.context.FhirContext; | ||
import ca.uhn.fhir.rest.client.api.IGenericClient; | ||
import ca.uhn.fhir.rest.client.api.ServerValidationModeEnum; | ||
import ca.uhn.fhir.rest.client.interceptor.BasicAuthInterceptor; | ||
|
||
public class ClientHelper { | ||
|
||
/* | ||
* TODO - depending on future needs: 1. add OAuth 2. change if to switch to | ||
* accommodate additional FHIR versions | ||
*/ | ||
private static IGenericClient getRestClient(FhirContext fhirContext, String url) { | ||
fhirContext.getRestfulClientFactory().setServerValidationMode(ServerValidationModeEnum.NEVER); | ||
return fhirContext.newRestfulGenericClient(url); | ||
} | ||
|
||
// Overload in case you need to specify a specific version of the context | ||
public static IGenericClient getClient(FhirContext fhirContext, String url, String user, String password) { | ||
IGenericClient client = getRestClient(fhirContext, url); | ||
registerAuth(client, user, password); | ||
|
||
return client; | ||
} | ||
|
||
private static void registerAuth(IGenericClient client, String userId, String password) { | ||
if (userId != null) { | ||
BasicAuthInterceptor authInterceptor = new BasicAuthInterceptor(userId, password); | ||
client.registerInterceptor(authInterceptor); | ||
} | ||
} | ||
} |
Oops, something went wrong.