This repository has been archived by the owner on Apr 8, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 20
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 #556 from ehrbase/configure_ITI41
Configure iti41
- Loading branch information
Showing
11 changed files
with
402 additions
and
53 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
34 changes: 34 additions & 0 deletions
34
src/main/java/org/ehrbase/fhirbridge/fhir/bundle/validator/Iti65BundleValidator.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,34 @@ | ||
package org.ehrbase.fhirbridge.fhir.bundle.validator; | ||
|
||
import ca.uhn.fhir.rest.server.exceptions.UnprocessableEntityException; | ||
import org.hl7.fhir.r4.model.Bundle; | ||
import org.hl7.fhir.r4.model.ResourceType; | ||
import org.openehealth.ipf.commons.ihe.fhir.FhirTransactionValidator; | ||
|
||
import java.util.Map; | ||
|
||
public class Iti65BundleValidator implements FhirTransactionValidator { | ||
|
||
@Override | ||
public void validateRequest(Object payload, Map<String, Object> parameters) { | ||
Bundle bundle = (Bundle) payload; | ||
validateDocumentReference(bundle); | ||
} | ||
|
||
private void validateDocumentReference(Bundle bundle) { | ||
int count = 0; | ||
for(Bundle.BundleEntryComponent entry :bundle.getEntry()){ | ||
if(entry.getResource().getResourceType().equals(ResourceType.DocumentReference)){ | ||
count ++; | ||
} | ||
} | ||
if(count>1){ | ||
throw new UnprocessableEntityException("Only one DocumentReference per MHD Bundle is supported!"); | ||
} | ||
} | ||
|
||
@Override | ||
public void validateResponse(Object o, Map<String, Object> map) { | ||
throw new UnsupportedOperationException("Response validation is not supported"); | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
src/main/java/org/ehrbase/fhirbridge/ihe/xds/ITI41Processor.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,17 @@ | ||
package org.ehrbase.fhirbridge.ihe.xds; | ||
|
||
import org.apache.camel.Exchange; | ||
import org.apache.camel.Processor; | ||
import org.ehrbase.client.classgenerator.interfaces.CompositionEntity; | ||
|
||
public class ITI41Processor implements Processor { | ||
|
||
public static final String BEAN_ID = "iti41Processor"; | ||
|
||
@Override | ||
public void process(Exchange exchange) throws Exception { | ||
ITITrace iti41Trace = (ITITrace) exchange.getIn().getHeader("iti65-trace"); | ||
iti41Trace.setCompositionEntity((CompositionEntity) exchange.getIn().getBody()); | ||
exchange.getIn().setBody(iti41Trace); | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
src/main/java/org/ehrbase/fhirbridge/ihe/xds/ITITrace.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,34 @@ | ||
package org.ehrbase.fhirbridge.ihe.xds; | ||
|
||
import org.ehrbase.client.classgenerator.interfaces.CompositionEntity; | ||
import org.hl7.fhir.r4.model.DocumentManifest; | ||
import org.hl7.fhir.r4.model.DocumentReference; | ||
|
||
public class ITITrace { | ||
private final DocumentManifest documentManifest; | ||
private final DocumentReference documentReference; | ||
private CompositionEntity compositionEntity; | ||
|
||
public ITITrace(DocumentManifest documentManifest, DocumentReference documentReference) { | ||
this.documentManifest = documentManifest; | ||
this.documentReference = documentReference; | ||
} | ||
|
||
public CompositionEntity getCompositionEntity() { | ||
return compositionEntity; | ||
} | ||
|
||
public void setCompositionEntity(CompositionEntity compositionEntity) { | ||
this.compositionEntity = compositionEntity; | ||
} | ||
|
||
public DocumentManifest getDocumentManifest() { | ||
return documentManifest; | ||
} | ||
|
||
public DocumentReference getDocumentReference() { | ||
return documentReference; | ||
} | ||
} | ||
|
||
|
15 changes: 15 additions & 0 deletions
15
src/main/java/org/ehrbase/fhirbridge/ihe/xds/XDSValidator.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,15 @@ | ||
package org.ehrbase.fhirbridge.ihe.xds; | ||
|
||
import ca.uhn.fhir.rest.server.exceptions.UnprocessableEntityException; | ||
import org.apache.camel.Exchange; | ||
import org.apache.camel.Processor; | ||
|
||
public class XDSValidator implements Processor { | ||
|
||
@Override | ||
public void process(Exchange exchange) throws Exception { | ||
if(exchange.getIn().getHeader("iti65-trace")==null){ | ||
throw new UnprocessableEntityException("ITI 41 is only supported, if the rsource instance was sent via ITI65."); | ||
} | ||
} | ||
} |
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
Oops, something went wrong.