comparison JavaSDK/be/uclouvain/orthanc/ErrorCode.java @ 0:3ecef5782f2c

initial commit
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 18 Oct 2023 17:59:44 +0200
parents
children 26c08ff926a3
comparison
equal deleted inserted replaced
-1:000000000000 0:3ecef5782f2c
1 package be.uclouvain.orthanc;
2
3 /**
4 * SPDX-FileCopyrightText: 2023 Sebastien Jodogne, UCLouvain, Belgium
5 * SPDX-License-Identifier: GPL-3.0-or-later
6 */
7
8 /**
9 * Java plugin for Orthanc
10 * Copyright (C) 2023 Sebastien Jodogne, UCLouvain, Belgium
11 *
12 * This program is free software: you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License as
14 * published by the Free Software Foundation, either version 3 of the
15 * License, or (at your option) any later version.
16 *
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program. If not, see http://www.gnu.org/licenses/.
24 **/
25
26
27 /**
28 * The various error codes that can be returned by the Orthanc core.
29 **/
30 public enum ErrorCode {
31 /**
32 * Internal error
33 **/
34 INTERNAL_ERROR(-1),
35 /**
36 * Success
37 **/
38 SUCCESS(0),
39 /**
40 * Error encountered within the plugin engine
41 **/
42 PLUGIN(1),
43 /**
44 * Not implemented yet
45 **/
46 NOT_IMPLEMENTED(2),
47 /**
48 * Parameter out of range
49 **/
50 PARAMETER_OUT_OF_RANGE(3),
51 /**
52 * The server hosting Orthanc is running out of memory
53 **/
54 NOT_ENOUGH_MEMORY(4),
55 /**
56 * Bad type for a parameter
57 **/
58 BAD_PARAMETER_TYPE(5),
59 /**
60 * Bad sequence of calls
61 **/
62 BAD_SEQUENCE_OF_CALLS(6),
63 /**
64 * Accessing an inexistent item
65 **/
66 INEXISTENT_ITEM(7),
67 /**
68 * Bad request
69 **/
70 BAD_REQUEST(8),
71 /**
72 * Error in the network protocol
73 **/
74 NETWORK_PROTOCOL(9),
75 /**
76 * Error while calling a system command
77 **/
78 SYSTEM_COMMAND(10),
79 /**
80 * Error with the database engine
81 **/
82 DATABASE(11),
83 /**
84 * Badly formatted URI
85 **/
86 URI_SYNTAX(12),
87 /**
88 * Inexistent file
89 **/
90 INEXISTENT_FILE(13),
91 /**
92 * Cannot write to file
93 **/
94 CANNOT_WRITE_FILE(14),
95 /**
96 * Bad file format
97 **/
98 BAD_FILE_FORMAT(15),
99 /**
100 * Timeout
101 **/
102 TIMEOUT(16),
103 /**
104 * Unknown resource
105 **/
106 UNKNOWN_RESOURCE(17),
107 /**
108 * Incompatible version of the database
109 **/
110 INCOMPATIBLE_DATABASE_VERSION(18),
111 /**
112 * The file storage is full
113 **/
114 FULL_STORAGE(19),
115 /**
116 * Corrupted file (e.g. inconsistent MD5 hash)
117 **/
118 CORRUPTED_FILE(20),
119 /**
120 * Inexistent tag
121 **/
122 INEXISTENT_TAG(21),
123 /**
124 * Cannot modify a read-only data structure
125 **/
126 READ_ONLY(22),
127 /**
128 * Incompatible format of the images
129 **/
130 INCOMPATIBLE_IMAGE_FORMAT(23),
131 /**
132 * Incompatible size of the images
133 **/
134 INCOMPATIBLE_IMAGE_SIZE(24),
135 /**
136 * Error while using a shared library (plugin)
137 **/
138 SHARED_LIBRARY(25),
139 /**
140 * Plugin invoking an unknown service
141 **/
142 UNKNOWN_PLUGIN_SERVICE(26),
143 /**
144 * Unknown DICOM tag
145 **/
146 UNKNOWN_DICOM_TAG(27),
147 /**
148 * Cannot parse a JSON document
149 **/
150 BAD_JSON(28),
151 /**
152 * Bad credentials were provided to an HTTP request
153 **/
154 UNAUTHORIZED(29),
155 /**
156 * Badly formatted font file
157 **/
158 BAD_FONT(30),
159 /**
160 * The plugin implementing a custom database back-end does not fulfill the proper
161 * interface
162 **/
163 DATABASE_PLUGIN(31),
164 /**
165 * Error in the plugin implementing a custom storage area
166 **/
167 STORAGE_AREA_PLUGIN(32),
168 /**
169 * The request is empty
170 **/
171 EMPTY_REQUEST(33),
172 /**
173 * Cannot send a response which is acceptable according to the Accept HTTP header
174 **/
175 NOT_ACCEPTABLE(34),
176 /**
177 * Cannot handle a NULL pointer
178 **/
179 NULL_POINTER(35),
180 /**
181 * The database is currently not available (probably a transient situation)
182 **/
183 DATABASE_UNAVAILABLE(36),
184 /**
185 * This job was canceled
186 **/
187 CANCELED_JOB(37),
188 /**
189 * Geometry error encountered in Stone
190 **/
191 BAD_GEOMETRY(38),
192 /**
193 * Cannot initialize SSL encryption, check out your certificates
194 **/
195 SSL_INITIALIZATION(39),
196 /**
197 * Calling a function that has been removed from the Orthanc Framework
198 **/
199 DISCONTINUED_ABI(40),
200 /**
201 * Incorrect range request
202 **/
203 BAD_RANGE(41),
204 /**
205 * Database could not serialize access due to concurrent update, the transaction
206 * should be retried
207 **/
208 DATABASE_CANNOT_SERIALIZE(42),
209 /**
210 * A bad revision number was provided, which might indicate conflict between
211 * multiple writers
212 **/
213 REVISION(43),
214 /**
215 * SQLite: The database is not opened
216 **/
217 SQLITE_NOT_OPENED(1000),
218 /**
219 * SQLite: Connection is already open
220 **/
221 SQLITE_ALREADY_OPENED(1001),
222 /**
223 * SQLite: Unable to open the database
224 **/
225 SQLITE_CANNOT_OPEN(1002),
226 /**
227 * SQLite: This cached statement is already being referred to
228 **/
229 SQLITE_STATEMENT_ALREADY_USED(1003),
230 /**
231 * SQLite: Cannot execute a command
232 **/
233 SQLITE_EXECUTE(1004),
234 /**
235 * SQLite: Rolling back a nonexistent transaction (have you called Begin()?)
236 **/
237 SQLITE_ROLLBACK_WITHOUT_TRANSACTION(1005),
238 /**
239 * SQLite: Committing a nonexistent transaction
240 **/
241 SQLITE_COMMIT_WITHOUT_TRANSACTION(1006),
242 /**
243 * SQLite: Unable to register a function
244 **/
245 SQLITE_REGISTER_FUNCTION(1007),
246 /**
247 * SQLite: Unable to flush the database
248 **/
249 SQLITE_FLUSH(1008),
250 /**
251 * SQLite: Cannot run a cached statement
252 **/
253 SQLITE_CANNOT_RUN(1009),
254 /**
255 * SQLite: Cannot step over a cached statement
256 **/
257 SQLITE_CANNOT_STEP(1010),
258 /**
259 * SQLite: Bing a value while out of range (serious error)
260 **/
261 SQLITE_BIND_OUT_OF_RANGE(1011),
262 /**
263 * SQLite: Cannot prepare a cached statement
264 **/
265 SQLITE_PREPARE_STATEMENT(1012),
266 /**
267 * SQLite: Beginning the same transaction twice
268 **/
269 SQLITE_TRANSACTION_ALREADY_STARTED(1013),
270 /**
271 * SQLite: Failure when committing the transaction
272 **/
273 SQLITE_TRANSACTION_COMMIT(1014),
274 /**
275 * SQLite: Cannot start a transaction
276 **/
277 SQLITE_TRANSACTION_BEGIN(1015),
278 /**
279 * The directory to be created is already occupied by a regular file
280 **/
281 DIRECTORY_OVER_FILE(2000),
282 /**
283 * Unable to create a subdirectory or a file in the file storage
284 **/
285 FILE_STORAGE_CANNOT_WRITE(2001),
286 /**
287 * The specified path does not point to a directory
288 **/
289 DIRECTORY_EXPECTED(2002),
290 /**
291 * The TCP port of the HTTP server is privileged or already in use
292 **/
293 HTTP_PORT_IN_USE(2003),
294 /**
295 * The TCP port of the DICOM server is privileged or already in use
296 **/
297 DICOM_PORT_IN_USE(2004),
298 /**
299 * This HTTP status is not allowed in a REST API
300 **/
301 BAD_HTTP_STATUS_IN_REST(2005),
302 /**
303 * The specified path does not point to a regular file
304 **/
305 REGULAR_FILE_EXPECTED(2006),
306 /**
307 * Unable to get the path to the executable
308 **/
309 PATH_TO_EXECUTABLE(2007),
310 /**
311 * Cannot create a directory
312 **/
313 MAKE_DIRECTORY(2008),
314 /**
315 * An application entity title (AET) cannot be empty or be longer than 16
316 * characters
317 **/
318 BAD_APPLICATION_ENTITY_TITLE(2009),
319 /**
320 * No request handler factory for DICOM C-FIND SCP
321 **/
322 NO_CFIND_HANDLER(2010),
323 /**
324 * No request handler factory for DICOM C-MOVE SCP
325 **/
326 NO_CMOVE_HANDLER(2011),
327 /**
328 * No request handler factory for DICOM C-STORE SCP
329 **/
330 NO_CSTORE_HANDLER(2012),
331 /**
332 * No application entity filter
333 **/
334 NO_APPLICATION_ENTITY_FILTER(2013),
335 /**
336 * DicomUserConnection: Unable to find the SOP class and instance
337 **/
338 NO_SOP_CLASS_OR_INSTANCE(2014),
339 /**
340 * DicomUserConnection: No acceptable presentation context for modality
341 **/
342 NO_PRESENTATION_CONTEXT(2015),
343 /**
344 * DicomUserConnection: The C-FIND command is not supported by the remote SCP
345 **/
346 DICOM_FIND_UNAVAILABLE(2016),
347 /**
348 * DicomUserConnection: The C-MOVE command is not supported by the remote SCP
349 **/
350 DICOM_MOVE_UNAVAILABLE(2017),
351 /**
352 * Cannot store an instance
353 **/
354 CANNOT_STORE_INSTANCE(2018),
355 /**
356 * Only string values are supported when creating DICOM instances
357 **/
358 CREATE_DICOM_NOT_STRING(2019),
359 /**
360 * Trying to override a value inherited from a parent module
361 **/
362 CREATE_DICOM_OVERRIDE_TAG(2020),
363 /**
364 * Use \"Content\" to inject an image into a new DICOM instance
365 **/
366 CREATE_DICOM_USE_CONTENT(2021),
367 /**
368 * No payload is present for one instance in the series
369 **/
370 CREATE_DICOM_NO_PAYLOAD(2022),
371 /**
372 * The payload of the DICOM instance must be specified according to Data URI scheme
373 **/
374 CREATE_DICOM_USE_DATA_URI_SCHEME(2023),
375 /**
376 * Trying to attach a new DICOM instance to an inexistent resource
377 **/
378 CREATE_DICOM_BAD_PARENT(2024),
379 /**
380 * Trying to attach a new DICOM instance to an instance (must be a series, study or
381 * patient)
382 **/
383 CREATE_DICOM_PARENT_IS_INSTANCE(2025),
384 /**
385 * Unable to get the encoding of the parent resource
386 **/
387 CREATE_DICOM_PARENT_ENCODING(2026),
388 /**
389 * Unknown modality
390 **/
391 UNKNOWN_MODALITY(2027),
392 /**
393 * Bad ordering of filters in a job
394 **/
395 BAD_JOB_ORDERING(2028),
396 /**
397 * Cannot convert the given JSON object to a Lua table
398 **/
399 JSON_TO_LUA_TABLE(2029),
400 /**
401 * Cannot create the Lua context
402 **/
403 CANNOT_CREATE_LUA(2030),
404 /**
405 * Cannot execute a Lua command
406 **/
407 CANNOT_EXECUTE_LUA(2031),
408 /**
409 * Arguments cannot be pushed after the Lua function is executed
410 **/
411 LUA_ALREADY_EXECUTED(2032),
412 /**
413 * The Lua function does not give the expected number of outputs
414 **/
415 LUA_BAD_OUTPUT(2033),
416 /**
417 * The Lua function is not a predicate (only true/false outputs allowed)
418 **/
419 NOT_LUA_PREDICATE(2034),
420 /**
421 * The Lua function does not return a string
422 **/
423 LUA_RETURNS_NO_STRING(2035),
424 /**
425 * Another plugin has already registered a custom storage area
426 **/
427 STORAGE_AREA_ALREADY_REGISTERED(2036),
428 /**
429 * Another plugin has already registered a custom database back-end
430 **/
431 DATABASE_BACKEND_ALREADY_REGISTERED(2037),
432 /**
433 * Plugin trying to call the database during its initialization
434 **/
435 DATABASE_NOT_INITIALIZED(2038),
436 /**
437 * Orthanc has been built without SSL support
438 **/
439 SSL_DISABLED(2039),
440 /**
441 * Unable to order the slices of the series
442 **/
443 CANNOT_ORDER_SLICES(2040),
444 /**
445 * No request handler factory for DICOM C-Find Modality SCP
446 **/
447 NO_WORKLIST_HANDLER(2041),
448 /**
449 * Cannot override the value of a tag that already exists
450 **/
451 ALREADY_EXISTING_TAG(2042),
452 /**
453 * No request handler factory for DICOM N-ACTION SCP (storage commitment)
454 **/
455 NO_STORAGE_COMMITMENT_HANDLER(2043),
456 /**
457 * No request handler factory for DICOM C-GET SCP
458 **/
459 NO_CGET_HANDLER(2044),
460 /**
461 * Unsupported media type
462 **/
463 UNSUPPORTED_MEDIA_TYPE(3000);
464
465 private int value;
466
467 private ErrorCode(int value) {
468 this.value = value;
469 }
470
471 /**
472 * Return the enumeration value that corresponds to an integer value of interest.
473 * @param value The integer value.
474 * @return The enumeration value.
475 **/
476 protected static ErrorCode getInstance(int value) {
477 if (value == -1) {
478 return INTERNAL_ERROR;
479 }
480 if (value == 0) {
481 return SUCCESS;
482 }
483 if (value == 1) {
484 return PLUGIN;
485 }
486 if (value == 2) {
487 return NOT_IMPLEMENTED;
488 }
489 if (value == 3) {
490 return PARAMETER_OUT_OF_RANGE;
491 }
492 if (value == 4) {
493 return NOT_ENOUGH_MEMORY;
494 }
495 if (value == 5) {
496 return BAD_PARAMETER_TYPE;
497 }
498 if (value == 6) {
499 return BAD_SEQUENCE_OF_CALLS;
500 }
501 if (value == 7) {
502 return INEXISTENT_ITEM;
503 }
504 if (value == 8) {
505 return BAD_REQUEST;
506 }
507 if (value == 9) {
508 return NETWORK_PROTOCOL;
509 }
510 if (value == 10) {
511 return SYSTEM_COMMAND;
512 }
513 if (value == 11) {
514 return DATABASE;
515 }
516 if (value == 12) {
517 return URI_SYNTAX;
518 }
519 if (value == 13) {
520 return INEXISTENT_FILE;
521 }
522 if (value == 14) {
523 return CANNOT_WRITE_FILE;
524 }
525 if (value == 15) {
526 return BAD_FILE_FORMAT;
527 }
528 if (value == 16) {
529 return TIMEOUT;
530 }
531 if (value == 17) {
532 return UNKNOWN_RESOURCE;
533 }
534 if (value == 18) {
535 return INCOMPATIBLE_DATABASE_VERSION;
536 }
537 if (value == 19) {
538 return FULL_STORAGE;
539 }
540 if (value == 20) {
541 return CORRUPTED_FILE;
542 }
543 if (value == 21) {
544 return INEXISTENT_TAG;
545 }
546 if (value == 22) {
547 return READ_ONLY;
548 }
549 if (value == 23) {
550 return INCOMPATIBLE_IMAGE_FORMAT;
551 }
552 if (value == 24) {
553 return INCOMPATIBLE_IMAGE_SIZE;
554 }
555 if (value == 25) {
556 return SHARED_LIBRARY;
557 }
558 if (value == 26) {
559 return UNKNOWN_PLUGIN_SERVICE;
560 }
561 if (value == 27) {
562 return UNKNOWN_DICOM_TAG;
563 }
564 if (value == 28) {
565 return BAD_JSON;
566 }
567 if (value == 29) {
568 return UNAUTHORIZED;
569 }
570 if (value == 30) {
571 return BAD_FONT;
572 }
573 if (value == 31) {
574 return DATABASE_PLUGIN;
575 }
576 if (value == 32) {
577 return STORAGE_AREA_PLUGIN;
578 }
579 if (value == 33) {
580 return EMPTY_REQUEST;
581 }
582 if (value == 34) {
583 return NOT_ACCEPTABLE;
584 }
585 if (value == 35) {
586 return NULL_POINTER;
587 }
588 if (value == 36) {
589 return DATABASE_UNAVAILABLE;
590 }
591 if (value == 37) {
592 return CANCELED_JOB;
593 }
594 if (value == 38) {
595 return BAD_GEOMETRY;
596 }
597 if (value == 39) {
598 return SSL_INITIALIZATION;
599 }
600 if (value == 40) {
601 return DISCONTINUED_ABI;
602 }
603 if (value == 41) {
604 return BAD_RANGE;
605 }
606 if (value == 42) {
607 return DATABASE_CANNOT_SERIALIZE;
608 }
609 if (value == 43) {
610 return REVISION;
611 }
612 if (value == 1000) {
613 return SQLITE_NOT_OPENED;
614 }
615 if (value == 1001) {
616 return SQLITE_ALREADY_OPENED;
617 }
618 if (value == 1002) {
619 return SQLITE_CANNOT_OPEN;
620 }
621 if (value == 1003) {
622 return SQLITE_STATEMENT_ALREADY_USED;
623 }
624 if (value == 1004) {
625 return SQLITE_EXECUTE;
626 }
627 if (value == 1005) {
628 return SQLITE_ROLLBACK_WITHOUT_TRANSACTION;
629 }
630 if (value == 1006) {
631 return SQLITE_COMMIT_WITHOUT_TRANSACTION;
632 }
633 if (value == 1007) {
634 return SQLITE_REGISTER_FUNCTION;
635 }
636 if (value == 1008) {
637 return SQLITE_FLUSH;
638 }
639 if (value == 1009) {
640 return SQLITE_CANNOT_RUN;
641 }
642 if (value == 1010) {
643 return SQLITE_CANNOT_STEP;
644 }
645 if (value == 1011) {
646 return SQLITE_BIND_OUT_OF_RANGE;
647 }
648 if (value == 1012) {
649 return SQLITE_PREPARE_STATEMENT;
650 }
651 if (value == 1013) {
652 return SQLITE_TRANSACTION_ALREADY_STARTED;
653 }
654 if (value == 1014) {
655 return SQLITE_TRANSACTION_COMMIT;
656 }
657 if (value == 1015) {
658 return SQLITE_TRANSACTION_BEGIN;
659 }
660 if (value == 2000) {
661 return DIRECTORY_OVER_FILE;
662 }
663 if (value == 2001) {
664 return FILE_STORAGE_CANNOT_WRITE;
665 }
666 if (value == 2002) {
667 return DIRECTORY_EXPECTED;
668 }
669 if (value == 2003) {
670 return HTTP_PORT_IN_USE;
671 }
672 if (value == 2004) {
673 return DICOM_PORT_IN_USE;
674 }
675 if (value == 2005) {
676 return BAD_HTTP_STATUS_IN_REST;
677 }
678 if (value == 2006) {
679 return REGULAR_FILE_EXPECTED;
680 }
681 if (value == 2007) {
682 return PATH_TO_EXECUTABLE;
683 }
684 if (value == 2008) {
685 return MAKE_DIRECTORY;
686 }
687 if (value == 2009) {
688 return BAD_APPLICATION_ENTITY_TITLE;
689 }
690 if (value == 2010) {
691 return NO_CFIND_HANDLER;
692 }
693 if (value == 2011) {
694 return NO_CMOVE_HANDLER;
695 }
696 if (value == 2012) {
697 return NO_CSTORE_HANDLER;
698 }
699 if (value == 2013) {
700 return NO_APPLICATION_ENTITY_FILTER;
701 }
702 if (value == 2014) {
703 return NO_SOP_CLASS_OR_INSTANCE;
704 }
705 if (value == 2015) {
706 return NO_PRESENTATION_CONTEXT;
707 }
708 if (value == 2016) {
709 return DICOM_FIND_UNAVAILABLE;
710 }
711 if (value == 2017) {
712 return DICOM_MOVE_UNAVAILABLE;
713 }
714 if (value == 2018) {
715 return CANNOT_STORE_INSTANCE;
716 }
717 if (value == 2019) {
718 return CREATE_DICOM_NOT_STRING;
719 }
720 if (value == 2020) {
721 return CREATE_DICOM_OVERRIDE_TAG;
722 }
723 if (value == 2021) {
724 return CREATE_DICOM_USE_CONTENT;
725 }
726 if (value == 2022) {
727 return CREATE_DICOM_NO_PAYLOAD;
728 }
729 if (value == 2023) {
730 return CREATE_DICOM_USE_DATA_URI_SCHEME;
731 }
732 if (value == 2024) {
733 return CREATE_DICOM_BAD_PARENT;
734 }
735 if (value == 2025) {
736 return CREATE_DICOM_PARENT_IS_INSTANCE;
737 }
738 if (value == 2026) {
739 return CREATE_DICOM_PARENT_ENCODING;
740 }
741 if (value == 2027) {
742 return UNKNOWN_MODALITY;
743 }
744 if (value == 2028) {
745 return BAD_JOB_ORDERING;
746 }
747 if (value == 2029) {
748 return JSON_TO_LUA_TABLE;
749 }
750 if (value == 2030) {
751 return CANNOT_CREATE_LUA;
752 }
753 if (value == 2031) {
754 return CANNOT_EXECUTE_LUA;
755 }
756 if (value == 2032) {
757 return LUA_ALREADY_EXECUTED;
758 }
759 if (value == 2033) {
760 return LUA_BAD_OUTPUT;
761 }
762 if (value == 2034) {
763 return NOT_LUA_PREDICATE;
764 }
765 if (value == 2035) {
766 return LUA_RETURNS_NO_STRING;
767 }
768 if (value == 2036) {
769 return STORAGE_AREA_ALREADY_REGISTERED;
770 }
771 if (value == 2037) {
772 return DATABASE_BACKEND_ALREADY_REGISTERED;
773 }
774 if (value == 2038) {
775 return DATABASE_NOT_INITIALIZED;
776 }
777 if (value == 2039) {
778 return SSL_DISABLED;
779 }
780 if (value == 2040) {
781 return CANNOT_ORDER_SLICES;
782 }
783 if (value == 2041) {
784 return NO_WORKLIST_HANDLER;
785 }
786 if (value == 2042) {
787 return ALREADY_EXISTING_TAG;
788 }
789 if (value == 2043) {
790 return NO_STORAGE_COMMITMENT_HANDLER;
791 }
792 if (value == 2044) {
793 return NO_CGET_HANDLER;
794 }
795 if (value == 3000) {
796 return UNSUPPORTED_MEDIA_TYPE;
797 }
798
799 throw new IllegalArgumentException("Value out of range for enumeration ErrorCode: " + value);
800 }
801
802 /**
803 * Get the integer value corresponding to this enumeration value.
804 * @return The integer value.
805 **/
806 public int getValue() {
807 return value;
808 }
809 }