private void LoadSIQEntries() { using (IReadContext ctx = PersistentStoreRegistry.GetDefaultStore().OpenReadContext()) { IStudyIntegrityQueueEntityBroker broker = ctx.GetBroker <IStudyIntegrityQueueEntityBroker>(); _siqEntries = new List <StudyIntegrityQueue>(broker.Find(new StudyIntegrityQueueSelectCriteria())); } }
/// <summary> /// Finds all storage locations used for the study. /// </summary> protected void FindAllRelatedDirectories() { // Check the work queue for other entries IList <Model.WorkQueue> list; // NOTE: a local read context is used for lookup because we want to // release the lock on the rows asap. using (IReadContext ctx = PersistentStoreRegistry.GetDefaultStore().OpenReadContext()) { IWorkQueueEntityBroker broker = ctx.GetBroker <IWorkQueueEntityBroker>(); WorkQueueSelectCriteria criteria = new WorkQueueSelectCriteria(); criteria.StudyStorageKey.EqualTo(WorkQueueItem.StudyStorageKey); list = broker.Find(criteria); } List <DirectoryInfo> dirs = new List <DirectoryInfo>(); foreach (Model.WorkQueue item in list) { string path = GetWorkQueueSecondaryFolder(item); if (!string.IsNullOrEmpty(path)) { dirs.Add(new DirectoryInfo(path)); } } // NOTE: Under normal operation, the SIQ entries should be // empty at this point because the Delete Study button is disabled otherwise. // This block of code is still needed just in case this DeleteStudy work queue entry // is inserted through different means. IList <StudyIntegrityQueue> siqList; using (IReadContext ctx = PersistentStoreRegistry.GetDefaultStore().OpenReadContext()) { IStudyIntegrityQueueEntityBroker broker = ctx.GetBroker <IStudyIntegrityQueueEntityBroker>(); StudyIntegrityQueueSelectCriteria criteria = new StudyIntegrityQueueSelectCriteria(); criteria.StudyStorageKey.EqualTo(WorkQueueItem.StudyStorageKey); siqList = broker.Find(criteria); } foreach (StudyIntegrityQueue item in siqList) { string path = GetSIQItemStorageFolder(item); if (!string.IsNullOrEmpty(path)) { dirs.Add(new DirectoryInfo(path)); } } _relatedDirectories = dirs; }
public IList <StudyIntegrityQueue> GetStudyIntegrityQueueItems(ServerEntityKey studyStorageKey) { Platform.CheckForNullReference(studyStorageKey, "storageKey"); IStudyIntegrityQueueEntityBroker integrityQueueBroker = HttpContext.Current.GetSharedPersistentContext().GetBroker <IStudyIntegrityQueueEntityBroker>(); StudyIntegrityQueueSelectCriteria parms = new StudyIntegrityQueueSelectCriteria(); parms.StudyStorageKey.EqualTo(studyStorageKey); return(integrityQueueBroker.Find(parms)); }
/// <summary> /// Finds a list of <see cref="StudyIntegrityQueue"/> related to the specified <see cref="StudyStorage"/>. /// </summary> /// <param name="studyStorageKey"></param> /// <param name="filter">A delegate that will be used to filter the returned list. Pass in Null to get the entire list.</param> /// <returns>A list of <see cref="StudyIntegrityQueue"/></returns> static public IList <StudyIntegrityQueue> FindSIQEntries(ServerEntityKey studyStorageKey, Predicate <StudyIntegrityQueue> filter) { using (ServerExecutionContext scope = new ServerExecutionContext()) { IStudyIntegrityQueueEntityBroker broker = scope.PersistenceContext.GetBroker <IStudyIntegrityQueueEntityBroker>(); StudyIntegrityQueueSelectCriteria criteria = new StudyIntegrityQueueSelectCriteria(); criteria.StudyStorageKey.EqualTo(studyStorageKey); criteria.InsertTime.SortDesc(0); IList <StudyIntegrityQueue> list = broker.Find(criteria); if (filter != null) { CollectionUtils.Remove(list, filter); } return(list); } }
/// <summary> /// Return snapshot of all related items in the Study Integrity Queue. /// </summary> /// <returns></returns> public IList <StudyIntegrityQueue> GetRelatedStudyIntegrityQueueItems() { lock (SyncRoot) // make this thread-safe { if (_integrityQueueItems == null) { using (IReadContext ctx = _store.OpenReadContext()) { IStudyIntegrityQueueEntityBroker integrityQueueBroker = ctx.GetBroker <IStudyIntegrityQueueEntityBroker>(); StudyIntegrityQueueSelectCriteria parms = new StudyIntegrityQueueSelectCriteria(); parms.StudyStorageKey.EqualTo(GetKey()); _integrityQueueItems = integrityQueueBroker.Find(parms); } } } return(_integrityQueueItems); }