protected Content activeParticipant(ActiveParticipantType activeParticipant) { Element element = new Element("ActiveParticipant"); element.setAttribute("UserID", activeParticipant.getUserID()); conditionallyAddAttribute(element, "AlternativeUserID", activeParticipant.getAlternativeUserID()); conditionallyAddAttribute(element, "UserName", activeParticipant.getUserName()); element.setAttribute("UserIsRequestor", Boolean.toString(activeParticipant.isUserIsRequestor())); conditionallyAddAttribute(element, "NetworkAccessPointID", activeParticipant.getNetworkAccessPointID()); conditionallyAddAttribute(element, "NetworkAccessPointTypeCode", activeParticipant.getNetworkAccessPointTypeCode()); if (activeParticipant.getMediaType() != null) { element.addContent( new Element("MediaIdentifier") .addContent(codedValueType("MediaType", activeParticipant.getMediaType()))); } if (activeParticipant.getRoleIDCodes() != null) { activeParticipant.getRoleIDCodes().stream() .map(roleIdCode -> codedValueType("RoleIDCode", roleIdCode)) .forEach(element::addContent); } return element; }
String mediaIdentifier, MediaType mediaType) { ActiveParticipantType ap = new ActiveParticipantType(userID, userIsRequestor); ap.setAlternativeUserID(altUserID); ap.setUserName(userName); if (roleIdCodes != null) { roleIdCodes.stream() .filter(Objects::nonNull) .forEach(roleId -> ap.getRoleIDCodes().add(roleId)); ap.setNetworkAccessPointID(networkAccessPointID); ap.setNetworkAccessPointTypeCode(networkAccessPointTypeCode); ap.setMediaIdentifier(mediaIdentifier); ap.setMediaType(mediaType); return addActiveParticipant(ap);
assertTrue(source.isUserIsRequestor()); assertEquals("127.0.0.1", source.getNetworkAccessPointID()); assertEquals(NetworkAccessPointTypeCode.IPAddress, source.getNetworkAccessPointTypeCode()); assertFalse(destination.isUserIsRequestor()); assertEquals(AuditUtils.getLocalIPAddress(), destination.getNetworkAccessPointID()); assertEquals("http://localhost:" + DEMO_APP_PORT + "/", destination.getUserID());
.filter(apt -> apt.getUserName() != null) .findFirst().orElse(null); .filter(apt -> ActiveParticipantRoleIdCode.Source == apt.getRoleIDCodes().get(0)) .findFirst().orElseThrow(() -> new AssertionError("Expected source participant")); assertEquals(human == null, source.isUserIsRequestor()); assertEquals(sourceUserId, source.getUserID()); if (!serverSide) { assertNotNull(source.getAlternativeUserID()); .filter(apt -> ActiveParticipantRoleIdCode.Destination == apt.getRoleIDCodes().get(0)) .findFirst().orElseThrow(() -> new AssertionError("Expected destination active participant")); assertFalse(destination.isUserIsRequestor()); assertEquals(destinationUserId, destination.getUserID()); if (serverSide) { assertNotNull(destination.getAlternativeUserID());
@Override public void validate() { super.validate(); if (getMessage().findActiveParticipants(ap -> ap.getRoleIDCodes().contains(ActiveParticipantRoleIdCode.Source)).size() != 1) { throw new AuditException("Must have one ActiveParticipant with RoleIDCode Source"); } if (getMessage().findActiveParticipants(ap -> ap.getRoleIDCodes().contains(ActiveParticipantRoleIdCode.Destination)).size() != 1) { throw new AuditException("Must have one ActiveParticipant with RoleIDCode Destination"); } // DICOM restricts Participating Object to be one SOP Queried and the Query, but IHE also uses this Audit Event // for all sorts of other queries, so we cannot validate this at this point. } }
assertTrue(source.isUserIsRequestor()); assertEquals("127.0.0.1", source.getNetworkAccessPointID()); assertEquals(NetworkAccessPointTypeCode.IPAddress, source.getNetworkAccessPointTypeCode()); assertFalse(destination.isUserIsRequestor()); assertEquals("http://localhost:" + DEMO_APP_PORT + "/Patient/$ihe-pix", destination.getUserID()); assertEquals(AuditUtils.getLocalIPAddress(), destination.getNetworkAccessPointID());
@Override public void validate() { super.validate(); if (getMessage().findActiveParticipants(ap -> ap.getRoleIDCodes().contains(ActiveParticipantRoleIdCode.Destination)).isEmpty()) { throw new AuditException("Must have one or more ActiveParticipant with RoleIDCode Destination"); } if (getMessage().findActiveParticipants(ap -> ap.getRoleIDCodes().contains(ActiveParticipantRoleIdCode.SourceMedia)).size() != 1) { throw new AuditException("Must have one ActiveParticipant with RoleIDCode SourceMedia"); } if (getMessage().findParticipantObjectIdentifications(poi -> poi.getParticipantObjectIDTypeCode() == ParticipantObjectIdTypeCode.PatientNumber).isEmpty()) { throw new AuditException("Must one or more ParticipantObjectIdentification with ParticipantObjectIDTypeCode PatientNumber"); } } }
assertTrue(source.isUserIsRequestor()); assertEquals("127.0.0.1", source.getNetworkAccessPointID()); assertEquals(NetworkAccessPointTypeCode.IPAddress, source.getNetworkAccessPointTypeCode()); assertFalse(destination.isUserIsRequestor()); assertEquals("http://localhost:" + DEMO_APP_PORT + "/Patient/$ihe-pix", destination.getUserID()); assertEquals(AuditUtils.getLocalIPAddress(), destination.getNetworkAccessPointID());
protected AuditEvent.AuditEventAgentComponent activeParticipantToAgent(ActiveParticipantType ap) { AuditEvent.AuditEventAgentComponent agent = new AuditEvent.AuditEventAgentComponent() .setUserId(new Identifier().setValue(ap.getUserID())) .setAltId(ap.getAlternativeUserID()) .setName(ap.getUserName()) .setRequestor(ap.isUserIsRequestor()) .setMedia(codedValueTypeToCoding(ap.getMediaType())) .setNetwork(new AuditEvent.AuditEventAgentNetworkComponent() .setAddress(ap.getNetworkAccessPointID()) .setType(auditEventNetworkType(ap.getNetworkAccessPointTypeCode()))); ap.getRoleIDCodes().forEach(roleID -> agent.addPolicy(roleID.getCode())); return agent; }
@Override public void validate() { super.validate(); int sources = getMessage().findActiveParticipants(ap -> ap.getRoleIDCodes().contains(ActiveParticipantRoleIdCode.Source)).size(); if (sources < 1 || sources > 2) { throw new AuditException("Must have one or two ActiveParticipant with RoleIDCode Source"); } if (getMessage().findActiveParticipants(ap -> ap.getRoleIDCodes().contains(ActiveParticipantRoleIdCode.DestinationMedia)).size() != 1) { throw new AuditException("Must have one ActiveParticipant with RoleIDCode DestinationMedia"); } if (getMessage().findParticipantObjectIdentifications(poi -> poi.getParticipantObjectIDTypeCode() == ParticipantObjectIdTypeCode.PatientNumber).isEmpty()) { throw new AuditException("Must one or more ParticipantObjectIdentification with ParticipantObjectIDTypeCode PatientNumber"); } } }
assertTrue(source.isUserIsRequestor()); assertEquals("127.0.0.1", source.getNetworkAccessPointID()); assertEquals(NetworkAccessPointTypeCode.IPAddress, source.getNetworkAccessPointTypeCode()); assertFalse(destination.isUserIsRequestor()); assertEquals("http://localhost:" + DEMO_APP_PORT + "/", destination.getUserID()); assertEquals(AuditUtils.getLocalIPAddress(), destination.getNetworkAccessPointID());
protected AuditEvent.AuditEventAgentComponent activeParticipantToAgent(ActiveParticipantType ap) { AuditEvent.AuditEventAgentComponent agent = new AuditEvent.AuditEventAgentComponent() .setWho(new Reference().setIdentifier(new Identifier().setValue(ap.getUserID()))) .setAltId(ap.getAlternativeUserID()) .setName(ap.getUserName()) .setRequestor(ap.isUserIsRequestor()) .setMedia(codedValueTypeToCoding(ap.getMediaType())) .setNetwork(new AuditEvent.AuditEventAgentNetworkComponent() .setAddress(ap.getNetworkAccessPointID()) .setType(auditEventNetworkType(ap.getNetworkAccessPointTypeCode()))); ap.getRoleIDCodes().forEach(roleID -> agent.addPolicy(roleID.getCode())); return agent; }
@Override public void validate() { super.validate(); if (getMessage().findActiveParticipants(ap -> ap.getRoleIDCodes().contains(ActiveParticipantRoleIdCode.Source)).size() != 1) { throw new AuditException("Must have one ActiveParticipant with RoleIDCode Source"); } if (getMessage().findActiveParticipants(ap -> ap.getRoleIDCodes().contains(ActiveParticipantRoleIdCode.Destination)).size() != 1) { throw new AuditException("Must have one ActiveParticipant with RoleIDCode Destination"); } if (getMessage().findParticipantObjectIdentifications(poi -> poi.getParticipantObjectIDTypeCode() == ParticipantObjectIdTypeCode.PatientNumber).size() != 1) { throw new AuditException("Must one ParticipantObjectIdentification with ParticipantObjectIDTypeCode PatientNumber"); } if (getMessage().findParticipantObjectIdentifications(poi -> poi.getParticipantObjectIDTypeCode() == ParticipantObjectIdTypeCode.StudyInstanceUID).isEmpty()) { throw new AuditException("Must have one or more ParticipantObjectIdentification with ParticipantObjectIDTypeCode StudyInstanceUID"); } } }
assertTrue(source.isUserIsRequestor()); assertEquals("127.0.0.1", source.getNetworkAccessPointID()); assertEquals(NetworkAccessPointTypeCode.IPAddress, source.getNetworkAccessPointTypeCode()); assertFalse(destination.isUserIsRequestor()); assertEquals("http://localhost:" + DEMO_APP_PORT + "/", destination.getUserID()); assertEquals(AuditUtils.getLocalIPAddress(), destination.getNetworkAccessPointID());
@Override public void validate() { super.validate(); if (getMessage().findActiveParticipants(ap -> ap.getRoleIDCodes().contains(ActiveParticipantRoleIdCode.Source)).size() != 1) { throw new AuditException("Must have one ActiveParticipant with RoleIDCode Source"); } if (getMessage().findActiveParticipants(ap -> ap.getRoleIDCodes().contains(ActiveParticipantRoleIdCode.Destination)).size() != 1) { throw new AuditException("Must have one ActiveParticipant with RoleIDCode Destination"); } if (getMessage().findParticipantObjectIdentifications(poi -> poi.getParticipantObjectIDTypeCode() == ParticipantObjectIdTypeCode.PatientNumber).size() != 1) { throw new AuditException("Must have one ParticipantObjectIdentification with ParticipantObjectIDTypeCode PatientNumber"); } if (getMessage().findParticipantObjectIdentifications(poi -> poi.getParticipantObjectIDTypeCode() == ParticipantObjectIdTypeCode.StudyInstanceUID).isEmpty()) { throw new AuditException("Must have one or more ParticipantObjectIdentification with ParticipantObjectIDTypeCode StudyInstanceUID"); } } }
assertTrue(source.isUserIsRequestor()); assertEquals("127.0.0.1", source.getNetworkAccessPointID()); assertEquals(NetworkAccessPointTypeCode.IPAddress, source.getNetworkAccessPointTypeCode()); assertFalse(destination.isUserIsRequestor()); assertEquals("http://localhost:" + DEMO_APP_PORT + "/Patient", destination.getUserID()); assertEquals(AuditUtils.getLocalIPAddress(), destination.getNetworkAccessPointID());
assertTrue(source.isUserIsRequestor()); assertEquals("127.0.0.1", source.getNetworkAccessPointID()); assertEquals(NetworkAccessPointTypeCode.IPAddress, source.getNetworkAccessPointTypeCode()); assertFalse(destination.isUserIsRequestor()); assertEquals("http://localhost:" + DEMO_APP_PORT + "/Patient", destination.getUserID()); assertEquals(AuditUtils.getLocalIPAddress(), destination.getNetworkAccessPointID());
assertTrue(source.isUserIsRequestor()); assertEquals("127.0.0.1", source.getNetworkAccessPointID()); assertEquals(NetworkAccessPointTypeCode.IPAddress, source.getNetworkAccessPointTypeCode()); assertFalse(destination.isUserIsRequestor()); assertEquals("http://localhost:" + DEMO_APP_PORT + "/DocumentManifest", destination.getUserID()); assertEquals(AuditUtils.getLocalIPAddress(), destination.getNetworkAccessPointID());
assertTrue(source.isUserIsRequestor()); assertEquals("127.0.0.1", source.getNetworkAccessPointID()); assertEquals(NetworkAccessPointTypeCode.IPAddress, source.getNetworkAccessPointTypeCode()); assertFalse(destination.isUserIsRequestor()); assertEquals("http://localhost:" + DEMO_APP_PORT + "/DocumentManifest", destination.getUserID()); assertEquals(AuditUtils.getLocalIPAddress(), destination.getNetworkAccessPointID());
assertTrue(source.isUserIsRequestor()); assertEquals("127.0.0.1", source.getNetworkAccessPointID()); assertEquals(NetworkAccessPointTypeCode.IPAddress, source.getNetworkAccessPointTypeCode()); assertFalse(destination.isUserIsRequestor()); assertEquals("http://localhost:" + DEMO_APP_PORT + "/DocumentReference", destination.getUserID()); assertEquals(AuditUtils.getLocalIPAddress(), destination.getNetworkAccessPointID());