Exemple #1
0
        /// <summary>
        /// Returns a value indicating whether this study can be updated.
        /// It does not necessarily mean a work queue entry can be inserted. Other conditions may require (eg, . </summary>
        /// <param name="reason"></param>
        /// <returns></returns>
        public bool CanUpdate(out string reason)
        {
            reason = null;
            if (StudyStatusEnum.Equals(StudyStatusEnum.OnlineLossy) && IsLatestArchiveLossless)
            {
                reason = String.Format("Study {0} cannot be updated because it has been archived as lossless and is currently lossy compressed.", StudyInstanceUid);
            }

            return(string.IsNullOrEmpty(reason));
        }
Exemple #2
0
 public StudyStorage(
      ServerEntityKey _serverPartitionKey_
     ,String _studyInstanceUid_
     ,DateTime _insertTime_
     ,DateTime _lastAccessedTime_
     ,Boolean _writeLock_
     ,Int16 _readLock_
     ,StudyStatusEnum _studyStatusEnum_
     ,QueueStudyStateEnum _queueStudyStateEnum_
     ):base("StudyStorage")
 {
     ServerPartitionKey = _serverPartitionKey_;
     StudyInstanceUid = _studyInstanceUid_;
     InsertTime = _insertTime_;
     LastAccessedTime = _lastAccessedTime_;
     WriteLock = _writeLock_;
     ReadLock = _readLock_;
     StudyStatusEnum = _studyStatusEnum_;
     QueueStudyStateEnum = _queueStudyStateEnum_;
 }
 public StudyStorage(
     ServerEntityKey _serverPartitionKey_
     , String _studyInstanceUid_
     , DateTime _insertTime_
     , DateTime _lastAccessedTime_
     , Boolean _writeLock_
     , Int16 _readLock_
     , StudyStatusEnum _studyStatusEnum_
     , QueueStudyStateEnum _queueStudyStateEnum_
     ) : base("StudyStorage")
 {
     ServerPartitionKey  = _serverPartitionKey_;
     StudyInstanceUid    = _studyInstanceUid_;
     InsertTime          = _insertTime_;
     LastAccessedTime    = _lastAccessedTime_;
     WriteLock           = _writeLock_;
     ReadLock            = _readLock_;
     StudyStatusEnum     = _studyStatusEnum_;
     QueueStudyStateEnum = _queueStudyStateEnum_;
 }
		public UpdateStudyStateCommand(StudyStorageLocation location, StudyStatusEnum status, ServerTransferSyntax newSyntax) : base("Update the StudyState")
		{
			_location = location;
			_newStatus = status;
			_newSyntax = newSyntax;
		}
        /// <summary>
        /// Updates the status of a study to a new status
        /// </summary>
		protected virtual void UpdateStudyStatus(StudyStorageLocation theStudyStorage, StudyStatusEnum theStatus, TransferSyntax theSyntax)
        {
        	DBUpdateTime.Add(
        		delegate
        			{
        				using (
        					IUpdateContext updateContext =
        						PersistentStoreRegistry.GetDefaultStore().OpenUpdateContext(UpdateContextSyncMode.Flush))
        				{
							// Select the Server Transfer Syntax
							ServerTransferSyntaxSelectCriteria syntaxCriteria = new ServerTransferSyntaxSelectCriteria();
							IServerTransferSyntaxEntityBroker syntaxBroker =
								updateContext.GetBroker<IServerTransferSyntaxEntityBroker>();
							syntaxCriteria.Uid.EqualTo(theSyntax.UidString);

							ServerTransferSyntax serverSyntax = syntaxBroker.FindOne(syntaxCriteria);
							if (serverSyntax == null)
							{
								Platform.Log(LogLevel.Error, "Unable to load ServerTransferSyntax for {0}.  Unable to update study status.", theSyntax.Name);
								return;
							}

							// Get the FilesystemStudyStorage update broker ready
        					IFilesystemStudyStorageEntityBroker filesystemQueueBroker =
								updateContext.GetBroker<IFilesystemStudyStorageEntityBroker>();
							FilesystemStudyStorageUpdateColumns filesystemQueueUpdate = new FilesystemStudyStorageUpdateColumns
							                                                                {
							                                                                    ServerTransferSyntaxKey = serverSyntax.GetKey()
							                                                                };
        				    FilesystemStudyStorageSelectCriteria filesystemQueueCriteria = new FilesystemStudyStorageSelectCriteria();
        					filesystemQueueCriteria.StudyStorageKey.EqualTo(theStudyStorage.GetKey());

							// Get the StudyStorage update broker ready
        					IStudyStorageEntityBroker studyStorageBroker =
        						updateContext.GetBroker<IStudyStorageEntityBroker>();
							StudyStorageUpdateColumns studyStorageUpdate = new StudyStorageUpdateColumns
							                                                   {
							                                                       StudyStatusEnum = theStatus,
							                                                       LastAccessedTime = Platform.Time
							                                                   };

        				    if (!filesystemQueueBroker.Update(filesystemQueueCriteria,filesystemQueueUpdate))
							{
								Platform.Log(LogLevel.Error, "Unable to update FilesystemQueue row: Study {0}, Server Entity {1}",
											 theStudyStorage.StudyInstanceUid, theStudyStorage.ServerPartitionKey);
								
							}
							else if (!studyStorageBroker.Update(theStudyStorage.GetKey(),studyStorageUpdate))
							{
								Platform.Log(LogLevel.Error, "Unable to update StudyStorage row: Study {0}, Server Entity {1}",
											 theStudyStorage.StudyInstanceUid, theStudyStorage.ServerPartitionKey);								
							}
							else
								updateContext.Commit();
        				}
        			}
        		);
        }