public void RunApplication(string[] args)
        {
            using (IUpdateContext updateContext = PersistentStore.OpenUpdateContext(UpdateContextSyncMode.Flush))
            {
                IPartitionArchiveEntityBroker partitionBroker = updateContext.GetBroker<IPartitionArchiveEntityBroker>();
                PartitionArchiveSelectCriteria partitionCriteria = new PartitionArchiveSelectCriteria();

                partitionCriteria.Enabled.EqualTo(true);
                partitionCriteria.ReadOnly.EqualTo(false);
                PartitionArchive activePartition = partitionBroker.FindOne(partitionCriteria);
                if (activePartition == null)
                {
                    Platform.Log(LogLevel.Error, "No active ArchivePartition were found.");
                    return;
                }

                partitionCriteria.ReadOnly.EqualTo(true);
                IList<ServerEntityKey> partitionKeys = new List<ServerEntityKey>();
                foreach (PartitionArchive partition in partitionBroker.Find(partitionCriteria))
                {
                    partitionKeys.Add(partition.Key);
                }

                IArchiveQueueEntityBroker queueBroker = updateContext.GetBroker<IArchiveQueueEntityBroker>();
                ArchiveQueueSelectCriteria queueCriteria = new ArchiveQueueSelectCriteria();
                queueCriteria.ArchiveQueueStatusEnum.In(new ArchiveQueueStatusEnum[] { ArchiveQueueStatusEnum.Failed, ArchiveQueueStatusEnum.Pending });
                queueCriteria.PartitionArchiveKey.In(partitionKeys);

                ArchiveQueueUpdateColumns queueColumns = new ArchiveQueueUpdateColumns()
                {
                    PartitionArchiveKey = activePartition.Key,
                    ArchiveQueueStatusEnum = ArchiveQueueStatusEnum.Pending,
                    ProcessorId = "",
                    ScheduledTime = Platform.Time
                };

                if (queueBroker.Update(queueCriteria, queueColumns))
                {
                    updateContext.Commit();
                }
            }
        }
        /// <summary>
        /// Retrieves all archive paritions.
        /// </summary>
        /// <returns></returns>
        public IList<PartitionArchive> GetAllPartitions()
        {
        	PartitionArchiveSelectCriteria searchCriteria = new PartitionArchiveSelectCriteria();
			return GetPartitions(searchCriteria);
        }
        protected void LoadData()
        {
            var criteria = new PartitionArchiveSelectCriteria();

            if (String.IsNullOrEmpty(DescriptionFilter.Text) == false)
            {
                QueryHelper.SetGuiStringCondition(criteria.Description,
                                                   SearchHelper.TrailingWildCard(DescriptionFilter.Text));
            }

            if (StatusFilter.SelectedIndex > 0)
            {
                criteria.Enabled.EqualTo(StatusFilter.SelectedIndex == 1);
            }

        	criteria.ServerPartitionKey.EqualTo(ServerPartition.Key);

            PartitionArchives =
                _theController.GetPartitions(criteria);
            PartitionArchiveGridPanel.RefreshCurrentPage();
        }
 public PartitionArchiveSelectCriteria(PartitionArchiveSelectCriteria other)
 : base(other)
 {}
 /// <summary>
 /// Retrieves a list of <seealso cref="PartitionArchive"/> matching the specified criteria.
 /// </summary>
 /// <returns>A list of partitions</returns>
 public IList<PartitionArchive> GetPartitions(PartitionArchiveSelectCriteria criteria)
 {
     return _archiveAdapter.GetPartitionArchives(criteria);
 }
예제 #6
0
		/// <summary>
		/// Load the list of <see cref="PartitionArchive"/> entries that are enabled.
		/// </summary>
		/// <returns>The list of <see cref="PartitionArchive"/> instances from the persistant store</returns>
		private static IList<PartitionArchive> LoadEnabledPartitionArchives()
		{
			using (IReadContext readContext = PersistentStoreRegistry.GetDefaultStore().OpenReadContext())
			{
				IPartitionArchiveEntityBroker broker = readContext.GetBroker<IPartitionArchiveEntityBroker>();

				PartitionArchiveSelectCriteria criteria = new PartitionArchiveSelectCriteria();

				criteria.Enabled.EqualTo(true);

				return broker.Find(criteria);
			}
		}
예제 #7
0
		private PartitionArchive SelectPartitionArchive(StudyItem study)
		{
			using (var ctx = PersistentStoreRegistry.GetDefaultStore().OpenReadContext())
			{
				var partitionArchiveBroker = ctx.GetBroker<IPartitionArchiveEntityBroker>();
				var partitionArchiveCriteria = new PartitionArchiveSelectCriteria();
				partitionArchiveCriteria.ServerPartitionKey.EqualTo(study.StudyStorage.ServerPartitionKey);
				return partitionArchiveBroker.Find(partitionArchiveCriteria).FirstOrDefault();

			}
		}
예제 #8
0
        private void LoadArchiveInfo()
        {
            if (!_archiveLoaded)
            {
                lock (_syncLock)
                {
                    if (!_archiveLoaded)
                    {
                        using (var ctx = PersistentStoreRegistry.GetDefaultStore().OpenReadContext())
                        {
                            var broker = ctx.GetBroker<IPartitionArchiveEntityBroker>();
                            var criteria = new PartitionArchiveSelectCriteria();
                            criteria.ServerPartitionKey.EqualTo(this.Key);
                            _archives = broker.Find(criteria);
                        }

                        _archiveLoaded = true;
                    }
                }
            }
        }
예제 #9
0
        private void LoadArchiveInfo()
        {
            if (!_archiveLoaded)
            {
                lock (_syncLock)
                {
                    if (!_archiveLoaded)
                    {
                        using (var context = new ServerExecutionContext())
                        {
                            var broker = context.ReadContext.GetBroker<IPartitionArchiveEntityBroker>();
                            var criteria = new PartitionArchiveSelectCriteria();
                            criteria.ServerPartitionKey.EqualTo(this.Key);
                            _archives = broker.Find(criteria);
                        }

                        _archiveLoaded = true;
                    }
                }
            }
        }
 public PartitionArchiveSelectCriteria(PartitionArchiveSelectCriteria other)
     : base(other)
 {
 }