示例#1
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();
 }
示例#2
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);
   }
 }
示例#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;
 }
示例#4
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);
 }
示例#5
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;
 }
示例#6
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);
 }
示例#7
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);
   }
 }
示例#8
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);
   }
 }
示例#9
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);
   }
 }
示例#10
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);
   }
 }
示例#11
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);
     }
   }
 }