Ejemplo n.º 1
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);
        }
        private static EditStudyWorkQueueData ParseOldXml(XmlElement element)
        {
            EditStudyWorkQueueData data = new EditStudyWorkQueueData();

            WebEditStudyCommandCompiler        compiler       = new WebEditStudyCommandCompiler();
            List <BaseImageLevelUpdateCommand> updateCommands = compiler.Compile(element);

            foreach (BaseImageLevelUpdateCommand command in updateCommands)
            {
                if (data.EditRequest.UpdateEntries == null)
                {
                    data.EditRequest.UpdateEntries = new List <UpdateItem>();
                }

                // convert BaseImageLevelUpdateCommand to UpdateItem
                string value = command.UpdateEntry.Value != null?command.UpdateEntry.Value.ToString() : null;

                data.EditRequest.UpdateEntries.Add(new UpdateItem(command.UpdateEntry.TagPath.Tag.TagValue, command.UpdateEntry.OriginalValue, value));
            }

            return(data);
        }
Ejemplo n.º 3
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);
        }