comparison OrthancServer/Sources/ServerJobs/ResourceModificationJob.cpp @ 5716:8db85be7a445 find-refactoring

removed one ExpandedResource from ResourceModificationJob
author Sebastien Jodogne <s.jodogne@gmail.com>
date Sat, 13 Jul 2024 00:41:43 +0200
parents f7adfb22e20e
children c5ca97d21023
comparison
equal deleted inserted replaced
5714:2b05428843d2 5716:8db85be7a445
742 { 742 {
743 targetPatientId = modification_->GetReplacementAsString(DICOM_TAG_PATIENT_ID); 743 targetPatientId = modification_->GetReplacementAsString(DICOM_TAG_PATIENT_ID);
744 } 744 }
745 else 745 else
746 { 746 {
747 ExpandedResource originalStudy; 747 FindRequest request(ResourceType_Study);
748 if (GetContext().GetIndex().ExpandResource(originalStudy, *studyId, ResourceType_Study, emptyRequestedTags, ExpandResourceFlags_IncludeMainDicomTags)) 748 request.SetOrthancStudyId(*studyId);
749 request.SetRetrieveMainDicomTags(true);
750
751 FindResponse response;
752 GetContext().GetIndex().ExecuteFind(response, request);
753
754 if (response.GetSize() == 1)
749 { 755 {
750 targetPatientId = originalStudy.GetMainDicomTags().GetStringValue(DICOM_TAG_PATIENT_ID, "", false); 756 DicomMap tags;
757 response.GetResourceByIndex(0).GetMainDicomTags(tags, ResourceType_Study);
758 targetPatientId = tags.GetStringValue(DICOM_TAG_PATIENT_ID, "", false);
751 } 759 }
752 else 760 else
753 { 761 {
754 throw OrthancException(ErrorCode_UnknownResource, "Study not found"); 762 throw OrthancException(ErrorCode_UnknownResource, "Study not found");
755 } 763 }