Пример #1
0
        /// <summary>
        /// Check if a study is nearline and restore if requested.
        /// </summary>
        /// <param name="context"></param>
        /// <param name="partitionKey"></param>
        /// <param name="studyInstanceUid"></param>
        /// <param name="restore"></param>
        private static void CheckForStudyRestore(IPersistenceContext context, ServerEntityKey partitionKey, string studyInstanceUid, StudyRestore restore)
        {
            IStudyStorageEntityBroker  selectBroker = context.GetBroker <IStudyStorageEntityBroker>();
            StudyStorageSelectCriteria criteria     = new StudyStorageSelectCriteria();

            criteria.ServerPartitionKey.EqualTo(partitionKey);
            criteria.StudyInstanceUid.EqualTo(studyInstanceUid);

            StudyStorage storage = selectBroker.FindOne(criteria);

            if (storage != null)
            {
                if (restore == StudyRestore.True)
                {
                    RestoreQueue restoreRq = storage.InsertRestoreRequest();
                    if (restoreRq != null)
                    {
                        throw new StudyIsNearlineException(true);
                    }
                }

                throw new StudyIsNearlineException(false);
            }

            throw new StudyNotFoundException(studyInstanceUid);
        }