Search in sources :

Example 1 with PatientIdBasedStoredQuery

use of org.openehealth.ipf.commons.ihe.xds.core.requests.query.PatientIdBasedStoredQuery in project ipf by oehf.

the class Iti18AuditStrategyTest method testRequest.

private void testRequest(boolean serverSide, StoredQuery query) {
    if (query instanceof PatientIdBasedStoredQuery) {
        ((PatientIdBasedStoredQuery) query).setPatientId(Hl7v2Based.parse(AuditorTestBase.PATIENT_IDS[0], Identifiable.class));
    }
    var strategy = new Iti18AuditStrategy(serverSide);
    var auditDataset = getXdsAuditDataset(strategy);
    EbXMLAdhocQueryRequest ebXmlQueryRequest = new QueryRegistryTransformer().toEbXML(new QueryRegistry(query));
    strategy.enrichAuditDatasetFromRequest(auditDataset, ebXmlQueryRequest.getInternal(), null);
    var auditMessages = makeAuditMessages(strategy, auditContext, auditDataset);
    assertEquals(1, auditMessages.length);
    for (var auditMessage : auditMessages) {
        auditMessage.validate();
    }
    assertEquals(ebXmlQueryRequest.getId(), auditMessages[0].findParticipantObjectIdentifications(p -> p.getParticipantObjectTypeCode().equals(ParticipantObjectTypeCode.System)).get(0).getParticipantObjectID());
    assertCommonXdsAuditAttributes(auditMessages[0], EventOutcomeIndicator.Success, EventIdCode.Query, EventActionCode.Execute, serverSide, true);
}
Also used : ParticipantObjectTypeCode(org.openehealth.ipf.commons.audit.codes.ParticipantObjectTypeCode) GetAllQuery(org.openehealth.ipf.commons.ihe.xds.core.requests.query.GetAllQuery) EventOutcomeIndicator(org.openehealth.ipf.commons.audit.codes.EventOutcomeIndicator) AuditorTestBase(org.openehealth.ipf.commons.ihe.core.atna.AuditorTestBase) Identifiable(org.openehealth.ipf.commons.ihe.xds.core.metadata.Identifiable) EbXMLAdhocQueryRequest(org.openehealth.ipf.commons.ihe.xds.core.ebxml.EbXMLAdhocQueryRequest) QueryRegistry(org.openehealth.ipf.commons.ihe.xds.core.requests.QueryRegistry) XdsQueryAuditDataset(org.openehealth.ipf.commons.ihe.xds.core.audit.XdsQueryAuditDataset) FindDocumentsByReferenceIdQuery(org.openehealth.ipf.commons.ihe.xds.core.requests.query.FindDocumentsByReferenceIdQuery) XdsAuditorTestBase(org.openehealth.ipf.commons.ihe.xds.atna.XdsAuditorTestBase) Test(org.junit.jupiter.api.Test) StoredQuery(org.openehealth.ipf.commons.ihe.xds.core.requests.query.StoredQuery) EventIdCode(org.openehealth.ipf.commons.audit.codes.EventIdCode) QueryRegistryTransformer(org.openehealth.ipf.commons.ihe.xds.core.transform.requests.QueryRegistryTransformer) EventActionCode(org.openehealth.ipf.commons.audit.codes.EventActionCode) Hl7v2Based(org.openehealth.ipf.commons.ihe.xds.core.metadata.Hl7v2Based) PatientIdBasedStoredQuery(org.openehealth.ipf.commons.ihe.xds.core.requests.query.PatientIdBasedStoredQuery) Assertions.assertEquals(org.junit.jupiter.api.Assertions.assertEquals) HumanUser(org.openehealth.ipf.commons.ihe.core.atna.AuditDataset.HumanUser) EbXMLAdhocQueryRequest(org.openehealth.ipf.commons.ihe.xds.core.ebxml.EbXMLAdhocQueryRequest) QueryRegistryTransformer(org.openehealth.ipf.commons.ihe.xds.core.transform.requests.QueryRegistryTransformer) QueryRegistry(org.openehealth.ipf.commons.ihe.xds.core.requests.QueryRegistry) PatientIdBasedStoredQuery(org.openehealth.ipf.commons.ihe.xds.core.requests.query.PatientIdBasedStoredQuery) Identifiable(org.openehealth.ipf.commons.ihe.xds.core.metadata.Identifiable)

Aggregations

Assertions.assertEquals (org.junit.jupiter.api.Assertions.assertEquals)1 Test (org.junit.jupiter.api.Test)1 EventActionCode (org.openehealth.ipf.commons.audit.codes.EventActionCode)1 EventIdCode (org.openehealth.ipf.commons.audit.codes.EventIdCode)1 EventOutcomeIndicator (org.openehealth.ipf.commons.audit.codes.EventOutcomeIndicator)1 ParticipantObjectTypeCode (org.openehealth.ipf.commons.audit.codes.ParticipantObjectTypeCode)1 HumanUser (org.openehealth.ipf.commons.ihe.core.atna.AuditDataset.HumanUser)1 AuditorTestBase (org.openehealth.ipf.commons.ihe.core.atna.AuditorTestBase)1 XdsAuditorTestBase (org.openehealth.ipf.commons.ihe.xds.atna.XdsAuditorTestBase)1 XdsQueryAuditDataset (org.openehealth.ipf.commons.ihe.xds.core.audit.XdsQueryAuditDataset)1 EbXMLAdhocQueryRequest (org.openehealth.ipf.commons.ihe.xds.core.ebxml.EbXMLAdhocQueryRequest)1 Hl7v2Based (org.openehealth.ipf.commons.ihe.xds.core.metadata.Hl7v2Based)1 Identifiable (org.openehealth.ipf.commons.ihe.xds.core.metadata.Identifiable)1 QueryRegistry (org.openehealth.ipf.commons.ihe.xds.core.requests.QueryRegistry)1 FindDocumentsByReferenceIdQuery (org.openehealth.ipf.commons.ihe.xds.core.requests.query.FindDocumentsByReferenceIdQuery)1 GetAllQuery (org.openehealth.ipf.commons.ihe.xds.core.requests.query.GetAllQuery)1 PatientIdBasedStoredQuery (org.openehealth.ipf.commons.ihe.xds.core.requests.query.PatientIdBasedStoredQuery)1 StoredQuery (org.openehealth.ipf.commons.ihe.xds.core.requests.query.StoredQuery)1 QueryRegistryTransformer (org.openehealth.ipf.commons.ihe.xds.core.transform.requests.QueryRegistryTransformer)1