Exemple #1
0
 public static void logPatientFeed(
     String patID,
     String eventActionCode,
     byte[] msh10,
     String srcUserID,
     String remoteHost,
     String destUserID,
     boolean success) {
   if (logger != null && logger.isInstalled()) {
     try {
       Calendar timeStamp = logger.timeStamp();
       AuditMessage msg =
           XDSAudit.createPatientFeed(
               patID,
               EventActionCode.Create,
               msh10,
               srcUserID,
               null,
               remoteHost,
               destUserID,
               timeStamp,
               success ? EventOutcomeIndicator.Success : EventOutcomeIndicator.MinorFailure);
       sendAuditMessage(timeStamp, msg);
     } catch (Exception e) {
       log.warn("Audit log of Patient Feed failed!");
       log.debug("AuditLog Exception:", e);
     }
   }
 }
Exemple #2
0
 public static void logStudyUsed(RetrieveDocumentSetResponseType rsp, AuditRequestInfo info) {
   if (logger == null || !logger.isInstalled()) return;
   try {
     Calendar timeStamp = logger.timeStamp();
     AuditMessage msg =
         createStudyUsedLogMessage(rsp, info.getRemoteHost(), info.getRemoteUser(), timeStamp);
     sendAuditMessage(timeStamp, msg);
   } catch (Exception e) {
     log.warn("Audit log of Study Used failed!");
     log.debug("AuditLog Exception:", e);
   }
 }
Exemple #3
0
 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;
 }
Exemple #4
0
 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;
 }
Exemple #5
0
 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;
 }
Exemple #6
0
 public static void logImport(
     EventTypeCode eventTypeCode,
     String submissionSetUID,
     String patID,
     String srcUserID,
     String altSrcUserID,
     String srcHostName,
     String destUserID,
     String altDestUserID,
     String destHostName,
     RetrieveDocumentSetRequestType docReq,
     boolean success) {
   try {
     Calendar timeStamp = logger.timeStamp();
     AuditMessage msg =
         XDSAudit.createImport(
             eventTypeCode,
             submissionSetUID,
             patID,
             srcUserID,
             altSrcUserID,
             srcHostName,
             destUserID,
             altDestUserID,
             destHostName,
             docReq,
             timeStamp,
             success ? EventOutcomeIndicator.Success : EventOutcomeIndicator.MinorFailure);
     sendAuditMessage(timeStamp, msg);
   } catch (Exception e) {
     log.warn("Audit log of Import (" + eventTypeCode.getDisplayName() + ") failed!");
     log.debug("AuditLog Exception:", e);
   }
 }
Exemple #7
0
 public static void logApplicationActivity(EventTypeCode eventType, boolean success) {
   if (logger != null && logger.isInstalled()) {
     try {
       Calendar timeStamp = logger.timeStamp();
       AuditMessage msg =
           createApplicationActivity(
               eventType,
               timeStamp,
               success ? EventOutcomeIndicator.Success : EventOutcomeIndicator.MajorFailure);
       sendAuditMessage(timeStamp, msg);
     } catch (Exception e) {
       log.warn("Audit log of ApplicationActivity failed!");
       log.debug("AuditLog Exception:", e);
     }
   }
 }
Exemple #8
0
 /**
  * Send a ITI-41 Export Audit message. (document source) patID(1) srcUserID wsa:ReplyTo.
  * ('http://www.w3.org/2005/08/addressing/anonymous' if null altSrcUserID Process ID (consumer)
  * destUserID SOAP endpoint URI altDestUserID not spezialized SubmissionSet(1) Document(0)
  *
  * @param submissionSetUID
  * @param patID
  * @param srcUserID
  * @param altSrcUserID
  * @param srcHostName
  * @param destUserID
  * @param destHostName
  * @param success
  */
 public static void logSourceExport(
     String submissionSetUID,
     String patID,
     String srcUserID,
     String altSrcUserID,
     String srcHostName,
     String destUserID,
     String destHostName,
     boolean success) {
   if (logger != null && logger.isInstalled()) {
     if (patID == null) {
       log.error("Audit ITI-41 Export! patient ID is null. set to 'UNKNOWN'!");
       patID = UNKNOWN;
     }
     if (srcUserID == null) {
       srcUserID = XDSConstants.WS_ADDRESSING_ANONYMOUS;
     }
     logExport(
         EventTypeCode.ITI_41_ProvideAndRegisterDocumentSetB,
         submissionSetUID,
         patID,
         srcUserID,
         altSrcUserID,
         srcHostName,
         destUserID,
         null,
         destHostName,
         null,
         null,
         success);
   }
 }
Exemple #9
0
 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;
 }
Exemple #10
0
 public static void logConsumerXCAImport(
     String patID, URL repositoryURL, RetrieveDocumentSetRequestType docReq, boolean success) {
   if (logger != null && logger.isInstalled()) {
     logImport(
         EventTypeCode.ITI_39_CrossGatewayRetrieve,
         null,
         patID,
         repositoryURL.toExternalForm(),
         null,
         repositoryURL.getHost(),
         XDSConstants.WS_ADDRESSING_ANONYMOUS,
         AuditLogger.processID(),
         AuditLogger.localHost().getHostName(),
         docReq,
         success);
   }
 }
Exemple #11
0
 /**
  * Send a ITI-42 Import Audit message. (Document Registry: register document set) patID(1)
  * srcUserID content of wsa:ReplyTo. ('http://www.w3.org/2005/08/addressing/anonymous' if null).
  * altSrcUserID not specialized destUserID SOAP endpoint URI. altDestUserID Process ID (consumer)
  * SubmissionSet(1) Document(0)
  *
  * @param submissionSetUID
  * @param patID
  * @param info
  * @param success
  */
 public static void logRegistryImport(
     String submissionSetUID, String patID, AuditRequestInfo info, boolean success) {
   if (logger != null && logger.isInstalled()) {
     logImport(
         EventTypeCode.ITI_42_RegisterDocumentSetB,
         submissionSetUID,
         patID,
         info.getReplyTo(),
         null,
         info.getRemoteHost(),
         info.getRequestURI(),
         AuditLogger.processID(),
         info.getLocalHost(),
         null,
         success);
   }
 }
Exemple #12
0
 public static void logExport(
     EventTypeCode eventTypeCode,
     RetrieveDocumentSetRequestType req,
     RetrieveDocumentSetResponseType rsp,
     AuditRequestInfo info) {
   if (logger == null || !logger.isInstalled()) return;
   List<DocumentRequest> docReq = req.getDocumentRequest();
   List<String> retrievedUIDs = new ArrayList<String>();
   for (DocumentResponse doc : rsp.getDocumentResponse())
     retrievedUIDs.add(doc.getDocumentUniqueId());
   if (retrievedUIDs.size() > 0) {
     logExport(
         eventTypeCode,
         null,
         null,
         info.getRequestURI(),
         AuditLogger.processID(),
         info.getLocalHost(),
         info.getReplyTo(),
         null,
         info.getRemoteHost(),
         req,
         retrievedUIDs,
         true);
   }
   if (retrievedUIDs.size() < docReq.size()) {
     List<String> failedUIDs = new ArrayList<String>();
     for (DocumentRequest doc : req.getDocumentRequest())
       if (!retrievedUIDs.contains(doc.getDocumentUniqueId()))
         failedUIDs.add(doc.getDocumentUniqueId());
     logExport(
         eventTypeCode,
         null,
         null,
         info.getRequestURI(),
         AuditLogger.processID(),
         info.getLocalHost(),
         info.getReplyTo(),
         null,
         info.getRemoteHost(),
         req,
         failedUIDs,
         false);
   }
 }
Exemple #13
0
 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!");
 }
Exemple #14
0
  public static void logQuery(
      EventTypeCode eventTypeCode,
      AdhocQueryRequest req,
      String srcUserID,
      String altSrcUserID,
      String srcHostName,
      String destUserID,
      String altDestUserID,
      String destHostName,
      boolean success) {

    if (logger != null && logger.isInstalled()) {
      try {
        AdhocQueryType qry = req.getAdhocQuery();
        String patID = XDSUtil.getQueryPatID(qry.getSlot());
        String homeCommunityID =
            InfosetUtil.getSlotValue(qry.getSlot(), XDSConstants.QRY_HOME_COMMUNITY_ID, null);
        if (srcHostName == null) srcHostName = AuditLogger.localHost().getHostName();
        Calendar timeStamp = logger.timeStamp();
        AuditMessage msg =
            XDSAudit.createQuery(
                eventTypeCode,
                qry.getId(),
                patID,
                homeCommunityID,
                InfosetUtil.marshallObject(req, true).getBytes("UTF-8"),
                srcUserID,
                altSrcUserID,
                srcHostName,
                destUserID,
                altDestUserID,
                destHostName,
                timeStamp,
                success ? EventOutcomeIndicator.Success : EventOutcomeIndicator.MinorFailure);
        sendAuditMessage(timeStamp, msg);
      } catch (Exception e) {
        log.warn("Audit log of Stored Query failed!");
        log.debug("AuditLog Exception:", e);
      }
    }
  }
Exemple #15
0
 /**
  * Send a ITI-43 Export Audit message. (document repository: Retrieve document set) patID(0)
  * srcUserID SOAP Endpoint URI of repository altSrcUserID Process ID destUserID content of
  * wsa:ReplyTo. ('http://www.w3.org/2005/08/addressing/anonymous' if null). altDestUserID not
  * spezialized SubmissionSet(0) Document(1..n)
  *
  * @param info
  * @param docReq
  * @param docUIDs
  * @param success
  */
 public static void logRepositoryRetrieveExport(
     AuditRequestInfo info,
     RetrieveDocumentSetRequestType docReq,
     List<String> docUIDs,
     boolean success) {
   if (logger != null && logger.isInstalled()) {
     logExport(
         EventTypeCode.ITI_43_RetrieveDocumentSet,
         null,
         null,
         info.getRequestURI(),
         AuditLogger.processID(),
         info.getLocalHost(),
         info.getReplyTo(),
         null,
         info.getRemoteHost(),
         docReq,
         docUIDs,
         success);
   }
 }
Exemple #16
0
 public static String info() {
   if (logger == null) {
     return "AuditLogger not configured!";
   }
   StringBuilder sb = new StringBuilder();
   sb.append("Audit Source ID:")
       .append(logger.getAuditSourceID())
       .append("\nInstalled:")
       .append(logger.isInstalled());
   for (Connection c : logger.getConnections()) {
     sb.append("\nConnection: ")
         .append(c.getHostname())
         .append(":")
         .append(c.getPort())
         .append('(')
         .append(c.getProtocol())
         .append(')');
   }
   Device arrDevice = logger.getAuditRecordRepositoryDevice();
   sb.append("\nAudit Record Repository:").append(arrDevice);
   sb.append("\nProcess ID:")
       .append(AuditLogger.processID())
       .append("\nLocalHost:")
       .append(AuditLogger.localHost());
   return sb.toString();
 }
Exemple #17
0
 public static void logRegistryQuery(
     EventTypeCode eventTypeCode, AdhocQueryRequest req, AuditRequestInfo info, boolean success) {
   logQuery(
       eventTypeCode,
       req,
       info.getReplyTo(),
       null,
       info.getRemoteHost(),
       info.getRequestURI(),
       AuditLogger.processID(),
       info.getLocalHost(),
       success);
 }
Exemple #18
0
 /**
  * Send a ITI-42 Export Audit message. (document repository: register document set) patID(1)
  * srcUserID wsa:ReplyTo. ('http://www.w3.org/2005/08/addressing/anonymous' if null). altSrcUserID
  * Process ID destUserID SOAP endpoint URI. altDestUserID not spezialized SubmissionSet(1)
  * Document(0)
  *
  * @param submissionSetUID
  * @param patID
  * @param info
  * @param registryURL
  * @param success
  */
 public static void logRepositoryPnRExport(
     String submissionSetUID,
     String patID,
     AuditRequestInfo info,
     URL registryURL,
     boolean success) {
   if (logger != null && logger.isInstalled()) {
     logExport(
         EventTypeCode.ITI_42_RegisterDocumentSetB,
         submissionSetUID,
         patID,
         XDSConstants.WS_ADDRESSING_ANONYMOUS,
         AuditLogger.processID(),
         info.getLocalHost(),
         registryURL.toExternalForm(),
         null,
         registryURL.getHost(),
         null,
         null,
         success);
   }
 }
Exemple #19
0
 public static void logClientXCAQuery(
     AdhocQueryRequest req,
     String srcUserID,
     String srcHostName,
     URL registryURL,
     boolean success) {
   logQuery(
       EventTypeCode.ITI_38_CrossGatewayQuery,
       req,
       srcUserID,
       AuditLogger.processID(),
       srcHostName,
       registryURL.toExternalForm(),
       null,
       registryURL.getHost(),
       success);
 }
Exemple #20
0
 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;
 }
Exemple #21
0
 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);
     }
   }
 }