-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#449: trace context ID in FHIR based transactions
- Loading branch information
Showing
17 changed files
with
181 additions
and
10 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
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
25 changes: 25 additions & 0 deletions
25
commons/audit/src/main/java/org/openehealth/ipf/commons/audit/FhirAuditDatasetEnricher.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,25 @@ | ||
/* | ||
* Copyright 2024 the original author or authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.openehealth.ipf.commons.audit; | ||
|
||
/** | ||
* Marker interface for FHIR audit dataset enrichers. | ||
*/ | ||
public interface FhirAuditDatasetEnricher { | ||
|
||
FhirAuditDatasetEnricher NONE = new FhirAuditDatasetEnricher() {}; | ||
|
||
} |
32 changes: 32 additions & 0 deletions
32
...re/src/main/java/org/openehealth/ipf/commons/ihe/fhir/audit/FhirAuditDatasetEnricher.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,32 @@ | ||
/* | ||
* Copyright 2024 the original author or authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.openehealth.ipf.commons.ihe.fhir.audit; | ||
|
||
import org.openehealth.ipf.commons.ihe.core.atna.AuditDataset; | ||
|
||
import java.util.Map; | ||
|
||
/** | ||
* Interface for FHIR ATNA audit dataset enrichers. | ||
* Each implementing class shall have a default constructor and be thread-safe. | ||
* | ||
* @author Dmytro Rud | ||
*/ | ||
public interface FhirAuditDatasetEnricher extends org.openehealth.ipf.commons.audit.FhirAuditDatasetEnricher { | ||
|
||
void enrichAuditDataset(AuditDataset auditDataset, Object request, Map<String, Object> parameters); | ||
|
||
} |
54 changes: 54 additions & 0 deletions
54
...ain/java/org/openehealth/ipf/commons/ihe/fhir/audit/SwissEprFhirAuditDatasetEnricher.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,54 @@ | ||
/* | ||
* Copyright 2024 the original author or authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.openehealth.ipf.commons.ihe.fhir.audit; | ||
|
||
import org.openehealth.ipf.commons.ihe.core.atna.AuditDataset; | ||
|
||
import java.util.List; | ||
import java.util.Map; | ||
|
||
import static org.openehealth.ipf.commons.ihe.fhir.Constants.HTTP_INCOMING_HEADERS; | ||
import static org.openehealth.ipf.commons.ihe.fhir.Constants.HTTP_OUTGOING_HEADERS; | ||
|
||
/** | ||
* Audit dataset enricher for FHIR based transactions which implements requirements | ||
* of the Swiss Electronic Patient Record. | ||
* | ||
* @author Dmytro Rud | ||
*/ | ||
public class SwissEprFhirAuditDatasetEnricher implements FhirAuditDatasetEnricher { | ||
|
||
@Override | ||
public void enrichAuditDataset(AuditDataset auditDataset, Object request, Map<String, Object> parameters) { | ||
// the outbound value, whenever present, shall override the incoming one | ||
extractW3cTraceContextId(parameters, HTTP_INCOMING_HEADERS, auditDataset); | ||
extractW3cTraceContextId(parameters, HTTP_OUTGOING_HEADERS, auditDataset); | ||
} | ||
|
||
private static void extractW3cTraceContextId(Map<String, Object> parameters, String key, AuditDataset auditDataset) { | ||
Object value = parameters.get(key); | ||
if (value != null) { | ||
Map<String, List<String>> headers = (Map<String, List<String>>) value; | ||
for (String name : headers.keySet()) { | ||
if ("traceparent".equalsIgnoreCase(name)) { | ||
auditDataset.setW3cTraceContextId(headers.get(name).get(0)); | ||
return; | ||
} | ||
} | ||
} | ||
} | ||
|
||
} |
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
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