comparison OrthancServer/Sources/OrthancRestApi/OrthancRestResources.cpp @ 5693:023787ecaff2 find-refactoring

cont
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 11 Jul 2024 21:37:20 +0200
parents 708952bd869c
children 380a71e0d7e7
comparison
equal deleted inserted replaced
5692:7c11a71927a9 5693:023787ecaff2
263 call.FlattenUri()); 263 call.FlattenUri());
264 } 264 }
265 265
266 uint64_t since = boost::lexical_cast<uint64_t>(call.GetArgument("since", "")); 266 uint64_t since = boost::lexical_cast<uint64_t>(call.GetArgument("since", ""));
267 uint64_t limit = boost::lexical_cast<uint64_t>(call.GetArgument("limit", "")); 267 uint64_t limit = boost::lexical_cast<uint64_t>(call.GetArgument("limit", ""));
268 finder.SetLimits(since, limit); 268 finder.SetLimitsSince(since);
269 finder.SetLimitsCount(limit);
269 } 270 }
270 271
271 Json::Value answer; 272 Json::Value answer;
272 finder.Execute(answer, context); 273 finder.Execute(answer, context);
273 call.GetOutput().AnswerJson(answer); 274 call.GetOutput().AnswerJson(answer);
3345 3346
3346 ResourceFinder finder(level, expand); 3347 ResourceFinder finder(level, expand);
3347 finder.SetDatabaseLimits(context.GetDatabaseLimits(level)); 3348 finder.SetDatabaseLimits(context.GetDatabaseLimits(level));
3348 finder.SetFormat(OrthancRestApi::GetDicomFormat(request, DicomToJsonFormat_Human)); 3349 finder.SetFormat(OrthancRestApi::GetDicomFormat(request, DicomToJsonFormat_Human));
3349 3350
3350 size_t limit = 0;
3351 if (request.isMember(KEY_LIMIT)) 3351 if (request.isMember(KEY_LIMIT))
3352 { 3352 {
3353 int tmp = request[KEY_LIMIT].asInt(); 3353 int64_t tmp = request[KEY_LIMIT].asInt64();
3354 if (tmp < 0) 3354 if (tmp < 0)
3355 { 3355 {
3356 throw OrthancException(ErrorCode_ParameterOutOfRange, 3356 throw OrthancException(ErrorCode_ParameterOutOfRange,
3357 "Field \"" + std::string(KEY_LIMIT) + "\" must be a positive integer"); 3357 "Field \"" + std::string(KEY_LIMIT) + "\" must be a positive integer");
3358 } 3358 }
3359 3359 else
3360 limit = static_cast<size_t>(tmp); 3360 {
3361 } 3361 finder.SetLimitsCount(static_cast<uint64_t>(tmp));
3362 3362 }
3363 size_t since = 0; 3363 }
3364
3364 if (request.isMember(KEY_SINCE)) 3365 if (request.isMember(KEY_SINCE))
3365 { 3366 {
3366 int tmp = request[KEY_SINCE].asInt(); 3367 int64_t tmp = request[KEY_SINCE].asInt64();
3367 if (tmp < 0) 3368 if (tmp < 0)
3368 { 3369 {
3369 throw OrthancException(ErrorCode_ParameterOutOfRange, 3370 throw OrthancException(ErrorCode_ParameterOutOfRange,
3370 "Field \"" + std::string(KEY_SINCE) + "\" must be a positive integer"); 3371 "Field \"" + std::string(KEY_SINCE) + "\" must be a positive integer");
3371 } 3372 }
3372 3373 else
3373 since = static_cast<size_t>(tmp); 3374 {
3374 } 3375 finder.SetLimitsSince(static_cast<uint64_t>(tmp));
3375 3376 }
3376 if (request.isMember(KEY_LIMIT) ||
3377 request.isMember(KEY_SINCE))
3378 {
3379 finder.SetLimits(since, limit);
3380 } 3377 }
3381 3378
3382 { 3379 {
3383 bool caseSensitive = false; 3380 bool caseSensitive = false;
3384 if (request.isMember(KEY_CASE_SENSITIVE)) 3381 if (request.isMember(KEY_CASE_SENSITIVE))