Mercurial > hg > orthanc
comparison OrthancServer/OrthancRestApi/OrthancRestModalities.cpp @ 2799:6e3a60b85da6
New primitives to access Orthanc peers from plugins
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 22 Aug 2018 16:55:07 +0200 |
parents | 6801f99bbc2f |
children | dc7330089736 |
comparison
equal
deleted
inserted
replaced
2798:5c83e5cf9d79 | 2799:6e3a60b85da6 |
---|---|
834 Json::Value result = Json::objectValue; | 834 Json::Value result = Json::objectValue; |
835 for (OrthancRestApi::SetOfStrings::const_iterator | 835 for (OrthancRestApi::SetOfStrings::const_iterator |
836 it = peers.begin(); it != peers.end(); ++it) | 836 it = peers.begin(); it != peers.end(); ++it) |
837 { | 837 { |
838 WebServiceParameters peer; | 838 WebServiceParameters peer; |
839 Configuration::GetOrthancPeer(peer, *it); | 839 |
840 | 840 if (Configuration::GetOrthancPeer(peer, *it)) |
841 Json::Value jsonPeer = Json::objectValue; | |
842 // only return the minimum information to identify the destination, do not include "security" information like passwords | |
843 jsonPeer["Url"] = peer.GetUrl(); | |
844 if (!peer.GetUsername().empty()) | |
845 { | 841 { |
846 jsonPeer["Username"] = peer.GetUsername(); | 842 Json::Value jsonPeer = Json::objectValue; |
843 // only return the minimum information to identify the destination, do not include "security" information like passwords | |
844 jsonPeer["Url"] = peer.GetUrl(); | |
845 if (!peer.GetUsername().empty()) | |
846 { | |
847 jsonPeer["Username"] = peer.GetUsername(); | |
848 } | |
849 result[*it] = jsonPeer; | |
847 } | 850 } |
848 result[*it] = jsonPeer; | |
849 } | 851 } |
850 call.GetOutput().AnswerJson(result); | 852 call.GetOutput().AnswerJson(result); |
851 } | 853 } |
852 else // if expand is not present, keep backward compatibility and return an array of peers | 854 else // if expand is not present, keep backward compatibility and return an array of peers |
853 { | 855 { |
884 std::auto_ptr<OrthancPeerStoreJob> job(new OrthancPeerStoreJob(context)); | 886 std::auto_ptr<OrthancPeerStoreJob> job(new OrthancPeerStoreJob(context)); |
885 | 887 |
886 if (GetInstancesToExport(request, *job, remote, call)) | 888 if (GetInstancesToExport(request, *job, remote, call)) |
887 { | 889 { |
888 WebServiceParameters peer; | 890 WebServiceParameters peer; |
889 Configuration::GetOrthancPeer(peer, remote); | 891 if (Configuration::GetOrthancPeer(peer, remote)) |
890 | 892 { |
891 job->SetDescription("REST API"); | 893 job->SetDescription("REST API"); |
892 job->SetPeer(peer); | 894 job->SetPeer(peer); |
893 | 895 SubmitJob(call, request, job.release()); |
894 SubmitJob(call, request, job.release()); | 896 } |
897 else | |
898 { | |
899 LOG(ERROR) << "No peer with symbolic name: " << remote; | |
900 throw OrthancException(ErrorCode_UnknownResource); | |
901 } | |
895 } | 902 } |
896 } | 903 } |
897 | 904 |
898 | 905 |
899 // DICOM bridge ------------------------------------------------------------- | 906 // DICOM bridge ------------------------------------------------------------- |