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; }
private static AuditMessage createApplicationActivity( EventTypeCode eventType, Calendar timeStamp, String outcomeIndicator) { AuditMessage msg = new AuditMessage(); msg.setEventIdentification( createEventIdentification( EventID.ApplicationActivity, EventActionCode.Execute, timeStamp, outcomeIndicator, null, eventType)); msg.getAuditSourceIdentification().add(logger.createAuditSourceIdentification()); msg.getActiveParticipant().add(logger.createActiveParticipant(true, RoleIDCode.Application)); 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 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 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 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); } } }