/// <summary>
        /// Log FilesystemQueue related entries.
        /// </summary>
        public void LogFilesystemQueue()
        {
            FilesystemQueueSelectCriteria criteria = new FilesystemQueueSelectCriteria();

            criteria.StudyStorageKey.EqualTo(Key);

            using (IReadContext read = PersistentStoreRegistry.GetDefaultStore().OpenReadContext())
            {
                IFilesystemQueueEntityBroker broker = read.GetBroker <IFilesystemQueueEntityBroker>();

                IList <FilesystemQueue> list = broker.Find(criteria);
                foreach (FilesystemQueue queueItem in list)
                {
                    if (queueItem.FilesystemQueueTypeEnum.Equals(FilesystemQueueTypeEnum.LosslessCompress) ||
                        queueItem.FilesystemQueueTypeEnum.Equals(FilesystemQueueTypeEnum.LossyCompress))
                    {
                        XmlElement element = queueItem.QueueXml.DocumentElement;

                        string syntax = element.Attributes["syntax"].Value;

                        TransferSyntax compressSyntax = TransferSyntax.GetTransferSyntax(syntax);
                        if (compressSyntax != null)
                        {
                            Platform.Log(LogLevel.Info, "{0}: Study {1} on partition {2} scheduled for {3} compression at {4}",
                                         queueItem.FilesystemQueueTypeEnum.Description, StudyInstanceUid, ServerPartition.AeTitle,
                                         compressSyntax.Name, queueItem.ScheduledTime);
                        }
                        else
                        {
                            Platform.Log(LogLevel.Info, "{0}: Study {1} on partition {2} scheduled for {3} compression at {4}",
                                         queueItem.FilesystemQueueTypeEnum.Description, StudyInstanceUid, ServerPartition.AeTitle,
                                         syntax, queueItem.ScheduledTime);
                        }
                    }
                    else
                    {
                        Platform.Log(LogLevel.Info, "{0}: Study {1} on partition {2} scheduled for {3}",
                                     queueItem.FilesystemQueueTypeEnum.Description, StudyInstanceUid, ServerPartition.AeTitle,
                                     queueItem.ScheduledTime);
                    }
                }
            }
        }
Example #2
0
        /// <summary>
        /// Get a list of candidates from the <see cref="FilesystemQueue"/>.
        /// </summary>
        /// <param name="item">The ServiceLock item.</param>
        /// <param name="scheduledTime">The scheduled time to query against</param>
        /// <param name="type">The type of FilesystemQueue entry.</param>
        /// <param name="statusCheck">If true, check for specific status value WorkQueue entries already existing, otherwise check for any WorkQueue entry.</param>
        /// <returns>The list of queue entries.</returns>
        protected IList <FilesystemQueue> GetFilesystemQueueCandidates(Model.ServiceLock item, DateTime scheduledTime, FilesystemQueueTypeEnum type, bool statusCheck)
        {
            using (ServerExecutionContext context = new ServerExecutionContext())
            {
                IFilesystemQueueEntityBroker  broker          = context.ReadContext.GetBroker <IFilesystemQueueEntityBroker>();
                FilesystemQueueSelectCriteria fsQueueCriteria = new FilesystemQueueSelectCriteria();

                fsQueueCriteria.FilesystemKey.EqualTo(item.FilesystemKey);
                fsQueueCriteria.ScheduledTime.LessThanOrEqualTo(scheduledTime);
                fsQueueCriteria.FilesystemQueueTypeEnum.EqualTo(type);

                // Do the select based on the QueueStudyState (used to be based on a link to the WorkQueue table)
                StudyStorageSelectCriteria studyStorageSearchCriteria = new StudyStorageSelectCriteria();
                studyStorageSearchCriteria.QueueStudyStateEnum.EqualTo(QueueStudyStateEnum.Idle);
                fsQueueCriteria.StudyStorage.Exists(studyStorageSearchCriteria);

                fsQueueCriteria.ScheduledTime.SortAsc(0);

                IList <FilesystemQueue> list = broker.Find(fsQueueCriteria, 0, ServiceLockSettings.Default.FilesystemQueueResultCount);

                return(list);
            }
        }