Mercurial > hg > orthanc-java
comparison JavaSDK/be/uclouvain/orthanc/StorageArea.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 * Storage area plugin | |
29 **/ | |
30 public class StorageArea { | |
31 private long self; | |
32 | |
33 /** | |
34 * Construct a Java object wrapping a C object that is managed by Orthanc. | |
35 * @param self Pointer to the C object. | |
36 **/ | |
37 protected StorageArea(long self) { | |
38 if (self == 0) { | |
39 throw new IllegalArgumentException("Null pointer"); | |
40 } else { | |
41 this.self = self; | |
42 } | |
43 } | |
44 | |
45 /** | |
46 * Return the C object that is associated with this Java wrapper. | |
47 * @return Pointer to the C object. | |
48 **/ | |
49 protected long getSelf() { | |
50 return self; | |
51 } | |
52 | |
53 | |
54 | |
55 /** | |
56 * Create a file inside the storage area. | |
57 * | |
58 * This function creates a new file inside the storage area that is currently used | |
59 * by Orthanc. | |
60 * | |
61 * @param uuid The identifier of the file to be created. | |
62 * @param content The content to store in the newly created file. | |
63 * @param size The size of the content. | |
64 * @param type The type of the file content. | |
65 **/ | |
66 public void storageAreaCreate( | |
67 String uuid, | |
68 byte[] content, | |
69 long size, | |
70 ContentType type) { | |
71 NativeSDK.OrthancPluginStorageAreaCreate(self, uuid, content, size, type.getValue()); | |
72 } | |
73 | |
74 /** | |
75 * Read a file from the storage area. | |
76 * | |
77 * This function reads the content of a given file from the storage area that is | |
78 * currently used by Orthanc. | |
79 * | |
80 * @param uuid The identifier of the file to be read. | |
81 * @param type The type of the file content. | |
82 * @return The resulting memory buffer. | |
83 **/ | |
84 public byte[] storageAreaRead( | |
85 String uuid, | |
86 ContentType type) { | |
87 return NativeSDK.OrthancPluginStorageAreaRead(self, uuid, type.getValue()); | |
88 } | |
89 | |
90 /** | |
91 * Remove a file from the storage area. | |
92 * | |
93 * This function removes a given file from the storage area that is currently used | |
94 * by Orthanc. | |
95 * | |
96 * @param uuid The identifier of the file to be removed. | |
97 * @param type The type of the file content. | |
98 **/ | |
99 public void storageAreaRemove( | |
100 String uuid, | |
101 ContentType type) { | |
102 NativeSDK.OrthancPluginStorageAreaRemove(self, uuid, type.getValue()); | |
103 } | |
104 | |
105 /** | |
106 * Reconstruct the main DICOM tags. | |
107 * | |
108 * This function requests the Orthanc core to reconstruct the main DICOM tags of | |
109 * all the resources of the given type. This function can only be used as a part of | |
110 * the upgrade of a custom database back-end. A database transaction will be | |
111 * automatically setup. | |
112 * | |
113 * @param level The type of the resources of interest. | |
114 **/ | |
115 public void reconstructMainDicomTags( | |
116 ResourceType level) { | |
117 NativeSDK.OrthancPluginReconstructMainDicomTags(self, level.getValue()); | |
118 } | |
119 | |
120 } |