Skip to content

Commit

Permalink
CH PIXm ITI-83 constraints for sourceIdentifier and targetSystem #170
Browse files Browse the repository at this point in the history
  • Loading branch information
oliveregger authored and qligier committed Nov 26, 2024
1 parent d81bc49 commit ce6a44a
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 5 deletions.
4 changes: 3 additions & 1 deletion docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

- Fixed an NPE in the assertion route
- Improved mapping between XDS XON and FHIR Organization [165](https://github.com/i4mi/MobileAccessGateway/issues/165)
- capability statment validation issues [177](https://github.com/i4mi/MobileAccessGateway/issues/177)
- capability statement validation issues [#177](https://github.com/i4mi/MobileAccessGateway/issues/177)
- Add CH PIXm ITI-83 constraints for sourceIdentifier and targetSystem [#170](https://github.com/i4mi/MobileAccessGateway/issues/170)


## 2024/05/15 v070
- support for multiple IDP's [128](https://github.com/i4mi/MobileAccessGateway/issues/128)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import org.springframework.beans.factory.annotation.Autowired;

import ca.uhn.fhir.rest.server.exceptions.ForbiddenOperationException;
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
import ch.bfh.ti.i4mi.mag.BaseRequestConverter;
import ch.bfh.ti.i4mi.mag.Config;
import lombok.extern.slf4j.Slf4j;
Expand Down Expand Up @@ -88,15 +89,33 @@ public String iti83ToIti45Converter(Parameters parameters) throws JAXBException
// https://fhir.ch/ig/ch-epr-fhir/iti-83.html#message-semantics-1
if (sourceIdentifier == null) {
log.error("sourceIdentifier is missing");
throw new ForbiddenOperationException("sourceIdentifier is missing", getTargetDomainNotRecognized());
throw new InvalidRequestException("sourceIdentifier is missing", getTargetDomainNotRecognized());
}
if (targetSystemList == null || (targetSystemList.size() != 2)) {

if (sourceIdentifier != null && (sourceIdentifier.getSystem() == null || sourceIdentifier.getValue() == null)) {
log.error("sourceIdentifier system or value is missing");
throw new InvalidRequestException("sourceIdentifier is missing", getTargetDomainNotRecognized());
}

// FIXME https://gazelle.ihe.net/jira/servicedesk/customer/portal/8/EHS-820
if (targetSystemList == null || (targetSystemList.size() == 0)) {
// if (targetSystemList == null || (targetSystemList.size() != 2)) {
log.error("targetSystem need to be 2..2");
throw new ForbiddenOperationException("targetSystem need to be 2..2", getTargetDomainNotRecognized());
}
// FIXME https://gazelle.ihe.net/jira/servicedesk/customer/portal/8/EHS-820
UriType uri1 = (UriType) targetSystemList.get(0).getValue();
UriType uri2 = (UriType) targetSystemList.get(1).getValue();
if (!((uri1.equals("urn:oid:"+config.OID_EPRSPID) && uri2.equals("urn:oid:"+config.getOidMpiPid()) || (uri1.equals("urn:oid:"+config.getOidMpiPid()) && uri2.equals("urn:oid:"+config.OID_EPRSPID))))) {
if (uri1.getValue().equals(config.OID_EPRSPID)) {
uri1.setValue("urn:oid:"+config.OID_EPRSPID);
}
UriType uri2 = null;
if (targetSystemList.size()>1) {
uri2 = (UriType) targetSystemList.get(1).getValue();
if (uri2.getValue().equals(config.OID_EPRSPID)) {
uri2.setValue("urn:oid:"+config.OID_EPRSPID);
}
}
if (!((uri1.equals("urn:oid:"+config.OID_EPRSPID) && (uri2==null || uri2.equals("urn:oid:"+config.getOidMpiPid())) || (uri1.equals("urn:oid:"+config.getOidMpiPid()) && (uri2==null || uri2.equals("urn:oid:"+config.OID_EPRSPID)))))) {
log.error("targetSystem is not restricted to the Assigning authority of the community and the EPR-SPID");
throw new ForbiddenOperationException("targetSystem is not restricted to the Assigning authority of the community and the EPR-SPID,", getTargetDomainNotRecognized());
}
Expand Down

0 comments on commit ce6a44a

Please sign in to comment.