@Override public void validate() { super.validate(); if (getMessage().getActiveParticipants().isEmpty() || getMessage().getActiveParticipants().size() > 2) { throw new AuditException("Must have one or two participants that started the Application"); } if (getMessage().findParticipantObjectIdentifications(poi -> ParticipantObjectIdTypeCode.URI.equals(poi.getParticipantObjectTypeCode())).size() != 1) { throw new AuditException("Must have exactly Audit Log Identity Participating Object "); } } }
protected Element participantObjectIdentification(ParticipantObjectIdentificationType poi) { Element element = new Element("ParticipantObjectIdentification"); if (poi != null) { conditionallyAddAttribute(element, "ParticipantObjectID", poi.getParticipantObjectID()); if (poi.getParticipantObjectTypeCode() != null) { conditionallyAddAttribute(element, "ParticipantObjectTypeCode", poi.getParticipantObjectTypeCode().getValue().toString()); } conditionallyAddAttribute(element, "ParticipantObjectTypeCodeRole", poi.getParticipantObjectTypeCodeRole()); conditionallyAddAttribute(element, "ParticipantObjectDataLifeCycle", poi.getParticipantObjectDataLifeCycle()); conditionallyAddAttribute(element, "ParticipantObjectSensitivity", poi.getParticipantObjectSensitivity()); element.addContent(codedValueType("ParticipantObjectIDTypeCode", poi.getParticipantObjectIDTypeCode())); if (poi.getParticipantObjectName() != null) { element.addContent(new Element("ParticipantObjectName") .addContent(poi.getParticipantObjectName())); } if (poi.getParticipantObjectQuery() != null) { element.addContent(new Element("ParticipantObjectQuery") .addContent(new String( Base64.getEncoder().encode(poi.getParticipantObjectQuery()), StandardCharsets.UTF_8))); } poi.getParticipantObjectDetails().stream() .map(participantObjectDetail -> typeValuePairType("ParticipantObjectDetail", participantObjectDetail)) .forEach(element::addContent); poi.getParticipantObjectDescriptions().stream() .map(this::dicomObjectDescription) .forEach(element::addContent); } return element; }
private void testRequest(boolean serverSide, XdsIRetrieveAuditStrategy30 strategy) { XdsNonconstructiveDocumentSetRequestAuditDataset auditDataset = getXdsAuditDataset(strategy); AuditMessage auditMessage = makeAuditMessage(strategy, auditContext, auditDataset); assertNotNull(auditMessage); auditMessage.validate(); // System.out.println(printAuditMessage(auditMessage)); assertCommonXdsAuditAttributes(auditMessage, EventOutcomeIndicator.Success, serverSide ? EventIdCode.Export : EventIdCode.Import, serverSide ? EventActionCode.Read : EventActionCode.Create, serverSide, true); assertEquals(3, auditMessage.findParticipantObjectIdentifications( poit -> poit.getParticipantObjectTypeCodeRole() == ParticipantObjectTypeCodeRole.Report).size()); assertEquals(4, auditMessage.findParticipantObjectIdentifications( poit -> poit.getParticipantObjectTypeCode() == ParticipantObjectTypeCode.System) .get(0) .getParticipantObjectDetails().size()); }
private void testRequest(boolean serverSide) { Iti63AuditStrategy strategy = new Iti63AuditStrategy(serverSide); XdsQueryAuditDataset auditDataset = getXdsAuditDataset(strategy); AuditMessage auditMessage = makeAuditMessage(strategy, auditContext, auditDataset); assertNotNull(auditMessage); auditMessage.validate(); // System.out.println(printAuditMessage(auditMessage)); assertCommonXdsAuditAttributes(auditMessage, EventOutcomeIndicator.Success, EventIdCode.Query, EventActionCode.Execute, serverSide, true); assertEquals(2, auditMessage.findParticipantObjectIdentifications( poit -> poit.getParticipantObjectTypeCode() == ParticipantObjectTypeCode.System) .get(0) .getParticipantObjectDetails().size()); }
private void testRequest(boolean serverSide, XdsIRetrieveAuditStrategy30 strategy) { XdsNonconstructiveDocumentSetRequestAuditDataset auditDataset = getXdsAuditDataset(strategy); AuditMessage auditMessage = makeAuditMessage(strategy, auditContext, auditDataset); assertNotNull(auditMessage); auditMessage.validate(); // System.out.println(printAuditMessage(auditMessage)); assertCommonXdsAuditAttributes(auditMessage, EventOutcomeIndicator.Success, serverSide ? EventIdCode.Export : EventIdCode.Import, serverSide ? EventActionCode.Read : EventActionCode.Create, serverSide, true); assertEquals(3, auditMessage.findParticipantObjectIdentifications( poit -> poit.getParticipantObjectTypeCodeRole() == ParticipantObjectTypeCodeRole.Report).size()); assertEquals(4, auditMessage.findParticipantObjectIdentifications( poit -> poit.getParticipantObjectTypeCode() == ParticipantObjectTypeCode.System) .get(0) .getParticipantObjectDetails().size()); }
p.getParticipantObjectTypeCode() == ParticipantObjectTypeCode.System).get(0); assertEquals(Iti68TestRouteBuilder.DOCUMENT_UNIQUE_ID, poit.getParticipantObjectID()); assertEquals(2, poit.getParticipantObjectDetails().size());
@Test public void testGetResource() { PdqPatient p = client.read() .resource(PdqPatient.class) .withId("4711") .execute(); assertEquals("Test", p.getName().get(0).getFamily().get(0).getValue()); assertEquals(String.format("http://localhost:%d/Patient/4711", DEMO_APP_PORT), p.getId()); AbstractMockedAuditMessageQueue sender = getAuditSender(); assertEquals(1, sender.getMessages().size()); AuditMessage event = sender.getMessages().get(0); // Patient ParticipantObjectIdentificationType patient = event.getParticipantObjectIdentifications().get(0); assertEquals(ParticipantObjectTypeCode.Person, patient.getParticipantObjectTypeCode()); assertEquals(ParticipantObjectTypeCodeRole.Patient, patient.getParticipantObjectTypeCodeRole()); assertEquals("Patient/4711", patient.getParticipantObjectID()); }
@Test public void testGetResource() { PdqPatient p = client.read() .resource(PdqPatient.class) .withId("4711") .execute(); assertEquals("Test", p.getName().get(0).getFamily()); assertEquals(String.format("http://localhost:%d/Patient/4711", DEMO_APP_PORT), p.getId()); AbstractMockedAuditMessageQueue sender = getAuditSender(); assertEquals(1, sender.getMessages().size()); AuditMessage event = sender.getMessages().get(0); // Patient ParticipantObjectIdentificationType patient = event.getParticipantObjectIdentifications().get(0); assertEquals(ParticipantObjectTypeCode.Person, patient.getParticipantObjectTypeCode()); assertEquals(ParticipantObjectTypeCodeRole.Patient, patient.getParticipantObjectTypeCodeRole()); assertEquals("Patient/4711", patient.getParticipantObjectID()); }
protected AuditEvent.AuditEventEntityComponent participantObjectIdentificationToEntity(ParticipantObjectIdentificationType poit) { AuditEvent.AuditEventEntityComponent entity = new AuditEvent.AuditEventEntityComponent() .setIdentifier(new Identifier() .setValue(poit.getParticipantObjectID())) // poit.getParticipantObjectIDTypeCode())) not used here .setType(new Coding() .setCode(String.valueOf(poit.getParticipantObjectTypeCode().getValue())) .setSystem("http://hl7.org/fhir/audit-entity-type")) .setRole(new Coding() .setCode(String.valueOf(poit.getParticipantObjectTypeCodeRole().getValue())) .setSystem("http://hl7.org/fhir/object-role")) .setLifecycle(new Coding() .setCode(String.valueOf(poit.getParticipantObjectDataLifeCycle().getValue())) .setSystem("http://hl7.org/fhir/dicom-audit-lifecycle")) .addSecurityLabel(new Coding() .setCode(poit.getParticipantObjectSensitivity())) .setName(poit.getParticipantObjectName()) // poit.getParticipantObjectDescription) not mappable here .setQuery(poit.getParticipantObjectQuery()); poit.getParticipantObjectDetails().forEach(tvp -> entity.addDetail(new AuditEvent.AuditEventEntityDetailComponent() .setType(tvp.getType()) .setValue(tvp.getValue()))); return entity; }
protected AuditEvent.AuditEventEntityComponent participantObjectIdentificationToEntity(ParticipantObjectIdentificationType poit) { AuditEvent.AuditEventEntityComponent entity = new AuditEvent.AuditEventEntityComponent() .setWhat(new Reference().setIdentifier(new Identifier() .setValue(poit.getParticipantObjectID()))) // poit.getParticipantObjectIDTypeCode())) not used here .setType(new Coding() .setCode(String.valueOf(poit.getParticipantObjectTypeCode().getValue())) .setSystem("http://hl7.org/fhir/audit-entity-type")) .setRole(new Coding() .setCode(String.valueOf(poit.getParticipantObjectTypeCodeRole().getValue())) .setSystem("http://hl7.org/fhir/object-role")) .setLifecycle(new Coding() .setCode(String.valueOf(poit.getParticipantObjectDataLifeCycle().getValue())) .setSystem("http://hl7.org/fhir/dicom-audit-lifecycle")) .addSecurityLabel(new Coding() .setCode(poit.getParticipantObjectSensitivity())) .setName(poit.getParticipantObjectName()) // poit.getParticipantObjectDescription) not mappable here .setQuery(poit.getParticipantObjectQuery()); poit.getParticipantObjectDetails().forEach(tvp -> entity.addDetail(new AuditEvent.AuditEventEntityDetailComponent() .setType(tvp.getType()) .setValue(new Base64BinaryType(tvp.getValue())))); return entity; }
assertEquals(ParticipantObjectTypeCode.Person, patientIn.getParticipantObjectTypeCode()); assertEquals(ParticipantObjectTypeCodeRole.Patient, patientIn.getParticipantObjectTypeCodeRole()); assertEquals("urn:oid:1.2.3.4|0815", patientIn.getParticipantObjectID()); assertEquals(ParticipantObjectTypeCode.System, patient.getParticipantObjectTypeCode()); assertEquals(ParticipantObjectTypeCodeRole.Query, patient.getParticipantObjectTypeCodeRole()); assertEquals("http://localhost:8999/Patient/$ihe-pix?sourceIdentifier=urn:oid:1.2.3.4|0815&targetSystem=urn:oid:1.2.3.4.6",
assertEquals(ParticipantObjectTypeCode.Person, patientIn.getParticipantObjectTypeCode()); assertEquals(ParticipantObjectTypeCodeRole.Patient, patientIn.getParticipantObjectTypeCodeRole()); assertEquals("urn:oid:1.2.3.4|0815", new String(patientIn.getParticipantObjectID())); assertEquals(ParticipantObjectTypeCode.System, patient.getParticipantObjectTypeCode()); assertEquals(ParticipantObjectTypeCodeRole.Query, patient.getParticipantObjectTypeCodeRole()); assertEquals("http://localhost:8999/Patient/$ihe-pix?sourceIdentifier=urn:oid:1.2.3.4|0815&targetSystem=urn:oid:1.2.3.4.6",
assertEquals(ParticipantObjectTypeCode.Person, patient.getParticipantObjectTypeCode()); assertEquals(ParticipantObjectTypeCodeRole.Patient, patient.getParticipantObjectTypeCodeRole()); assertEquals(ParticipantObjectIdTypeCode.PatientNumber, patient.getParticipantObjectIDTypeCode()); assertEquals(ParticipantObjectTypeCode.System, poit.getParticipantObjectTypeCode()); assertEquals(ParticipantObjectTypeCodeRole.Job, poit.getParticipantObjectTypeCodeRole());
assertEquals(ParticipantObjectTypeCode.Person, patient.getParticipantObjectTypeCode()); assertEquals(ParticipantObjectTypeCodeRole.Patient, patient.getParticipantObjectTypeCodeRole()); assertEquals(ParticipantObjectIdTypeCode.PatientNumber, patient.getParticipantObjectIDTypeCode()); assertEquals(ParticipantObjectTypeCode.System, poit.getParticipantObjectTypeCode()); assertEquals(ParticipantObjectTypeCodeRole.Job, poit.getParticipantObjectTypeCodeRole());
assertEquals(ParticipantObjectTypeCode.Person, patient.getParticipantObjectTypeCode()); assertEquals(ParticipantObjectTypeCodeRole.Patient, patient.getParticipantObjectTypeCodeRole()); assertEquals("urn:oid:2.16.840.1.113883.3.37.4.1.1.2.1.1|1", patient.getParticipantObjectID()); assertEquals(ParticipantObjectTypeCode.System, query.getParticipantObjectTypeCode()); assertEquals(ParticipantObjectTypeCodeRole.Query, query.getParticipantObjectTypeCodeRole()); assertEquals("http://localhost:8999/DocumentManifest?patient.identifier=urn:oid:2.16.840.1.113883.3.37.4.1.1.2.1.1|1",
assertEquals(ParticipantObjectTypeCode.Person, patient.getParticipantObjectTypeCode()); assertEquals(ParticipantObjectTypeCodeRole.Patient, patient.getParticipantObjectTypeCodeRole()); assertEquals("urn:oid:2.16.840.1.113883.3.37.4.1.1.2.1.1|1", patient.getParticipantObjectID()); assertEquals(ParticipantObjectTypeCode.System, query.getParticipantObjectTypeCode()); assertEquals(ParticipantObjectTypeCodeRole.Query, query.getParticipantObjectTypeCodeRole()); assertEquals("http://localhost:8999/DocumentManifest?patient.identifier=urn:oid:2.16.840.1.113883.3.37.4.1.1.2.1.1|1",
assertEquals(ParticipantObjectTypeCode.Person, patient.getParticipantObjectTypeCode()); assertEquals(ParticipantObjectTypeCodeRole.Patient, patient.getParticipantObjectTypeCodeRole()); assertEquals("urn:oid:2.16.840.1.113883.3.37.4.1.1.2.1.1|1", patient.getParticipantObjectID()); assertEquals(ParticipantObjectTypeCode.System, query.getParticipantObjectTypeCode()); assertEquals(ParticipantObjectTypeCodeRole.Query, query.getParticipantObjectTypeCodeRole()); assertEquals("http://localhost:8999/DocumentReference?patient.identifier=urn:oid:2.16.840.1.113883.3.37.4.1.1.2.1.1|1",
assertEquals(ParticipantObjectTypeCode.Person, patient.getParticipantObjectTypeCode()); assertEquals(ParticipantObjectTypeCodeRole.Patient, patient.getParticipantObjectTypeCodeRole()); assertEquals("urn:oid:2.16.840.1.113883.3.37.4.1.1.2.1.1|1", patient.getParticipantObjectID()); assertEquals(ParticipantObjectTypeCode.System, query.getParticipantObjectTypeCode()); assertEquals(ParticipantObjectTypeCodeRole.Query, query.getParticipantObjectTypeCodeRole()); assertEquals("http://localhost:8999/DocumentReference?patient.identifier=urn:oid:2.16.840.1.113883.3.37.4.1.1.2.1.1|1",
assertEquals(ParticipantObjectTypeCode.System, patient.getParticipantObjectTypeCode()); assertEquals(ParticipantObjectTypeCodeRole.Query, patient.getParticipantObjectTypeCodeRole()); assertEquals("http://localhost:8999/Patient?family=Test",
assertEquals(ParticipantObjectTypeCode.System, patient.getParticipantObjectTypeCode()); assertEquals(ParticipantObjectTypeCodeRole.Query, patient.getParticipantObjectTypeCodeRole()); assertEquals("http://localhost:8999/Patient?family=Test",