comparison OrthancServer/OrthancRestApi/OrthancRestModalities.cpp @ 2801:3ee82c7313e7

New events in change callbacks: "UpdatedPeers" and "UpdatedModalities"
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 23 Aug 2018 13:52:54 +0200
parents dc7330089736
children 4ee3a759afea
comparison
equal deleted inserted replaced
2800:dc7330089736 2801:3ee82c7313e7
955 } 955 }
956 956
957 957
958 static void UpdateModality(RestApiPutCall& call) 958 static void UpdateModality(RestApiPutCall& call)
959 { 959 {
960 ServerContext& context = OrthancRestApi::GetContext(call);
961
960 Json::Value json; 962 Json::Value json;
961 Json::Reader reader; 963 Json::Reader reader;
962 if (reader.parse(call.GetBodyData(), call.GetBodyData() + call.GetBodySize(), json)) 964 if (reader.parse(call.GetBodyData(), call.GetBodyData() + call.GetBodySize(), json))
963 { 965 {
964 RemoteModalityParameters modality; 966 RemoteModalityParameters modality;
965 modality.FromJson(json); 967 modality.FromJson(json);
966 Configuration::UpdateModality(call.GetUriComponent("id", ""), modality); 968 Configuration::UpdateModality(context, call.GetUriComponent("id", ""), modality);
967 call.GetOutput().AnswerBuffer("", "text/plain"); 969 call.GetOutput().AnswerBuffer("", "text/plain");
968 } 970 }
969 } 971 }
970 972
971 973
972 static void DeleteModality(RestApiDeleteCall& call) 974 static void DeleteModality(RestApiDeleteCall& call)
973 { 975 {
974 Configuration::RemoveModality(call.GetUriComponent("id", "")); 976 ServerContext& context = OrthancRestApi::GetContext(call);
977
978 Configuration::RemoveModality(context, call.GetUriComponent("id", ""));
975 call.GetOutput().AnswerBuffer("", "text/plain"); 979 call.GetOutput().AnswerBuffer("", "text/plain");
976 } 980 }
977 981
978 982
979 static void UpdatePeer(RestApiPutCall& call) 983 static void UpdatePeer(RestApiPutCall& call)
980 { 984 {
985 ServerContext& context = OrthancRestApi::GetContext(call);
986
981 Json::Value json; 987 Json::Value json;
982 Json::Reader reader; 988 Json::Reader reader;
983 if (reader.parse(call.GetBodyData(), call.GetBodyData() + call.GetBodySize(), json)) 989 if (reader.parse(call.GetBodyData(), call.GetBodyData() + call.GetBodySize(), json))
984 { 990 {
985 WebServiceParameters peer; 991 WebServiceParameters peer;
986 peer.Unserialize(json); 992 peer.Unserialize(json);
987 Configuration::UpdatePeer(call.GetUriComponent("id", ""), peer); 993 Configuration::UpdatePeer(context, call.GetUriComponent("id", ""), peer);
988 call.GetOutput().AnswerBuffer("", "text/plain"); 994 call.GetOutput().AnswerBuffer("", "text/plain");
989 } 995 }
990 } 996 }
991 997
992 998
993 static void DeletePeer(RestApiDeleteCall& call) 999 static void DeletePeer(RestApiDeleteCall& call)
994 { 1000 {
995 Configuration::RemovePeer(call.GetUriComponent("id", "")); 1001 ServerContext& context = OrthancRestApi::GetContext(call);
1002
1003 Configuration::RemovePeer(context, call.GetUriComponent("id", ""));
996 call.GetOutput().AnswerBuffer("", "text/plain"); 1004 call.GetOutput().AnswerBuffer("", "text/plain");
997 } 1005 }
998 1006
999 1007
1000 static void DicomFindWorklist(RestApiPostCall& call) 1008 static void DicomFindWorklist(RestApiPostCall& call)