comparison JavaSDK/be/uclouvain/orthanc/InstanceOrigin.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 origin of a DICOM instance that has been received by Orthanc.
29 **/
30 public enum InstanceOrigin {
31 /**
32 * Unknown origin
33 **/
34 UNKNOWN(1),
35 /**
36 * Instance received through DICOM protocol
37 **/
38 DICOM_PROTOCOL(2),
39 /**
40 * Instance received through REST API of Orthanc
41 **/
42 REST_API(3),
43 /**
44 * Instance added to Orthanc by a plugin
45 **/
46 PLUGIN(4),
47 /**
48 * Instance added to Orthanc by a Lua script
49 **/
50 LUA(5),
51 /**
52 * Instance received through WebDAV (new in 1.8.0)
53 **/
54 WEB_DAV(6);
55
56 private int value;
57
58 private InstanceOrigin(int value) {
59 this.value = value;
60 }
61
62 /**
63 * Return the enumeration value that corresponds to an integer value of interest.
64 * @param value The integer value.
65 * @return The enumeration value.
66 **/
67 protected static InstanceOrigin getInstance(int value) {
68 if (value == 1) {
69 return UNKNOWN;
70 }
71 if (value == 2) {
72 return DICOM_PROTOCOL;
73 }
74 if (value == 3) {
75 return REST_API;
76 }
77 if (value == 4) {
78 return PLUGIN;
79 }
80 if (value == 5) {
81 return LUA;
82 }
83 if (value == 6) {
84 return WEB_DAV;
85 }
86
87 throw new IllegalArgumentException("Value out of range for enumeration InstanceOrigin: " + value);
88 }
89
90 /**
91 * Get the integer value corresponding to this enumeration value.
92 * @return The integer value.
93 **/
94 public int getValue() {
95 return value;
96 }
97 }