comparison OrthancServer/OrthancRestApi/OrthancRestSystem.cpp @ 974:83622b0f544c

refactoring
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 30 Jun 2014 14:44:05 +0200
parents 84513f2ee1f3
children cf52f3bcb2b3
comparison
equal deleted inserted replaced
972:2047e6f033bd 974:83622b0f544c
41 41
42 namespace Orthanc 42 namespace Orthanc
43 { 43 {
44 // System information ------------------------------------------------------- 44 // System information -------------------------------------------------------
45 45
46 static void ServeRoot(RestApi::GetCall& call) 46 static void ServeRoot(RestApiGetCall& call)
47 { 47 {
48 call.GetOutput().Redirect("app/explorer.html"); 48 call.GetOutput().Redirect("app/explorer.html");
49 } 49 }
50 50
51 static void GetSystemInformation(RestApi::GetCall& call) 51 static void GetSystemInformation(RestApiGetCall& call)
52 { 52 {
53 Json::Value result = Json::objectValue; 53 Json::Value result = Json::objectValue;
54 54
55 result["Version"] = ORTHANC_VERSION; 55 result["Version"] = ORTHANC_VERSION;
56 result["Name"] = Configuration::GetGlobalStringParameter("Name", ""); 56 result["Name"] = Configuration::GetGlobalStringParameter("Name", "");
57 57
58 call.GetOutput().AnswerJson(result); 58 call.GetOutput().AnswerJson(result);
59 } 59 }
60 60
61 static void GetStatistics(RestApi::GetCall& call) 61 static void GetStatistics(RestApiGetCall& call)
62 { 62 {
63 Json::Value result = Json::objectValue; 63 Json::Value result = Json::objectValue;
64 OrthancRestApi::GetIndex(call).ComputeStatistics(result); 64 OrthancRestApi::GetIndex(call).ComputeStatistics(result);
65 call.GetOutput().AnswerJson(result); 65 call.GetOutput().AnswerJson(result);
66 } 66 }
67 67
68 static void GenerateUid(RestApi::GetCall& call) 68 static void GenerateUid(RestApiGetCall& call)
69 { 69 {
70 std::string level = call.GetArgument("level", ""); 70 std::string level = call.GetArgument("level", "");
71 if (level == "patient") 71 if (level == "patient")
72 { 72 {
73 call.GetOutput().AnswerBuffer(FromDcmtkBridge::GenerateUniqueIdentifier(ResourceType_Patient), "text/plain"); 73 call.GetOutput().AnswerBuffer(FromDcmtkBridge::GenerateUniqueIdentifier(ResourceType_Patient), "text/plain");
84 { 84 {
85 call.GetOutput().AnswerBuffer(FromDcmtkBridge::GenerateUniqueIdentifier(ResourceType_Instance), "text/plain"); 85 call.GetOutput().AnswerBuffer(FromDcmtkBridge::GenerateUniqueIdentifier(ResourceType_Instance), "text/plain");
86 } 86 }
87 } 87 }
88 88
89 static void ExecuteScript(RestApi::PostCall& call) 89 static void ExecuteScript(RestApiPostCall& call)
90 { 90 {
91 std::string result; 91 std::string result;
92 ServerContext& context = OrthancRestApi::GetContext(call); 92 ServerContext& context = OrthancRestApi::GetContext(call);
93 context.GetLuaContext().Execute(result, call.GetPostBody()); 93 context.GetLuaContext().Execute(result, call.GetPostBody());
94 call.GetOutput().AnswerBuffer(result, "text/plain"); 94 call.GetOutput().AnswerBuffer(result, "text/plain");
95 } 95 }
96 96
97 static void GetNowIsoString(RestApi::GetCall& call) 97 static void GetNowIsoString(RestApiGetCall& call)
98 { 98 {
99 call.GetOutput().AnswerBuffer(Toolbox::GetNowIsoString(), "text/plain"); 99 call.GetOutput().AnswerBuffer(Toolbox::GetNowIsoString(), "text/plain");
100 } 100 }
101 101
102 void OrthancRestApi::RegisterSystem() 102 void OrthancRestApi::RegisterSystem()