public WorkQueueTypeProperties(
      WorkQueueTypeEnum _workQueueTypeEnum_
     ,WorkQueuePriorityEnum _workQueuePriorityEnum_
     ,Boolean _memoryLimited_
     ,Boolean _alertFailedWorkQueue_
     ,Int32 _maxFailureCount_
     ,Int32 _processDelaySeconds_
     ,Int32 _failureDelaySeconds_
     ,Int32 _deleteDelaySeconds_
     ,Int32 _postponeDelaySeconds_
     ,Int32 _expireDelaySeconds_
     ,Int32 _maxBatchSize_
     ,Boolean _readLock_
     ,Boolean _writeLock_
     ,QueueStudyStateEnum _queueStudyStateEnum_
     ,Int16 _queueStudyStateOrder_
     ):base("WorkQueueTypeProperties")
 {
     WorkQueueTypeEnum = _workQueueTypeEnum_;
     WorkQueuePriorityEnum = _workQueuePriorityEnum_;
     MemoryLimited = _memoryLimited_;
     AlertFailedWorkQueue = _alertFailedWorkQueue_;
     MaxFailureCount = _maxFailureCount_;
     ProcessDelaySeconds = _processDelaySeconds_;
     FailureDelaySeconds = _failureDelaySeconds_;
     DeleteDelaySeconds = _deleteDelaySeconds_;
     PostponeDelaySeconds = _postponeDelaySeconds_;
     ExpireDelaySeconds = _expireDelaySeconds_;
     MaxBatchSize = _maxBatchSize_;
     ReadLock = _readLock_;
     WriteLock = _writeLock_;
     QueueStudyStateEnum = _queueStudyStateEnum_;
     QueueStudyStateOrder = _queueStudyStateOrder_;
 }
 public WorkQueueTypeProperties(
     WorkQueueTypeEnum _workQueueTypeEnum_
     , WorkQueuePriorityEnum _workQueuePriorityEnum_
     , Boolean _memoryLimited_
     , Boolean _alertFailedWorkQueue_
     , Int32 _maxFailureCount_
     , Int32 _processDelaySeconds_
     , Int32 _failureDelaySeconds_
     , Int32 _deleteDelaySeconds_
     , Int32 _postponeDelaySeconds_
     , Int32 _expireDelaySeconds_
     , Int32 _maxBatchSize_
     , Boolean _readLock_
     , Boolean _writeLock_
     , QueueStudyStateEnum _queueStudyStateEnum_
     , Int16 _queueStudyStateOrder_
     ) : base("WorkQueueTypeProperties")
 {
     WorkQueueTypeEnum     = _workQueueTypeEnum_;
     WorkQueuePriorityEnum = _workQueuePriorityEnum_;
     MemoryLimited         = _memoryLimited_;
     AlertFailedWorkQueue  = _alertFailedWorkQueue_;
     MaxFailureCount       = _maxFailureCount_;
     ProcessDelaySeconds   = _processDelaySeconds_;
     FailureDelaySeconds   = _failureDelaySeconds_;
     DeleteDelaySeconds    = _deleteDelaySeconds_;
     PostponeDelaySeconds  = _postponeDelaySeconds_;
     ExpireDelaySeconds    = _expireDelaySeconds_;
     MaxBatchSize          = _maxBatchSize_;
     ReadLock             = _readLock_;
     WriteLock            = _writeLock_;
     QueueStudyStateEnum  = _queueStudyStateEnum_;
     QueueStudyStateOrder = _queueStudyStateOrder_;
 }
Example #3
0
 public WorkQueue(
     ServerEntityKey _serverPartitionKey_
     ,ServerEntityKey _studyStorageKey_
     ,WorkQueueTypeEnum _workQueueTypeEnum_
     ,WorkQueueStatusEnum _workQueueStatusEnum_
     ,WorkQueuePriorityEnum _workQueuePriorityEnum_
     ,Int32 _failureCount_
     ,DateTime _scheduledTime_
     ,DateTime _insertTime_
     ,DateTime? _lastUpdatedTime_
     ,String _failureDescription_
     ,XmlDocument _data_
     ,ServerEntityKey _externalRequestQueueKey_
     ,String _processorID_
     ,String _groupID_
     ,DateTime? _expirationTime_
     ,ServerEntityKey _deviceKey_
     ,ServerEntityKey _studyHistoryKey_
     )
     : base("WorkQueue")
 {
     ServerPartitionKey = _serverPartitionKey_;
     StudyStorageKey = _studyStorageKey_;
     WorkQueueTypeEnum = _workQueueTypeEnum_;
     WorkQueueStatusEnum = _workQueueStatusEnum_;
     WorkQueuePriorityEnum = _workQueuePriorityEnum_;
     FailureCount = _failureCount_;
     ScheduledTime = _scheduledTime_;
     InsertTime = _insertTime_;
     LastUpdatedTime = _lastUpdatedTime_;
     FailureDescription = _failureDescription_;
     Data = _data_;
     ExternalRequestQueueKey = _externalRequestQueueKey_;
     ProcessorID = _processorID_;
     GroupID = _groupID_;
     ExpirationTime = _expirationTime_;
     DeviceKey = _deviceKey_;
     StudyHistoryKey = _studyHistoryKey_;
 }
Example #4
0
 public WorkQueue(
      ServerEntityKey _serverPartitionKey_
     ,ServerEntityKey _studyStorageKey_
     ,WorkQueueTypeEnum _workQueueTypeEnum_
     ,WorkQueueStatusEnum _workQueueStatusEnum_
     ,WorkQueuePriorityEnum _workQueuePriorityEnum_
     ,Int32 _failureCount_
     ,DateTime _scheduledTime_
     ,DateTime _insertTime_
     ,DateTime _lastUpdatedTime_
     ,String _failureDescription_
     ,XmlDocument _data_
     ,ServerEntityKey _externalRequestQueueKey_
     ,String _processorID_
     ,String _groupID_
     ,DateTime _expirationTime_
     ,ServerEntityKey _deviceKey_
     ,ServerEntityKey _studyHistoryKey_
     ):base("WorkQueue")
 {
     ServerPartitionKey = _serverPartitionKey_;
     StudyStorageKey = _studyStorageKey_;
     WorkQueueTypeEnum = _workQueueTypeEnum_;
     WorkQueueStatusEnum = _workQueueStatusEnum_;
     WorkQueuePriorityEnum = _workQueuePriorityEnum_;
     FailureCount = _failureCount_;
     ScheduledTime = _scheduledTime_;
     InsertTime = _insertTime_;
     LastUpdatedTime = _lastUpdatedTime_;
     FailureDescription = _failureDescription_;
     Data = _data_;
     ExternalRequestQueueKey = _externalRequestQueueKey_;
     ProcessorID = _processorID_;
     GroupID = _groupID_;
     ExpirationTime = _expirationTime_;
     DeviceKey = _deviceKey_;
     StudyHistoryKey = _studyHistoryKey_;
 }
Example #5
0
        /// <summary>
        /// Returns a value indicating whether the specified study has been scheduled for delete.
        /// </summary>
        /// <param name="study"></param>
        /// <param name="workQueueType"></param>
        /// <returns></returns>           
		private static bool IsStudyInWorkQueue(Study study, WorkQueueTypeEnum workQueueType)
        {
        	Platform.CheckForNullReference(study, "Study");

        	WorkQueueAdaptor adaptor = new WorkQueueAdaptor();
        	WorkQueueSelectCriteria workQueueCriteria = new WorkQueueSelectCriteria();
        	workQueueCriteria.WorkQueueTypeEnum.EqualTo(workQueueType);
        	workQueueCriteria.ServerPartitionKey.EqualTo(study.ServerPartitionKey);
        	workQueueCriteria.StudyStorageKey.EqualTo(study.StudyStorageKey);

        	workQueueCriteria.WorkQueueStatusEnum.EqualTo(WorkQueueStatusEnum.Pending);

        	IList<WorkQueue> list = adaptor.Get(workQueueCriteria);
        	if (list != null && list.Count > 0)
        		return true;

        	workQueueCriteria.WorkQueueStatusEnum.EqualTo(WorkQueueStatusEnum.Idle); // not likely but who knows
        	list = adaptor.Get(workQueueCriteria);
        	if (list != null && list.Count > 0)
        		return true;

        	return false;
        }
Example #6
0
        public EditStudyWorkQueueParameters(ServerEntityKey studyStorageKey, ServerEntityKey serverPartitionKey, WorkQueueTypeEnum type, List<UpdateItem> updateItems, string reason, string user, EditType editType)
        {
            DateTime now = Platform.Time;
            var data = new EditStudyWorkQueueData
                           {
                               EditRequest =
                                   {
                                       TimeStamp = now,
                                       UserId = user,
                                       UpdateEntries = updateItems,
                                       Reason = reason,
                                       EditType = editType
                                   }
                           };

            WorkQueueTypeEnum = type;
            StudyStorageKey = studyStorageKey;
            ServerPartitionKey = serverPartitionKey;
            ScheduledTime = now;
            WorkQueueData = XmlUtils.SerializeAsXmlDoc(data); 
        }
Example #7
0
        /// <summary>
        /// Insert an EditStudy request.
        /// </summary>
        /// <param name="context"></param>
        /// <param name="studyStorageKey"></param>
        /// <param name="serverPartitionKey"></param>
        /// <param name="type"></param>
        /// <param name="updateItems"></param>
        /// <param name="reason"></param>
        /// <param name="user"></param>
        /// <param name="editType"></param>
        /// <returns></returns>
        private static WorkQueue InsertExternalEditStudyRequest(IUpdateContext context, ServerEntityKey studyStorageKey, ServerEntityKey serverPartitionKey, WorkQueueTypeEnum type, List<UpdateItem> updateItems, string reason, string user, EditType editType)
        {
            var propertiesBroker = context.GetBroker<IWorkQueueTypePropertiesEntityBroker>();
            var criteria = new WorkQueueTypePropertiesSelectCriteria();
            criteria.WorkQueueTypeEnum.EqualTo(type);
            WorkQueueTypeProperties properties = propertiesBroker.FindOne(criteria);

            var broker = context.GetBroker<IWorkQueueEntityBroker>();
            var insert = new WorkQueueUpdateColumns();
            DateTime now = Platform.Time;
            var data = new EditStudyWorkQueueData
            {
                EditRequest =
                {
                    TimeStamp = now,
                    UserId = user,
                    UpdateEntries = updateItems,
                    Reason = reason,
                    EditType = editType
                }
            };
            insert.WorkQueueTypeEnum = type;
            insert.StudyStorageKey = studyStorageKey;
            insert.ServerPartitionKey = serverPartitionKey;
            insert.ScheduledTime = now;
            insert.ExpirationTime = now.AddSeconds(properties.ExpireDelaySeconds);
            insert.WorkQueueStatusEnum = WorkQueueStatusEnum.Pending;
            insert.WorkQueuePriorityEnum = properties.WorkQueuePriorityEnum;
            insert.Data = XmlUtils.SerializeAsXmlDoc(data); 
            WorkQueue editEntry = broker.Insert(insert);
            if (editEntry == null)
            {
                throw new ApplicationException(string.Format("Unable to insert an Edit request of type {0} for study for user {1}", type.Description, user));
            }
            return editEntry;
        }
Example #8
0
 /// <summary>
 /// Insert an EditStudy request.
 /// </summary>
 /// <param name="context"></param>
 /// <param name="studyStorageKey"></param>
 /// <param name="serverPartitionKey"></param>
 /// <param name="type"></param>
 /// <param name="updateItems"></param>
 /// <param name="reason"></param>
 /// <param name="user"></param>
 /// <param name="editType"></param>
 /// <returns></returns>
 private static WorkQueue InsertEditStudyRequest(IUpdateContext context, ServerEntityKey studyStorageKey, ServerEntityKey serverPartitionKey, WorkQueueTypeEnum type, List<UpdateItem> updateItems, string reason, string user, EditType editType)
 {
 	var broker = context.GetBroker<IInsertWorkQueue>();
     InsertWorkQueueParameters criteria = new EditStudyWorkQueueParameters(studyStorageKey, serverPartitionKey, type, updateItems, reason, user, editType);
     WorkQueue editEntry = broker.FindOne(criteria);
     if (editEntry == null)
     {
         throw new ApplicationException(string.Format("Unable to insert an Edit request of type {0} for study for user {1}",type.Description, user));
     }
     return editEntry;
 }