comparison OrthancServer/Sources/Database/StatelessDatabaseOperations.cpp @ 5590:8b32213af23e find-refactoring

replaced FindRequest::ResponseContent by booleans
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 03 May 2024 18:17:53 +0200
parents b51ee994cd6f
children 1e2631b8b9af
comparison
equal deleted inserted replaced
5589:b51ee994cd6f 5590:8b32213af23e
3875 if (request.GetLevel() != resource.GetLevel()) 3875 if (request.GetLevel() != resource.GetLevel())
3876 { 3876 {
3877 throw OrthancException(ErrorCode_InternalError); 3877 throw OrthancException(ErrorCode_InternalError);
3878 } 3878 }
3879 3879
3880 if (request.HasResponseContent(FindRequest::ResponseContent_MainDicomTags)) 3880 if (request.IsRetrieveTagsAtLevel(request.GetLevel()))
3881 { 3881 {
3882 resource.GetDicomTagsAtLevel(tags_, request.GetLevel()); 3882 resource.GetDicomTagsAtLevel(tags_, request.GetLevel());
3883 } 3883 }
3884 3884
3885 if (request.HasResponseContent(FindRequest::ResponseContent_Children)) 3885 if (request.IsRetrieveChildrenIdentifiers())
3886 { 3886 {
3887 const std::set<std::string>& s = resource.GetChildrenIdentifiers(GetChildResourceType(request.GetLevel())); 3887 const std::set<std::string>& s = resource.GetChildrenIdentifiers(GetChildResourceType(request.GetLevel()));
3888 for (std::set<std::string>::const_iterator it = s.begin(); it != s.end(); ++it) 3888 for (std::set<std::string>::const_iterator it = s.begin(); it != s.end(); ++it)
3889 { 3889 {
3890 childrenIds_.push_back(*it); 3890 childrenIds_.push_back(*it);
3891 } 3891 }
3892 } 3892 }
3893 3893
3894 if (request.HasResponseContent(FindRequest::ResponseContent_Parent)) 3894 if (request.IsRetrieveParentIdentifier())
3895 { 3895 {
3896 parentId_ = resource.GetParentIdentifier(); 3896 parentId_ = resource.GetParentIdentifier();
3897 } 3897 }
3898 3898
3899 if (request.HasResponseContent(FindRequest::ResponseContent_Metadata)) 3899 if (request.IsRetrieveMetadata())
3900 { 3900 {
3901 metadata_ = resource.GetMetadata(); 3901 metadata_ = resource.GetMetadata();
3902 std::string value; 3902 std::string value;
3903 if (resource.LookupMetadata(value, MetadataType_MainDicomTagsSignature)) 3903 if (resource.LookupMetadata(value, MetadataType_MainDicomTagsSignature))
3904 { 3904 {
3930 indexInSeries_ = boost::lexical_cast<int>(value); 3930 indexInSeries_ = boost::lexical_cast<int>(value);
3931 } 3931 }
3932 } 3932 }
3933 } 3933 }
3934 3934
3935 if (request.HasResponseContent(FindRequest::ResponseContent_Labels)) 3935 if (request.IsRetrieveLabels())
3936 { 3936 {
3937 labels_ = resource.GetLabels(); 3937 labels_ = resource.GetLabels();
3938 } 3938 }
3939 3939
3940 if (request.HasResponseContent(FindRequest::ResponseContent_Attachments)) 3940 if (request.IsRetrieveAttachments())
3941 { 3941 {
3942 FileInfo attachment; 3942 FileInfo attachment;
3943 if (resource.LookupAttachment(attachment, FileContentType_Dicom)) 3943 if (resource.LookupAttachment(attachment, FileContentType_Dicom))
3944 { 3944 {
3945 fileSize_ = attachment.GetUncompressedSize(); 3945 fileSize_ = attachment.GetUncompressedSize();
3946 fileUuid_ = attachment.GetUuid(); 3946 fileUuid_ = attachment.GetUuid();
3947 } 3947 }
3948 } 3948 }
3949 3949
3950 if (request.HasResponseContent(FindRequest::ResponseContent_ChildrenMetadata)) 3950 if (request.IsRetrieveChildrenMetadata())
3951 { 3951 {
3952 // TODO-FIND: the status_ is normally obtained from transaction.GetSeriesStatus(internalId, i) 3952 // TODO-FIND: the status_ is normally obtained from transaction.GetSeriesStatus(internalId, i)
3953 // but, that's an heavy operation for something that is rarely used -> we should have dedicated SQL code 3953 // but, that's an heavy operation for something that is rarely used -> we should have dedicated SQL code
3954 // to compute it AFAP and we should compute it only if the user request it ! 3954 // to compute it AFAP and we should compute it only if the user request it !
3955 } 3955 }