Esempio n. 1
0
        protected void InsertRequest(WorkItemRequest request, WorkItemProgress progress)
        {
            WorkItemInsertResponse response = null;

            // Used for auditing purposes in the ShredHostService.
            if (string.IsNullOrEmpty(request.UserName))
            {
                request.UserName = GetUserName();
            }

            Request = request;

            Platform.GetService <IWorkItemService>(s => response = s.Insert(new WorkItemInsertRequest {
                Request = request, Progress = progress
            }));

            // TODO (CR Jun 2012): The passed-in WorkItem contract should not be updated;
            // it should be done by the service and a new instance returned, or something should be returned by this
            // method to let the caller decide what to do.

            if (response.Item == null)
            {
                WorkItem.Status = WorkItemStatusEnum.Deleted;
            }
            else
            {
                WorkItem = response.Item;
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Get the first WorkItem where the request type matches <paramref name="request"/> and if its a <see cref="WorkItemStudyRequest"/>, the
        /// Study Instance UID also matches.  The WorkItem must be Idle/Pending/InProgress status.
        /// </summary>
        /// <param name="request">The request to match </param>
        /// <returns>The matching WorkItem or null if none found.</returns>
        protected WorkItemData GetMatchingActiveWorkItem(WorkItemRequest request)
        {
            WorkItemData returnedItem = null;

            Platform.GetService(delegate(IWorkItemService s)
            {
                var response = s.Query(new WorkItemQueryRequest
                {
                    Type             = request.WorkItemType,
                    StudyInstanceUid =
                        (request is WorkItemStudyRequest)
                                                                               ? (request as WorkItemStudyRequest).Study.StudyInstanceUid
                                                                               : null
                });

                foreach (var relatedItem in response.Items)
                {
                    if (relatedItem.Status == WorkItemStatusEnum.Idle ||
                        relatedItem.Status == WorkItemStatusEnum.Pending ||
                        relatedItem.Status == WorkItemStatusEnum.InProgress)
                    {
                        returnedItem = relatedItem;
                        break;
                    }
                }
            });

            return(returnedItem);
        }
Esempio n. 3
0
        public InsertWorkItemCommand(WorkItemRequest request, WorkItemProgress progress, string studyInstanceUid, string seriesInstanceUid, string sopInstanceUid) : base("Insert a WorkItem")
        {
            _request = request;
            _progress = progress;
            _studyInstanceUid = studyInstanceUid;
            ExpirationDelaySeconds = 60;

            WorkItemUid = new WorkItemUid
            {
                Complete = false,
                FailureCount = 0,
                SeriesInstanceUid = seriesInstanceUid,
                SopInstanceUid = sopInstanceUid,
                Failed = false
            };
        }
		public InsertWorkItemCommand(WorkItem item, string studyInstanceUid, string seriesInstanceUid, string sopInstanceUid)
			: base("Insert a WorkItem")
		{
			_request = item.Request;
			_studyInstanceUid = studyInstanceUid;
			ExpirationDelaySeconds = 60;

			WorkItem = item;

			WorkItemUid = new WorkItemUid
			              	{
			              		Complete = false,
			              		FailureCount = 0,
			              		WorkItemOid = WorkItem.Oid,
			              		SeriesInstanceUid = seriesInstanceUid,
			              		SopInstanceUid = sopInstanceUid,
			              		Failed = false
			              	};
		}
Esempio n. 5
0
        /// <summary>
        /// Get the first WorkItem where the request type matches <paramref name="request"/> and if its a <see cref="WorkItemStudyRequest"/>, the
        /// Study Instance UID also matches.  The WorkItem must be Idle/Pending/InProgress status.
        /// </summary>
        /// <param name="request">The request to match </param>
        /// <returns>The matching WorkItem or null if none found.</returns>
        protected WorkItemData GetMatchingActiveWorkItem(WorkItemRequest request)
        {
            WorkItemData returnedItem = null;

            Platform.GetService(delegate(IWorkItemService s)
                                    {
                                        var response = s.Query(new WorkItemQueryRequest
                                                                   {
                                                                       Type = request.WorkItemType,
                                                                       StudyInstanceUid =
                                                                           (request is WorkItemStudyRequest)
                                                                               ? (request as WorkItemStudyRequest).Study.StudyInstanceUid
                                                                               : null
                                                                   });

                                        foreach (var relatedItem in response.Items)
                                        {
                                            if (relatedItem.Status == WorkItemStatusEnum.Idle
                                                || relatedItem.Status == WorkItemStatusEnum.Pending
                                                || relatedItem.Status == WorkItemStatusEnum.InProgress)
                                            {
                                                returnedItem = relatedItem;
                                                break;
                                            }
                                        }
                                    });

            return returnedItem;
        }
Esempio n. 6
0
        protected void InsertRequest(WorkItemRequest request, WorkItemProgress progress)
        {
            WorkItemInsertResponse response = null;

           // Used for auditing purposes in the ShredHostService.
            if(string.IsNullOrEmpty(request.UserName))
                request.UserName = GetUserName();
            
            Request = request;

            Platform.GetService<IWorkItemService>(s => response = s.Insert(new WorkItemInsertRequest { Request = request, Progress = progress}));

            // TODO (CR Jun 2012): The passed-in WorkItem contract should not be updated;
            // it should be done by the service and a new instance returned, or something should be returned by this
            // method to let the caller decide what to do.

            if (response.Item == null)
                WorkItem.Status = WorkItemStatusEnum.Deleted;
            else
                WorkItem = response.Item;
        }
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="item">The WorkItem to create a proxy for.</param>
 public WorkItemStatusProxy(WorkItem item)
 {
     Item = item;
     Progress = item.Progress;
     Request = item.Request;
 }
Esempio n. 8
0
		public static string SerializeWorkItemRequest(WorkItemRequest data)
		{
			return JsmlSerializer.Serialize(data, "data",
				new JsmlSerializer.SerializeOptions { Hook = _workItemRequestHook, DataContractTest = IsWorkItemRequestContract });
		}