Ejemplo n.º 1
0
 /// <summary>
 /// Creates an instance of <see cref="ImportFilesContext"/> to be used
 /// by <see cref="ImportFilesUtility"/> 
 /// </summary>
 protected ImportFilesContext(string sourceAE, StorageConfiguration configuration, EventSource auditSource)
 {
     StudyWorkItems = new ObservableDictionary<string, WorkItem>();
     FailedStudyAudits = new Dictionary<string, string>();
     SourceAE = sourceAE;
     StorageConfiguration = configuration;
     AuditSource = auditSource;
     ExpirationDelaySeconds = WorkItemServiceSettings.Default.ExpireDelaySeconds;
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Gets a generic event source for other sources of auditable events.
 /// </summary>
 /// <param name="otherSourceName">The name of the source.</param>
 public static DicomEventSource GetOtherEventSource(string otherSourceName)
 {
     return(DicomEventSource.GetOtherEventSource(otherSourceName));
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Generates a "Dicom Instances Accessed" update event in the audit log (with ActionCode of Delete), according to DICOM Supplement 95.
        /// </summary>
        /// <remarks>
        /// This method automatically separates different patients into separately logged events, as required by DICOM.
        ///
        /// We chose to impleemnt the DicomInstancesAccessed audit log, as opposed to the DicomStudyDeleted audit message because the whole
        /// study isn't being deleted, just a series.
        /// </remarks>
        /// <param name="aeTitles">The application entities from which the instances were accessed.</param>
        /// <param name="instances">The studies that the series belong that are being deleted.</param>
        /// <param name="eventSource">The source user or application entity which invoked the operation.</param>
        /// <param name="eventResult">The result of the operation.</param>
        public static void LogDeleteSeries(IEnumerable <string> aeTitles, AuditedInstances instances, EventSource eventSource, EventResult eventResult)
        {
            if (!AuditingEnabled)
            {
                return;
            }

            try
            {
                var aeTitlesArray = ToArray(aeTitles);
                foreach (var patient in instances.EnumeratePatients())
                {
                    var auditHelper = new DicomInstancesAccessedAuditHelper(eventSource, eventResult, EventIdentificationContentsEventActionCode.D);
                    auditHelper.AddUser(eventSource);
                    if (aeTitlesArray.Length > 0)
                    {
                        auditHelper.AddUser(new AuditProcessActiveParticipant(aeTitlesArray));
                    }
                    auditHelper.AddPatientParticipantObject(patient);
                    foreach (var study in instances.EnumerateStudies(patient))
                    {
                        auditHelper.AddStudyParticipantObject(study);
                    }
                    Log(auditHelper);
                }
            }
            catch (Exception ex)
            {
                Platform.Log(LogLevel.Warn, ex, _messageAuditFailed);
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Generates a "Dicom Study Deleted" event in the audit log, according to DICOM Supplement 95.
        /// </summary>
        /// <remarks>
        /// This method automatically separates different patients into separately logged events, as required by DICOM.
        /// </remarks>
        /// <param name="aeTitle">The application entity from which the instances were deleted.</param>
        /// <param name="instances">The studies that were deleted.</param>
        /// <param name="eventSource">The source user or application entity which invoked the operation.</param>
        /// <param name="eventResult">The result of the operation.</param>
        public static void LogDeleteStudies(string aeTitle, AuditedInstances instances, EventSource eventSource, EventResult eventResult)
        {
            if (!AuditingEnabled)
            {
                return;
            }

            try
            {
                foreach (var patient in instances.EnumeratePatients())
                {
                    var auditHelper = new DicomStudyDeletedAuditHelper(eventSource, eventResult);
                    auditHelper.AddUserParticipant(eventSource);
                    auditHelper.AddUserParticipant(new AuditProcessActiveParticipant(aeTitle));
                    auditHelper.AddPatientParticipantObject(patient);
                    foreach (var study in instances.EnumerateStudies(patient))
                    {
                        auditHelper.AddStudyParticipantObject(study);
                    }
                    Log(auditHelper);
                }
            }
            catch (Exception ex)
            {
                Platform.Log(LogLevel.Warn, ex, _messageAuditFailed);
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Generates a "Data Export" event in the audit log, according to DICOM Supplement 95.
        /// </summary>
        /// <remarks>
        /// One audit event is generated for each file system volume to which data is exported.
        /// If the audited instances are not on a file system, a single event is generated with an empty media identifier.
        /// </remarks>
        /// <param name="instances">The files that were exported.</param>
        /// <param name="eventSource">The source user or application entity which invoked the operation.</param>
        /// <param name="currentAE">The current DICOM AE performing the operation.</param>
        /// <param name="eventResult">The result of the operation.</param>
        public static void LogExportStudies(AuditedInstances instances, EventSource eventSource, EventSource currentAE, EventResult eventResult)
        {
            if (!AuditingEnabled)
            {
                return;
            }

            try
            {
                var fileVolumes = new List <string>(instances.EnumerateFileVolumes());
                if (fileVolumes.Count == 0)
                {
                    fileVolumes.Add(string.Empty);
                }

                foreach (var volume in fileVolumes)
                {
                    var auditHelper = new DataExportAuditHelper(eventSource, eventResult, volume);
                    auditHelper.AddExporter(eventSource);
                    if (eventSource != currentAE)
                    {
                        auditHelper.AddExporter(currentAE);
                    }
                    foreach (var patient in instances.EnumeratePatients())
                    {
                        auditHelper.AddPatientParticipantObject(patient);
                    }
                    foreach (var study in instances.EnumerateStudies())
                    {
                        auditHelper.AddStudyParticipantObject(study);
                    }
                    Log(auditHelper);
                }
            }
            catch (Exception ex)
            {
                Platform.Log(LogLevel.Warn, ex, _messageAuditFailed);
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Generates a "DICOM Instances Transferred" received event in the audit log, according to DICOM Supplement 95.
        /// </summary>
        /// <remarks>
        /// This method automatically separates different patients into separately logged events, as required by DICOM.
        /// </remarks>
        /// <param name="localAETitle">The local application entity to which the transfer was completed.</param>
        /// <param name="remoteAETitle">The application entity from which the transfer was completed.</param>
        /// <param name="remoteHostName">The hostname of the application entity from which the transfer was completed.</param>
        /// <param name="instances">The studies that were transferred.</param>
        /// <param name="eventSource">The source user or application entity which invoked the operation.</param>
        /// <param name="eventResult">The result of the operation.</param>
        /// <param name="action">The action taken on the studies that were transferred.</param>
        public static void LogReceivedInstances(string localAETitle, string remoteAETitle, string remoteHostName, AuditedInstances instances, EventSource eventSource, EventResult eventResult, EventReceiptAction action)
        {
            if (!AuditingEnabled)
            {
                return;
            }

            try
            {
                foreach (var patient in instances.EnumeratePatients())
                {
                    var auditHelper = new DicomInstancesTransferredAuditHelper(eventSource, eventResult, action,
                                                                               remoteAETitle ?? localAETitle, remoteHostName ?? LocalHostname, localAETitle, LocalHostname);
                    foreach (var study in instances.EnumerateStudies(patient))
                    {
                        auditHelper.AddStudyParticipantObject(study);
                    }
                    Log(auditHelper);
                }
            }
            catch (Exception ex)
            {
                Platform.Log(LogLevel.Warn, ex, _messageAuditFailed);
            }
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Generates an (issued) "Query" event in the audit log, according to DICOM Supplement 95.
        /// </summary>
        /// <param name="localAETitle">The local application entity making the query.</param>
        /// <param name="remoteAETitle">The application entity on which the query is taking place.</param>
        /// <param name="remoteHostName">The hostname of the application entity on which the query is taking place.</param>
        /// <param name="eventSource">The source user or application entity which invoked the operation.</param>
        /// <param name="currentAE">The current DICOM AE performing the operation.</param>
        /// <param name="eventResult">The result of the operation.</param>
        /// <param name="sopClassUid">The SOP Class Uid of the type of DICOM Query being issued</param>
        /// <param name="ds">The dataset containing the DICOM query being issued</param>
        public static void LogQueryIssued(string localAETitle, string remoteAETitle, string remoteHostName, EventSource eventSource, EventSource currentAE, EventResult eventResult, string sopClassUid, DicomAttributeCollection ds)
        {
            if (!AuditingEnabled)
            {
                return;
            }

            try
            {
                var auditHelper = new QueryAuditHelper(eventSource, eventResult,
                                                       localAETitle, LocalHostname, remoteAETitle ?? localAETitle,
                                                       remoteHostName ?? LocalHostname,
                                                       sopClassUid, ds);
                if (eventSource != currentAE)
                {
                    auditHelper.AddOtherParticipant(currentAE);
                }
                Log(auditHelper);
            }
            catch (Exception ex)
            {
                Platform.Log(LogLevel.Warn, ex, _messageAuditFailed);
            }
        }
Ejemplo n.º 8
0
		private EventSource(DicomEventSource source)
		{
			_source = source;
		}
Ejemplo n.º 9
0
		/// <summary>
		/// Constructor.
		/// </summary>
		/// <param name="sourceAE">The local AE title of the application importing the studies.</param>
		/// <param name="configuration">The storage configuration. </param>
		/// <param name="auditSource">The source of the import. </param>
		public ImportStudyContext(string sourceAE, StorageConfiguration configuration, EventSource auditSource)
			: base(sourceAE, configuration, auditSource) {}
Ejemplo n.º 10
0
		/// <summary>
		/// Constructor.
		/// </summary>
		/// <param name="sourceAE">The AE title of the remote application sending the SOP Instances.</param>
		/// <param name="configuration">Storage configuration. </param>
		/// <param name="hostname">The IP Address the remote app is connecting with.</param>
		/// <param name="auditSource">The source of the request for auditing purposes </param>
		public DicomReceiveImportContext(string sourceAE, string hostname, StorageConfiguration configuration, EventSource auditSource) : base(sourceAE, configuration, auditSource)
		{
			_monitor = WorkItemActivityMonitor.Create(false);
			_monitor.WorkItemsChanged += WorkItemsChanged;

			var serverList = ServerDirectory.GetRemoteServersByAETitle(sourceAE);
			if (serverList.Count == 1)
				_dicomServerNode = CollectionUtils.FirstElement(serverList);

			_hostname = hostname;
		}
Ejemplo n.º 11
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="sourceAE">The local AE title of the application importing the studies.</param>
 /// <param name="configuration">The storage configuration. </param>
 /// <param name="auditSource">The source of the import. </param>
 public ImportStudyContext(string sourceAE, StorageConfiguration configuration, EventSource auditSource)
     : base(sourceAE, configuration, auditSource)
 {
 }
Ejemplo n.º 12
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="sourceAE">The AE title of the remote application sending the SOP Instances.</param>
        /// <param name="configuration">Storage configuration. </param>
        /// <param name="hostname">The IP Address the remote app is connecting with.</param>
        /// <param name="auditSource">The source of the request for auditing purposes </param>
        public DicomReceiveImportContext(string sourceAE, string hostname, StorageConfiguration configuration, EventSource auditSource) : base(sourceAE, configuration, auditSource)
        {
            // TODO (CR Jun 2012 - Med): This object is disposable and should be cleaned up.

            _monitor = WorkItemActivityMonitor.Create(false);
            _monitor.WorkItemsChanged += WorkItemsChanged;

            var serverList = ServerDirectory.GetRemoteServersByAETitle(sourceAE);
            if (serverList.Count == 1)
                _dicomServerNode = CollectionUtils.FirstElement(serverList);

            _hostname = hostname;
        }
Ejemplo n.º 13
0
        /// <summary>
        /// Generates a (received) "Query" event in the audit log, according to DICOM Supplement 95.
        /// </summary>
        /// <param name="localAETitle">The local application entity receiving the query.</param>
        /// <param name="remoteAETitle">The application entity that issued the query.</param>
        /// <param name="remoteHostName">The hostname of the application entity that issued the query.</param>
        /// <param name="currentAE">The current DICOM AE performing the operation.</param>
        /// <param name="eventResult">The result of the operation.</param>
        /// <param name="sopClassUid">The SOP Class Uid of the type of DICOM Query being received.</param>
        /// <param name="ds">The dataset containing the DICOM query received.</param>
        public static void LogQueryReceived(string localAETitle, string remoteAETitle, string remoteHostName, EventSource currentAE, EventResult eventResult, string sopClassUid, DicomAttributeCollection ds)
        {
            if (!AuditingEnabled)
                return;

            try
            {
                var auditHelper = new QueryAuditHelper(currentAE, eventResult,
                                                       remoteAETitle ?? localAETitle, remoteHostName ?? LocalHostname, localAETitle, LocalHostname,
                                                       sopClassUid, ds);
                Log(auditHelper);
            }
            catch (Exception ex)
            {
                Platform.Log(LogLevel.Warn, ex, _messageAuditFailed);
            }
        }
Ejemplo n.º 14
0
 /// <summary>
 /// Gets a user event source when the specified user is the source of the auditable event.
 /// </summary>
 /// <param name="userName">The username of the source.</param>
 public static DicomEventSource GetUserEventSource(string userName)
 {
     return(DicomEventSource.GetUserEventSource(userName));
 }
Ejemplo n.º 15
0
		/// <summary>
		/// Creates an instance of <see cref="ImportFilesContext"/> to be used
		/// by <see cref="ImportFilesUtility"/> 
		/// </summary>
		protected ImportFilesContext(string sourceAE, StorageConfiguration configuration, EventSource auditSource)
		{
			StudyWorkItems = new ObservableDictionary<string, WorkItem>();
			FailedStudyAudits = new Dictionary<string, string>();
			SourceAE = sourceAE;
			StorageConfiguration = configuration;
			AuditSource = auditSource;
			ExpirationDelaySeconds = WorkItemServiceSettings.Default.ExpireDelaySeconds;
		}
Ejemplo n.º 16
0
 private EventSource(DicomEventSource source)
 {
     _source = source;
 }
Ejemplo n.º 17
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="sourceAE">The AE title of the remote application sending the SOP Instances.</param>
        /// <param name="configuration">Storage configuration. </param>
        /// <param name="hostname">The IP Address the remote app is connecting with.</param>
        /// <param name="auditSource">The source of the request for auditing purposes </param>
        public DicomReceiveImportContext(string sourceAE, string hostname, StorageConfiguration configuration, EventSource auditSource) : base(sourceAE, configuration, auditSource)
        {
            _monitor = WorkItemActivityMonitor.Create(false);
            _monitor.WorkItemsChanged += WorkItemsChanged;

            var serverList = ServerDirectory.GetRemoteServersByAETitle(sourceAE);

            if (serverList.Count == 1)
            {
                _dicomServerNode = CollectionUtils.FirstElement(serverList);
            }

            _hostname = hostname;
        }