コード例 #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;
            }
        }
コード例 #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);
        }
コード例 #3
0
ファイル: InsertWorkItemCommand.cs プロジェクト: nhannd/Xian
        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
            };
        }
コード例 #4
0
		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
			              	};
		}
コード例 #5
0
ファイル: WorkItemBridge.cs プロジェクト: UIKit0/ClearCanvas
        /// <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;
        }
コード例 #6
0
ファイル: WorkItemBridge.cs プロジェクト: UIKit0/ClearCanvas
        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;
        }
コード例 #7
0
 /// <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;
 }
コード例 #8
0
ファイル: Serializer.cs プロジェクト: nhannd/Xian
		public static string SerializeWorkItemRequest(WorkItemRequest data)
		{
			return JsmlSerializer.Serialize(data, "data",
				new JsmlSerializer.SerializeOptions { Hook = _workItemRequestHook, DataContractTest = IsWorkItemRequestContract });
		}