private static void addDocuments( List<ParticipantObjectIdentification> pois, RetrieveDocumentSetRequestType req, List<String> docUIDs, boolean success) { List<DocumentRequest> docRequests = req.getDocumentRequest(); List<ParticipantObjectDetail> details; for (DocumentRequest docReq : docRequests) { if (isAddDocument(docReq.getDocumentUniqueId(), docUIDs, success)) { ParticipantObjectIdentification poi = AuditMessages.createParticipantObjectIdentification( docReq.getDocumentUniqueId(), ParticipantObjectIDTypeCode.ReportNumber, null, (byte[]) null, AuditMessages.ParticipantObjectTypeCode.SystemObject, AuditMessages.ParticipantObjectTypeCodeRole.Report, null, null, null); details = poi.getParticipantObjectDetail(); details.add( AuditMessages.createParticipantObjectDetail( "Repository Unique Id", docReq.getRepositoryUniqueId().getBytes())); if (docReq.getHomeCommunityId() != null) details.add( AuditMessages.createParticipantObjectDetail( "ihe:homeCommunityID", docReq.getHomeCommunityId().getBytes())); pois.add(poi); } } }
public static AuditMessage createImport( EventTypeCode eventTypeCode, String submissionSetUID, String patID, String srcUserID, String altSrcUserID, String srcHostName, String destUserID, String altDestUserID, String destHostName, RetrieveDocumentSetRequestType docReq, Calendar timeStamp, String outcomeIndicator) { AuditMessage msg = new AuditMessage(); msg.setEventIdentification( createEventIdentification( EventID.Import, EventActionCode.Create, timeStamp, outcomeIndicator, null, eventTypeCode)); msg.getAuditSourceIdentification().add(logger.createAuditSourceIdentification()); msg.getActiveParticipant() .add( AuditMessages.createActiveParticipant( srcUserID, altSrcUserID, null, true, srcHostName, machineOrIP(srcHostName), null, RoleIDCode.Source)); msg.getActiveParticipant() .add( AuditMessages.createActiveParticipant( destUserID, altDestUserID, null, false, destHostName, machineOrIP(destHostName), null, RoleIDCode.Destination)); if (patID != null) msg.getParticipantObjectIdentification().add(createPatient(null2unknown(patID))); if (submissionSetUID != null) msg.getParticipantObjectIdentification() .add(createSubmissionSet(null2unknown(submissionSetUID))); if (docReq != null) { addDocuments( msg.getParticipantObjectIdentification(), docReq, null, EventOutcomeIndicator.Success.equals(outcomeIndicator)); } return msg; }
public static AuditMessage createQuery( EventTypeCode eventTypeCode, String queryUID, String patID, String homeCommunityID, byte[] adhocQuery, String srcUserID, String altSrcUserID, String srcHostName, String destUserID, String altDestUserID, String destHostName, Calendar timeStamp, String outcomeIndicator) { AuditMessage msg = new AuditMessage(); msg.setEventIdentification( createEventIdentification( EventID.Query, EventActionCode.Execute, timeStamp, outcomeIndicator, null, eventTypeCode)); msg.getAuditSourceIdentification().add(logger.createAuditSourceIdentification()); String hostName = AuditLogger.localHost().getHostName(); msg.getActiveParticipant() .add( AuditMessages.createActiveParticipant( srcUserID, altSrcUserID, null, true, srcHostName, machineOrIP(srcHostName), null, RoleIDCode.Source)); msg.getActiveParticipant() .add( AuditMessages.createActiveParticipant( destUserID, AuditLogger.processID(), null, false, hostName, machineOrIP(hostName), null, RoleIDCode.Destination)); if (patID != null) msg.getParticipantObjectIdentification().add(createPatient(patID)); log.info("Query:\n" + new String(adhocQuery)); msg.getParticipantObjectIdentification() .add(createQueryParticipantObjectIdentification(queryUID, homeCommunityID, adhocQuery)); return msg; }
public static AuditMessage createPatientFeed( String patID, String eventActionCode, byte[] msh10, String srcUserID, String altSrcUserID, String srcHostName, String destUserID, Calendar timeStamp, String outcomeIndicator) { AuditMessage msg = new AuditMessage(); msg.setEventIdentification( createEventIdentification( EventID.PatientRecord, eventActionCode, timeStamp, outcomeIndicator, null, EventTypeCode.ITI_8_PatientIdentityFeed)); msg.getAuditSourceIdentification().add(logger.createAuditSourceIdentification()); String hostName = AuditLogger.localHost().getHostName(); msg.getActiveParticipant() .add( AuditMessages.createActiveParticipant( srcUserID, altSrcUserID, null, true, srcHostName, machineOrIP(srcHostName), null, RoleIDCode.Source)); msg.getActiveParticipant() .add( AuditMessages.createActiveParticipant( destUserID, AuditLogger.processID(), null, false, hostName, machineOrIP(hostName), null, RoleIDCode.Destination)); ParticipantObjectIdentification patPOI = createPatient(patID); patPOI .getParticipantObjectDetail() .add(AuditMessages.createParticipantObjectDetail("MSH-10", msh10)); msg.getParticipantObjectIdentification().add(patPOI); return msg; }
public static void sendAuditMessage(Calendar timeStamp, AuditMessage msg) throws IncompatibleConnectionException, GeneralSecurityException, IOException { log.info( "Send audit message! EventId:" + msg.getEventIdentification().getEventID().getDisplayName()); if (log.isDebugEnabled()) log.debug("Send audit message:" + AuditMessages.toXML(msg)); logger.write(timeStamp, msg); log.info("Audit message sent!"); }
public static ParticipantObjectIdentification createPatient(String patID) { return AuditMessages.createParticipantObjectIdentification( patID, ParticipantObjectIDTypeCode.ITI_PatientNumber, null, (byte[]) null, AuditMessages.ParticipantObjectTypeCode.Person, AuditMessages.ParticipantObjectTypeCodeRole.Patient, null, null, null); }
private static ParticipantObjectIdentification createStudyPOI( String studyIUID, ParticipantObjectDescription pod) { return AuditMessages.createParticipantObjectIdentification( studyIUID, AuditMessages.ParticipantObjectIDTypeCode.StudyInstanceUID, null, null, AuditMessages.ParticipantObjectTypeCode.SystemObject, AuditMessages.ParticipantObjectTypeCodeRole.Report, null, null, pod); }
public static AuditMessage createStudyUsedLogMessage( RetrieveDocumentSetResponseType rsp, String remoteHost, String user, Calendar timeStamp) { AuditMessage msg = new AuditMessage(); msg.setEventIdentification( AuditMessages.createEventIdentification( EventID.DICOMInstancesAccessed, EventActionCode.Read, timeStamp, XDSConstants.XDS_B_STATUS_FAILURE.equals(rsp.getRegistryResponse().getStatus()) ? EventOutcomeIndicator.MinorFailure : EventOutcomeIndicator.Success, null)); msg.getActiveParticipant().add(logger.createActiveParticipant(false, RoleIDCode.Application)); msg.getActiveParticipant() .add( AuditMessages.createActiveParticipant( user != null ? user : "******", null, null, true, remoteHost, machineOrIP(remoteHost), null, AuditMessages.RoleIDCode.Application)); String patientID = addStudyPOIsAndGetPatientID(msg.getParticipantObjectIdentification(), rsp); msg.getParticipantObjectIdentification() .add( AuditMessages.createParticipantObjectIdentification( patientID, AuditMessages.ParticipantObjectIDTypeCode.PatientNumber, null, null, AuditMessages.ParticipantObjectTypeCode.Person, AuditMessages.ParticipantObjectTypeCodeRole.Patient, null, null, null)); return msg; }
public static ParticipantObjectIdentification createQueryParticipantObjectIdentification( String queryUID, String homeCommunityID, byte[] adhocQuery) { return AuditMessages.createParticipantObjectIdentification( queryUID, new ParticipantObjectIDTypeCode("ITI-18", "IHE Transactions", "Registry Stored Query"), homeCommunityID, adhocQuery, AuditMessages.ParticipantObjectTypeCode.SystemObject, AuditMessages.ParticipantObjectTypeCodeRole.Query, null, null, null); }
public static ParticipantObjectIdentification createSubmissionSet(String submissionSetUID) { return AuditMessages.createParticipantObjectIdentification( submissionSetUID, new ParticipantObjectIDTypeCode( "urn:uuid:a54d6aa5-d40d-43f9-88c5-b4633d873bdd", "IHE XDS Metadata", "submission set classificationNode"), null, (byte[]) null, AuditMessages.ParticipantObjectTypeCode.SystemObject, AuditMessages.ParticipantObjectTypeCodeRole.Job, null, null, null); }
public static void logPixQuery( String patID, String sendingApp, String sendingFacility, String receivingApp, String receivingFacility, String remoteHost, byte[] query, byte[] msh10, boolean success) { if (logger != null && logger.isInstalled()) { try { Calendar timeStamp = logger.timeStamp(); AuditMessage msg = new AuditMessage(); msg.setEventIdentification( createEventIdentification( EventID.Query, EventActionCode.Execute, timeStamp, success ? EventOutcomeIndicator.Success : EventOutcomeIndicator.MinorFailure, null, EventTypeCode.ITI_9_PIXQuery)); msg.getAuditSourceIdentification().add(logger.createAuditSourceIdentification()); String hostName = AuditLogger.localHost().getHostName(); msg.getActiveParticipant() .add( AuditMessages.createActiveParticipant( sendingFacility + "|" + sendingApp, AuditLogger.processID(), null, true, hostName, machineOrIP(hostName), null, RoleIDCode.Source)); msg.getActiveParticipant() .add( AuditMessages.createActiveParticipant( sendingFacility + "|" + sendingApp, null, null, false, remoteHost, machineOrIP(remoteHost), null, RoleIDCode.Destination)); msg.getParticipantObjectIdentification().add(createPatient(patID)); msg.getParticipantObjectIdentification() .add( AuditMessages.createParticipantObjectIdentification( null, new ParticipantObjectIDTypeCode("ITI-9", "IHE Transactions", "PIX Query"), null, query, AuditMessages.ParticipantObjectTypeCode.SystemObject, AuditMessages.ParticipantObjectTypeCodeRole.Query, null, null, null, AuditMessages.createParticipantObjectDetail("MSH-10", msh10))); msg.getParticipantObjectIdentification() .add( AuditMessages.createParticipantObjectIdentification( patID, ParticipantObjectIDTypeCode.ITI_PatientNumber, null, (byte[]) null, AuditMessages.ParticipantObjectTypeCode.Person, AuditMessages.ParticipantObjectTypeCodeRole.Patient, null, null, null)); sendAuditMessage(timeStamp, msg); } catch (Exception e) { log.warn("Audit log of PIX query failed!"); log.debug("AuditLog Exception:", e); } } }
private static String machineOrIP(String hostName) { return AuditMessages.isIP(hostName) ? AuditMessages.NetworkAccessPointTypeCode.IPAddress : AuditMessages.NetworkAccessPointTypeCode.MachineName; }