diff --git a/commons/ihe/fhir/r4/chppqm/src/main/groovy/org/openehealth/ipf/commons/ihe/fhir/chppqm/translation/XacmlToFhirTranslator.groovy b/commons/ihe/fhir/r4/chppqm/src/main/groovy/org/openehealth/ipf/commons/ihe/fhir/chppqm/translation/XacmlToFhirTranslator.groovy index e6745a2503..e848ab9375 100644 --- a/commons/ihe/fhir/r4/chppqm/src/main/groovy/org/openehealth/ipf/commons/ihe/fhir/chppqm/translation/XacmlToFhirTranslator.groovy +++ b/commons/ihe/fhir/r4/chppqm/src/main/groovy/org/openehealth/ipf/commons/ihe/fhir/chppqm/translation/XacmlToFhirTranslator.groovy @@ -72,7 +72,7 @@ class XacmlToFhirTranslator { } GPathResult subjectMatches = xacml.Target.Subjects.Subject.SubjectMatch - for (subjectMatch in (subjectMatches)) { + for (subjectMatch in subjectMatches) { def cv = subjectMatch.AttributeValue.CodedValue if ((cv.@codeSystem.text() == PpqConstants.CodingSystemIds.SWISS_PURPOSE_OF_USE) && (cv.@code.text() == 'EMER')) { diff --git a/commons/ihe/xacml20/impl/src/main/groovy/org/openehealth/ipf/commons/ihe/xacml20/ChPpqMessageCreator.groovy b/commons/ihe/xacml20/impl/src/main/groovy/org/openehealth/ipf/commons/ihe/xacml20/ChPpqMessageCreator.groovy index 6657f63a24..4b783afd4b 100644 --- a/commons/ihe/xacml20/impl/src/main/groovy/org/openehealth/ipf/commons/ihe/xacml20/ChPpqMessageCreator.groovy +++ b/commons/ihe/xacml20/impl/src/main/groovy/org/openehealth/ipf/commons/ihe/xacml20/ChPpqMessageCreator.groovy @@ -17,14 +17,10 @@ package org.openehealth.ipf.commons.ihe.xacml20 import org.apache.commons.lang3.Validate -import org.herasaf.xacml.core.context.impl.ActionType -import org.herasaf.xacml.core.context.impl.AttributeType -import org.herasaf.xacml.core.context.impl.AttributeValueType -import org.herasaf.xacml.core.context.impl.EnvironmentType -import org.herasaf.xacml.core.context.impl.RequestType -import org.herasaf.xacml.core.context.impl.ResourceType -import org.herasaf.xacml.core.context.impl.SubjectType +import org.herasaf.xacml.core.context.impl.* +import org.herasaf.xacml.core.context.impl.ObjectFactory as XacmlContextObjectFactory import org.herasaf.xacml.core.policy.impl.IdReferenceType +import org.herasaf.xacml.core.policy.impl.ObjectFactory as XacmlPolicyObjectFactory import org.herasaf.xacml.core.policy.impl.PolicySetType import org.openehealth.ipf.commons.ihe.xacml20.herasaf.types.IiDataTypeAttribute import org.openehealth.ipf.commons.ihe.xacml20.model.PpqConstants @@ -33,6 +29,7 @@ import org.openehealth.ipf.commons.ihe.xacml20.stub.ehealthswiss.DeletePolicyReq import org.openehealth.ipf.commons.ihe.xacml20.stub.ehealthswiss.UpdatePolicyRequest import org.openehealth.ipf.commons.ihe.xacml20.stub.ehealthswiss.XACMLPolicySetIdReferenceStatementType import org.openehealth.ipf.commons.ihe.xacml20.stub.hl7v3.II +import org.openehealth.ipf.commons.ihe.xacml20.stub.hl7v3.ObjectFactory as Hl7v3ObjectFactory import org.openehealth.ipf.commons.ihe.xacml20.stub.saml20.assertion.AssertionType import org.openehealth.ipf.commons.ihe.xacml20.stub.saml20.assertion.NameIDType import org.openehealth.ipf.commons.ihe.xacml20.stub.saml20.protocol.ResponseType @@ -45,10 +42,10 @@ import javax.xml.datatype.DatatypeFactory class ChPpqMessageCreator { - private static final HL7V3_OBJECT_FACTORY = new org.openehealth.ipf.commons.ihe.xacml20.stub.hl7v3.ObjectFactory() - private static final XACML_CONTEXT_OBJECT_FACTORY = new org.herasaf.xacml.core.context.impl.ObjectFactory() - private static final XACML_POLICY_OBJECT_FACTORY = new org.herasaf.xacml.core.policy.impl.ObjectFactory() - private static final XML_OBJECT_FACTORY = DatatypeFactory.newInstance() + private static final Hl7v3ObjectFactory HL7V3_OBJECT_FACTORY = new Hl7v3ObjectFactory() + private static final XacmlContextObjectFactory XACML_CONTEXT_OBJECT_FACTORY = new XacmlContextObjectFactory() + private static final XacmlPolicyObjectFactory XACML_POLICY_OBJECT_FACTORY = new XacmlPolicyObjectFactory() + private static final DatatypeFactory XML_OBJECT_FACTORY = DatatypeFactory.newInstance() private final String homeCommunityId @@ -56,15 +53,19 @@ class ChPpqMessageCreator { this.homeCommunityId = Validate.notEmpty(homeCommunityId as String, 'Home community ID shall be provided') } - private AssertionType createAssertion() { + NameIDType createIssuer() { + return new NameIDType( + nameQualifier: PpqConstants.NAME_QUALIFIER_EHEALTH_SUISSSE_COMMUNITY_INDEX, + value: homeCommunityId, + ) + } + + AssertionType createAssertion() { return new AssertionType( ID: '_' + UUID.randomUUID(), issueInstant: XML_OBJECT_FACTORY.newXMLGregorianCalendar(new GregorianCalendar()), version: '2.0', - issuer: new NameIDType( - nameQualifier: PpqConstants.NAME_QUALIFIER_EHEALTH_SUISSSE_COMMUNITY_INDEX, - value: homeCommunityId, - ), + issuer: createIssuer(), ) } diff --git a/platform-camel/ihe/xacml20/src/test/java/org/openehealth/ipf/platform/camel/ihe/xacml20/chppq2/ChPpq2TestRouteBuilder.java b/platform-camel/ihe/xacml20/src/test/java/org/openehealth/ipf/platform/camel/ihe/xacml20/chppq2/ChPpq2TestRouteBuilder.java index 8bd0d64167..0134fde95e 100644 --- a/platform-camel/ihe/xacml20/src/test/java/org/openehealth/ipf/platform/camel/ihe/xacml20/chppq2/ChPpq2TestRouteBuilder.java +++ b/platform-camel/ihe/xacml20/src/test/java/org/openehealth/ipf/platform/camel/ihe/xacml20/chppq2/ChPpq2TestRouteBuilder.java @@ -48,13 +48,13 @@ public void configure() throws Exception { var writer = new StringWriter(); marshaller.marshal(exchange.getMessage().getBody(), writer); log.debug("PPQ output message:\n{}", writer.toString()); - exchange.setProperty(HomeCommunityUtils.HOME_COMMUNITY_ID_NAME, "urn:oid:1.2.3"); }) .process(chPpq2ResponseValidator()); // sends a correct response with status "failure" - from("ch-ppq2:ch-ppq-failure?homeCommunityId=urn:oid:1.2.4") + from("ch-ppq2:ch-ppq-failure?homeCommunityId=urn:oid:1.2.777") .process(chPpq2RequestValidator()) + .setProperty(HomeCommunityUtils.HOME_COMMUNITY_ID_NAME, constant("urn:oid:1.2.4")) .throwException(new RuntimeException("Alles schlimm...")); }