Mercurial > hg > orthanc-java
comparison Plugin/NativeSDK.cpp @ 5:c8f19e93ff99
reorganization
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 19 Oct 2023 08:49:07 +0200 |
parents | 3ecef5782f2c |
children | 26c08ff926a3 |
comparison
equal
deleted
inserted
replaced
4:9032ffb3a7d5 | 5:c8f19e93ff99 |
---|---|
30 return OrthancPluginCheckVersionAdvanced(context_ | 30 return OrthancPluginCheckVersionAdvanced(context_ |
31 , arg0, arg1, arg2); | 31 , arg0, arg1, arg2); |
32 } | 32 } |
33 catch (std::runtime_error& e) | 33 catch (std::runtime_error& e) |
34 { | 34 { |
35 JavaEnvironment::ThrowException(env, e.what()); | 35 JavaEnvironment::ThrowOrthancException(env, e.what()); |
36 return 0; | 36 return 0; |
37 } | 37 } |
38 catch (...) | 38 catch (...) |
39 { | 39 { |
40 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 40 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
41 return 0; | 41 return 0; |
42 } | 42 } |
43 } | 43 } |
44 | 44 |
45 | 45 |
50 return OrthancPluginCheckVersion(context_ | 50 return OrthancPluginCheckVersion(context_ |
51 ); | 51 ); |
52 } | 52 } |
53 catch (std::runtime_error& e) | 53 catch (std::runtime_error& e) |
54 { | 54 { |
55 JavaEnvironment::ThrowException(env, e.what()); | 55 JavaEnvironment::ThrowOrthancException(env, e.what()); |
56 return 0; | 56 return 0; |
57 } | 57 } |
58 catch (...) | 58 catch (...) |
59 { | 59 { |
60 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 60 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
61 return 0; | 61 return 0; |
62 } | 62 } |
63 } | 63 } |
64 | 64 |
65 | 65 |
71 OrthancPluginLogError(context_ | 71 OrthancPluginLogError(context_ |
72 , c_arg0.GetValue()); | 72 , c_arg0.GetValue()); |
73 } | 73 } |
74 catch (std::runtime_error& e) | 74 catch (std::runtime_error& e) |
75 { | 75 { |
76 JavaEnvironment::ThrowException(env, e.what()); | 76 JavaEnvironment::ThrowOrthancException(env, e.what()); |
77 } | 77 } |
78 catch (...) | 78 catch (...) |
79 { | 79 { |
80 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 80 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
81 } | 81 } |
82 } | 82 } |
83 | 83 |
84 | 84 |
85 JNIEXPORT void JNI_OrthancPluginLogWarning(JNIEnv* env, jobject sdkObject, jstring arg0) | 85 JNIEXPORT void JNI_OrthancPluginLogWarning(JNIEnv* env, jobject sdkObject, jstring arg0) |
90 OrthancPluginLogWarning(context_ | 90 OrthancPluginLogWarning(context_ |
91 , c_arg0.GetValue()); | 91 , c_arg0.GetValue()); |
92 } | 92 } |
93 catch (std::runtime_error& e) | 93 catch (std::runtime_error& e) |
94 { | 94 { |
95 JavaEnvironment::ThrowException(env, e.what()); | 95 JavaEnvironment::ThrowOrthancException(env, e.what()); |
96 } | 96 } |
97 catch (...) | 97 catch (...) |
98 { | 98 { |
99 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 99 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
100 } | 100 } |
101 } | 101 } |
102 | 102 |
103 | 103 |
104 JNIEXPORT void JNI_OrthancPluginLogInfo(JNIEnv* env, jobject sdkObject, jstring arg0) | 104 JNIEXPORT void JNI_OrthancPluginLogInfo(JNIEnv* env, jobject sdkObject, jstring arg0) |
109 OrthancPluginLogInfo(context_ | 109 OrthancPluginLogInfo(context_ |
110 , c_arg0.GetValue()); | 110 , c_arg0.GetValue()); |
111 } | 111 } |
112 catch (std::runtime_error& e) | 112 catch (std::runtime_error& e) |
113 { | 113 { |
114 JavaEnvironment::ThrowException(env, e.what()); | 114 JavaEnvironment::ThrowOrthancException(env, e.what()); |
115 } | 115 } |
116 catch (...) | 116 catch (...) |
117 { | 117 { |
118 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 118 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
119 } | 119 } |
120 } | 120 } |
121 | 121 |
122 | 122 |
123 JNIEXPORT jbyteArray JNI_OrthancPluginGetDicomForInstance(JNIEnv* env, jobject sdkObject, jstring arg0) | 123 JNIEXPORT jbyteArray JNI_OrthancPluginGetDicomForInstance(JNIEnv* env, jobject sdkObject, jstring arg0) |
131 if (code == OrthancPluginErrorCode_Success) | 131 if (code == OrthancPluginErrorCode_Success) |
132 { | 132 { |
133 jbyteArray answer = env->NewByteArray(b.GetSize()); | 133 jbyteArray answer = env->NewByteArray(b.GetSize()); |
134 if (answer == NULL) | 134 if (answer == NULL) |
135 { | 135 { |
136 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory); | 136 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_NotEnoughMemory); |
137 return NULL; | 137 return NULL; |
138 } | 138 } |
139 else | 139 else |
140 { | 140 { |
141 env->SetByteArrayRegion(answer, 0, b.GetSize(), reinterpret_cast<const jbyte*>(b.GetData())); | 141 env->SetByteArrayRegion(answer, 0, b.GetSize(), reinterpret_cast<const jbyte*>(b.GetData())); |
142 return answer; | 142 return answer; |
143 } | 143 } |
144 } | 144 } |
145 else | 145 else |
146 { | 146 { |
147 JavaEnvironment::ThrowException(env, code); | 147 JavaEnvironment::ThrowOrthancException(env, code); |
148 return NULL; | 148 return NULL; |
149 } | 149 } |
150 } | 150 } |
151 catch (std::runtime_error& e) | 151 catch (std::runtime_error& e) |
152 { | 152 { |
153 JavaEnvironment::ThrowException(env, e.what()); | 153 JavaEnvironment::ThrowOrthancException(env, e.what()); |
154 return NULL; | 154 return NULL; |
155 } | 155 } |
156 catch (...) | 156 catch (...) |
157 { | 157 { |
158 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 158 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
159 return NULL; | 159 return NULL; |
160 } | 160 } |
161 } | 161 } |
162 | 162 |
163 | 163 |
172 if (code == OrthancPluginErrorCode_Success) | 172 if (code == OrthancPluginErrorCode_Success) |
173 { | 173 { |
174 jbyteArray answer = env->NewByteArray(b.GetSize()); | 174 jbyteArray answer = env->NewByteArray(b.GetSize()); |
175 if (answer == NULL) | 175 if (answer == NULL) |
176 { | 176 { |
177 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory); | 177 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_NotEnoughMemory); |
178 return NULL; | 178 return NULL; |
179 } | 179 } |
180 else | 180 else |
181 { | 181 { |
182 env->SetByteArrayRegion(answer, 0, b.GetSize(), reinterpret_cast<const jbyte*>(b.GetData())); | 182 env->SetByteArrayRegion(answer, 0, b.GetSize(), reinterpret_cast<const jbyte*>(b.GetData())); |
183 return answer; | 183 return answer; |
184 } | 184 } |
185 } | 185 } |
186 else | 186 else |
187 { | 187 { |
188 JavaEnvironment::ThrowException(env, code); | 188 JavaEnvironment::ThrowOrthancException(env, code); |
189 return NULL; | 189 return NULL; |
190 } | 190 } |
191 } | 191 } |
192 catch (std::runtime_error& e) | 192 catch (std::runtime_error& e) |
193 { | 193 { |
194 JavaEnvironment::ThrowException(env, e.what()); | 194 JavaEnvironment::ThrowOrthancException(env, e.what()); |
195 return NULL; | 195 return NULL; |
196 } | 196 } |
197 catch (...) | 197 catch (...) |
198 { | 198 { |
199 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 199 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
200 return NULL; | 200 return NULL; |
201 } | 201 } |
202 } | 202 } |
203 | 203 |
204 | 204 |
213 if (code == OrthancPluginErrorCode_Success) | 213 if (code == OrthancPluginErrorCode_Success) |
214 { | 214 { |
215 jbyteArray answer = env->NewByteArray(b.GetSize()); | 215 jbyteArray answer = env->NewByteArray(b.GetSize()); |
216 if (answer == NULL) | 216 if (answer == NULL) |
217 { | 217 { |
218 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory); | 218 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_NotEnoughMemory); |
219 return NULL; | 219 return NULL; |
220 } | 220 } |
221 else | 221 else |
222 { | 222 { |
223 env->SetByteArrayRegion(answer, 0, b.GetSize(), reinterpret_cast<const jbyte*>(b.GetData())); | 223 env->SetByteArrayRegion(answer, 0, b.GetSize(), reinterpret_cast<const jbyte*>(b.GetData())); |
224 return answer; | 224 return answer; |
225 } | 225 } |
226 } | 226 } |
227 else | 227 else |
228 { | 228 { |
229 JavaEnvironment::ThrowException(env, code); | 229 JavaEnvironment::ThrowOrthancException(env, code); |
230 return NULL; | 230 return NULL; |
231 } | 231 } |
232 } | 232 } |
233 catch (std::runtime_error& e) | 233 catch (std::runtime_error& e) |
234 { | 234 { |
235 JavaEnvironment::ThrowException(env, e.what()); | 235 JavaEnvironment::ThrowOrthancException(env, e.what()); |
236 return NULL; | 236 return NULL; |
237 } | 237 } |
238 catch (...) | 238 catch (...) |
239 { | 239 { |
240 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 240 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
241 return NULL; | 241 return NULL; |
242 } | 242 } |
243 } | 243 } |
244 | 244 |
245 | 245 |
255 if (code == OrthancPluginErrorCode_Success) | 255 if (code == OrthancPluginErrorCode_Success) |
256 { | 256 { |
257 jbyteArray answer = env->NewByteArray(b.GetSize()); | 257 jbyteArray answer = env->NewByteArray(b.GetSize()); |
258 if (answer == NULL) | 258 if (answer == NULL) |
259 { | 259 { |
260 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory); | 260 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_NotEnoughMemory); |
261 return NULL; | 261 return NULL; |
262 } | 262 } |
263 else | 263 else |
264 { | 264 { |
265 env->SetByteArrayRegion(answer, 0, b.GetSize(), reinterpret_cast<const jbyte*>(b.GetData())); | 265 env->SetByteArrayRegion(answer, 0, b.GetSize(), reinterpret_cast<const jbyte*>(b.GetData())); |
266 return answer; | 266 return answer; |
267 } | 267 } |
268 } | 268 } |
269 else | 269 else |
270 { | 270 { |
271 JavaEnvironment::ThrowException(env, code); | 271 JavaEnvironment::ThrowOrthancException(env, code); |
272 return NULL; | 272 return NULL; |
273 } | 273 } |
274 } | 274 } |
275 catch (std::runtime_error& e) | 275 catch (std::runtime_error& e) |
276 { | 276 { |
277 JavaEnvironment::ThrowException(env, e.what()); | 277 JavaEnvironment::ThrowOrthancException(env, e.what()); |
278 return NULL; | 278 return NULL; |
279 } | 279 } |
280 catch (...) | 280 catch (...) |
281 { | 281 { |
282 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 282 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
283 return NULL; | 283 return NULL; |
284 } | 284 } |
285 } | 285 } |
286 | 286 |
287 | 287 |
297 if (code == OrthancPluginErrorCode_Success) | 297 if (code == OrthancPluginErrorCode_Success) |
298 { | 298 { |
299 jbyteArray answer = env->NewByteArray(b.GetSize()); | 299 jbyteArray answer = env->NewByteArray(b.GetSize()); |
300 if (answer == NULL) | 300 if (answer == NULL) |
301 { | 301 { |
302 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory); | 302 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_NotEnoughMemory); |
303 return NULL; | 303 return NULL; |
304 } | 304 } |
305 else | 305 else |
306 { | 306 { |
307 env->SetByteArrayRegion(answer, 0, b.GetSize(), reinterpret_cast<const jbyte*>(b.GetData())); | 307 env->SetByteArrayRegion(answer, 0, b.GetSize(), reinterpret_cast<const jbyte*>(b.GetData())); |
308 return answer; | 308 return answer; |
309 } | 309 } |
310 } | 310 } |
311 else | 311 else |
312 { | 312 { |
313 JavaEnvironment::ThrowException(env, code); | 313 JavaEnvironment::ThrowOrthancException(env, code); |
314 return NULL; | 314 return NULL; |
315 } | 315 } |
316 } | 316 } |
317 catch (std::runtime_error& e) | 317 catch (std::runtime_error& e) |
318 { | 318 { |
319 JavaEnvironment::ThrowException(env, e.what()); | 319 JavaEnvironment::ThrowOrthancException(env, e.what()); |
320 return NULL; | 320 return NULL; |
321 } | 321 } |
322 catch (...) | 322 catch (...) |
323 { | 323 { |
324 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 324 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
325 return NULL; | 325 return NULL; |
326 } | 326 } |
327 } | 327 } |
328 | 328 |
329 | 329 |
334 JavaString c_arg0(env, arg0); | 334 JavaString c_arg0(env, arg0); |
335 OrthancPluginErrorCode code = OrthancPluginRestApiDelete(context_ | 335 OrthancPluginErrorCode code = OrthancPluginRestApiDelete(context_ |
336 , c_arg0.GetValue()); | 336 , c_arg0.GetValue()); |
337 if (code != OrthancPluginErrorCode_Success) | 337 if (code != OrthancPluginErrorCode_Success) |
338 { | 338 { |
339 JavaEnvironment::ThrowException(env, code); | 339 JavaEnvironment::ThrowOrthancException(env, code); |
340 } | 340 } |
341 } | 341 } |
342 catch (std::runtime_error& e) | 342 catch (std::runtime_error& e) |
343 { | 343 { |
344 JavaEnvironment::ThrowException(env, e.what()); | 344 JavaEnvironment::ThrowOrthancException(env, e.what()); |
345 } | 345 } |
346 catch (...) | 346 catch (...) |
347 { | 347 { |
348 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 348 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
349 } | 349 } |
350 } | 350 } |
351 | 351 |
352 | 352 |
353 JNIEXPORT void JNI_OrthancPluginRestApiDeleteAfterPlugins(JNIEnv* env, jobject sdkObject, jstring arg0) | 353 JNIEXPORT void JNI_OrthancPluginRestApiDeleteAfterPlugins(JNIEnv* env, jobject sdkObject, jstring arg0) |
357 JavaString c_arg0(env, arg0); | 357 JavaString c_arg0(env, arg0); |
358 OrthancPluginErrorCode code = OrthancPluginRestApiDeleteAfterPlugins(context_ | 358 OrthancPluginErrorCode code = OrthancPluginRestApiDeleteAfterPlugins(context_ |
359 , c_arg0.GetValue()); | 359 , c_arg0.GetValue()); |
360 if (code != OrthancPluginErrorCode_Success) | 360 if (code != OrthancPluginErrorCode_Success) |
361 { | 361 { |
362 JavaEnvironment::ThrowException(env, code); | 362 JavaEnvironment::ThrowOrthancException(env, code); |
363 } | 363 } |
364 } | 364 } |
365 catch (std::runtime_error& e) | 365 catch (std::runtime_error& e) |
366 { | 366 { |
367 JavaEnvironment::ThrowException(env, e.what()); | 367 JavaEnvironment::ThrowOrthancException(env, e.what()); |
368 } | 368 } |
369 catch (...) | 369 catch (...) |
370 { | 370 { |
371 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 371 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
372 } | 372 } |
373 } | 373 } |
374 | 374 |
375 | 375 |
376 JNIEXPORT jbyteArray JNI_OrthancPluginRestApiPut(JNIEnv* env, jobject sdkObject, jstring arg0, jbyteArray arg1) | 376 JNIEXPORT jbyteArray JNI_OrthancPluginRestApiPut(JNIEnv* env, jobject sdkObject, jstring arg0, jbyteArray arg1) |
385 if (code == OrthancPluginErrorCode_Success) | 385 if (code == OrthancPluginErrorCode_Success) |
386 { | 386 { |
387 jbyteArray answer = env->NewByteArray(b.GetSize()); | 387 jbyteArray answer = env->NewByteArray(b.GetSize()); |
388 if (answer == NULL) | 388 if (answer == NULL) |
389 { | 389 { |
390 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory); | 390 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_NotEnoughMemory); |
391 return NULL; | 391 return NULL; |
392 } | 392 } |
393 else | 393 else |
394 { | 394 { |
395 env->SetByteArrayRegion(answer, 0, b.GetSize(), reinterpret_cast<const jbyte*>(b.GetData())); | 395 env->SetByteArrayRegion(answer, 0, b.GetSize(), reinterpret_cast<const jbyte*>(b.GetData())); |
396 return answer; | 396 return answer; |
397 } | 397 } |
398 } | 398 } |
399 else | 399 else |
400 { | 400 { |
401 JavaEnvironment::ThrowException(env, code); | 401 JavaEnvironment::ThrowOrthancException(env, code); |
402 return NULL; | 402 return NULL; |
403 } | 403 } |
404 } | 404 } |
405 catch (std::runtime_error& e) | 405 catch (std::runtime_error& e) |
406 { | 406 { |
407 JavaEnvironment::ThrowException(env, e.what()); | 407 JavaEnvironment::ThrowOrthancException(env, e.what()); |
408 return NULL; | 408 return NULL; |
409 } | 409 } |
410 catch (...) | 410 catch (...) |
411 { | 411 { |
412 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 412 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
413 return NULL; | 413 return NULL; |
414 } | 414 } |
415 } | 415 } |
416 | 416 |
417 | 417 |
427 if (code == OrthancPluginErrorCode_Success) | 427 if (code == OrthancPluginErrorCode_Success) |
428 { | 428 { |
429 jbyteArray answer = env->NewByteArray(b.GetSize()); | 429 jbyteArray answer = env->NewByteArray(b.GetSize()); |
430 if (answer == NULL) | 430 if (answer == NULL) |
431 { | 431 { |
432 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory); | 432 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_NotEnoughMemory); |
433 return NULL; | 433 return NULL; |
434 } | 434 } |
435 else | 435 else |
436 { | 436 { |
437 env->SetByteArrayRegion(answer, 0, b.GetSize(), reinterpret_cast<const jbyte*>(b.GetData())); | 437 env->SetByteArrayRegion(answer, 0, b.GetSize(), reinterpret_cast<const jbyte*>(b.GetData())); |
438 return answer; | 438 return answer; |
439 } | 439 } |
440 } | 440 } |
441 else | 441 else |
442 { | 442 { |
443 JavaEnvironment::ThrowException(env, code); | 443 JavaEnvironment::ThrowOrthancException(env, code); |
444 return NULL; | 444 return NULL; |
445 } | 445 } |
446 } | 446 } |
447 catch (std::runtime_error& e) | 447 catch (std::runtime_error& e) |
448 { | 448 { |
449 JavaEnvironment::ThrowException(env, e.what()); | 449 JavaEnvironment::ThrowOrthancException(env, e.what()); |
450 return NULL; | 450 return NULL; |
451 } | 451 } |
452 catch (...) | 452 catch (...) |
453 { | 453 { |
454 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 454 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
455 return NULL; | 455 return NULL; |
456 } | 456 } |
457 } | 457 } |
458 | 458 |
459 | 459 |
464 JavaString c_arg0(env, arg0); | 464 JavaString c_arg0(env, arg0); |
465 OrthancString s(OrthancPluginLookupPatient(context_ | 465 OrthancString s(OrthancPluginLookupPatient(context_ |
466 , c_arg0.GetValue())); | 466 , c_arg0.GetValue())); |
467 if (s.GetValue() == NULL) | 467 if (s.GetValue() == NULL) |
468 { | 468 { |
469 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 469 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
470 return NULL; | 470 return NULL; |
471 } | 471 } |
472 else | 472 else |
473 { | 473 { |
474 jstring t = env->NewStringUTF(s.GetValue()); | 474 jstring t = env->NewStringUTF(s.GetValue()); |
475 if (t == NULL) | 475 if (t == NULL) |
476 { | 476 { |
477 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory); | 477 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_NotEnoughMemory); |
478 return NULL; | 478 return NULL; |
479 } | 479 } |
480 else | 480 else |
481 { | 481 { |
482 return t; | 482 return t; |
483 } | 483 } |
484 } | 484 } |
485 } | 485 } |
486 catch (std::runtime_error& e) | 486 catch (std::runtime_error& e) |
487 { | 487 { |
488 JavaEnvironment::ThrowException(env, e.what()); | 488 JavaEnvironment::ThrowOrthancException(env, e.what()); |
489 return NULL; | 489 return NULL; |
490 } | 490 } |
491 catch (...) | 491 catch (...) |
492 { | 492 { |
493 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 493 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
494 return NULL; | 494 return NULL; |
495 } | 495 } |
496 } | 496 } |
497 | 497 |
498 | 498 |
503 JavaString c_arg0(env, arg0); | 503 JavaString c_arg0(env, arg0); |
504 OrthancString s(OrthancPluginLookupStudy(context_ | 504 OrthancString s(OrthancPluginLookupStudy(context_ |
505 , c_arg0.GetValue())); | 505 , c_arg0.GetValue())); |
506 if (s.GetValue() == NULL) | 506 if (s.GetValue() == NULL) |
507 { | 507 { |
508 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 508 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
509 return NULL; | 509 return NULL; |
510 } | 510 } |
511 else | 511 else |
512 { | 512 { |
513 jstring t = env->NewStringUTF(s.GetValue()); | 513 jstring t = env->NewStringUTF(s.GetValue()); |
514 if (t == NULL) | 514 if (t == NULL) |
515 { | 515 { |
516 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory); | 516 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_NotEnoughMemory); |
517 return NULL; | 517 return NULL; |
518 } | 518 } |
519 else | 519 else |
520 { | 520 { |
521 return t; | 521 return t; |
522 } | 522 } |
523 } | 523 } |
524 } | 524 } |
525 catch (std::runtime_error& e) | 525 catch (std::runtime_error& e) |
526 { | 526 { |
527 JavaEnvironment::ThrowException(env, e.what()); | 527 JavaEnvironment::ThrowOrthancException(env, e.what()); |
528 return NULL; | 528 return NULL; |
529 } | 529 } |
530 catch (...) | 530 catch (...) |
531 { | 531 { |
532 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 532 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
533 return NULL; | 533 return NULL; |
534 } | 534 } |
535 } | 535 } |
536 | 536 |
537 | 537 |
542 JavaString c_arg0(env, arg0); | 542 JavaString c_arg0(env, arg0); |
543 OrthancString s(OrthancPluginLookupStudyWithAccessionNumber(context_ | 543 OrthancString s(OrthancPluginLookupStudyWithAccessionNumber(context_ |
544 , c_arg0.GetValue())); | 544 , c_arg0.GetValue())); |
545 if (s.GetValue() == NULL) | 545 if (s.GetValue() == NULL) |
546 { | 546 { |
547 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 547 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
548 return NULL; | 548 return NULL; |
549 } | 549 } |
550 else | 550 else |
551 { | 551 { |
552 jstring t = env->NewStringUTF(s.GetValue()); | 552 jstring t = env->NewStringUTF(s.GetValue()); |
553 if (t == NULL) | 553 if (t == NULL) |
554 { | 554 { |
555 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory); | 555 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_NotEnoughMemory); |
556 return NULL; | 556 return NULL; |
557 } | 557 } |
558 else | 558 else |
559 { | 559 { |
560 return t; | 560 return t; |
561 } | 561 } |
562 } | 562 } |
563 } | 563 } |
564 catch (std::runtime_error& e) | 564 catch (std::runtime_error& e) |
565 { | 565 { |
566 JavaEnvironment::ThrowException(env, e.what()); | 566 JavaEnvironment::ThrowOrthancException(env, e.what()); |
567 return NULL; | 567 return NULL; |
568 } | 568 } |
569 catch (...) | 569 catch (...) |
570 { | 570 { |
571 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 571 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
572 return NULL; | 572 return NULL; |
573 } | 573 } |
574 } | 574 } |
575 | 575 |
576 | 576 |
581 JavaString c_arg0(env, arg0); | 581 JavaString c_arg0(env, arg0); |
582 OrthancString s(OrthancPluginLookupSeries(context_ | 582 OrthancString s(OrthancPluginLookupSeries(context_ |
583 , c_arg0.GetValue())); | 583 , c_arg0.GetValue())); |
584 if (s.GetValue() == NULL) | 584 if (s.GetValue() == NULL) |
585 { | 585 { |
586 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 586 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
587 return NULL; | 587 return NULL; |
588 } | 588 } |
589 else | 589 else |
590 { | 590 { |
591 jstring t = env->NewStringUTF(s.GetValue()); | 591 jstring t = env->NewStringUTF(s.GetValue()); |
592 if (t == NULL) | 592 if (t == NULL) |
593 { | 593 { |
594 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory); | 594 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_NotEnoughMemory); |
595 return NULL; | 595 return NULL; |
596 } | 596 } |
597 else | 597 else |
598 { | 598 { |
599 return t; | 599 return t; |
600 } | 600 } |
601 } | 601 } |
602 } | 602 } |
603 catch (std::runtime_error& e) | 603 catch (std::runtime_error& e) |
604 { | 604 { |
605 JavaEnvironment::ThrowException(env, e.what()); | 605 JavaEnvironment::ThrowOrthancException(env, e.what()); |
606 return NULL; | 606 return NULL; |
607 } | 607 } |
608 catch (...) | 608 catch (...) |
609 { | 609 { |
610 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 610 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
611 return NULL; | 611 return NULL; |
612 } | 612 } |
613 } | 613 } |
614 | 614 |
615 | 615 |
620 JavaString c_arg0(env, arg0); | 620 JavaString c_arg0(env, arg0); |
621 OrthancString s(OrthancPluginLookupInstance(context_ | 621 OrthancString s(OrthancPluginLookupInstance(context_ |
622 , c_arg0.GetValue())); | 622 , c_arg0.GetValue())); |
623 if (s.GetValue() == NULL) | 623 if (s.GetValue() == NULL) |
624 { | 624 { |
625 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 625 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
626 return NULL; | 626 return NULL; |
627 } | 627 } |
628 else | 628 else |
629 { | 629 { |
630 jstring t = env->NewStringUTF(s.GetValue()); | 630 jstring t = env->NewStringUTF(s.GetValue()); |
631 if (t == NULL) | 631 if (t == NULL) |
632 { | 632 { |
633 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory); | 633 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_NotEnoughMemory); |
634 return NULL; | 634 return NULL; |
635 } | 635 } |
636 else | 636 else |
637 { | 637 { |
638 return t; | 638 return t; |
639 } | 639 } |
640 } | 640 } |
641 } | 641 } |
642 catch (std::runtime_error& e) | 642 catch (std::runtime_error& e) |
643 { | 643 { |
644 JavaEnvironment::ThrowException(env, e.what()); | 644 JavaEnvironment::ThrowOrthancException(env, e.what()); |
645 return NULL; | 645 return NULL; |
646 } | 646 } |
647 catch (...) | 647 catch (...) |
648 { | 648 { |
649 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 649 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
650 return NULL; | 650 return NULL; |
651 } | 651 } |
652 } | 652 } |
653 | 653 |
654 | 654 |
658 { | 658 { |
659 OrthancString s(OrthancPluginGetOrthancPath(context_ | 659 OrthancString s(OrthancPluginGetOrthancPath(context_ |
660 )); | 660 )); |
661 if (s.GetValue() == NULL) | 661 if (s.GetValue() == NULL) |
662 { | 662 { |
663 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 663 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
664 return NULL; | 664 return NULL; |
665 } | 665 } |
666 else | 666 else |
667 { | 667 { |
668 jstring t = env->NewStringUTF(s.GetValue()); | 668 jstring t = env->NewStringUTF(s.GetValue()); |
669 if (t == NULL) | 669 if (t == NULL) |
670 { | 670 { |
671 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory); | 671 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_NotEnoughMemory); |
672 return NULL; | 672 return NULL; |
673 } | 673 } |
674 else | 674 else |
675 { | 675 { |
676 return t; | 676 return t; |
677 } | 677 } |
678 } | 678 } |
679 } | 679 } |
680 catch (std::runtime_error& e) | 680 catch (std::runtime_error& e) |
681 { | 681 { |
682 JavaEnvironment::ThrowException(env, e.what()); | 682 JavaEnvironment::ThrowOrthancException(env, e.what()); |
683 return NULL; | 683 return NULL; |
684 } | 684 } |
685 catch (...) | 685 catch (...) |
686 { | 686 { |
687 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 687 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
688 return NULL; | 688 return NULL; |
689 } | 689 } |
690 } | 690 } |
691 | 691 |
692 | 692 |
696 { | 696 { |
697 OrthancString s(OrthancPluginGetOrthancDirectory(context_ | 697 OrthancString s(OrthancPluginGetOrthancDirectory(context_ |
698 )); | 698 )); |
699 if (s.GetValue() == NULL) | 699 if (s.GetValue() == NULL) |
700 { | 700 { |
701 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 701 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
702 return NULL; | 702 return NULL; |
703 } | 703 } |
704 else | 704 else |
705 { | 705 { |
706 jstring t = env->NewStringUTF(s.GetValue()); | 706 jstring t = env->NewStringUTF(s.GetValue()); |
707 if (t == NULL) | 707 if (t == NULL) |
708 { | 708 { |
709 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory); | 709 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_NotEnoughMemory); |
710 return NULL; | 710 return NULL; |
711 } | 711 } |
712 else | 712 else |
713 { | 713 { |
714 return t; | 714 return t; |
715 } | 715 } |
716 } | 716 } |
717 } | 717 } |
718 catch (std::runtime_error& e) | 718 catch (std::runtime_error& e) |
719 { | 719 { |
720 JavaEnvironment::ThrowException(env, e.what()); | 720 JavaEnvironment::ThrowOrthancException(env, e.what()); |
721 return NULL; | 721 return NULL; |
722 } | 722 } |
723 catch (...) | 723 catch (...) |
724 { | 724 { |
725 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 725 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
726 return NULL; | 726 return NULL; |
727 } | 727 } |
728 } | 728 } |
729 | 729 |
730 | 730 |
734 { | 734 { |
735 OrthancString s(OrthancPluginGetConfigurationPath(context_ | 735 OrthancString s(OrthancPluginGetConfigurationPath(context_ |
736 )); | 736 )); |
737 if (s.GetValue() == NULL) | 737 if (s.GetValue() == NULL) |
738 { | 738 { |
739 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 739 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
740 return NULL; | 740 return NULL; |
741 } | 741 } |
742 else | 742 else |
743 { | 743 { |
744 jstring t = env->NewStringUTF(s.GetValue()); | 744 jstring t = env->NewStringUTF(s.GetValue()); |
745 if (t == NULL) | 745 if (t == NULL) |
746 { | 746 { |
747 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory); | 747 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_NotEnoughMemory); |
748 return NULL; | 748 return NULL; |
749 } | 749 } |
750 else | 750 else |
751 { | 751 { |
752 return t; | 752 return t; |
753 } | 753 } |
754 } | 754 } |
755 } | 755 } |
756 catch (std::runtime_error& e) | 756 catch (std::runtime_error& e) |
757 { | 757 { |
758 JavaEnvironment::ThrowException(env, e.what()); | 758 JavaEnvironment::ThrowOrthancException(env, e.what()); |
759 return NULL; | 759 return NULL; |
760 } | 760 } |
761 catch (...) | 761 catch (...) |
762 { | 762 { |
763 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 763 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
764 return NULL; | 764 return NULL; |
765 } | 765 } |
766 } | 766 } |
767 | 767 |
768 | 768 |
774 OrthancPluginSetRootUri(context_ | 774 OrthancPluginSetRootUri(context_ |
775 , c_arg0.GetValue()); | 775 , c_arg0.GetValue()); |
776 } | 776 } |
777 catch (std::runtime_error& e) | 777 catch (std::runtime_error& e) |
778 { | 778 { |
779 JavaEnvironment::ThrowException(env, e.what()); | 779 JavaEnvironment::ThrowOrthancException(env, e.what()); |
780 } | 780 } |
781 catch (...) | 781 catch (...) |
782 { | 782 { |
783 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 783 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
784 } | 784 } |
785 } | 785 } |
786 | 786 |
787 | 787 |
788 JNIEXPORT void JNI_OrthancPluginSetDescription(JNIEnv* env, jobject sdkObject, jstring arg0) | 788 JNIEXPORT void JNI_OrthancPluginSetDescription(JNIEnv* env, jobject sdkObject, jstring arg0) |
793 OrthancPluginSetDescription(context_ | 793 OrthancPluginSetDescription(context_ |
794 , c_arg0.GetValue()); | 794 , c_arg0.GetValue()); |
795 } | 795 } |
796 catch (std::runtime_error& e) | 796 catch (std::runtime_error& e) |
797 { | 797 { |
798 JavaEnvironment::ThrowException(env, e.what()); | 798 JavaEnvironment::ThrowOrthancException(env, e.what()); |
799 } | 799 } |
800 catch (...) | 800 catch (...) |
801 { | 801 { |
802 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 802 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
803 } | 803 } |
804 } | 804 } |
805 | 805 |
806 | 806 |
807 JNIEXPORT void JNI_OrthancPluginExtendOrthancExplorer(JNIEnv* env, jobject sdkObject, jstring arg0) | 807 JNIEXPORT void JNI_OrthancPluginExtendOrthancExplorer(JNIEnv* env, jobject sdkObject, jstring arg0) |
812 OrthancPluginExtendOrthancExplorer(context_ | 812 OrthancPluginExtendOrthancExplorer(context_ |
813 , c_arg0.GetValue()); | 813 , c_arg0.GetValue()); |
814 } | 814 } |
815 catch (std::runtime_error& e) | 815 catch (std::runtime_error& e) |
816 { | 816 { |
817 JavaEnvironment::ThrowException(env, e.what()); | 817 JavaEnvironment::ThrowOrthancException(env, e.what()); |
818 } | 818 } |
819 catch (...) | 819 catch (...) |
820 { | 820 { |
821 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 821 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
822 } | 822 } |
823 } | 823 } |
824 | 824 |
825 | 825 |
826 JNIEXPORT jstring JNI_OrthancPluginGetGlobalProperty(JNIEnv* env, jobject sdkObject, jint arg0, jstring arg1) | 826 JNIEXPORT jstring JNI_OrthancPluginGetGlobalProperty(JNIEnv* env, jobject sdkObject, jint arg0, jstring arg1) |
830 JavaString c_arg1(env, arg1); | 830 JavaString c_arg1(env, arg1); |
831 OrthancString s(OrthancPluginGetGlobalProperty(context_ | 831 OrthancString s(OrthancPluginGetGlobalProperty(context_ |
832 , arg0, c_arg1.GetValue())); | 832 , arg0, c_arg1.GetValue())); |
833 if (s.GetValue() == NULL) | 833 if (s.GetValue() == NULL) |
834 { | 834 { |
835 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 835 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
836 return NULL; | 836 return NULL; |
837 } | 837 } |
838 else | 838 else |
839 { | 839 { |
840 jstring t = env->NewStringUTF(s.GetValue()); | 840 jstring t = env->NewStringUTF(s.GetValue()); |
841 if (t == NULL) | 841 if (t == NULL) |
842 { | 842 { |
843 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory); | 843 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_NotEnoughMemory); |
844 return NULL; | 844 return NULL; |
845 } | 845 } |
846 else | 846 else |
847 { | 847 { |
848 return t; | 848 return t; |
849 } | 849 } |
850 } | 850 } |
851 } | 851 } |
852 catch (std::runtime_error& e) | 852 catch (std::runtime_error& e) |
853 { | 853 { |
854 JavaEnvironment::ThrowException(env, e.what()); | 854 JavaEnvironment::ThrowOrthancException(env, e.what()); |
855 return NULL; | 855 return NULL; |
856 } | 856 } |
857 catch (...) | 857 catch (...) |
858 { | 858 { |
859 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 859 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
860 return NULL; | 860 return NULL; |
861 } | 861 } |
862 } | 862 } |
863 | 863 |
864 | 864 |
869 JavaString c_arg1(env, arg1); | 869 JavaString c_arg1(env, arg1); |
870 OrthancPluginErrorCode code = OrthancPluginSetGlobalProperty(context_ | 870 OrthancPluginErrorCode code = OrthancPluginSetGlobalProperty(context_ |
871 , arg0, c_arg1.GetValue()); | 871 , arg0, c_arg1.GetValue()); |
872 if (code != OrthancPluginErrorCode_Success) | 872 if (code != OrthancPluginErrorCode_Success) |
873 { | 873 { |
874 JavaEnvironment::ThrowException(env, code); | 874 JavaEnvironment::ThrowOrthancException(env, code); |
875 } | 875 } |
876 } | 876 } |
877 catch (std::runtime_error& e) | 877 catch (std::runtime_error& e) |
878 { | 878 { |
879 JavaEnvironment::ThrowException(env, e.what()); | 879 JavaEnvironment::ThrowOrthancException(env, e.what()); |
880 } | 880 } |
881 catch (...) | 881 catch (...) |
882 { | 882 { |
883 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 883 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
884 } | 884 } |
885 } | 885 } |
886 | 886 |
887 | 887 |
888 JNIEXPORT jint JNI_OrthancPluginGetCommandLineArgumentsCount(JNIEnv* env, jobject sdkObject) | 888 JNIEXPORT jint JNI_OrthancPluginGetCommandLineArgumentsCount(JNIEnv* env, jobject sdkObject) |
892 return OrthancPluginGetCommandLineArgumentsCount(context_ | 892 return OrthancPluginGetCommandLineArgumentsCount(context_ |
893 ); | 893 ); |
894 } | 894 } |
895 catch (std::runtime_error& e) | 895 catch (std::runtime_error& e) |
896 { | 896 { |
897 JavaEnvironment::ThrowException(env, e.what()); | 897 JavaEnvironment::ThrowOrthancException(env, e.what()); |
898 return 0; | 898 return 0; |
899 } | 899 } |
900 catch (...) | 900 catch (...) |
901 { | 901 { |
902 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 902 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
903 return 0; | 903 return 0; |
904 } | 904 } |
905 } | 905 } |
906 | 906 |
907 | 907 |
911 { | 911 { |
912 OrthancString s(OrthancPluginGetCommandLineArgument(context_ | 912 OrthancString s(OrthancPluginGetCommandLineArgument(context_ |
913 , arg0)); | 913 , arg0)); |
914 if (s.GetValue() == NULL) | 914 if (s.GetValue() == NULL) |
915 { | 915 { |
916 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 916 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
917 return NULL; | 917 return NULL; |
918 } | 918 } |
919 else | 919 else |
920 { | 920 { |
921 jstring t = env->NewStringUTF(s.GetValue()); | 921 jstring t = env->NewStringUTF(s.GetValue()); |
922 if (t == NULL) | 922 if (t == NULL) |
923 { | 923 { |
924 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory); | 924 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_NotEnoughMemory); |
925 return NULL; | 925 return NULL; |
926 } | 926 } |
927 else | 927 else |
928 { | 928 { |
929 return t; | 929 return t; |
930 } | 930 } |
931 } | 931 } |
932 } | 932 } |
933 catch (std::runtime_error& e) | 933 catch (std::runtime_error& e) |
934 { | 934 { |
935 JavaEnvironment::ThrowException(env, e.what()); | 935 JavaEnvironment::ThrowOrthancException(env, e.what()); |
936 return NULL; | 936 return NULL; |
937 } | 937 } |
938 catch (...) | 938 catch (...) |
939 { | 939 { |
940 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 940 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
941 return NULL; | 941 return NULL; |
942 } | 942 } |
943 } | 943 } |
944 | 944 |
945 | 945 |
950 return OrthancPluginGetExpectedDatabaseVersion(context_ | 950 return OrthancPluginGetExpectedDatabaseVersion(context_ |
951 ); | 951 ); |
952 } | 952 } |
953 catch (std::runtime_error& e) | 953 catch (std::runtime_error& e) |
954 { | 954 { |
955 JavaEnvironment::ThrowException(env, e.what()); | 955 JavaEnvironment::ThrowOrthancException(env, e.what()); |
956 return 0; | 956 return 0; |
957 } | 957 } |
958 catch (...) | 958 catch (...) |
959 { | 959 { |
960 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 960 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
961 return 0; | 961 return 0; |
962 } | 962 } |
963 } | 963 } |
964 | 964 |
965 | 965 |
969 { | 969 { |
970 OrthancString s(OrthancPluginGetConfiguration(context_ | 970 OrthancString s(OrthancPluginGetConfiguration(context_ |
971 )); | 971 )); |
972 if (s.GetValue() == NULL) | 972 if (s.GetValue() == NULL) |
973 { | 973 { |
974 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 974 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
975 return NULL; | 975 return NULL; |
976 } | 976 } |
977 else | 977 else |
978 { | 978 { |
979 jstring t = env->NewStringUTF(s.GetValue()); | 979 jstring t = env->NewStringUTF(s.GetValue()); |
980 if (t == NULL) | 980 if (t == NULL) |
981 { | 981 { |
982 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory); | 982 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_NotEnoughMemory); |
983 return NULL; | 983 return NULL; |
984 } | 984 } |
985 else | 985 else |
986 { | 986 { |
987 return t; | 987 return t; |
988 } | 988 } |
989 } | 989 } |
990 } | 990 } |
991 catch (std::runtime_error& e) | 991 catch (std::runtime_error& e) |
992 { | 992 { |
993 JavaEnvironment::ThrowException(env, e.what()); | 993 JavaEnvironment::ThrowOrthancException(env, e.what()); |
994 return NULL; | 994 return NULL; |
995 } | 995 } |
996 catch (...) | 996 catch (...) |
997 { | 997 { |
998 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 998 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
999 return NULL; | 999 return NULL; |
1000 } | 1000 } |
1001 } | 1001 } |
1002 | 1002 |
1003 | 1003 |
1012 if (code == OrthancPluginErrorCode_Success) | 1012 if (code == OrthancPluginErrorCode_Success) |
1013 { | 1013 { |
1014 jbyteArray answer = env->NewByteArray(b.GetSize()); | 1014 jbyteArray answer = env->NewByteArray(b.GetSize()); |
1015 if (answer == NULL) | 1015 if (answer == NULL) |
1016 { | 1016 { |
1017 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory); | 1017 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_NotEnoughMemory); |
1018 return NULL; | 1018 return NULL; |
1019 } | 1019 } |
1020 else | 1020 else |
1021 { | 1021 { |
1022 env->SetByteArrayRegion(answer, 0, b.GetSize(), reinterpret_cast<const jbyte*>(b.GetData())); | 1022 env->SetByteArrayRegion(answer, 0, b.GetSize(), reinterpret_cast<const jbyte*>(b.GetData())); |
1023 return answer; | 1023 return answer; |
1024 } | 1024 } |
1025 } | 1025 } |
1026 else | 1026 else |
1027 { | 1027 { |
1028 JavaEnvironment::ThrowException(env, code); | 1028 JavaEnvironment::ThrowOrthancException(env, code); |
1029 return NULL; | 1029 return NULL; |
1030 } | 1030 } |
1031 } | 1031 } |
1032 catch (std::runtime_error& e) | 1032 catch (std::runtime_error& e) |
1033 { | 1033 { |
1034 JavaEnvironment::ThrowException(env, e.what()); | 1034 JavaEnvironment::ThrowOrthancException(env, e.what()); |
1035 return NULL; | 1035 return NULL; |
1036 } | 1036 } |
1037 catch (...) | 1037 catch (...) |
1038 { | 1038 { |
1039 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 1039 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
1040 return NULL; | 1040 return NULL; |
1041 } | 1041 } |
1042 } | 1042 } |
1043 | 1043 |
1044 | 1044 |
1053 if (code == OrthancPluginErrorCode_Success) | 1053 if (code == OrthancPluginErrorCode_Success) |
1054 { | 1054 { |
1055 jbyteArray answer = env->NewByteArray(b.GetSize()); | 1055 jbyteArray answer = env->NewByteArray(b.GetSize()); |
1056 if (answer == NULL) | 1056 if (answer == NULL) |
1057 { | 1057 { |
1058 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory); | 1058 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_NotEnoughMemory); |
1059 return NULL; | 1059 return NULL; |
1060 } | 1060 } |
1061 else | 1061 else |
1062 { | 1062 { |
1063 env->SetByteArrayRegion(answer, 0, b.GetSize(), reinterpret_cast<const jbyte*>(b.GetData())); | 1063 env->SetByteArrayRegion(answer, 0, b.GetSize(), reinterpret_cast<const jbyte*>(b.GetData())); |
1064 return answer; | 1064 return answer; |
1065 } | 1065 } |
1066 } | 1066 } |
1067 else | 1067 else |
1068 { | 1068 { |
1069 JavaEnvironment::ThrowException(env, code); | 1069 JavaEnvironment::ThrowOrthancException(env, code); |
1070 return NULL; | 1070 return NULL; |
1071 } | 1071 } |
1072 } | 1072 } |
1073 catch (std::runtime_error& e) | 1073 catch (std::runtime_error& e) |
1074 { | 1074 { |
1075 JavaEnvironment::ThrowException(env, e.what()); | 1075 JavaEnvironment::ThrowOrthancException(env, e.what()); |
1076 return NULL; | 1076 return NULL; |
1077 } | 1077 } |
1078 catch (...) | 1078 catch (...) |
1079 { | 1079 { |
1080 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 1080 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
1081 return NULL; | 1081 return NULL; |
1082 } | 1082 } |
1083 } | 1083 } |
1084 | 1084 |
1085 | 1085 |
1091 JavaBytes c_arg1(env, arg1); | 1091 JavaBytes c_arg1(env, arg1); |
1092 OrthancPluginErrorCode code = OrthancPluginWriteFile(context_ | 1092 OrthancPluginErrorCode code = OrthancPluginWriteFile(context_ |
1093 , c_arg0.GetValue(), c_arg1.GetData(), c_arg1.GetSize()); | 1093 , c_arg0.GetValue(), c_arg1.GetData(), c_arg1.GetSize()); |
1094 if (code != OrthancPluginErrorCode_Success) | 1094 if (code != OrthancPluginErrorCode_Success) |
1095 { | 1095 { |
1096 JavaEnvironment::ThrowException(env, code); | 1096 JavaEnvironment::ThrowOrthancException(env, code); |
1097 } | 1097 } |
1098 } | 1098 } |
1099 catch (std::runtime_error& e) | 1099 catch (std::runtime_error& e) |
1100 { | 1100 { |
1101 JavaEnvironment::ThrowException(env, e.what()); | 1101 JavaEnvironment::ThrowOrthancException(env, e.what()); |
1102 } | 1102 } |
1103 catch (...) | 1103 catch (...) |
1104 { | 1104 { |
1105 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 1105 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
1106 } | 1106 } |
1107 } | 1107 } |
1108 | 1108 |
1109 | 1109 |
1110 JNIEXPORT jstring JNI_OrthancPluginGetErrorDescription(JNIEnv* env, jobject sdkObject, jint arg0) | 1110 JNIEXPORT jstring JNI_OrthancPluginGetErrorDescription(JNIEnv* env, jobject sdkObject, jint arg0) |
1113 { | 1113 { |
1114 const char* s = OrthancPluginGetErrorDescription(context_ | 1114 const char* s = OrthancPluginGetErrorDescription(context_ |
1115 , static_cast<OrthancPluginErrorCode>(arg0)); | 1115 , static_cast<OrthancPluginErrorCode>(arg0)); |
1116 if (s == NULL) | 1116 if (s == NULL) |
1117 { | 1117 { |
1118 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 1118 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
1119 return NULL; | 1119 return NULL; |
1120 } | 1120 } |
1121 else | 1121 else |
1122 { | 1122 { |
1123 return env->NewStringUTF(s); | 1123 return env->NewStringUTF(s); |
1124 } | 1124 } |
1125 } | 1125 } |
1126 catch (std::runtime_error& e) | 1126 catch (std::runtime_error& e) |
1127 { | 1127 { |
1128 JavaEnvironment::ThrowException(env, e.what()); | 1128 JavaEnvironment::ThrowOrthancException(env, e.what()); |
1129 return NULL; | 1129 return NULL; |
1130 } | 1130 } |
1131 catch (...) | 1131 catch (...) |
1132 { | 1132 { |
1133 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 1133 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
1134 return NULL; | 1134 return NULL; |
1135 } | 1135 } |
1136 } | 1136 } |
1137 | 1137 |
1138 | 1138 |
1143 JavaBytes c_arg0(env, arg0); | 1143 JavaBytes c_arg0(env, arg0); |
1144 OrthancPluginImage* answer = OrthancPluginUncompressImage(context_ | 1144 OrthancPluginImage* answer = OrthancPluginUncompressImage(context_ |
1145 , c_arg0.GetData(), c_arg0.GetSize(), static_cast<OrthancPluginImageFormat>(arg2)); | 1145 , c_arg0.GetData(), c_arg0.GetSize(), static_cast<OrthancPluginImageFormat>(arg2)); |
1146 if (answer == NULL) | 1146 if (answer == NULL) |
1147 { | 1147 { |
1148 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 1148 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
1149 return 0; | 1149 return 0; |
1150 } | 1150 } |
1151 else | 1151 else |
1152 { | 1152 { |
1153 return reinterpret_cast<intptr_t>(answer); | 1153 return reinterpret_cast<intptr_t>(answer); |
1154 } | 1154 } |
1155 } | 1155 } |
1156 catch (std::runtime_error& e) | 1156 catch (std::runtime_error& e) |
1157 { | 1157 { |
1158 JavaEnvironment::ThrowException(env, e.what()); | 1158 JavaEnvironment::ThrowOrthancException(env, e.what()); |
1159 return 0; | 1159 return 0; |
1160 } | 1160 } |
1161 catch (...) | 1161 catch (...) |
1162 { | 1162 { |
1163 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 1163 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
1164 return 0; | 1164 return 0; |
1165 } | 1165 } |
1166 } | 1166 } |
1167 | 1167 |
1168 | 1168 |
1177 if (code == OrthancPluginErrorCode_Success) | 1177 if (code == OrthancPluginErrorCode_Success) |
1178 { | 1178 { |
1179 jbyteArray answer = env->NewByteArray(b.GetSize()); | 1179 jbyteArray answer = env->NewByteArray(b.GetSize()); |
1180 if (answer == NULL) | 1180 if (answer == NULL) |
1181 { | 1181 { |
1182 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory); | 1182 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_NotEnoughMemory); |
1183 return NULL; | 1183 return NULL; |
1184 } | 1184 } |
1185 else | 1185 else |
1186 { | 1186 { |
1187 env->SetByteArrayRegion(answer, 0, b.GetSize(), reinterpret_cast<const jbyte*>(b.GetData())); | 1187 env->SetByteArrayRegion(answer, 0, b.GetSize(), reinterpret_cast<const jbyte*>(b.GetData())); |
1188 return answer; | 1188 return answer; |
1189 } | 1189 } |
1190 } | 1190 } |
1191 else | 1191 else |
1192 { | 1192 { |
1193 JavaEnvironment::ThrowException(env, code); | 1193 JavaEnvironment::ThrowOrthancException(env, code); |
1194 return NULL; | 1194 return NULL; |
1195 } | 1195 } |
1196 } | 1196 } |
1197 catch (std::runtime_error& e) | 1197 catch (std::runtime_error& e) |
1198 { | 1198 { |
1199 JavaEnvironment::ThrowException(env, e.what()); | 1199 JavaEnvironment::ThrowOrthancException(env, e.what()); |
1200 return NULL; | 1200 return NULL; |
1201 } | 1201 } |
1202 catch (...) | 1202 catch (...) |
1203 { | 1203 { |
1204 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 1204 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
1205 return NULL; | 1205 return NULL; |
1206 } | 1206 } |
1207 } | 1207 } |
1208 | 1208 |
1209 | 1209 |
1218 if (code == OrthancPluginErrorCode_Success) | 1218 if (code == OrthancPluginErrorCode_Success) |
1219 { | 1219 { |
1220 jbyteArray answer = env->NewByteArray(b.GetSize()); | 1220 jbyteArray answer = env->NewByteArray(b.GetSize()); |
1221 if (answer == NULL) | 1221 if (answer == NULL) |
1222 { | 1222 { |
1223 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory); | 1223 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_NotEnoughMemory); |
1224 return NULL; | 1224 return NULL; |
1225 } | 1225 } |
1226 else | 1226 else |
1227 { | 1227 { |
1228 env->SetByteArrayRegion(answer, 0, b.GetSize(), reinterpret_cast<const jbyte*>(b.GetData())); | 1228 env->SetByteArrayRegion(answer, 0, b.GetSize(), reinterpret_cast<const jbyte*>(b.GetData())); |
1229 return answer; | 1229 return answer; |
1230 } | 1230 } |
1231 } | 1231 } |
1232 else | 1232 else |
1233 { | 1233 { |
1234 JavaEnvironment::ThrowException(env, code); | 1234 JavaEnvironment::ThrowOrthancException(env, code); |
1235 return NULL; | 1235 return NULL; |
1236 } | 1236 } |
1237 } | 1237 } |
1238 catch (std::runtime_error& e) | 1238 catch (std::runtime_error& e) |
1239 { | 1239 { |
1240 JavaEnvironment::ThrowException(env, e.what()); | 1240 JavaEnvironment::ThrowOrthancException(env, e.what()); |
1241 return NULL; | 1241 return NULL; |
1242 } | 1242 } |
1243 catch (...) | 1243 catch (...) |
1244 { | 1244 { |
1245 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 1245 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
1246 return NULL; | 1246 return NULL; |
1247 } | 1247 } |
1248 } | 1248 } |
1249 | 1249 |
1250 | 1250 |
1261 if (code == OrthancPluginErrorCode_Success) | 1261 if (code == OrthancPluginErrorCode_Success) |
1262 { | 1262 { |
1263 jbyteArray answer = env->NewByteArray(b.GetSize()); | 1263 jbyteArray answer = env->NewByteArray(b.GetSize()); |
1264 if (answer == NULL) | 1264 if (answer == NULL) |
1265 { | 1265 { |
1266 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory); | 1266 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_NotEnoughMemory); |
1267 return NULL; | 1267 return NULL; |
1268 } | 1268 } |
1269 else | 1269 else |
1270 { | 1270 { |
1271 env->SetByteArrayRegion(answer, 0, b.GetSize(), reinterpret_cast<const jbyte*>(b.GetData())); | 1271 env->SetByteArrayRegion(answer, 0, b.GetSize(), reinterpret_cast<const jbyte*>(b.GetData())); |
1272 return answer; | 1272 return answer; |
1273 } | 1273 } |
1274 } | 1274 } |
1275 else | 1275 else |
1276 { | 1276 { |
1277 JavaEnvironment::ThrowException(env, code); | 1277 JavaEnvironment::ThrowOrthancException(env, code); |
1278 return NULL; | 1278 return NULL; |
1279 } | 1279 } |
1280 } | 1280 } |
1281 catch (std::runtime_error& e) | 1281 catch (std::runtime_error& e) |
1282 { | 1282 { |
1283 JavaEnvironment::ThrowException(env, e.what()); | 1283 JavaEnvironment::ThrowOrthancException(env, e.what()); |
1284 return NULL; | 1284 return NULL; |
1285 } | 1285 } |
1286 catch (...) | 1286 catch (...) |
1287 { | 1287 { |
1288 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 1288 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
1289 return NULL; | 1289 return NULL; |
1290 } | 1290 } |
1291 } | 1291 } |
1292 | 1292 |
1293 | 1293 |
1305 if (code == OrthancPluginErrorCode_Success) | 1305 if (code == OrthancPluginErrorCode_Success) |
1306 { | 1306 { |
1307 jbyteArray answer = env->NewByteArray(b.GetSize()); | 1307 jbyteArray answer = env->NewByteArray(b.GetSize()); |
1308 if (answer == NULL) | 1308 if (answer == NULL) |
1309 { | 1309 { |
1310 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory); | 1310 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_NotEnoughMemory); |
1311 return NULL; | 1311 return NULL; |
1312 } | 1312 } |
1313 else | 1313 else |
1314 { | 1314 { |
1315 env->SetByteArrayRegion(answer, 0, b.GetSize(), reinterpret_cast<const jbyte*>(b.GetData())); | 1315 env->SetByteArrayRegion(answer, 0, b.GetSize(), reinterpret_cast<const jbyte*>(b.GetData())); |
1316 return answer; | 1316 return answer; |
1317 } | 1317 } |
1318 } | 1318 } |
1319 else | 1319 else |
1320 { | 1320 { |
1321 JavaEnvironment::ThrowException(env, code); | 1321 JavaEnvironment::ThrowOrthancException(env, code); |
1322 return NULL; | 1322 return NULL; |
1323 } | 1323 } |
1324 } | 1324 } |
1325 catch (std::runtime_error& e) | 1325 catch (std::runtime_error& e) |
1326 { | 1326 { |
1327 JavaEnvironment::ThrowException(env, e.what()); | 1327 JavaEnvironment::ThrowOrthancException(env, e.what()); |
1328 return NULL; | 1328 return NULL; |
1329 } | 1329 } |
1330 catch (...) | 1330 catch (...) |
1331 { | 1331 { |
1332 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 1332 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
1333 return NULL; | 1333 return NULL; |
1334 } | 1334 } |
1335 } | 1335 } |
1336 | 1336 |
1337 | 1337 |
1349 if (code == OrthancPluginErrorCode_Success) | 1349 if (code == OrthancPluginErrorCode_Success) |
1350 { | 1350 { |
1351 jbyteArray answer = env->NewByteArray(b.GetSize()); | 1351 jbyteArray answer = env->NewByteArray(b.GetSize()); |
1352 if (answer == NULL) | 1352 if (answer == NULL) |
1353 { | 1353 { |
1354 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory); | 1354 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_NotEnoughMemory); |
1355 return NULL; | 1355 return NULL; |
1356 } | 1356 } |
1357 else | 1357 else |
1358 { | 1358 { |
1359 env->SetByteArrayRegion(answer, 0, b.GetSize(), reinterpret_cast<const jbyte*>(b.GetData())); | 1359 env->SetByteArrayRegion(answer, 0, b.GetSize(), reinterpret_cast<const jbyte*>(b.GetData())); |
1360 return answer; | 1360 return answer; |
1361 } | 1361 } |
1362 } | 1362 } |
1363 else | 1363 else |
1364 { | 1364 { |
1365 JavaEnvironment::ThrowException(env, code); | 1365 JavaEnvironment::ThrowOrthancException(env, code); |
1366 return NULL; | 1366 return NULL; |
1367 } | 1367 } |
1368 } | 1368 } |
1369 catch (std::runtime_error& e) | 1369 catch (std::runtime_error& e) |
1370 { | 1370 { |
1371 JavaEnvironment::ThrowException(env, e.what()); | 1371 JavaEnvironment::ThrowOrthancException(env, e.what()); |
1372 return NULL; | 1372 return NULL; |
1373 } | 1373 } |
1374 catch (...) | 1374 catch (...) |
1375 { | 1375 { |
1376 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 1376 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
1377 return NULL; | 1377 return NULL; |
1378 } | 1378 } |
1379 } | 1379 } |
1380 | 1380 |
1381 | 1381 |
1388 JavaString c_arg2(env, arg2); | 1388 JavaString c_arg2(env, arg2); |
1389 OrthancPluginErrorCode code = OrthancPluginHttpDelete(context_ | 1389 OrthancPluginErrorCode code = OrthancPluginHttpDelete(context_ |
1390 , c_arg0.GetValue(), c_arg1.GetValue(), c_arg2.GetValue()); | 1390 , c_arg0.GetValue(), c_arg1.GetValue(), c_arg2.GetValue()); |
1391 if (code != OrthancPluginErrorCode_Success) | 1391 if (code != OrthancPluginErrorCode_Success) |
1392 { | 1392 { |
1393 JavaEnvironment::ThrowException(env, code); | 1393 JavaEnvironment::ThrowOrthancException(env, code); |
1394 } | 1394 } |
1395 } | 1395 } |
1396 catch (std::runtime_error& e) | 1396 catch (std::runtime_error& e) |
1397 { | 1397 { |
1398 JavaEnvironment::ThrowException(env, e.what()); | 1398 JavaEnvironment::ThrowOrthancException(env, e.what()); |
1399 } | 1399 } |
1400 catch (...) | 1400 catch (...) |
1401 { | 1401 { |
1402 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 1402 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
1403 } | 1403 } |
1404 } | 1404 } |
1405 | 1405 |
1406 | 1406 |
1407 JNIEXPORT jint JNI_OrthancPluginGetFontsCount(JNIEnv* env, jobject sdkObject) | 1407 JNIEXPORT jint JNI_OrthancPluginGetFontsCount(JNIEnv* env, jobject sdkObject) |
1411 return OrthancPluginGetFontsCount(context_ | 1411 return OrthancPluginGetFontsCount(context_ |
1412 ); | 1412 ); |
1413 } | 1413 } |
1414 catch (std::runtime_error& e) | 1414 catch (std::runtime_error& e) |
1415 { | 1415 { |
1416 JavaEnvironment::ThrowException(env, e.what()); | 1416 JavaEnvironment::ThrowOrthancException(env, e.what()); |
1417 return 0; | 1417 return 0; |
1418 } | 1418 } |
1419 catch (...) | 1419 catch (...) |
1420 { | 1420 { |
1421 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 1421 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
1422 return 0; | 1422 return 0; |
1423 } | 1423 } |
1424 } | 1424 } |
1425 | 1425 |
1426 | 1426 |
1430 { | 1430 { |
1431 const char* s = OrthancPluginGetFontName(context_ | 1431 const char* s = OrthancPluginGetFontName(context_ |
1432 , arg0); | 1432 , arg0); |
1433 if (s == NULL) | 1433 if (s == NULL) |
1434 { | 1434 { |
1435 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 1435 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
1436 return NULL; | 1436 return NULL; |
1437 } | 1437 } |
1438 else | 1438 else |
1439 { | 1439 { |
1440 return env->NewStringUTF(s); | 1440 return env->NewStringUTF(s); |
1441 } | 1441 } |
1442 } | 1442 } |
1443 catch (std::runtime_error& e) | 1443 catch (std::runtime_error& e) |
1444 { | 1444 { |
1445 JavaEnvironment::ThrowException(env, e.what()); | 1445 JavaEnvironment::ThrowOrthancException(env, e.what()); |
1446 return NULL; | 1446 return NULL; |
1447 } | 1447 } |
1448 catch (...) | 1448 catch (...) |
1449 { | 1449 { |
1450 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 1450 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
1451 return NULL; | 1451 return NULL; |
1452 } | 1452 } |
1453 } | 1453 } |
1454 | 1454 |
1455 | 1455 |
1460 return OrthancPluginGetFontSize(context_ | 1460 return OrthancPluginGetFontSize(context_ |
1461 , arg0); | 1461 , arg0); |
1462 } | 1462 } |
1463 catch (std::runtime_error& e) | 1463 catch (std::runtime_error& e) |
1464 { | 1464 { |
1465 JavaEnvironment::ThrowException(env, e.what()); | 1465 JavaEnvironment::ThrowOrthancException(env, e.what()); |
1466 return 0; | 1466 return 0; |
1467 } | 1467 } |
1468 catch (...) | 1468 catch (...) |
1469 { | 1469 { |
1470 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 1470 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
1471 return 0; | 1471 return 0; |
1472 } | 1472 } |
1473 } | 1473 } |
1474 | 1474 |
1475 | 1475 |
1480 JavaString c_arg2(env, arg2); | 1480 JavaString c_arg2(env, arg2); |
1481 OrthancPluginErrorCode code = OrthancPluginRegisterErrorCode(context_ | 1481 OrthancPluginErrorCode code = OrthancPluginRegisterErrorCode(context_ |
1482 , arg0, arg1, c_arg2.GetValue()); | 1482 , arg0, arg1, c_arg2.GetValue()); |
1483 if (code != OrthancPluginErrorCode_Success) | 1483 if (code != OrthancPluginErrorCode_Success) |
1484 { | 1484 { |
1485 JavaEnvironment::ThrowException(env, code); | 1485 JavaEnvironment::ThrowOrthancException(env, code); |
1486 } | 1486 } |
1487 } | 1487 } |
1488 catch (std::runtime_error& e) | 1488 catch (std::runtime_error& e) |
1489 { | 1489 { |
1490 JavaEnvironment::ThrowException(env, e.what()); | 1490 JavaEnvironment::ThrowOrthancException(env, e.what()); |
1491 } | 1491 } |
1492 catch (...) | 1492 catch (...) |
1493 { | 1493 { |
1494 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 1494 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
1495 } | 1495 } |
1496 } | 1496 } |
1497 | 1497 |
1498 | 1498 |
1499 JNIEXPORT void JNI_OrthancPluginRegisterDictionaryTag(JNIEnv* env, jobject sdkObject, jshort arg0, jshort arg1, jint arg2, jstring arg3, jint arg4, jint arg5) | 1499 JNIEXPORT void JNI_OrthancPluginRegisterDictionaryTag(JNIEnv* env, jobject sdkObject, jshort arg0, jshort arg1, jint arg2, jstring arg3, jint arg4, jint arg5) |
1503 JavaString c_arg3(env, arg3); | 1503 JavaString c_arg3(env, arg3); |
1504 OrthancPluginErrorCode code = OrthancPluginRegisterDictionaryTag(context_ | 1504 OrthancPluginErrorCode code = OrthancPluginRegisterDictionaryTag(context_ |
1505 , arg0, arg1, static_cast<OrthancPluginValueRepresentation>(arg2), c_arg3.GetValue(), arg4, arg5); | 1505 , arg0, arg1, static_cast<OrthancPluginValueRepresentation>(arg2), c_arg3.GetValue(), arg4, arg5); |
1506 if (code != OrthancPluginErrorCode_Success) | 1506 if (code != OrthancPluginErrorCode_Success) |
1507 { | 1507 { |
1508 JavaEnvironment::ThrowException(env, code); | 1508 JavaEnvironment::ThrowOrthancException(env, code); |
1509 } | 1509 } |
1510 } | 1510 } |
1511 catch (std::runtime_error& e) | 1511 catch (std::runtime_error& e) |
1512 { | 1512 { |
1513 JavaEnvironment::ThrowException(env, e.what()); | 1513 JavaEnvironment::ThrowOrthancException(env, e.what()); |
1514 } | 1514 } |
1515 catch (...) | 1515 catch (...) |
1516 { | 1516 { |
1517 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 1517 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
1518 } | 1518 } |
1519 } | 1519 } |
1520 | 1520 |
1521 | 1521 |
1522 JNIEXPORT void JNI_OrthancPluginRegisterPrivateDictionaryTag(JNIEnv* env, jobject sdkObject, jshort arg0, jshort arg1, jint arg2, jstring arg3, jint arg4, jint arg5, jstring arg6) | 1522 JNIEXPORT void JNI_OrthancPluginRegisterPrivateDictionaryTag(JNIEnv* env, jobject sdkObject, jshort arg0, jshort arg1, jint arg2, jstring arg3, jint arg4, jint arg5, jstring arg6) |
1527 JavaString c_arg6(env, arg6); | 1527 JavaString c_arg6(env, arg6); |
1528 OrthancPluginErrorCode code = OrthancPluginRegisterPrivateDictionaryTag(context_ | 1528 OrthancPluginErrorCode code = OrthancPluginRegisterPrivateDictionaryTag(context_ |
1529 , arg0, arg1, static_cast<OrthancPluginValueRepresentation>(arg2), c_arg3.GetValue(), arg4, arg5, c_arg6.GetValue()); | 1529 , arg0, arg1, static_cast<OrthancPluginValueRepresentation>(arg2), c_arg3.GetValue(), arg4, arg5, c_arg6.GetValue()); |
1530 if (code != OrthancPluginErrorCode_Success) | 1530 if (code != OrthancPluginErrorCode_Success) |
1531 { | 1531 { |
1532 JavaEnvironment::ThrowException(env, code); | 1532 JavaEnvironment::ThrowOrthancException(env, code); |
1533 } | 1533 } |
1534 } | 1534 } |
1535 catch (std::runtime_error& e) | 1535 catch (std::runtime_error& e) |
1536 { | 1536 { |
1537 JavaEnvironment::ThrowException(env, e.what()); | 1537 JavaEnvironment::ThrowOrthancException(env, e.what()); |
1538 } | 1538 } |
1539 catch (...) | 1539 catch (...) |
1540 { | 1540 { |
1541 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 1541 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
1542 } | 1542 } |
1543 } | 1543 } |
1544 | 1544 |
1545 | 1545 |
1546 JNIEXPORT jstring JNI_OrthancPluginDicomBufferToJson(JNIEnv* env, jobject sdkObject, jbyteArray arg0, jint arg2, jint arg3, jint arg4) | 1546 JNIEXPORT jstring JNI_OrthancPluginDicomBufferToJson(JNIEnv* env, jobject sdkObject, jbyteArray arg0, jint arg2, jint arg3, jint arg4) |
1550 JavaBytes c_arg0(env, arg0); | 1550 JavaBytes c_arg0(env, arg0); |
1551 OrthancString s(OrthancPluginDicomBufferToJson(context_ | 1551 OrthancString s(OrthancPluginDicomBufferToJson(context_ |
1552 , c_arg0.GetData(), c_arg0.GetSize(), static_cast<OrthancPluginDicomToJsonFormat>(arg2), static_cast<OrthancPluginDicomToJsonFlags>(arg3), arg4)); | 1552 , c_arg0.GetData(), c_arg0.GetSize(), static_cast<OrthancPluginDicomToJsonFormat>(arg2), static_cast<OrthancPluginDicomToJsonFlags>(arg3), arg4)); |
1553 if (s.GetValue() == NULL) | 1553 if (s.GetValue() == NULL) |
1554 { | 1554 { |
1555 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 1555 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
1556 return NULL; | 1556 return NULL; |
1557 } | 1557 } |
1558 else | 1558 else |
1559 { | 1559 { |
1560 jstring t = env->NewStringUTF(s.GetValue()); | 1560 jstring t = env->NewStringUTF(s.GetValue()); |
1561 if (t == NULL) | 1561 if (t == NULL) |
1562 { | 1562 { |
1563 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory); | 1563 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_NotEnoughMemory); |
1564 return NULL; | 1564 return NULL; |
1565 } | 1565 } |
1566 else | 1566 else |
1567 { | 1567 { |
1568 return t; | 1568 return t; |
1569 } | 1569 } |
1570 } | 1570 } |
1571 } | 1571 } |
1572 catch (std::runtime_error& e) | 1572 catch (std::runtime_error& e) |
1573 { | 1573 { |
1574 JavaEnvironment::ThrowException(env, e.what()); | 1574 JavaEnvironment::ThrowOrthancException(env, e.what()); |
1575 return NULL; | 1575 return NULL; |
1576 } | 1576 } |
1577 catch (...) | 1577 catch (...) |
1578 { | 1578 { |
1579 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 1579 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
1580 return NULL; | 1580 return NULL; |
1581 } | 1581 } |
1582 } | 1582 } |
1583 | 1583 |
1584 | 1584 |
1589 JavaString c_arg0(env, arg0); | 1589 JavaString c_arg0(env, arg0); |
1590 OrthancString s(OrthancPluginDicomInstanceToJson(context_ | 1590 OrthancString s(OrthancPluginDicomInstanceToJson(context_ |
1591 , c_arg0.GetValue(), static_cast<OrthancPluginDicomToJsonFormat>(arg1), static_cast<OrthancPluginDicomToJsonFlags>(arg2), arg3)); | 1591 , c_arg0.GetValue(), static_cast<OrthancPluginDicomToJsonFormat>(arg1), static_cast<OrthancPluginDicomToJsonFlags>(arg2), arg3)); |
1592 if (s.GetValue() == NULL) | 1592 if (s.GetValue() == NULL) |
1593 { | 1593 { |
1594 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 1594 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
1595 return NULL; | 1595 return NULL; |
1596 } | 1596 } |
1597 else | 1597 else |
1598 { | 1598 { |
1599 jstring t = env->NewStringUTF(s.GetValue()); | 1599 jstring t = env->NewStringUTF(s.GetValue()); |
1600 if (t == NULL) | 1600 if (t == NULL) |
1601 { | 1601 { |
1602 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory); | 1602 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_NotEnoughMemory); |
1603 return NULL; | 1603 return NULL; |
1604 } | 1604 } |
1605 else | 1605 else |
1606 { | 1606 { |
1607 return t; | 1607 return t; |
1608 } | 1608 } |
1609 } | 1609 } |
1610 } | 1610 } |
1611 catch (std::runtime_error& e) | 1611 catch (std::runtime_error& e) |
1612 { | 1612 { |
1613 JavaEnvironment::ThrowException(env, e.what()); | 1613 JavaEnvironment::ThrowOrthancException(env, e.what()); |
1614 return NULL; | 1614 return NULL; |
1615 } | 1615 } |
1616 catch (...) | 1616 catch (...) |
1617 { | 1617 { |
1618 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 1618 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
1619 return NULL; | 1619 return NULL; |
1620 } | 1620 } |
1621 } | 1621 } |
1622 | 1622 |
1623 | 1623 |
1632 if (code == OrthancPluginErrorCode_Success) | 1632 if (code == OrthancPluginErrorCode_Success) |
1633 { | 1633 { |
1634 jbyteArray answer = env->NewByteArray(b.GetSize()); | 1634 jbyteArray answer = env->NewByteArray(b.GetSize()); |
1635 if (answer == NULL) | 1635 if (answer == NULL) |
1636 { | 1636 { |
1637 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory); | 1637 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_NotEnoughMemory); |
1638 return NULL; | 1638 return NULL; |
1639 } | 1639 } |
1640 else | 1640 else |
1641 { | 1641 { |
1642 env->SetByteArrayRegion(answer, 0, b.GetSize(), reinterpret_cast<const jbyte*>(b.GetData())); | 1642 env->SetByteArrayRegion(answer, 0, b.GetSize(), reinterpret_cast<const jbyte*>(b.GetData())); |
1643 return answer; | 1643 return answer; |
1644 } | 1644 } |
1645 } | 1645 } |
1646 else | 1646 else |
1647 { | 1647 { |
1648 JavaEnvironment::ThrowException(env, code); | 1648 JavaEnvironment::ThrowOrthancException(env, code); |
1649 return NULL; | 1649 return NULL; |
1650 } | 1650 } |
1651 } | 1651 } |
1652 catch (std::runtime_error& e) | 1652 catch (std::runtime_error& e) |
1653 { | 1653 { |
1654 JavaEnvironment::ThrowException(env, e.what()); | 1654 JavaEnvironment::ThrowOrthancException(env, e.what()); |
1655 return NULL; | 1655 return NULL; |
1656 } | 1656 } |
1657 catch (...) | 1657 catch (...) |
1658 { | 1658 { |
1659 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 1659 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
1660 return NULL; | 1660 return NULL; |
1661 } | 1661 } |
1662 } | 1662 } |
1663 | 1663 |
1664 | 1664 |
1668 { | 1668 { |
1669 OrthancPluginImage* answer = OrthancPluginCreateImage(context_ | 1669 OrthancPluginImage* answer = OrthancPluginCreateImage(context_ |
1670 , static_cast<OrthancPluginPixelFormat>(arg0), arg1, arg2); | 1670 , static_cast<OrthancPluginPixelFormat>(arg0), arg1, arg2); |
1671 if (answer == NULL) | 1671 if (answer == NULL) |
1672 { | 1672 { |
1673 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 1673 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
1674 return 0; | 1674 return 0; |
1675 } | 1675 } |
1676 else | 1676 else |
1677 { | 1677 { |
1678 return reinterpret_cast<intptr_t>(answer); | 1678 return reinterpret_cast<intptr_t>(answer); |
1679 } | 1679 } |
1680 } | 1680 } |
1681 catch (std::runtime_error& e) | 1681 catch (std::runtime_error& e) |
1682 { | 1682 { |
1683 JavaEnvironment::ThrowException(env, e.what()); | 1683 JavaEnvironment::ThrowOrthancException(env, e.what()); |
1684 return 0; | 1684 return 0; |
1685 } | 1685 } |
1686 catch (...) | 1686 catch (...) |
1687 { | 1687 { |
1688 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 1688 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
1689 return 0; | 1689 return 0; |
1690 } | 1690 } |
1691 } | 1691 } |
1692 | 1692 |
1693 | 1693 |
1698 JavaBytes c_arg0(env, arg0); | 1698 JavaBytes c_arg0(env, arg0); |
1699 OrthancPluginImage* answer = OrthancPluginDecodeDicomImage(context_ | 1699 OrthancPluginImage* answer = OrthancPluginDecodeDicomImage(context_ |
1700 , c_arg0.GetData(), c_arg0.GetSize(), arg2); | 1700 , c_arg0.GetData(), c_arg0.GetSize(), arg2); |
1701 if (answer == NULL) | 1701 if (answer == NULL) |
1702 { | 1702 { |
1703 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 1703 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
1704 return 0; | 1704 return 0; |
1705 } | 1705 } |
1706 else | 1706 else |
1707 { | 1707 { |
1708 return reinterpret_cast<intptr_t>(answer); | 1708 return reinterpret_cast<intptr_t>(answer); |
1709 } | 1709 } |
1710 } | 1710 } |
1711 catch (std::runtime_error& e) | 1711 catch (std::runtime_error& e) |
1712 { | 1712 { |
1713 JavaEnvironment::ThrowException(env, e.what()); | 1713 JavaEnvironment::ThrowOrthancException(env, e.what()); |
1714 return 0; | 1714 return 0; |
1715 } | 1715 } |
1716 catch (...) | 1716 catch (...) |
1717 { | 1717 { |
1718 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 1718 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
1719 return 0; | 1719 return 0; |
1720 } | 1720 } |
1721 } | 1721 } |
1722 | 1722 |
1723 | 1723 |
1728 JavaBytes c_arg0(env, arg0); | 1728 JavaBytes c_arg0(env, arg0); |
1729 OrthancString s(OrthancPluginComputeMd5(context_ | 1729 OrthancString s(OrthancPluginComputeMd5(context_ |
1730 , c_arg0.GetData(), c_arg0.GetSize())); | 1730 , c_arg0.GetData(), c_arg0.GetSize())); |
1731 if (s.GetValue() == NULL) | 1731 if (s.GetValue() == NULL) |
1732 { | 1732 { |
1733 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 1733 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
1734 return NULL; | 1734 return NULL; |
1735 } | 1735 } |
1736 else | 1736 else |
1737 { | 1737 { |
1738 jstring t = env->NewStringUTF(s.GetValue()); | 1738 jstring t = env->NewStringUTF(s.GetValue()); |
1739 if (t == NULL) | 1739 if (t == NULL) |
1740 { | 1740 { |
1741 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory); | 1741 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_NotEnoughMemory); |
1742 return NULL; | 1742 return NULL; |
1743 } | 1743 } |
1744 else | 1744 else |
1745 { | 1745 { |
1746 return t; | 1746 return t; |
1747 } | 1747 } |
1748 } | 1748 } |
1749 } | 1749 } |
1750 catch (std::runtime_error& e) | 1750 catch (std::runtime_error& e) |
1751 { | 1751 { |
1752 JavaEnvironment::ThrowException(env, e.what()); | 1752 JavaEnvironment::ThrowOrthancException(env, e.what()); |
1753 return NULL; | 1753 return NULL; |
1754 } | 1754 } |
1755 catch (...) | 1755 catch (...) |
1756 { | 1756 { |
1757 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 1757 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
1758 return NULL; | 1758 return NULL; |
1759 } | 1759 } |
1760 } | 1760 } |
1761 | 1761 |
1762 | 1762 |
1767 JavaBytes c_arg0(env, arg0); | 1767 JavaBytes c_arg0(env, arg0); |
1768 OrthancString s(OrthancPluginComputeSha1(context_ | 1768 OrthancString s(OrthancPluginComputeSha1(context_ |
1769 , c_arg0.GetData(), c_arg0.GetSize())); | 1769 , c_arg0.GetData(), c_arg0.GetSize())); |
1770 if (s.GetValue() == NULL) | 1770 if (s.GetValue() == NULL) |
1771 { | 1771 { |
1772 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 1772 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
1773 return NULL; | 1773 return NULL; |
1774 } | 1774 } |
1775 else | 1775 else |
1776 { | 1776 { |
1777 jstring t = env->NewStringUTF(s.GetValue()); | 1777 jstring t = env->NewStringUTF(s.GetValue()); |
1778 if (t == NULL) | 1778 if (t == NULL) |
1779 { | 1779 { |
1780 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory); | 1780 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_NotEnoughMemory); |
1781 return NULL; | 1781 return NULL; |
1782 } | 1782 } |
1783 else | 1783 else |
1784 { | 1784 { |
1785 return t; | 1785 return t; |
1786 } | 1786 } |
1787 } | 1787 } |
1788 } | 1788 } |
1789 catch (std::runtime_error& e) | 1789 catch (std::runtime_error& e) |
1790 { | 1790 { |
1791 JavaEnvironment::ThrowException(env, e.what()); | 1791 JavaEnvironment::ThrowOrthancException(env, e.what()); |
1792 return NULL; | 1792 return NULL; |
1793 } | 1793 } |
1794 catch (...) | 1794 catch (...) |
1795 { | 1795 { |
1796 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 1796 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
1797 return NULL; | 1797 return NULL; |
1798 } | 1798 } |
1799 } | 1799 } |
1800 | 1800 |
1801 | 1801 |
1805 { | 1805 { |
1806 OrthancString s(OrthancPluginGenerateUuid(context_ | 1806 OrthancString s(OrthancPluginGenerateUuid(context_ |
1807 )); | 1807 )); |
1808 if (s.GetValue() == NULL) | 1808 if (s.GetValue() == NULL) |
1809 { | 1809 { |
1810 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 1810 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
1811 return NULL; | 1811 return NULL; |
1812 } | 1812 } |
1813 else | 1813 else |
1814 { | 1814 { |
1815 jstring t = env->NewStringUTF(s.GetValue()); | 1815 jstring t = env->NewStringUTF(s.GetValue()); |
1816 if (t == NULL) | 1816 if (t == NULL) |
1817 { | 1817 { |
1818 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory); | 1818 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_NotEnoughMemory); |
1819 return NULL; | 1819 return NULL; |
1820 } | 1820 } |
1821 else | 1821 else |
1822 { | 1822 { |
1823 return t; | 1823 return t; |
1824 } | 1824 } |
1825 } | 1825 } |
1826 } | 1826 } |
1827 catch (std::runtime_error& e) | 1827 catch (std::runtime_error& e) |
1828 { | 1828 { |
1829 JavaEnvironment::ThrowException(env, e.what()); | 1829 JavaEnvironment::ThrowOrthancException(env, e.what()); |
1830 return NULL; | 1830 return NULL; |
1831 } | 1831 } |
1832 catch (...) | 1832 catch (...) |
1833 { | 1833 { |
1834 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 1834 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
1835 return NULL; | 1835 return NULL; |
1836 } | 1836 } |
1837 } | 1837 } |
1838 | 1838 |
1839 | 1839 |
1844 JavaBytes c_arg0(env, arg0); | 1844 JavaBytes c_arg0(env, arg0); |
1845 OrthancPluginFindMatcher* answer = OrthancPluginCreateFindMatcher(context_ | 1845 OrthancPluginFindMatcher* answer = OrthancPluginCreateFindMatcher(context_ |
1846 , c_arg0.GetData(), c_arg0.GetSize()); | 1846 , c_arg0.GetData(), c_arg0.GetSize()); |
1847 if (answer == NULL) | 1847 if (answer == NULL) |
1848 { | 1848 { |
1849 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 1849 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
1850 return 0; | 1850 return 0; |
1851 } | 1851 } |
1852 else | 1852 else |
1853 { | 1853 { |
1854 return reinterpret_cast<intptr_t>(answer); | 1854 return reinterpret_cast<intptr_t>(answer); |
1855 } | 1855 } |
1856 } | 1856 } |
1857 catch (std::runtime_error& e) | 1857 catch (std::runtime_error& e) |
1858 { | 1858 { |
1859 JavaEnvironment::ThrowException(env, e.what()); | 1859 JavaEnvironment::ThrowOrthancException(env, e.what()); |
1860 return 0; | 1860 return 0; |
1861 } | 1861 } |
1862 catch (...) | 1862 catch (...) |
1863 { | 1863 { |
1864 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 1864 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
1865 return 0; | 1865 return 0; |
1866 } | 1866 } |
1867 } | 1867 } |
1868 | 1868 |
1869 | 1869 |
1873 { | 1873 { |
1874 OrthancPluginPeers* answer = OrthancPluginGetPeers(context_ | 1874 OrthancPluginPeers* answer = OrthancPluginGetPeers(context_ |
1875 ); | 1875 ); |
1876 if (answer == NULL) | 1876 if (answer == NULL) |
1877 { | 1877 { |
1878 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 1878 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
1879 return 0; | 1879 return 0; |
1880 } | 1880 } |
1881 else | 1881 else |
1882 { | 1882 { |
1883 return reinterpret_cast<intptr_t>(answer); | 1883 return reinterpret_cast<intptr_t>(answer); |
1884 } | 1884 } |
1885 } | 1885 } |
1886 catch (std::runtime_error& e) | 1886 catch (std::runtime_error& e) |
1887 { | 1887 { |
1888 JavaEnvironment::ThrowException(env, e.what()); | 1888 JavaEnvironment::ThrowOrthancException(env, e.what()); |
1889 return 0; | 1889 return 0; |
1890 } | 1890 } |
1891 catch (...) | 1891 catch (...) |
1892 { | 1892 { |
1893 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 1893 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
1894 return 0; | 1894 return 0; |
1895 } | 1895 } |
1896 } | 1896 } |
1897 | 1897 |
1898 | 1898 |
1903 JavaString c_arg0(env, arg0); | 1903 JavaString c_arg0(env, arg0); |
1904 const char* s = OrthancPluginAutodetectMimeType(context_ | 1904 const char* s = OrthancPluginAutodetectMimeType(context_ |
1905 , c_arg0.GetValue()); | 1905 , c_arg0.GetValue()); |
1906 if (s == NULL) | 1906 if (s == NULL) |
1907 { | 1907 { |
1908 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 1908 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
1909 return NULL; | 1909 return NULL; |
1910 } | 1910 } |
1911 else | 1911 else |
1912 { | 1912 { |
1913 return env->NewStringUTF(s); | 1913 return env->NewStringUTF(s); |
1914 } | 1914 } |
1915 } | 1915 } |
1916 catch (std::runtime_error& e) | 1916 catch (std::runtime_error& e) |
1917 { | 1917 { |
1918 JavaEnvironment::ThrowException(env, e.what()); | 1918 JavaEnvironment::ThrowOrthancException(env, e.what()); |
1919 return NULL; | 1919 return NULL; |
1920 } | 1920 } |
1921 catch (...) | 1921 catch (...) |
1922 { | 1922 { |
1923 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 1923 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
1924 return NULL; | 1924 return NULL; |
1925 } | 1925 } |
1926 } | 1926 } |
1927 | 1927 |
1928 | 1928 |
1934 OrthancPluginSetMetricsValue(context_ | 1934 OrthancPluginSetMetricsValue(context_ |
1935 , c_arg0.GetValue(), arg1, static_cast<OrthancPluginMetricsType>(arg2)); | 1935 , c_arg0.GetValue(), arg1, static_cast<OrthancPluginMetricsType>(arg2)); |
1936 } | 1936 } |
1937 catch (std::runtime_error& e) | 1937 catch (std::runtime_error& e) |
1938 { | 1938 { |
1939 JavaEnvironment::ThrowException(env, e.what()); | 1939 JavaEnvironment::ThrowOrthancException(env, e.what()); |
1940 } | 1940 } |
1941 catch (...) | 1941 catch (...) |
1942 { | 1942 { |
1943 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 1943 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
1944 } | 1944 } |
1945 } | 1945 } |
1946 | 1946 |
1947 | 1947 |
1948 JNIEXPORT jstring JNI_OrthancPluginGetTagName(JNIEnv* env, jobject sdkObject, jshort arg0, jshort arg1, jstring arg2) | 1948 JNIEXPORT jstring JNI_OrthancPluginGetTagName(JNIEnv* env, jobject sdkObject, jshort arg0, jshort arg1, jstring arg2) |
1952 JavaString c_arg2(env, arg2); | 1952 JavaString c_arg2(env, arg2); |
1953 OrthancString s(OrthancPluginGetTagName(context_ | 1953 OrthancString s(OrthancPluginGetTagName(context_ |
1954 , arg0, arg1, c_arg2.GetValue())); | 1954 , arg0, arg1, c_arg2.GetValue())); |
1955 if (s.GetValue() == NULL) | 1955 if (s.GetValue() == NULL) |
1956 { | 1956 { |
1957 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 1957 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
1958 return NULL; | 1958 return NULL; |
1959 } | 1959 } |
1960 else | 1960 else |
1961 { | 1961 { |
1962 jstring t = env->NewStringUTF(s.GetValue()); | 1962 jstring t = env->NewStringUTF(s.GetValue()); |
1963 if (t == NULL) | 1963 if (t == NULL) |
1964 { | 1964 { |
1965 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory); | 1965 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_NotEnoughMemory); |
1966 return NULL; | 1966 return NULL; |
1967 } | 1967 } |
1968 else | 1968 else |
1969 { | 1969 { |
1970 return t; | 1970 return t; |
1971 } | 1971 } |
1972 } | 1972 } |
1973 } | 1973 } |
1974 catch (std::runtime_error& e) | 1974 catch (std::runtime_error& e) |
1975 { | 1975 { |
1976 JavaEnvironment::ThrowException(env, e.what()); | 1976 JavaEnvironment::ThrowOrthancException(env, e.what()); |
1977 return NULL; | 1977 return NULL; |
1978 } | 1978 } |
1979 catch (...) | 1979 catch (...) |
1980 { | 1980 { |
1981 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 1981 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
1982 return NULL; | 1982 return NULL; |
1983 } | 1983 } |
1984 } | 1984 } |
1985 | 1985 |
1986 | 1986 |
1991 JavaBytes c_arg0(env, arg0); | 1991 JavaBytes c_arg0(env, arg0); |
1992 OrthancPluginDicomInstance* answer = OrthancPluginCreateDicomInstance(context_ | 1992 OrthancPluginDicomInstance* answer = OrthancPluginCreateDicomInstance(context_ |
1993 , c_arg0.GetData(), c_arg0.GetSize()); | 1993 , c_arg0.GetData(), c_arg0.GetSize()); |
1994 if (answer == NULL) | 1994 if (answer == NULL) |
1995 { | 1995 { |
1996 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 1996 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
1997 return 0; | 1997 return 0; |
1998 } | 1998 } |
1999 else | 1999 else |
2000 { | 2000 { |
2001 return reinterpret_cast<intptr_t>(answer); | 2001 return reinterpret_cast<intptr_t>(answer); |
2002 } | 2002 } |
2003 } | 2003 } |
2004 catch (std::runtime_error& e) | 2004 catch (std::runtime_error& e) |
2005 { | 2005 { |
2006 JavaEnvironment::ThrowException(env, e.what()); | 2006 JavaEnvironment::ThrowOrthancException(env, e.what()); |
2007 return 0; | 2007 return 0; |
2008 } | 2008 } |
2009 catch (...) | 2009 catch (...) |
2010 { | 2010 { |
2011 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 2011 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
2012 return 0; | 2012 return 0; |
2013 } | 2013 } |
2014 } | 2014 } |
2015 | 2015 |
2016 | 2016 |
2022 JavaString c_arg2(env, arg2); | 2022 JavaString c_arg2(env, arg2); |
2023 OrthancPluginDicomInstance* answer = OrthancPluginTranscodeDicomInstance(context_ | 2023 OrthancPluginDicomInstance* answer = OrthancPluginTranscodeDicomInstance(context_ |
2024 , c_arg0.GetData(), c_arg0.GetSize(), c_arg2.GetValue()); | 2024 , c_arg0.GetData(), c_arg0.GetSize(), c_arg2.GetValue()); |
2025 if (answer == NULL) | 2025 if (answer == NULL) |
2026 { | 2026 { |
2027 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 2027 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
2028 return 0; | 2028 return 0; |
2029 } | 2029 } |
2030 else | 2030 else |
2031 { | 2031 { |
2032 return reinterpret_cast<intptr_t>(answer); | 2032 return reinterpret_cast<intptr_t>(answer); |
2033 } | 2033 } |
2034 } | 2034 } |
2035 catch (std::runtime_error& e) | 2035 catch (std::runtime_error& e) |
2036 { | 2036 { |
2037 JavaEnvironment::ThrowException(env, e.what()); | 2037 JavaEnvironment::ThrowOrthancException(env, e.what()); |
2038 return 0; | 2038 return 0; |
2039 } | 2039 } |
2040 catch (...) | 2040 catch (...) |
2041 { | 2041 { |
2042 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 2042 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
2043 return 0; | 2043 return 0; |
2044 } | 2044 } |
2045 } | 2045 } |
2046 | 2046 |
2047 | 2047 |
2051 { | 2051 { |
2052 OrthancString s(OrthancPluginGenerateRestApiAuthorizationToken(context_ | 2052 OrthancString s(OrthancPluginGenerateRestApiAuthorizationToken(context_ |
2053 )); | 2053 )); |
2054 if (s.GetValue() == NULL) | 2054 if (s.GetValue() == NULL) |
2055 { | 2055 { |
2056 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 2056 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
2057 return NULL; | 2057 return NULL; |
2058 } | 2058 } |
2059 else | 2059 else |
2060 { | 2060 { |
2061 jstring t = env->NewStringUTF(s.GetValue()); | 2061 jstring t = env->NewStringUTF(s.GetValue()); |
2062 if (t == NULL) | 2062 if (t == NULL) |
2063 { | 2063 { |
2064 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory); | 2064 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_NotEnoughMemory); |
2065 return NULL; | 2065 return NULL; |
2066 } | 2066 } |
2067 else | 2067 else |
2068 { | 2068 { |
2069 return t; | 2069 return t; |
2070 } | 2070 } |
2071 } | 2071 } |
2072 } | 2072 } |
2073 catch (std::runtime_error& e) | 2073 catch (std::runtime_error& e) |
2074 { | 2074 { |
2075 JavaEnvironment::ThrowException(env, e.what()); | 2075 JavaEnvironment::ThrowOrthancException(env, e.what()); |
2076 return NULL; | 2076 return NULL; |
2077 } | 2077 } |
2078 catch (...) | 2078 catch (...) |
2079 { | 2079 { |
2080 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 2080 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
2081 return NULL; | 2081 return NULL; |
2082 } | 2082 } |
2083 } | 2083 } |
2084 | 2084 |
2085 | 2085 |
2095 if (code == OrthancPluginErrorCode_Success) | 2095 if (code == OrthancPluginErrorCode_Success) |
2096 { | 2096 { |
2097 jbyteArray answer = env->NewByteArray(b.GetSize()); | 2097 jbyteArray answer = env->NewByteArray(b.GetSize()); |
2098 if (answer == NULL) | 2098 if (answer == NULL) |
2099 { | 2099 { |
2100 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory); | 2100 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_NotEnoughMemory); |
2101 return NULL; | 2101 return NULL; |
2102 } | 2102 } |
2103 else | 2103 else |
2104 { | 2104 { |
2105 env->SetByteArrayRegion(answer, 0, b.GetSize(), reinterpret_cast<const jbyte*>(b.GetData())); | 2105 env->SetByteArrayRegion(answer, 0, b.GetSize(), reinterpret_cast<const jbyte*>(b.GetData())); |
2106 return answer; | 2106 return answer; |
2107 } | 2107 } |
2108 } | 2108 } |
2109 else | 2109 else |
2110 { | 2110 { |
2111 JavaEnvironment::ThrowException(env, code); | 2111 JavaEnvironment::ThrowOrthancException(env, code); |
2112 return NULL; | 2112 return NULL; |
2113 } | 2113 } |
2114 } | 2114 } |
2115 catch (std::runtime_error& e) | 2115 catch (std::runtime_error& e) |
2116 { | 2116 { |
2117 JavaEnvironment::ThrowException(env, e.what()); | 2117 JavaEnvironment::ThrowOrthancException(env, e.what()); |
2118 return NULL; | 2118 return NULL; |
2119 } | 2119 } |
2120 catch (...) | 2120 catch (...) |
2121 { | 2121 { |
2122 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 2122 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
2123 return NULL; | 2123 return NULL; |
2124 } | 2124 } |
2125 } | 2125 } |
2126 | 2126 |
2127 | 2127 |
2133 , reinterpret_cast<OrthancPluginDicomInstance*>(static_cast<intptr_t>(self)) | 2133 , reinterpret_cast<OrthancPluginDicomInstance*>(static_cast<intptr_t>(self)) |
2134 ); | 2134 ); |
2135 } | 2135 } |
2136 catch (std::runtime_error& e) | 2136 catch (std::runtime_error& e) |
2137 { | 2137 { |
2138 JavaEnvironment::ThrowException(env, e.what()); | 2138 JavaEnvironment::ThrowOrthancException(env, e.what()); |
2139 } | 2139 } |
2140 catch (...) | 2140 catch (...) |
2141 { | 2141 { |
2142 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 2142 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
2143 } | 2143 } |
2144 } | 2144 } |
2145 | 2145 |
2146 | 2146 |
2147 JNIEXPORT jstring JNI_OrthancPluginGetInstanceRemoteAet(JNIEnv* env, jobject sdkObject, jlong self) | 2147 JNIEXPORT jstring JNI_OrthancPluginGetInstanceRemoteAet(JNIEnv* env, jobject sdkObject, jlong self) |
2151 const char* s = OrthancPluginGetInstanceRemoteAet(context_ | 2151 const char* s = OrthancPluginGetInstanceRemoteAet(context_ |
2152 , reinterpret_cast<OrthancPluginDicomInstance*>(static_cast<intptr_t>(self)) | 2152 , reinterpret_cast<OrthancPluginDicomInstance*>(static_cast<intptr_t>(self)) |
2153 ); | 2153 ); |
2154 if (s == NULL) | 2154 if (s == NULL) |
2155 { | 2155 { |
2156 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 2156 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
2157 return NULL; | 2157 return NULL; |
2158 } | 2158 } |
2159 else | 2159 else |
2160 { | 2160 { |
2161 return env->NewStringUTF(s); | 2161 return env->NewStringUTF(s); |
2162 } | 2162 } |
2163 } | 2163 } |
2164 catch (std::runtime_error& e) | 2164 catch (std::runtime_error& e) |
2165 { | 2165 { |
2166 JavaEnvironment::ThrowException(env, e.what()); | 2166 JavaEnvironment::ThrowOrthancException(env, e.what()); |
2167 return NULL; | 2167 return NULL; |
2168 } | 2168 } |
2169 catch (...) | 2169 catch (...) |
2170 { | 2170 { |
2171 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 2171 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
2172 return NULL; | 2172 return NULL; |
2173 } | 2173 } |
2174 } | 2174 } |
2175 | 2175 |
2176 | 2176 |
2182 , reinterpret_cast<OrthancPluginDicomInstance*>(static_cast<intptr_t>(self)) | 2182 , reinterpret_cast<OrthancPluginDicomInstance*>(static_cast<intptr_t>(self)) |
2183 ); | 2183 ); |
2184 } | 2184 } |
2185 catch (std::runtime_error& e) | 2185 catch (std::runtime_error& e) |
2186 { | 2186 { |
2187 JavaEnvironment::ThrowException(env, e.what()); | 2187 JavaEnvironment::ThrowOrthancException(env, e.what()); |
2188 return 0; | 2188 return 0; |
2189 } | 2189 } |
2190 catch (...) | 2190 catch (...) |
2191 { | 2191 { |
2192 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 2192 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
2193 return 0; | 2193 return 0; |
2194 } | 2194 } |
2195 } | 2195 } |
2196 | 2196 |
2197 | 2197 |
2202 OrthancString s(OrthancPluginGetInstanceJson(context_ | 2202 OrthancString s(OrthancPluginGetInstanceJson(context_ |
2203 , reinterpret_cast<OrthancPluginDicomInstance*>(static_cast<intptr_t>(self)) | 2203 , reinterpret_cast<OrthancPluginDicomInstance*>(static_cast<intptr_t>(self)) |
2204 )); | 2204 )); |
2205 if (s.GetValue() == NULL) | 2205 if (s.GetValue() == NULL) |
2206 { | 2206 { |
2207 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 2207 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
2208 return NULL; | 2208 return NULL; |
2209 } | 2209 } |
2210 else | 2210 else |
2211 { | 2211 { |
2212 jstring t = env->NewStringUTF(s.GetValue()); | 2212 jstring t = env->NewStringUTF(s.GetValue()); |
2213 if (t == NULL) | 2213 if (t == NULL) |
2214 { | 2214 { |
2215 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory); | 2215 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_NotEnoughMemory); |
2216 return NULL; | 2216 return NULL; |
2217 } | 2217 } |
2218 else | 2218 else |
2219 { | 2219 { |
2220 return t; | 2220 return t; |
2221 } | 2221 } |
2222 } | 2222 } |
2223 } | 2223 } |
2224 catch (std::runtime_error& e) | 2224 catch (std::runtime_error& e) |
2225 { | 2225 { |
2226 JavaEnvironment::ThrowException(env, e.what()); | 2226 JavaEnvironment::ThrowOrthancException(env, e.what()); |
2227 return NULL; | 2227 return NULL; |
2228 } | 2228 } |
2229 catch (...) | 2229 catch (...) |
2230 { | 2230 { |
2231 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 2231 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
2232 return NULL; | 2232 return NULL; |
2233 } | 2233 } |
2234 } | 2234 } |
2235 | 2235 |
2236 | 2236 |
2241 OrthancString s(OrthancPluginGetInstanceSimplifiedJson(context_ | 2241 OrthancString s(OrthancPluginGetInstanceSimplifiedJson(context_ |
2242 , reinterpret_cast<OrthancPluginDicomInstance*>(static_cast<intptr_t>(self)) | 2242 , reinterpret_cast<OrthancPluginDicomInstance*>(static_cast<intptr_t>(self)) |
2243 )); | 2243 )); |
2244 if (s.GetValue() == NULL) | 2244 if (s.GetValue() == NULL) |
2245 { | 2245 { |
2246 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 2246 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
2247 return NULL; | 2247 return NULL; |
2248 } | 2248 } |
2249 else | 2249 else |
2250 { | 2250 { |
2251 jstring t = env->NewStringUTF(s.GetValue()); | 2251 jstring t = env->NewStringUTF(s.GetValue()); |
2252 if (t == NULL) | 2252 if (t == NULL) |
2253 { | 2253 { |
2254 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory); | 2254 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_NotEnoughMemory); |
2255 return NULL; | 2255 return NULL; |
2256 } | 2256 } |
2257 else | 2257 else |
2258 { | 2258 { |
2259 return t; | 2259 return t; |
2260 } | 2260 } |
2261 } | 2261 } |
2262 } | 2262 } |
2263 catch (std::runtime_error& e) | 2263 catch (std::runtime_error& e) |
2264 { | 2264 { |
2265 JavaEnvironment::ThrowException(env, e.what()); | 2265 JavaEnvironment::ThrowOrthancException(env, e.what()); |
2266 return NULL; | 2266 return NULL; |
2267 } | 2267 } |
2268 catch (...) | 2268 catch (...) |
2269 { | 2269 { |
2270 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 2270 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
2271 return NULL; | 2271 return NULL; |
2272 } | 2272 } |
2273 } | 2273 } |
2274 | 2274 |
2275 | 2275 |
2282 , reinterpret_cast<OrthancPluginDicomInstance*>(static_cast<intptr_t>(self)) | 2282 , reinterpret_cast<OrthancPluginDicomInstance*>(static_cast<intptr_t>(self)) |
2283 , c_arg0.GetValue()); | 2283 , c_arg0.GetValue()); |
2284 } | 2284 } |
2285 catch (std::runtime_error& e) | 2285 catch (std::runtime_error& e) |
2286 { | 2286 { |
2287 JavaEnvironment::ThrowException(env, e.what()); | 2287 JavaEnvironment::ThrowOrthancException(env, e.what()); |
2288 return 0; | 2288 return 0; |
2289 } | 2289 } |
2290 catch (...) | 2290 catch (...) |
2291 { | 2291 { |
2292 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 2292 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
2293 return 0; | 2293 return 0; |
2294 } | 2294 } |
2295 } | 2295 } |
2296 | 2296 |
2297 | 2297 |
2303 const char* s = OrthancPluginGetInstanceMetadata(context_ | 2303 const char* s = OrthancPluginGetInstanceMetadata(context_ |
2304 , reinterpret_cast<OrthancPluginDicomInstance*>(static_cast<intptr_t>(self)) | 2304 , reinterpret_cast<OrthancPluginDicomInstance*>(static_cast<intptr_t>(self)) |
2305 , c_arg0.GetValue()); | 2305 , c_arg0.GetValue()); |
2306 if (s == NULL) | 2306 if (s == NULL) |
2307 { | 2307 { |
2308 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 2308 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
2309 return NULL; | 2309 return NULL; |
2310 } | 2310 } |
2311 else | 2311 else |
2312 { | 2312 { |
2313 return env->NewStringUTF(s); | 2313 return env->NewStringUTF(s); |
2314 } | 2314 } |
2315 } | 2315 } |
2316 catch (std::runtime_error& e) | 2316 catch (std::runtime_error& e) |
2317 { | 2317 { |
2318 JavaEnvironment::ThrowException(env, e.what()); | 2318 JavaEnvironment::ThrowOrthancException(env, e.what()); |
2319 return NULL; | 2319 return NULL; |
2320 } | 2320 } |
2321 catch (...) | 2321 catch (...) |
2322 { | 2322 { |
2323 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 2323 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
2324 return NULL; | 2324 return NULL; |
2325 } | 2325 } |
2326 } | 2326 } |
2327 | 2327 |
2328 | 2328 |
2334 , reinterpret_cast<OrthancPluginDicomInstance*>(static_cast<intptr_t>(self)) | 2334 , reinterpret_cast<OrthancPluginDicomInstance*>(static_cast<intptr_t>(self)) |
2335 ); | 2335 ); |
2336 } | 2336 } |
2337 catch (std::runtime_error& e) | 2337 catch (std::runtime_error& e) |
2338 { | 2338 { |
2339 JavaEnvironment::ThrowException(env, e.what()); | 2339 JavaEnvironment::ThrowOrthancException(env, e.what()); |
2340 return 0; | 2340 return 0; |
2341 } | 2341 } |
2342 catch (...) | 2342 catch (...) |
2343 { | 2343 { |
2344 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 2344 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
2345 return 0; | 2345 return 0; |
2346 } | 2346 } |
2347 } | 2347 } |
2348 | 2348 |
2349 | 2349 |
2354 OrthancString s(OrthancPluginGetInstanceTransferSyntaxUid(context_ | 2354 OrthancString s(OrthancPluginGetInstanceTransferSyntaxUid(context_ |
2355 , reinterpret_cast<OrthancPluginDicomInstance*>(static_cast<intptr_t>(self)) | 2355 , reinterpret_cast<OrthancPluginDicomInstance*>(static_cast<intptr_t>(self)) |
2356 )); | 2356 )); |
2357 if (s.GetValue() == NULL) | 2357 if (s.GetValue() == NULL) |
2358 { | 2358 { |
2359 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 2359 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
2360 return NULL; | 2360 return NULL; |
2361 } | 2361 } |
2362 else | 2362 else |
2363 { | 2363 { |
2364 jstring t = env->NewStringUTF(s.GetValue()); | 2364 jstring t = env->NewStringUTF(s.GetValue()); |
2365 if (t == NULL) | 2365 if (t == NULL) |
2366 { | 2366 { |
2367 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory); | 2367 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_NotEnoughMemory); |
2368 return NULL; | 2368 return NULL; |
2369 } | 2369 } |
2370 else | 2370 else |
2371 { | 2371 { |
2372 return t; | 2372 return t; |
2373 } | 2373 } |
2374 } | 2374 } |
2375 } | 2375 } |
2376 catch (std::runtime_error& e) | 2376 catch (std::runtime_error& e) |
2377 { | 2377 { |
2378 JavaEnvironment::ThrowException(env, e.what()); | 2378 JavaEnvironment::ThrowOrthancException(env, e.what()); |
2379 return NULL; | 2379 return NULL; |
2380 } | 2380 } |
2381 catch (...) | 2381 catch (...) |
2382 { | 2382 { |
2383 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 2383 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
2384 return NULL; | 2384 return NULL; |
2385 } | 2385 } |
2386 } | 2386 } |
2387 | 2387 |
2388 | 2388 |
2394 , reinterpret_cast<OrthancPluginDicomInstance*>(static_cast<intptr_t>(self)) | 2394 , reinterpret_cast<OrthancPluginDicomInstance*>(static_cast<intptr_t>(self)) |
2395 ); | 2395 ); |
2396 } | 2396 } |
2397 catch (std::runtime_error& e) | 2397 catch (std::runtime_error& e) |
2398 { | 2398 { |
2399 JavaEnvironment::ThrowException(env, e.what()); | 2399 JavaEnvironment::ThrowOrthancException(env, e.what()); |
2400 return 0; | 2400 return 0; |
2401 } | 2401 } |
2402 catch (...) | 2402 catch (...) |
2403 { | 2403 { |
2404 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 2404 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
2405 return 0; | 2405 return 0; |
2406 } | 2406 } |
2407 } | 2407 } |
2408 | 2408 |
2409 | 2409 |
2415 , reinterpret_cast<OrthancPluginDicomInstance*>(static_cast<intptr_t>(self)) | 2415 , reinterpret_cast<OrthancPluginDicomInstance*>(static_cast<intptr_t>(self)) |
2416 ); | 2416 ); |
2417 } | 2417 } |
2418 catch (std::runtime_error& e) | 2418 catch (std::runtime_error& e) |
2419 { | 2419 { |
2420 JavaEnvironment::ThrowException(env, e.what()); | 2420 JavaEnvironment::ThrowOrthancException(env, e.what()); |
2421 return 0; | 2421 return 0; |
2422 } | 2422 } |
2423 catch (...) | 2423 catch (...) |
2424 { | 2424 { |
2425 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 2425 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
2426 return 0; | 2426 return 0; |
2427 } | 2427 } |
2428 } | 2428 } |
2429 | 2429 |
2430 | 2430 |
2439 if (code == OrthancPluginErrorCode_Success) | 2439 if (code == OrthancPluginErrorCode_Success) |
2440 { | 2440 { |
2441 jbyteArray answer = env->NewByteArray(b.GetSize()); | 2441 jbyteArray answer = env->NewByteArray(b.GetSize()); |
2442 if (answer == NULL) | 2442 if (answer == NULL) |
2443 { | 2443 { |
2444 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory); | 2444 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_NotEnoughMemory); |
2445 return NULL; | 2445 return NULL; |
2446 } | 2446 } |
2447 else | 2447 else |
2448 { | 2448 { |
2449 env->SetByteArrayRegion(answer, 0, b.GetSize(), reinterpret_cast<const jbyte*>(b.GetData())); | 2449 env->SetByteArrayRegion(answer, 0, b.GetSize(), reinterpret_cast<const jbyte*>(b.GetData())); |
2450 return answer; | 2450 return answer; |
2451 } | 2451 } |
2452 } | 2452 } |
2453 else | 2453 else |
2454 { | 2454 { |
2455 JavaEnvironment::ThrowException(env, code); | 2455 JavaEnvironment::ThrowOrthancException(env, code); |
2456 return NULL; | 2456 return NULL; |
2457 } | 2457 } |
2458 } | 2458 } |
2459 catch (std::runtime_error& e) | 2459 catch (std::runtime_error& e) |
2460 { | 2460 { |
2461 JavaEnvironment::ThrowException(env, e.what()); | 2461 JavaEnvironment::ThrowOrthancException(env, e.what()); |
2462 return NULL; | 2462 return NULL; |
2463 } | 2463 } |
2464 catch (...) | 2464 catch (...) |
2465 { | 2465 { |
2466 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 2466 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
2467 return NULL; | 2467 return NULL; |
2468 } | 2468 } |
2469 } | 2469 } |
2470 | 2470 |
2471 | 2471 |
2476 OrthancPluginImage* answer = OrthancPluginGetInstanceDecodedFrame(context_ | 2476 OrthancPluginImage* answer = OrthancPluginGetInstanceDecodedFrame(context_ |
2477 , reinterpret_cast<OrthancPluginDicomInstance*>(static_cast<intptr_t>(self)) | 2477 , reinterpret_cast<OrthancPluginDicomInstance*>(static_cast<intptr_t>(self)) |
2478 , arg0); | 2478 , arg0); |
2479 if (answer == NULL) | 2479 if (answer == NULL) |
2480 { | 2480 { |
2481 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 2481 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
2482 return 0; | 2482 return 0; |
2483 } | 2483 } |
2484 else | 2484 else |
2485 { | 2485 { |
2486 return reinterpret_cast<intptr_t>(answer); | 2486 return reinterpret_cast<intptr_t>(answer); |
2487 } | 2487 } |
2488 } | 2488 } |
2489 catch (std::runtime_error& e) | 2489 catch (std::runtime_error& e) |
2490 { | 2490 { |
2491 JavaEnvironment::ThrowException(env, e.what()); | 2491 JavaEnvironment::ThrowOrthancException(env, e.what()); |
2492 return 0; | 2492 return 0; |
2493 } | 2493 } |
2494 catch (...) | 2494 catch (...) |
2495 { | 2495 { |
2496 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 2496 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
2497 return 0; | 2497 return 0; |
2498 } | 2498 } |
2499 } | 2499 } |
2500 | 2500 |
2501 | 2501 |
2510 if (code == OrthancPluginErrorCode_Success) | 2510 if (code == OrthancPluginErrorCode_Success) |
2511 { | 2511 { |
2512 jbyteArray answer = env->NewByteArray(b.GetSize()); | 2512 jbyteArray answer = env->NewByteArray(b.GetSize()); |
2513 if (answer == NULL) | 2513 if (answer == NULL) |
2514 { | 2514 { |
2515 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory); | 2515 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_NotEnoughMemory); |
2516 return NULL; | 2516 return NULL; |
2517 } | 2517 } |
2518 else | 2518 else |
2519 { | 2519 { |
2520 env->SetByteArrayRegion(answer, 0, b.GetSize(), reinterpret_cast<const jbyte*>(b.GetData())); | 2520 env->SetByteArrayRegion(answer, 0, b.GetSize(), reinterpret_cast<const jbyte*>(b.GetData())); |
2521 return answer; | 2521 return answer; |
2522 } | 2522 } |
2523 } | 2523 } |
2524 else | 2524 else |
2525 { | 2525 { |
2526 JavaEnvironment::ThrowException(env, code); | 2526 JavaEnvironment::ThrowOrthancException(env, code); |
2527 return NULL; | 2527 return NULL; |
2528 } | 2528 } |
2529 } | 2529 } |
2530 catch (std::runtime_error& e) | 2530 catch (std::runtime_error& e) |
2531 { | 2531 { |
2532 JavaEnvironment::ThrowException(env, e.what()); | 2532 JavaEnvironment::ThrowOrthancException(env, e.what()); |
2533 return NULL; | 2533 return NULL; |
2534 } | 2534 } |
2535 catch (...) | 2535 catch (...) |
2536 { | 2536 { |
2537 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 2537 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
2538 return NULL; | 2538 return NULL; |
2539 } | 2539 } |
2540 } | 2540 } |
2541 | 2541 |
2542 | 2542 |
2547 OrthancString s(OrthancPluginGetInstanceAdvancedJson(context_ | 2547 OrthancString s(OrthancPluginGetInstanceAdvancedJson(context_ |
2548 , reinterpret_cast<OrthancPluginDicomInstance*>(static_cast<intptr_t>(self)) | 2548 , reinterpret_cast<OrthancPluginDicomInstance*>(static_cast<intptr_t>(self)) |
2549 , static_cast<OrthancPluginDicomToJsonFormat>(arg0), static_cast<OrthancPluginDicomToJsonFlags>(arg1), arg2)); | 2549 , static_cast<OrthancPluginDicomToJsonFormat>(arg0), static_cast<OrthancPluginDicomToJsonFlags>(arg1), arg2)); |
2550 if (s.GetValue() == NULL) | 2550 if (s.GetValue() == NULL) |
2551 { | 2551 { |
2552 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 2552 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
2553 return NULL; | 2553 return NULL; |
2554 } | 2554 } |
2555 else | 2555 else |
2556 { | 2556 { |
2557 jstring t = env->NewStringUTF(s.GetValue()); | 2557 jstring t = env->NewStringUTF(s.GetValue()); |
2558 if (t == NULL) | 2558 if (t == NULL) |
2559 { | 2559 { |
2560 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory); | 2560 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_NotEnoughMemory); |
2561 return NULL; | 2561 return NULL; |
2562 } | 2562 } |
2563 else | 2563 else |
2564 { | 2564 { |
2565 return t; | 2565 return t; |
2566 } | 2566 } |
2567 } | 2567 } |
2568 } | 2568 } |
2569 catch (std::runtime_error& e) | 2569 catch (std::runtime_error& e) |
2570 { | 2570 { |
2571 JavaEnvironment::ThrowException(env, e.what()); | 2571 JavaEnvironment::ThrowOrthancException(env, e.what()); |
2572 return NULL; | 2572 return NULL; |
2573 } | 2573 } |
2574 catch (...) | 2574 catch (...) |
2575 { | 2575 { |
2576 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 2576 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
2577 return NULL; | 2577 return NULL; |
2578 } | 2578 } |
2579 } | 2579 } |
2580 | 2580 |
2581 | 2581 |
2587 OrthancPluginErrorCode code = OrthancPluginFindAddAnswer(context_ | 2587 OrthancPluginErrorCode code = OrthancPluginFindAddAnswer(context_ |
2588 , reinterpret_cast<OrthancPluginFindAnswers*>(static_cast<intptr_t>(self)) | 2588 , reinterpret_cast<OrthancPluginFindAnswers*>(static_cast<intptr_t>(self)) |
2589 , c_arg0.GetData(), c_arg0.GetSize()); | 2589 , c_arg0.GetData(), c_arg0.GetSize()); |
2590 if (code != OrthancPluginErrorCode_Success) | 2590 if (code != OrthancPluginErrorCode_Success) |
2591 { | 2591 { |
2592 JavaEnvironment::ThrowException(env, code); | 2592 JavaEnvironment::ThrowOrthancException(env, code); |
2593 } | 2593 } |
2594 } | 2594 } |
2595 catch (std::runtime_error& e) | 2595 catch (std::runtime_error& e) |
2596 { | 2596 { |
2597 JavaEnvironment::ThrowException(env, e.what()); | 2597 JavaEnvironment::ThrowOrthancException(env, e.what()); |
2598 } | 2598 } |
2599 catch (...) | 2599 catch (...) |
2600 { | 2600 { |
2601 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 2601 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
2602 } | 2602 } |
2603 } | 2603 } |
2604 | 2604 |
2605 | 2605 |
2606 JNIEXPORT void JNI_OrthancPluginFindMarkIncomplete(JNIEnv* env, jobject sdkObject, jlong self) | 2606 JNIEXPORT void JNI_OrthancPluginFindMarkIncomplete(JNIEnv* env, jobject sdkObject, jlong self) |
2610 OrthancPluginErrorCode code = OrthancPluginFindMarkIncomplete(context_ | 2610 OrthancPluginErrorCode code = OrthancPluginFindMarkIncomplete(context_ |
2611 , reinterpret_cast<OrthancPluginFindAnswers*>(static_cast<intptr_t>(self)) | 2611 , reinterpret_cast<OrthancPluginFindAnswers*>(static_cast<intptr_t>(self)) |
2612 ); | 2612 ); |
2613 if (code != OrthancPluginErrorCode_Success) | 2613 if (code != OrthancPluginErrorCode_Success) |
2614 { | 2614 { |
2615 JavaEnvironment::ThrowException(env, code); | 2615 JavaEnvironment::ThrowOrthancException(env, code); |
2616 } | 2616 } |
2617 } | 2617 } |
2618 catch (std::runtime_error& e) | 2618 catch (std::runtime_error& e) |
2619 { | 2619 { |
2620 JavaEnvironment::ThrowException(env, e.what()); | 2620 JavaEnvironment::ThrowOrthancException(env, e.what()); |
2621 } | 2621 } |
2622 catch (...) | 2622 catch (...) |
2623 { | 2623 { |
2624 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 2624 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
2625 } | 2625 } |
2626 } | 2626 } |
2627 | 2627 |
2628 | 2628 |
2629 JNIEXPORT void JNI_OrthancPluginFreeFindMatcher(JNIEnv* env, jobject sdkObject, jlong self) | 2629 JNIEXPORT void JNI_OrthancPluginFreeFindMatcher(JNIEnv* env, jobject sdkObject, jlong self) |
2634 , reinterpret_cast<OrthancPluginFindMatcher*>(static_cast<intptr_t>(self)) | 2634 , reinterpret_cast<OrthancPluginFindMatcher*>(static_cast<intptr_t>(self)) |
2635 ); | 2635 ); |
2636 } | 2636 } |
2637 catch (std::runtime_error& e) | 2637 catch (std::runtime_error& e) |
2638 { | 2638 { |
2639 JavaEnvironment::ThrowException(env, e.what()); | 2639 JavaEnvironment::ThrowOrthancException(env, e.what()); |
2640 } | 2640 } |
2641 catch (...) | 2641 catch (...) |
2642 { | 2642 { |
2643 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 2643 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
2644 } | 2644 } |
2645 } | 2645 } |
2646 | 2646 |
2647 | 2647 |
2648 JNIEXPORT jint JNI_OrthancPluginFindMatcherIsMatch(JNIEnv* env, jobject sdkObject, jlong self, jbyteArray arg0) | 2648 JNIEXPORT jint JNI_OrthancPluginFindMatcherIsMatch(JNIEnv* env, jobject sdkObject, jlong self, jbyteArray arg0) |
2654 , reinterpret_cast<OrthancPluginFindMatcher*>(static_cast<intptr_t>(self)) | 2654 , reinterpret_cast<OrthancPluginFindMatcher*>(static_cast<intptr_t>(self)) |
2655 , c_arg0.GetData(), c_arg0.GetSize()); | 2655 , c_arg0.GetData(), c_arg0.GetSize()); |
2656 } | 2656 } |
2657 catch (std::runtime_error& e) | 2657 catch (std::runtime_error& e) |
2658 { | 2658 { |
2659 JavaEnvironment::ThrowException(env, e.what()); | 2659 JavaEnvironment::ThrowOrthancException(env, e.what()); |
2660 return 0; | 2660 return 0; |
2661 } | 2661 } |
2662 catch (...) | 2662 catch (...) |
2663 { | 2663 { |
2664 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 2664 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
2665 return 0; | 2665 return 0; |
2666 } | 2666 } |
2667 } | 2667 } |
2668 | 2668 |
2669 | 2669 |
2675 , reinterpret_cast<OrthancPluginFindQuery*>(static_cast<intptr_t>(self)) | 2675 , reinterpret_cast<OrthancPluginFindQuery*>(static_cast<intptr_t>(self)) |
2676 ); | 2676 ); |
2677 } | 2677 } |
2678 catch (std::runtime_error& e) | 2678 catch (std::runtime_error& e) |
2679 { | 2679 { |
2680 JavaEnvironment::ThrowException(env, e.what()); | 2680 JavaEnvironment::ThrowOrthancException(env, e.what()); |
2681 return 0; | 2681 return 0; |
2682 } | 2682 } |
2683 catch (...) | 2683 catch (...) |
2684 { | 2684 { |
2685 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 2685 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
2686 return 0; | 2686 return 0; |
2687 } | 2687 } |
2688 } | 2688 } |
2689 | 2689 |
2690 | 2690 |
2695 OrthancString s(OrthancPluginGetFindQueryTagName(context_ | 2695 OrthancString s(OrthancPluginGetFindQueryTagName(context_ |
2696 , reinterpret_cast<OrthancPluginFindQuery*>(static_cast<intptr_t>(self)) | 2696 , reinterpret_cast<OrthancPluginFindQuery*>(static_cast<intptr_t>(self)) |
2697 , arg0)); | 2697 , arg0)); |
2698 if (s.GetValue() == NULL) | 2698 if (s.GetValue() == NULL) |
2699 { | 2699 { |
2700 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 2700 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
2701 return NULL; | 2701 return NULL; |
2702 } | 2702 } |
2703 else | 2703 else |
2704 { | 2704 { |
2705 jstring t = env->NewStringUTF(s.GetValue()); | 2705 jstring t = env->NewStringUTF(s.GetValue()); |
2706 if (t == NULL) | 2706 if (t == NULL) |
2707 { | 2707 { |
2708 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory); | 2708 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_NotEnoughMemory); |
2709 return NULL; | 2709 return NULL; |
2710 } | 2710 } |
2711 else | 2711 else |
2712 { | 2712 { |
2713 return t; | 2713 return t; |
2714 } | 2714 } |
2715 } | 2715 } |
2716 } | 2716 } |
2717 catch (std::runtime_error& e) | 2717 catch (std::runtime_error& e) |
2718 { | 2718 { |
2719 JavaEnvironment::ThrowException(env, e.what()); | 2719 JavaEnvironment::ThrowOrthancException(env, e.what()); |
2720 return NULL; | 2720 return NULL; |
2721 } | 2721 } |
2722 catch (...) | 2722 catch (...) |
2723 { | 2723 { |
2724 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 2724 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
2725 return NULL; | 2725 return NULL; |
2726 } | 2726 } |
2727 } | 2727 } |
2728 | 2728 |
2729 | 2729 |
2734 OrthancString s(OrthancPluginGetFindQueryValue(context_ | 2734 OrthancString s(OrthancPluginGetFindQueryValue(context_ |
2735 , reinterpret_cast<OrthancPluginFindQuery*>(static_cast<intptr_t>(self)) | 2735 , reinterpret_cast<OrthancPluginFindQuery*>(static_cast<intptr_t>(self)) |
2736 , arg0)); | 2736 , arg0)); |
2737 if (s.GetValue() == NULL) | 2737 if (s.GetValue() == NULL) |
2738 { | 2738 { |
2739 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 2739 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
2740 return NULL; | 2740 return NULL; |
2741 } | 2741 } |
2742 else | 2742 else |
2743 { | 2743 { |
2744 jstring t = env->NewStringUTF(s.GetValue()); | 2744 jstring t = env->NewStringUTF(s.GetValue()); |
2745 if (t == NULL) | 2745 if (t == NULL) |
2746 { | 2746 { |
2747 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory); | 2747 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_NotEnoughMemory); |
2748 return NULL; | 2748 return NULL; |
2749 } | 2749 } |
2750 else | 2750 else |
2751 { | 2751 { |
2752 return t; | 2752 return t; |
2753 } | 2753 } |
2754 } | 2754 } |
2755 } | 2755 } |
2756 catch (std::runtime_error& e) | 2756 catch (std::runtime_error& e) |
2757 { | 2757 { |
2758 JavaEnvironment::ThrowException(env, e.what()); | 2758 JavaEnvironment::ThrowOrthancException(env, e.what()); |
2759 return NULL; | 2759 return NULL; |
2760 } | 2760 } |
2761 catch (...) | 2761 catch (...) |
2762 { | 2762 { |
2763 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 2763 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
2764 return NULL; | 2764 return NULL; |
2765 } | 2765 } |
2766 } | 2766 } |
2767 | 2767 |
2768 | 2768 |
2774 , reinterpret_cast<OrthancPluginImage*>(static_cast<intptr_t>(self)) | 2774 , reinterpret_cast<OrthancPluginImage*>(static_cast<intptr_t>(self)) |
2775 ); | 2775 ); |
2776 } | 2776 } |
2777 catch (std::runtime_error& e) | 2777 catch (std::runtime_error& e) |
2778 { | 2778 { |
2779 JavaEnvironment::ThrowException(env, e.what()); | 2779 JavaEnvironment::ThrowOrthancException(env, e.what()); |
2780 } | 2780 } |
2781 catch (...) | 2781 catch (...) |
2782 { | 2782 { |
2783 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 2783 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
2784 } | 2784 } |
2785 } | 2785 } |
2786 | 2786 |
2787 | 2787 |
2788 JNIEXPORT jint JNI_OrthancPluginGetImagePixelFormat(JNIEnv* env, jobject sdkObject, jlong self) | 2788 JNIEXPORT jint JNI_OrthancPluginGetImagePixelFormat(JNIEnv* env, jobject sdkObject, jlong self) |
2793 , reinterpret_cast<OrthancPluginImage*>(static_cast<intptr_t>(self)) | 2793 , reinterpret_cast<OrthancPluginImage*>(static_cast<intptr_t>(self)) |
2794 ); | 2794 ); |
2795 } | 2795 } |
2796 catch (std::runtime_error& e) | 2796 catch (std::runtime_error& e) |
2797 { | 2797 { |
2798 JavaEnvironment::ThrowException(env, e.what()); | 2798 JavaEnvironment::ThrowOrthancException(env, e.what()); |
2799 return 0; | 2799 return 0; |
2800 } | 2800 } |
2801 catch (...) | 2801 catch (...) |
2802 { | 2802 { |
2803 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 2803 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
2804 return 0; | 2804 return 0; |
2805 } | 2805 } |
2806 } | 2806 } |
2807 | 2807 |
2808 | 2808 |
2814 , reinterpret_cast<OrthancPluginImage*>(static_cast<intptr_t>(self)) | 2814 , reinterpret_cast<OrthancPluginImage*>(static_cast<intptr_t>(self)) |
2815 ); | 2815 ); |
2816 } | 2816 } |
2817 catch (std::runtime_error& e) | 2817 catch (std::runtime_error& e) |
2818 { | 2818 { |
2819 JavaEnvironment::ThrowException(env, e.what()); | 2819 JavaEnvironment::ThrowOrthancException(env, e.what()); |
2820 return 0; | 2820 return 0; |
2821 } | 2821 } |
2822 catch (...) | 2822 catch (...) |
2823 { | 2823 { |
2824 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 2824 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
2825 return 0; | 2825 return 0; |
2826 } | 2826 } |
2827 } | 2827 } |
2828 | 2828 |
2829 | 2829 |
2835 , reinterpret_cast<OrthancPluginImage*>(static_cast<intptr_t>(self)) | 2835 , reinterpret_cast<OrthancPluginImage*>(static_cast<intptr_t>(self)) |
2836 ); | 2836 ); |
2837 } | 2837 } |
2838 catch (std::runtime_error& e) | 2838 catch (std::runtime_error& e) |
2839 { | 2839 { |
2840 JavaEnvironment::ThrowException(env, e.what()); | 2840 JavaEnvironment::ThrowOrthancException(env, e.what()); |
2841 return 0; | 2841 return 0; |
2842 } | 2842 } |
2843 catch (...) | 2843 catch (...) |
2844 { | 2844 { |
2845 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 2845 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
2846 return 0; | 2846 return 0; |
2847 } | 2847 } |
2848 } | 2848 } |
2849 | 2849 |
2850 | 2850 |
2856 , reinterpret_cast<OrthancPluginImage*>(static_cast<intptr_t>(self)) | 2856 , reinterpret_cast<OrthancPluginImage*>(static_cast<intptr_t>(self)) |
2857 ); | 2857 ); |
2858 } | 2858 } |
2859 catch (std::runtime_error& e) | 2859 catch (std::runtime_error& e) |
2860 { | 2860 { |
2861 JavaEnvironment::ThrowException(env, e.what()); | 2861 JavaEnvironment::ThrowOrthancException(env, e.what()); |
2862 return 0; | 2862 return 0; |
2863 } | 2863 } |
2864 catch (...) | 2864 catch (...) |
2865 { | 2865 { |
2866 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 2866 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
2867 return 0; | 2867 return 0; |
2868 } | 2868 } |
2869 } | 2869 } |
2870 | 2870 |
2871 | 2871 |
2876 OrthancPluginImage* answer = OrthancPluginConvertPixelFormat(context_ | 2876 OrthancPluginImage* answer = OrthancPluginConvertPixelFormat(context_ |
2877 , reinterpret_cast<OrthancPluginImage*>(static_cast<intptr_t>(self)) | 2877 , reinterpret_cast<OrthancPluginImage*>(static_cast<intptr_t>(self)) |
2878 , static_cast<OrthancPluginPixelFormat>(arg0)); | 2878 , static_cast<OrthancPluginPixelFormat>(arg0)); |
2879 if (answer == NULL) | 2879 if (answer == NULL) |
2880 { | 2880 { |
2881 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 2881 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
2882 return 0; | 2882 return 0; |
2883 } | 2883 } |
2884 else | 2884 else |
2885 { | 2885 { |
2886 return reinterpret_cast<intptr_t>(answer); | 2886 return reinterpret_cast<intptr_t>(answer); |
2887 } | 2887 } |
2888 } | 2888 } |
2889 catch (std::runtime_error& e) | 2889 catch (std::runtime_error& e) |
2890 { | 2890 { |
2891 JavaEnvironment::ThrowException(env, e.what()); | 2891 JavaEnvironment::ThrowOrthancException(env, e.what()); |
2892 return 0; | 2892 return 0; |
2893 } | 2893 } |
2894 catch (...) | 2894 catch (...) |
2895 { | 2895 { |
2896 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 2896 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
2897 return 0; | 2897 return 0; |
2898 } | 2898 } |
2899 } | 2899 } |
2900 | 2900 |
2901 | 2901 |
2907 OrthancPluginErrorCode code = OrthancPluginDrawText(context_ | 2907 OrthancPluginErrorCode code = OrthancPluginDrawText(context_ |
2908 , reinterpret_cast<OrthancPluginImage*>(static_cast<intptr_t>(self)) | 2908 , reinterpret_cast<OrthancPluginImage*>(static_cast<intptr_t>(self)) |
2909 , arg0, c_arg1.GetValue(), arg2, arg3, arg4, arg5, arg6); | 2909 , arg0, c_arg1.GetValue(), arg2, arg3, arg4, arg5, arg6); |
2910 if (code != OrthancPluginErrorCode_Success) | 2910 if (code != OrthancPluginErrorCode_Success) |
2911 { | 2911 { |
2912 JavaEnvironment::ThrowException(env, code); | 2912 JavaEnvironment::ThrowOrthancException(env, code); |
2913 } | 2913 } |
2914 } | 2914 } |
2915 catch (std::runtime_error& e) | 2915 catch (std::runtime_error& e) |
2916 { | 2916 { |
2917 JavaEnvironment::ThrowException(env, e.what()); | 2917 JavaEnvironment::ThrowOrthancException(env, e.what()); |
2918 } | 2918 } |
2919 catch (...) | 2919 catch (...) |
2920 { | 2920 { |
2921 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 2921 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
2922 } | 2922 } |
2923 } | 2923 } |
2924 | 2924 |
2925 | 2925 |
2926 JNIEXPORT void JNI_OrthancPluginFreeJob(JNIEnv* env, jobject sdkObject, jlong self) | 2926 JNIEXPORT void JNI_OrthancPluginFreeJob(JNIEnv* env, jobject sdkObject, jlong self) |
2931 , reinterpret_cast<OrthancPluginJob*>(static_cast<intptr_t>(self)) | 2931 , reinterpret_cast<OrthancPluginJob*>(static_cast<intptr_t>(self)) |
2932 ); | 2932 ); |
2933 } | 2933 } |
2934 catch (std::runtime_error& e) | 2934 catch (std::runtime_error& e) |
2935 { | 2935 { |
2936 JavaEnvironment::ThrowException(env, e.what()); | 2936 JavaEnvironment::ThrowOrthancException(env, e.what()); |
2937 } | 2937 } |
2938 catch (...) | 2938 catch (...) |
2939 { | 2939 { |
2940 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 2940 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
2941 } | 2941 } |
2942 } | 2942 } |
2943 | 2943 |
2944 | 2944 |
2945 JNIEXPORT jstring JNI_OrthancPluginSubmitJob(JNIEnv* env, jobject sdkObject, jlong self, jint arg0) | 2945 JNIEXPORT jstring JNI_OrthancPluginSubmitJob(JNIEnv* env, jobject sdkObject, jlong self, jint arg0) |
2949 OrthancString s(OrthancPluginSubmitJob(context_ | 2949 OrthancString s(OrthancPluginSubmitJob(context_ |
2950 , reinterpret_cast<OrthancPluginJob*>(static_cast<intptr_t>(self)) | 2950 , reinterpret_cast<OrthancPluginJob*>(static_cast<intptr_t>(self)) |
2951 , arg0)); | 2951 , arg0)); |
2952 if (s.GetValue() == NULL) | 2952 if (s.GetValue() == NULL) |
2953 { | 2953 { |
2954 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 2954 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
2955 return NULL; | 2955 return NULL; |
2956 } | 2956 } |
2957 else | 2957 else |
2958 { | 2958 { |
2959 jstring t = env->NewStringUTF(s.GetValue()); | 2959 jstring t = env->NewStringUTF(s.GetValue()); |
2960 if (t == NULL) | 2960 if (t == NULL) |
2961 { | 2961 { |
2962 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory); | 2962 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_NotEnoughMemory); |
2963 return NULL; | 2963 return NULL; |
2964 } | 2964 } |
2965 else | 2965 else |
2966 { | 2966 { |
2967 return t; | 2967 return t; |
2968 } | 2968 } |
2969 } | 2969 } |
2970 } | 2970 } |
2971 catch (std::runtime_error& e) | 2971 catch (std::runtime_error& e) |
2972 { | 2972 { |
2973 JavaEnvironment::ThrowException(env, e.what()); | 2973 JavaEnvironment::ThrowOrthancException(env, e.what()); |
2974 return NULL; | 2974 return NULL; |
2975 } | 2975 } |
2976 catch (...) | 2976 catch (...) |
2977 { | 2977 { |
2978 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 2978 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
2979 return NULL; | 2979 return NULL; |
2980 } | 2980 } |
2981 } | 2981 } |
2982 | 2982 |
2983 | 2983 |
2989 , reinterpret_cast<OrthancPluginPeers*>(static_cast<intptr_t>(self)) | 2989 , reinterpret_cast<OrthancPluginPeers*>(static_cast<intptr_t>(self)) |
2990 ); | 2990 ); |
2991 } | 2991 } |
2992 catch (std::runtime_error& e) | 2992 catch (std::runtime_error& e) |
2993 { | 2993 { |
2994 JavaEnvironment::ThrowException(env, e.what()); | 2994 JavaEnvironment::ThrowOrthancException(env, e.what()); |
2995 } | 2995 } |
2996 catch (...) | 2996 catch (...) |
2997 { | 2997 { |
2998 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 2998 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
2999 } | 2999 } |
3000 } | 3000 } |
3001 | 3001 |
3002 | 3002 |
3003 JNIEXPORT jint JNI_OrthancPluginGetPeersCount(JNIEnv* env, jobject sdkObject, jlong self) | 3003 JNIEXPORT jint JNI_OrthancPluginGetPeersCount(JNIEnv* env, jobject sdkObject, jlong self) |
3008 , reinterpret_cast<OrthancPluginPeers*>(static_cast<intptr_t>(self)) | 3008 , reinterpret_cast<OrthancPluginPeers*>(static_cast<intptr_t>(self)) |
3009 ); | 3009 ); |
3010 } | 3010 } |
3011 catch (std::runtime_error& e) | 3011 catch (std::runtime_error& e) |
3012 { | 3012 { |
3013 JavaEnvironment::ThrowException(env, e.what()); | 3013 JavaEnvironment::ThrowOrthancException(env, e.what()); |
3014 return 0; | 3014 return 0; |
3015 } | 3015 } |
3016 catch (...) | 3016 catch (...) |
3017 { | 3017 { |
3018 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 3018 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
3019 return 0; | 3019 return 0; |
3020 } | 3020 } |
3021 } | 3021 } |
3022 | 3022 |
3023 | 3023 |
3028 const char* s = OrthancPluginGetPeerName(context_ | 3028 const char* s = OrthancPluginGetPeerName(context_ |
3029 , reinterpret_cast<OrthancPluginPeers*>(static_cast<intptr_t>(self)) | 3029 , reinterpret_cast<OrthancPluginPeers*>(static_cast<intptr_t>(self)) |
3030 , arg0); | 3030 , arg0); |
3031 if (s == NULL) | 3031 if (s == NULL) |
3032 { | 3032 { |
3033 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 3033 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
3034 return NULL; | 3034 return NULL; |
3035 } | 3035 } |
3036 else | 3036 else |
3037 { | 3037 { |
3038 return env->NewStringUTF(s); | 3038 return env->NewStringUTF(s); |
3039 } | 3039 } |
3040 } | 3040 } |
3041 catch (std::runtime_error& e) | 3041 catch (std::runtime_error& e) |
3042 { | 3042 { |
3043 JavaEnvironment::ThrowException(env, e.what()); | 3043 JavaEnvironment::ThrowOrthancException(env, e.what()); |
3044 return NULL; | 3044 return NULL; |
3045 } | 3045 } |
3046 catch (...) | 3046 catch (...) |
3047 { | 3047 { |
3048 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 3048 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
3049 return NULL; | 3049 return NULL; |
3050 } | 3050 } |
3051 } | 3051 } |
3052 | 3052 |
3053 | 3053 |
3058 const char* s = OrthancPluginGetPeerUrl(context_ | 3058 const char* s = OrthancPluginGetPeerUrl(context_ |
3059 , reinterpret_cast<OrthancPluginPeers*>(static_cast<intptr_t>(self)) | 3059 , reinterpret_cast<OrthancPluginPeers*>(static_cast<intptr_t>(self)) |
3060 , arg0); | 3060 , arg0); |
3061 if (s == NULL) | 3061 if (s == NULL) |
3062 { | 3062 { |
3063 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 3063 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
3064 return NULL; | 3064 return NULL; |
3065 } | 3065 } |
3066 else | 3066 else |
3067 { | 3067 { |
3068 return env->NewStringUTF(s); | 3068 return env->NewStringUTF(s); |
3069 } | 3069 } |
3070 } | 3070 } |
3071 catch (std::runtime_error& e) | 3071 catch (std::runtime_error& e) |
3072 { | 3072 { |
3073 JavaEnvironment::ThrowException(env, e.what()); | 3073 JavaEnvironment::ThrowOrthancException(env, e.what()); |
3074 return NULL; | 3074 return NULL; |
3075 } | 3075 } |
3076 catch (...) | 3076 catch (...) |
3077 { | 3077 { |
3078 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 3078 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
3079 return NULL; | 3079 return NULL; |
3080 } | 3080 } |
3081 } | 3081 } |
3082 | 3082 |
3083 | 3083 |
3089 const char* s = OrthancPluginGetPeerUserProperty(context_ | 3089 const char* s = OrthancPluginGetPeerUserProperty(context_ |
3090 , reinterpret_cast<OrthancPluginPeers*>(static_cast<intptr_t>(self)) | 3090 , reinterpret_cast<OrthancPluginPeers*>(static_cast<intptr_t>(self)) |
3091 , arg0, c_arg1.GetValue()); | 3091 , arg0, c_arg1.GetValue()); |
3092 if (s == NULL) | 3092 if (s == NULL) |
3093 { | 3093 { |
3094 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 3094 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
3095 return NULL; | 3095 return NULL; |
3096 } | 3096 } |
3097 else | 3097 else |
3098 { | 3098 { |
3099 return env->NewStringUTF(s); | 3099 return env->NewStringUTF(s); |
3100 } | 3100 } |
3101 } | 3101 } |
3102 catch (std::runtime_error& e) | 3102 catch (std::runtime_error& e) |
3103 { | 3103 { |
3104 JavaEnvironment::ThrowException(env, e.what()); | 3104 JavaEnvironment::ThrowOrthancException(env, e.what()); |
3105 return NULL; | 3105 return NULL; |
3106 } | 3106 } |
3107 catch (...) | 3107 catch (...) |
3108 { | 3108 { |
3109 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 3109 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
3110 return NULL; | 3110 return NULL; |
3111 } | 3111 } |
3112 } | 3112 } |
3113 | 3113 |
3114 | 3114 |
3122 , reinterpret_cast<OrthancPluginRestOutput*>(static_cast<intptr_t>(self)) | 3122 , reinterpret_cast<OrthancPluginRestOutput*>(static_cast<intptr_t>(self)) |
3123 , c_arg0.GetData(), c_arg0.GetSize(), c_arg2.GetValue()); | 3123 , c_arg0.GetData(), c_arg0.GetSize(), c_arg2.GetValue()); |
3124 } | 3124 } |
3125 catch (std::runtime_error& e) | 3125 catch (std::runtime_error& e) |
3126 { | 3126 { |
3127 JavaEnvironment::ThrowException(env, e.what()); | 3127 JavaEnvironment::ThrowOrthancException(env, e.what()); |
3128 } | 3128 } |
3129 catch (...) | 3129 catch (...) |
3130 { | 3130 { |
3131 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 3131 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
3132 } | 3132 } |
3133 } | 3133 } |
3134 | 3134 |
3135 | 3135 |
3136 JNIEXPORT void JNI_OrthancPluginCompressAndAnswerPngImage(JNIEnv* env, jobject sdkObject, jlong self, jint arg0, jint arg1, jint arg2, jint arg3, jbyteArray arg4) | 3136 JNIEXPORT void JNI_OrthancPluginCompressAndAnswerPngImage(JNIEnv* env, jobject sdkObject, jlong self, jint arg0, jint arg1, jint arg2, jint arg3, jbyteArray arg4) |
3142 , reinterpret_cast<OrthancPluginRestOutput*>(static_cast<intptr_t>(self)) | 3142 , reinterpret_cast<OrthancPluginRestOutput*>(static_cast<intptr_t>(self)) |
3143 , static_cast<OrthancPluginPixelFormat>(arg0), arg1, arg2, arg3, c_arg4.GetData()); | 3143 , static_cast<OrthancPluginPixelFormat>(arg0), arg1, arg2, arg3, c_arg4.GetData()); |
3144 } | 3144 } |
3145 catch (std::runtime_error& e) | 3145 catch (std::runtime_error& e) |
3146 { | 3146 { |
3147 JavaEnvironment::ThrowException(env, e.what()); | 3147 JavaEnvironment::ThrowOrthancException(env, e.what()); |
3148 } | 3148 } |
3149 catch (...) | 3149 catch (...) |
3150 { | 3150 { |
3151 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 3151 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
3152 } | 3152 } |
3153 } | 3153 } |
3154 | 3154 |
3155 | 3155 |
3156 JNIEXPORT void JNI_OrthancPluginRedirect(JNIEnv* env, jobject sdkObject, jlong self, jstring arg0) | 3156 JNIEXPORT void JNI_OrthancPluginRedirect(JNIEnv* env, jobject sdkObject, jlong self, jstring arg0) |
3162 , reinterpret_cast<OrthancPluginRestOutput*>(static_cast<intptr_t>(self)) | 3162 , reinterpret_cast<OrthancPluginRestOutput*>(static_cast<intptr_t>(self)) |
3163 , c_arg0.GetValue()); | 3163 , c_arg0.GetValue()); |
3164 } | 3164 } |
3165 catch (std::runtime_error& e) | 3165 catch (std::runtime_error& e) |
3166 { | 3166 { |
3167 JavaEnvironment::ThrowException(env, e.what()); | 3167 JavaEnvironment::ThrowOrthancException(env, e.what()); |
3168 } | 3168 } |
3169 catch (...) | 3169 catch (...) |
3170 { | 3170 { |
3171 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 3171 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
3172 } | 3172 } |
3173 } | 3173 } |
3174 | 3174 |
3175 | 3175 |
3176 JNIEXPORT void JNI_OrthancPluginSendHttpStatusCode(JNIEnv* env, jobject sdkObject, jlong self, jshort arg0) | 3176 JNIEXPORT void JNI_OrthancPluginSendHttpStatusCode(JNIEnv* env, jobject sdkObject, jlong self, jshort arg0) |
3181 , reinterpret_cast<OrthancPluginRestOutput*>(static_cast<intptr_t>(self)) | 3181 , reinterpret_cast<OrthancPluginRestOutput*>(static_cast<intptr_t>(self)) |
3182 , arg0); | 3182 , arg0); |
3183 } | 3183 } |
3184 catch (std::runtime_error& e) | 3184 catch (std::runtime_error& e) |
3185 { | 3185 { |
3186 JavaEnvironment::ThrowException(env, e.what()); | 3186 JavaEnvironment::ThrowOrthancException(env, e.what()); |
3187 } | 3187 } |
3188 catch (...) | 3188 catch (...) |
3189 { | 3189 { |
3190 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 3190 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
3191 } | 3191 } |
3192 } | 3192 } |
3193 | 3193 |
3194 | 3194 |
3195 JNIEXPORT void JNI_OrthancPluginSendUnauthorized(JNIEnv* env, jobject sdkObject, jlong self, jstring arg0) | 3195 JNIEXPORT void JNI_OrthancPluginSendUnauthorized(JNIEnv* env, jobject sdkObject, jlong self, jstring arg0) |
3201 , reinterpret_cast<OrthancPluginRestOutput*>(static_cast<intptr_t>(self)) | 3201 , reinterpret_cast<OrthancPluginRestOutput*>(static_cast<intptr_t>(self)) |
3202 , c_arg0.GetValue()); | 3202 , c_arg0.GetValue()); |
3203 } | 3203 } |
3204 catch (std::runtime_error& e) | 3204 catch (std::runtime_error& e) |
3205 { | 3205 { |
3206 JavaEnvironment::ThrowException(env, e.what()); | 3206 JavaEnvironment::ThrowOrthancException(env, e.what()); |
3207 } | 3207 } |
3208 catch (...) | 3208 catch (...) |
3209 { | 3209 { |
3210 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 3210 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
3211 } | 3211 } |
3212 } | 3212 } |
3213 | 3213 |
3214 | 3214 |
3215 JNIEXPORT void JNI_OrthancPluginSendMethodNotAllowed(JNIEnv* env, jobject sdkObject, jlong self, jstring arg0) | 3215 JNIEXPORT void JNI_OrthancPluginSendMethodNotAllowed(JNIEnv* env, jobject sdkObject, jlong self, jstring arg0) |
3221 , reinterpret_cast<OrthancPluginRestOutput*>(static_cast<intptr_t>(self)) | 3221 , reinterpret_cast<OrthancPluginRestOutput*>(static_cast<intptr_t>(self)) |
3222 , c_arg0.GetValue()); | 3222 , c_arg0.GetValue()); |
3223 } | 3223 } |
3224 catch (std::runtime_error& e) | 3224 catch (std::runtime_error& e) |
3225 { | 3225 { |
3226 JavaEnvironment::ThrowException(env, e.what()); | 3226 JavaEnvironment::ThrowOrthancException(env, e.what()); |
3227 } | 3227 } |
3228 catch (...) | 3228 catch (...) |
3229 { | 3229 { |
3230 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 3230 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
3231 } | 3231 } |
3232 } | 3232 } |
3233 | 3233 |
3234 | 3234 |
3235 JNIEXPORT void JNI_OrthancPluginSetCookie(JNIEnv* env, jobject sdkObject, jlong self, jstring arg0, jstring arg1) | 3235 JNIEXPORT void JNI_OrthancPluginSetCookie(JNIEnv* env, jobject sdkObject, jlong self, jstring arg0, jstring arg1) |
3242 , reinterpret_cast<OrthancPluginRestOutput*>(static_cast<intptr_t>(self)) | 3242 , reinterpret_cast<OrthancPluginRestOutput*>(static_cast<intptr_t>(self)) |
3243 , c_arg0.GetValue(), c_arg1.GetValue()); | 3243 , c_arg0.GetValue(), c_arg1.GetValue()); |
3244 } | 3244 } |
3245 catch (std::runtime_error& e) | 3245 catch (std::runtime_error& e) |
3246 { | 3246 { |
3247 JavaEnvironment::ThrowException(env, e.what()); | 3247 JavaEnvironment::ThrowOrthancException(env, e.what()); |
3248 } | 3248 } |
3249 catch (...) | 3249 catch (...) |
3250 { | 3250 { |
3251 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 3251 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
3252 } | 3252 } |
3253 } | 3253 } |
3254 | 3254 |
3255 | 3255 |
3256 JNIEXPORT void JNI_OrthancPluginSetHttpHeader(JNIEnv* env, jobject sdkObject, jlong self, jstring arg0, jstring arg1) | 3256 JNIEXPORT void JNI_OrthancPluginSetHttpHeader(JNIEnv* env, jobject sdkObject, jlong self, jstring arg0, jstring arg1) |
3263 , reinterpret_cast<OrthancPluginRestOutput*>(static_cast<intptr_t>(self)) | 3263 , reinterpret_cast<OrthancPluginRestOutput*>(static_cast<intptr_t>(self)) |
3264 , c_arg0.GetValue(), c_arg1.GetValue()); | 3264 , c_arg0.GetValue(), c_arg1.GetValue()); |
3265 } | 3265 } |
3266 catch (std::runtime_error& e) | 3266 catch (std::runtime_error& e) |
3267 { | 3267 { |
3268 JavaEnvironment::ThrowException(env, e.what()); | 3268 JavaEnvironment::ThrowOrthancException(env, e.what()); |
3269 } | 3269 } |
3270 catch (...) | 3270 catch (...) |
3271 { | 3271 { |
3272 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 3272 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
3273 } | 3273 } |
3274 } | 3274 } |
3275 | 3275 |
3276 | 3276 |
3277 JNIEXPORT void JNI_OrthancPluginStartMultipartAnswer(JNIEnv* env, jobject sdkObject, jlong self, jstring arg0, jstring arg1) | 3277 JNIEXPORT void JNI_OrthancPluginStartMultipartAnswer(JNIEnv* env, jobject sdkObject, jlong self, jstring arg0, jstring arg1) |
3283 OrthancPluginErrorCode code = OrthancPluginStartMultipartAnswer(context_ | 3283 OrthancPluginErrorCode code = OrthancPluginStartMultipartAnswer(context_ |
3284 , reinterpret_cast<OrthancPluginRestOutput*>(static_cast<intptr_t>(self)) | 3284 , reinterpret_cast<OrthancPluginRestOutput*>(static_cast<intptr_t>(self)) |
3285 , c_arg0.GetValue(), c_arg1.GetValue()); | 3285 , c_arg0.GetValue(), c_arg1.GetValue()); |
3286 if (code != OrthancPluginErrorCode_Success) | 3286 if (code != OrthancPluginErrorCode_Success) |
3287 { | 3287 { |
3288 JavaEnvironment::ThrowException(env, code); | 3288 JavaEnvironment::ThrowOrthancException(env, code); |
3289 } | 3289 } |
3290 } | 3290 } |
3291 catch (std::runtime_error& e) | 3291 catch (std::runtime_error& e) |
3292 { | 3292 { |
3293 JavaEnvironment::ThrowException(env, e.what()); | 3293 JavaEnvironment::ThrowOrthancException(env, e.what()); |
3294 } | 3294 } |
3295 catch (...) | 3295 catch (...) |
3296 { | 3296 { |
3297 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 3297 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
3298 } | 3298 } |
3299 } | 3299 } |
3300 | 3300 |
3301 | 3301 |
3302 JNIEXPORT void JNI_OrthancPluginSendMultipartItem(JNIEnv* env, jobject sdkObject, jlong self, jbyteArray arg0) | 3302 JNIEXPORT void JNI_OrthancPluginSendMultipartItem(JNIEnv* env, jobject sdkObject, jlong self, jbyteArray arg0) |
3307 OrthancPluginErrorCode code = OrthancPluginSendMultipartItem(context_ | 3307 OrthancPluginErrorCode code = OrthancPluginSendMultipartItem(context_ |
3308 , reinterpret_cast<OrthancPluginRestOutput*>(static_cast<intptr_t>(self)) | 3308 , reinterpret_cast<OrthancPluginRestOutput*>(static_cast<intptr_t>(self)) |
3309 , c_arg0.GetData(), c_arg0.GetSize()); | 3309 , c_arg0.GetData(), c_arg0.GetSize()); |
3310 if (code != OrthancPluginErrorCode_Success) | 3310 if (code != OrthancPluginErrorCode_Success) |
3311 { | 3311 { |
3312 JavaEnvironment::ThrowException(env, code); | 3312 JavaEnvironment::ThrowOrthancException(env, code); |
3313 } | 3313 } |
3314 } | 3314 } |
3315 catch (std::runtime_error& e) | 3315 catch (std::runtime_error& e) |
3316 { | 3316 { |
3317 JavaEnvironment::ThrowException(env, e.what()); | 3317 JavaEnvironment::ThrowOrthancException(env, e.what()); |
3318 } | 3318 } |
3319 catch (...) | 3319 catch (...) |
3320 { | 3320 { |
3321 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 3321 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
3322 } | 3322 } |
3323 } | 3323 } |
3324 | 3324 |
3325 | 3325 |
3326 JNIEXPORT void JNI_OrthancPluginSendHttpStatus(JNIEnv* env, jobject sdkObject, jlong self, jshort arg0, jbyteArray arg1) | 3326 JNIEXPORT void JNI_OrthancPluginSendHttpStatus(JNIEnv* env, jobject sdkObject, jlong self, jshort arg0, jbyteArray arg1) |
3332 , reinterpret_cast<OrthancPluginRestOutput*>(static_cast<intptr_t>(self)) | 3332 , reinterpret_cast<OrthancPluginRestOutput*>(static_cast<intptr_t>(self)) |
3333 , arg0, c_arg1.GetData(), c_arg1.GetSize()); | 3333 , arg0, c_arg1.GetData(), c_arg1.GetSize()); |
3334 } | 3334 } |
3335 catch (std::runtime_error& e) | 3335 catch (std::runtime_error& e) |
3336 { | 3336 { |
3337 JavaEnvironment::ThrowException(env, e.what()); | 3337 JavaEnvironment::ThrowOrthancException(env, e.what()); |
3338 } | 3338 } |
3339 catch (...) | 3339 catch (...) |
3340 { | 3340 { |
3341 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 3341 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
3342 } | 3342 } |
3343 } | 3343 } |
3344 | 3344 |
3345 | 3345 |
3346 JNIEXPORT void JNI_OrthancPluginCompressAndAnswerJpegImage(JNIEnv* env, jobject sdkObject, jlong self, jint arg0, jint arg1, jint arg2, jint arg3, jbyteArray arg4, jbyte arg5) | 3346 JNIEXPORT void JNI_OrthancPluginCompressAndAnswerJpegImage(JNIEnv* env, jobject sdkObject, jlong self, jint arg0, jint arg1, jint arg2, jint arg3, jbyteArray arg4, jbyte arg5) |
3352 , reinterpret_cast<OrthancPluginRestOutput*>(static_cast<intptr_t>(self)) | 3352 , reinterpret_cast<OrthancPluginRestOutput*>(static_cast<intptr_t>(self)) |
3353 , static_cast<OrthancPluginPixelFormat>(arg0), arg1, arg2, arg3, c_arg4.GetData(), arg5); | 3353 , static_cast<OrthancPluginPixelFormat>(arg0), arg1, arg2, arg3, c_arg4.GetData(), arg5); |
3354 } | 3354 } |
3355 catch (std::runtime_error& e) | 3355 catch (std::runtime_error& e) |
3356 { | 3356 { |
3357 JavaEnvironment::ThrowException(env, e.what()); | 3357 JavaEnvironment::ThrowOrthancException(env, e.what()); |
3358 } | 3358 } |
3359 catch (...) | 3359 catch (...) |
3360 { | 3360 { |
3361 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 3361 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
3362 } | 3362 } |
3363 } | 3363 } |
3364 | 3364 |
3365 | 3365 |
3366 JNIEXPORT void JNI_OrthancPluginSetHttpErrorDetails(JNIEnv* env, jobject sdkObject, jlong self, jstring arg0, jbyte arg1) | 3366 JNIEXPORT void JNI_OrthancPluginSetHttpErrorDetails(JNIEnv* env, jobject sdkObject, jlong self, jstring arg0, jbyte arg1) |
3372 , reinterpret_cast<OrthancPluginRestOutput*>(static_cast<intptr_t>(self)) | 3372 , reinterpret_cast<OrthancPluginRestOutput*>(static_cast<intptr_t>(self)) |
3373 , c_arg0.GetValue(), arg1); | 3373 , c_arg0.GetValue(), arg1); |
3374 } | 3374 } |
3375 catch (std::runtime_error& e) | 3375 catch (std::runtime_error& e) |
3376 { | 3376 { |
3377 JavaEnvironment::ThrowException(env, e.what()); | 3377 JavaEnvironment::ThrowOrthancException(env, e.what()); |
3378 } | 3378 } |
3379 catch (...) | 3379 catch (...) |
3380 { | 3380 { |
3381 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 3381 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
3382 } | 3382 } |
3383 } | 3383 } |
3384 | 3384 |
3385 | 3385 |
3386 JNIEXPORT void JNI_OrthancPluginStorageAreaCreate(JNIEnv* env, jobject sdkObject, jlong self, jstring arg0, jbyteArray arg1, jlong arg2, jint arg3) | 3386 JNIEXPORT void JNI_OrthancPluginStorageAreaCreate(JNIEnv* env, jobject sdkObject, jlong self, jstring arg0, jbyteArray arg1, jlong arg2, jint arg3) |
3392 OrthancPluginErrorCode code = OrthancPluginStorageAreaCreate(context_ | 3392 OrthancPluginErrorCode code = OrthancPluginStorageAreaCreate(context_ |
3393 , reinterpret_cast<OrthancPluginStorageArea*>(static_cast<intptr_t>(self)) | 3393 , reinterpret_cast<OrthancPluginStorageArea*>(static_cast<intptr_t>(self)) |
3394 , c_arg0.GetValue(), c_arg1.GetData(), arg2, static_cast<OrthancPluginContentType>(arg3)); | 3394 , c_arg0.GetValue(), c_arg1.GetData(), arg2, static_cast<OrthancPluginContentType>(arg3)); |
3395 if (code != OrthancPluginErrorCode_Success) | 3395 if (code != OrthancPluginErrorCode_Success) |
3396 { | 3396 { |
3397 JavaEnvironment::ThrowException(env, code); | 3397 JavaEnvironment::ThrowOrthancException(env, code); |
3398 } | 3398 } |
3399 } | 3399 } |
3400 catch (std::runtime_error& e) | 3400 catch (std::runtime_error& e) |
3401 { | 3401 { |
3402 JavaEnvironment::ThrowException(env, e.what()); | 3402 JavaEnvironment::ThrowOrthancException(env, e.what()); |
3403 } | 3403 } |
3404 catch (...) | 3404 catch (...) |
3405 { | 3405 { |
3406 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 3406 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
3407 } | 3407 } |
3408 } | 3408 } |
3409 | 3409 |
3410 | 3410 |
3411 JNIEXPORT jbyteArray JNI_OrthancPluginStorageAreaRead(JNIEnv* env, jobject sdkObject, jlong self, jstring arg0, jint arg1) | 3411 JNIEXPORT jbyteArray JNI_OrthancPluginStorageAreaRead(JNIEnv* env, jobject sdkObject, jlong self, jstring arg0, jint arg1) |
3420 if (code == OrthancPluginErrorCode_Success) | 3420 if (code == OrthancPluginErrorCode_Success) |
3421 { | 3421 { |
3422 jbyteArray answer = env->NewByteArray(b.GetSize()); | 3422 jbyteArray answer = env->NewByteArray(b.GetSize()); |
3423 if (answer == NULL) | 3423 if (answer == NULL) |
3424 { | 3424 { |
3425 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory); | 3425 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_NotEnoughMemory); |
3426 return NULL; | 3426 return NULL; |
3427 } | 3427 } |
3428 else | 3428 else |
3429 { | 3429 { |
3430 env->SetByteArrayRegion(answer, 0, b.GetSize(), reinterpret_cast<const jbyte*>(b.GetData())); | 3430 env->SetByteArrayRegion(answer, 0, b.GetSize(), reinterpret_cast<const jbyte*>(b.GetData())); |
3431 return answer; | 3431 return answer; |
3432 } | 3432 } |
3433 } | 3433 } |
3434 else | 3434 else |
3435 { | 3435 { |
3436 JavaEnvironment::ThrowException(env, code); | 3436 JavaEnvironment::ThrowOrthancException(env, code); |
3437 return NULL; | 3437 return NULL; |
3438 } | 3438 } |
3439 } | 3439 } |
3440 catch (std::runtime_error& e) | 3440 catch (std::runtime_error& e) |
3441 { | 3441 { |
3442 JavaEnvironment::ThrowException(env, e.what()); | 3442 JavaEnvironment::ThrowOrthancException(env, e.what()); |
3443 return NULL; | 3443 return NULL; |
3444 } | 3444 } |
3445 catch (...) | 3445 catch (...) |
3446 { | 3446 { |
3447 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 3447 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
3448 return NULL; | 3448 return NULL; |
3449 } | 3449 } |
3450 } | 3450 } |
3451 | 3451 |
3452 | 3452 |
3458 OrthancPluginErrorCode code = OrthancPluginStorageAreaRemove(context_ | 3458 OrthancPluginErrorCode code = OrthancPluginStorageAreaRemove(context_ |
3459 , reinterpret_cast<OrthancPluginStorageArea*>(static_cast<intptr_t>(self)) | 3459 , reinterpret_cast<OrthancPluginStorageArea*>(static_cast<intptr_t>(self)) |
3460 , c_arg0.GetValue(), static_cast<OrthancPluginContentType>(arg1)); | 3460 , c_arg0.GetValue(), static_cast<OrthancPluginContentType>(arg1)); |
3461 if (code != OrthancPluginErrorCode_Success) | 3461 if (code != OrthancPluginErrorCode_Success) |
3462 { | 3462 { |
3463 JavaEnvironment::ThrowException(env, code); | 3463 JavaEnvironment::ThrowOrthancException(env, code); |
3464 } | 3464 } |
3465 } | 3465 } |
3466 catch (std::runtime_error& e) | 3466 catch (std::runtime_error& e) |
3467 { | 3467 { |
3468 JavaEnvironment::ThrowException(env, e.what()); | 3468 JavaEnvironment::ThrowOrthancException(env, e.what()); |
3469 } | 3469 } |
3470 catch (...) | 3470 catch (...) |
3471 { | 3471 { |
3472 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 3472 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
3473 } | 3473 } |
3474 } | 3474 } |
3475 | 3475 |
3476 | 3476 |
3477 JNIEXPORT void JNI_OrthancPluginReconstructMainDicomTags(JNIEnv* env, jobject sdkObject, jlong self, jint arg0) | 3477 JNIEXPORT void JNI_OrthancPluginReconstructMainDicomTags(JNIEnv* env, jobject sdkObject, jlong self, jint arg0) |
3481 OrthancPluginErrorCode code = OrthancPluginReconstructMainDicomTags(context_ | 3481 OrthancPluginErrorCode code = OrthancPluginReconstructMainDicomTags(context_ |
3482 , reinterpret_cast<OrthancPluginStorageArea*>(static_cast<intptr_t>(self)) | 3482 , reinterpret_cast<OrthancPluginStorageArea*>(static_cast<intptr_t>(self)) |
3483 , static_cast<OrthancPluginResourceType>(arg0)); | 3483 , static_cast<OrthancPluginResourceType>(arg0)); |
3484 if (code != OrthancPluginErrorCode_Success) | 3484 if (code != OrthancPluginErrorCode_Success) |
3485 { | 3485 { |
3486 JavaEnvironment::ThrowException(env, code); | 3486 JavaEnvironment::ThrowOrthancException(env, code); |
3487 } | 3487 } |
3488 } | 3488 } |
3489 catch (std::runtime_error& e) | 3489 catch (std::runtime_error& e) |
3490 { | 3490 { |
3491 JavaEnvironment::ThrowException(env, e.what()); | 3491 JavaEnvironment::ThrowOrthancException(env, e.what()); |
3492 } | 3492 } |
3493 catch (...) | 3493 catch (...) |
3494 { | 3494 { |
3495 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 3495 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
3496 } | 3496 } |
3497 } | 3497 } |
3498 | 3498 |
3499 | 3499 |
3500 JNIEXPORT void JNI_OrthancPluginWorklistAddAnswer(JNIEnv* env, jobject sdkObject, jlong self, jlong arg0, jbyteArray arg1) | 3500 JNIEXPORT void JNI_OrthancPluginWorklistAddAnswer(JNIEnv* env, jobject sdkObject, jlong self, jlong arg0, jbyteArray arg1) |
3505 OrthancPluginErrorCode code = OrthancPluginWorklistAddAnswer(context_ | 3505 OrthancPluginErrorCode code = OrthancPluginWorklistAddAnswer(context_ |
3506 , reinterpret_cast<OrthancPluginWorklistAnswers*>(static_cast<intptr_t>(self)) | 3506 , reinterpret_cast<OrthancPluginWorklistAnswers*>(static_cast<intptr_t>(self)) |
3507 , reinterpret_cast<OrthancPluginWorklistQuery*>(static_cast<intptr_t>(arg0)), c_arg1.GetData(), c_arg1.GetSize()); | 3507 , reinterpret_cast<OrthancPluginWorklistQuery*>(static_cast<intptr_t>(arg0)), c_arg1.GetData(), c_arg1.GetSize()); |
3508 if (code != OrthancPluginErrorCode_Success) | 3508 if (code != OrthancPluginErrorCode_Success) |
3509 { | 3509 { |
3510 JavaEnvironment::ThrowException(env, code); | 3510 JavaEnvironment::ThrowOrthancException(env, code); |
3511 } | 3511 } |
3512 } | 3512 } |
3513 catch (std::runtime_error& e) | 3513 catch (std::runtime_error& e) |
3514 { | 3514 { |
3515 JavaEnvironment::ThrowException(env, e.what()); | 3515 JavaEnvironment::ThrowOrthancException(env, e.what()); |
3516 } | 3516 } |
3517 catch (...) | 3517 catch (...) |
3518 { | 3518 { |
3519 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 3519 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
3520 } | 3520 } |
3521 } | 3521 } |
3522 | 3522 |
3523 | 3523 |
3524 JNIEXPORT void JNI_OrthancPluginWorklistMarkIncomplete(JNIEnv* env, jobject sdkObject, jlong self) | 3524 JNIEXPORT void JNI_OrthancPluginWorklistMarkIncomplete(JNIEnv* env, jobject sdkObject, jlong self) |
3528 OrthancPluginErrorCode code = OrthancPluginWorklistMarkIncomplete(context_ | 3528 OrthancPluginErrorCode code = OrthancPluginWorklistMarkIncomplete(context_ |
3529 , reinterpret_cast<OrthancPluginWorklistAnswers*>(static_cast<intptr_t>(self)) | 3529 , reinterpret_cast<OrthancPluginWorklistAnswers*>(static_cast<intptr_t>(self)) |
3530 ); | 3530 ); |
3531 if (code != OrthancPluginErrorCode_Success) | 3531 if (code != OrthancPluginErrorCode_Success) |
3532 { | 3532 { |
3533 JavaEnvironment::ThrowException(env, code); | 3533 JavaEnvironment::ThrowOrthancException(env, code); |
3534 } | 3534 } |
3535 } | 3535 } |
3536 catch (std::runtime_error& e) | 3536 catch (std::runtime_error& e) |
3537 { | 3537 { |
3538 JavaEnvironment::ThrowException(env, e.what()); | 3538 JavaEnvironment::ThrowOrthancException(env, e.what()); |
3539 } | 3539 } |
3540 catch (...) | 3540 catch (...) |
3541 { | 3541 { |
3542 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 3542 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
3543 } | 3543 } |
3544 } | 3544 } |
3545 | 3545 |
3546 | 3546 |
3547 JNIEXPORT jint JNI_OrthancPluginWorklistIsMatch(JNIEnv* env, jobject sdkObject, jlong self, jbyteArray arg0) | 3547 JNIEXPORT jint JNI_OrthancPluginWorklistIsMatch(JNIEnv* env, jobject sdkObject, jlong self, jbyteArray arg0) |
3553 , reinterpret_cast<OrthancPluginWorklistQuery*>(static_cast<intptr_t>(self)) | 3553 , reinterpret_cast<OrthancPluginWorklistQuery*>(static_cast<intptr_t>(self)) |
3554 , c_arg0.GetData(), c_arg0.GetSize()); | 3554 , c_arg0.GetData(), c_arg0.GetSize()); |
3555 } | 3555 } |
3556 catch (std::runtime_error& e) | 3556 catch (std::runtime_error& e) |
3557 { | 3557 { |
3558 JavaEnvironment::ThrowException(env, e.what()); | 3558 JavaEnvironment::ThrowOrthancException(env, e.what()); |
3559 return 0; | 3559 return 0; |
3560 } | 3560 } |
3561 catch (...) | 3561 catch (...) |
3562 { | 3562 { |
3563 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 3563 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
3564 return 0; | 3564 return 0; |
3565 } | 3565 } |
3566 } | 3566 } |
3567 | 3567 |
3568 | 3568 |
3577 if (code == OrthancPluginErrorCode_Success) | 3577 if (code == OrthancPluginErrorCode_Success) |
3578 { | 3578 { |
3579 jbyteArray answer = env->NewByteArray(b.GetSize()); | 3579 jbyteArray answer = env->NewByteArray(b.GetSize()); |
3580 if (answer == NULL) | 3580 if (answer == NULL) |
3581 { | 3581 { |
3582 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_NotEnoughMemory); | 3582 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_NotEnoughMemory); |
3583 return NULL; | 3583 return NULL; |
3584 } | 3584 } |
3585 else | 3585 else |
3586 { | 3586 { |
3587 env->SetByteArrayRegion(answer, 0, b.GetSize(), reinterpret_cast<const jbyte*>(b.GetData())); | 3587 env->SetByteArrayRegion(answer, 0, b.GetSize(), reinterpret_cast<const jbyte*>(b.GetData())); |
3588 return answer; | 3588 return answer; |
3589 } | 3589 } |
3590 } | 3590 } |
3591 else | 3591 else |
3592 { | 3592 { |
3593 JavaEnvironment::ThrowException(env, code); | 3593 JavaEnvironment::ThrowOrthancException(env, code); |
3594 return NULL; | 3594 return NULL; |
3595 } | 3595 } |
3596 } | 3596 } |
3597 catch (std::runtime_error& e) | 3597 catch (std::runtime_error& e) |
3598 { | 3598 { |
3599 JavaEnvironment::ThrowException(env, e.what()); | 3599 JavaEnvironment::ThrowOrthancException(env, e.what()); |
3600 return NULL; | 3600 return NULL; |
3601 } | 3601 } |
3602 catch (...) | 3602 catch (...) |
3603 { | 3603 { |
3604 JavaEnvironment::ThrowException(env, OrthancPluginErrorCode_Plugin); | 3604 JavaEnvironment::ThrowOrthancException(env, OrthancPluginErrorCode_Plugin); |
3605 return NULL; | 3605 return NULL; |
3606 } | 3606 } |
3607 } | 3607 } |
3608 | 3608 |
3609 | 3609 |