-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add settings for CDS Hooks and use latest hapi-fhir-cr configs
- Loading branch information
Showing
15 changed files
with
474 additions
and
538 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
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
14 changes: 14 additions & 0 deletions
14
src/main/java/ca/uhn/fhir/jpa/starter/cdshooks/CdsHooksConfigCondition.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,14 @@ | ||
package ca.uhn.fhir.jpa.starter.cdshooks; | ||
|
||
import org.springframework.context.annotation.Condition; | ||
import org.springframework.context.annotation.ConditionContext; | ||
import org.springframework.core.type.AnnotatedTypeMetadata; | ||
|
||
public class CdsHooksConfigCondition implements Condition { | ||
|
||
@Override | ||
public boolean matches(ConditionContext theConditionContext, AnnotatedTypeMetadata theAnnotatedTypeMetadata) { | ||
String property = theConditionContext.getEnvironment().getProperty("hapi.fhir.cdshooks.enabled"); | ||
return Boolean.parseBoolean(property); | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
src/main/java/ca/uhn/fhir/jpa/starter/cdshooks/CdsHooksProperties.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,27 @@ | ||
package ca.uhn.fhir.jpa.starter.cdshooks; | ||
|
||
import org.springframework.boot.context.properties.ConfigurationProperties; | ||
|
||
@ConfigurationProperties(prefix = "hapi.fhir.cdshooks") | ||
public class CdsHooksProperties { | ||
|
||
private boolean enabled; | ||
|
||
public boolean isEnabled() { | ||
return enabled; | ||
} | ||
|
||
public void setEnabled(boolean enabled) { | ||
this.enabled = enabled; | ||
} | ||
|
||
private String clientIdHeaderName; | ||
|
||
public String getClientIdHeaderName() { | ||
return clientIdHeaderName; | ||
} | ||
|
||
public void setClientIdHeaderName(String clientIdHeaderName) { | ||
this.clientIdHeaderName = clientIdHeaderName; | ||
} | ||
} |
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
29 changes: 29 additions & 0 deletions
29
src/main/java/ca/uhn/fhir/jpa/starter/cdshooks/ProviderConfiguration.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,29 @@ | ||
package ca.uhn.fhir.jpa.starter.cdshooks; | ||
|
||
import ca.uhn.fhir.jpa.starter.cr.CrProperties; | ||
|
||
public class ProviderConfiguration { | ||
|
||
public static final ProviderConfiguration DEFAULT_PROVIDER_CONFIGURATION = new ProviderConfiguration(false, "client_id"); | ||
|
||
private final String clientIdHeaderName; | ||
private final boolean cqlLoggingEnabled; | ||
|
||
public ProviderConfiguration(boolean cqlLoggingEnabled, String clientIdHeaderName) { | ||
this.cqlLoggingEnabled = cqlLoggingEnabled; | ||
this.clientIdHeaderName = clientIdHeaderName; | ||
} | ||
|
||
public ProviderConfiguration(CdsHooksProperties cdsProperties, CrProperties crProperties) { | ||
this.clientIdHeaderName = cdsProperties.getClientIdHeaderName(); | ||
this.cqlLoggingEnabled = crProperties.isCqlRuntimeDebugLoggingEnabled(); | ||
} | ||
|
||
public String getClientIdHeaderName() { | ||
return this.clientIdHeaderName; | ||
} | ||
|
||
public boolean getCqlLoggingEnabled() { | ||
return this.cqlLoggingEnabled; | ||
} | ||
} |
Oops, something went wrong.