示例#1
0
		public void OnStudyEditing(WebEditStudyContext context)
		{
			_studyInfo = StudyInformation.CreateFrom(context.OriginalStudy);
			_changeDesc = new WebEditStudyHistoryChangeDescription
			              	{
			              		UpdateCommands = context.EditCommands,
			              		TimeStamp = Platform.Time,
			              		UserId = context.UserId,
			              		Reason = context.Reason,
                                EditType = context.EditType
			              	};
		}
示例#2
0
 public void OnStudyEditing(WebEditStudyContext context)
 {
     _studyInfo  = StudyInformation.CreateFrom(context.OriginalStudy);
     _changeDesc = new WebEditStudyHistoryChangeDescription
     {
         UpdateCommands = context.EditCommands,
         TimeStamp      = Platform.Time,
         UserId         = context.UserId,
         Reason         = context.Reason,
         EditType       = context.EditType
     };
 }
示例#3
0
		public void OnStudyEdited(WebEditStudyContext context)
		{
			IPersistentStore store = PersistentStoreRegistry.GetDefaultStore();
			using (IUpdateContext ctx = store.OpenUpdateContext(UpdateContextSyncMode.Flush))
			{
				Platform.Log(LogLevel.Info, "Logging study history record...");
				IStudyHistoryEntityBroker broker = ctx.GetBroker<IStudyHistoryEntityBroker>();
				StudyHistoryUpdateColumns recordColumns = CreateStudyHistoryRecord(context);
				StudyHistory entry = broker.Insert(recordColumns);
				if (entry != null)
					ctx.Commit();
				else
					throw new ApplicationException("Unable to log study history record");
			}
		}
示例#4
0
        public void OnStudyEdited(WebEditStudyContext context)
        {
            IPersistentStore store = PersistentStoreRegistry.GetDefaultStore();

            using (IUpdateContext ctx = store.OpenUpdateContext(UpdateContextSyncMode.Flush))
            {
                Platform.Log(LogLevel.Info, "Logging study history record...");
                IStudyHistoryEntityBroker broker        = ctx.GetBroker <IStudyHistoryEntityBroker>();
                StudyHistoryUpdateColumns recordColumns = CreateStudyHistoryRecord(context);
                StudyHistory entry = broker.Insert(recordColumns);
                if (entry != null)
                {
                    ctx.Commit();
                }
                else
                {
                    throw new ApplicationException("Unable to log study history record");
                }
            }
        }
        public void OnStudyEditing(WebEditStudyContext context)
        {
            Platform.Log(LogLevel.Info, "Updating OriginalAttributesSequence...");
            List <DicomAttribute> values = new List <DicomAttribute>();

            foreach (BaseImageLevelUpdateCommand c in context.EditCommands)
            {
                if (!(c is SetTagCommand))
                {
                    continue;
                }
                DicomAttribute value = c.UpdateEntry.TagPath.Tag.CreateDicomAttribute();
                value.SetStringValue(c.UpdateEntry.OriginalValue);
                values.Add(value);
            }
            int cut = context.Reason.IndexOf("::");

            context.EditCommands.Insert(0,
                                        new AddOriginalAttributes(CreateOriginalAttributesSequence(values, null, null,
                                                                                                   context.Reason.Substring(0, cut > DicomVr.CSvr.MaximumLength || cut < 0 ? Math.Min((int)DicomVr.CSvr.MaximumLength, context.Reason.Length) : cut))));
        }
示例#6
0
文件: LogHistory.cs 项目: nhannd/Xian
		private StudyHistoryUpdateColumns CreateStudyHistoryRecord(WebEditStudyContext context)
		{
			Platform.CheckForNullReference(context.OriginalStudyStorageLocation, "context.OriginalStudyStorageLocation");
			Platform.CheckForNullReference(context.NewStudystorageLocation, "context.NewStudystorageLocation");

		    var columns = new StudyHistoryUpdateColumns
		                      {
		                          InsertTime = Platform.Time,
		                          StudyStorageKey = context.OriginalStudyStorageLocation.GetKey(),
		                          DestStudyStorageKey = context.NewStudystorageLocation.GetKey(),
		                          StudyData = XmlUtils.SerializeAsXmlDoc(_studyInfo),
		                          StudyHistoryTypeEnum =
		                              context.EditType == EditType.WebEdit
		                                  ? StudyHistoryTypeEnum.WebEdited
		                                  : StudyHistoryTypeEnum.ExternalEdit
		                      };


		    XmlDocument doc = XmlUtils.SerializeAsXmlDoc(_changeDesc);
			columns.ChangeDescription = doc;
			return columns;
		}
示例#7
0
        private StudyHistoryUpdateColumns CreateStudyHistoryRecord(WebEditStudyContext context)
        {
            Platform.CheckForNullReference(context.OriginalStudyStorageLocation, "context.OriginalStudyStorageLocation");
            Platform.CheckForNullReference(context.NewStudystorageLocation, "context.NewStudystorageLocation");

            var columns = new StudyHistoryUpdateColumns
            {
                InsertTime           = Platform.Time,
                StudyStorageKey      = context.OriginalStudyStorageLocation.GetKey(),
                DestStudyStorageKey  = context.NewStudystorageLocation.GetKey(),
                StudyData            = XmlUtils.SerializeAsXmlDoc(_studyInfo),
                StudyHistoryTypeEnum =
                    context.EditType == EditType.WebEdit
                                                  ? StudyHistoryTypeEnum.WebEdited
                                                  : StudyHistoryTypeEnum.ExternalEdit
            };


            XmlDocument doc = XmlUtils.SerializeAsXmlDoc(_changeDesc);

            columns.ChangeDescription = doc;
            return(columns);
        }
示例#8
0
 public StudyEditedEventArgs(WebEditStudyContext context)
 {
     _context = context;
 }
示例#9
0
        /// <summary>
        /// Perform the edit.
        /// </summary>
        /// <param name="actionXml">A serialized XML representation of <see cref="SetTagCommand"/> objects</param>
        /// <returns></returns>
        public bool Edit(XmlElement actionXml)
        {
            Platform.Log(LogLevel.Info,
                         "Starting Edit of study {0} for Patient {1} (PatientId:{2} A#:{3}) on Partition {4}",
                         Study.StudyInstanceUid, Study.PatientsName, Study.PatientId,
                         Study.AccessionNumber, ServerPartition.Description);

            LoadExtensions();

            EditStudyWorkQueueDataParser parser = new EditStudyWorkQueueDataParser();
            EditStudyWorkQueueData       data   = parser.Parse(actionXml);

            using (ServerCommandProcessor processor = new ServerCommandProcessor("Web Edit Study"))
            {
                // Convert UpdateItem in the request into BaseImageLevelUpdateCommand
                List <BaseImageLevelUpdateCommand> updateCommands = null;
                if (data != null)
                {
                    updateCommands = CollectionUtils.Map <Edit.UpdateItem, BaseImageLevelUpdateCommand>(
                        data.EditRequest.UpdateEntries,
                        delegate(Edit.UpdateItem item)
                    {
                        // Note: For edit, we assume each UpdateItem is equivalent to SetTagCommand
                        return(new SetTagCommand(item.DicomTag.TagValue, item.OriginalValue, item.Value));
                    }
                        );
                }

                UpdateStudyCommand updateStudyCommand =
                    new UpdateStudyCommand(ServerPartition, StorageLocation, updateCommands,
                                           ServerRuleApplyTimeEnum.SopEdited);
                processor.AddCommand(updateStudyCommand);

                // Note, this command will only insert the ArchiveQueue command if a delete doesn't exist
                processor.AddCommand(new InsertArchiveQueueCommand(ServerPartition.Key, StorageLocation.Key));

                var context = new WebEditStudyContext
                {
                    CommandProcessor             = processor,
                    EditType                     = data.EditRequest.EditType,
                    OriginalStudyStorageLocation = StorageLocation,
                    EditCommands                 = updateCommands,
                    OriginalStudy                = Study,
                    OrginalPatient               = Patient,
                    UserId = data.EditRequest.UserId,
                    Reason = data.EditRequest.Reason
                };

                OnStudyUpdating(context);

                if (!processor.Execute())
                {
                    Platform.Log(LogLevel.Error, processor.FailureException, "Unexpected failure editing study: {0}",
                                 processor.FailureReason);
                    FailureReason = processor.FailureReason;

                    return(false);
                }

                // reload the StudyStorageLocation
                NewStorageLocation = StudyStorageLocation.FindStorageLocations(StorageLocation.StudyStorage)[0];
                context.NewStudystorageLocation = NewStorageLocation;

                OnStudyUpdated(context);

                if (updateStudyCommand.Statistics != null)
                {
                    StatisticsLogger.Log(LogLevel.Info, updateStudyCommand.Statistics);
                }

                return(true);
            }
        }
示例#10
0
 private void OnStudyUpdated(WebEditStudyContext context)
 {
     EventsHelper.Fire(_editedHandlers, this, new StudyEditedEventArgs(context));
 }
 public void OnStudyEdited(WebEditStudyContext context)
 {
 }