Beispiel #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);
     }
   }
 }
Beispiel #2
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);
   }
 }
Beispiel #3
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();
 }
Beispiel #4
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);
   }
 }
Beispiel #5
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);
     }
   }
 }
Beispiel #6
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);
   }
 }
Beispiel #7
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);
   }
 }
Beispiel #8
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);
   }
 }
Beispiel #9
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);
      }
    }
  }
Beispiel #10
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);
   }
 }
Beispiel #11
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);
   }
 }
Beispiel #12
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);
     }
   }
 }