comparison Samples/FHIR/src/main/java/Main.java @ 30:296798e75896

publish software name and version in FHIR /metadata
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 12 Jun 2024 20:43:37 +0200
parents 1c407ba1d311
children 7579255a14f8
comparison
equal deleted inserted replaced
29:118adbad648f 30:296798e75896
21 * along with this program. If not, see <http://www.gnu.org/licenses/>. 21 * along with this program. If not, see <http://www.gnu.org/licenses/>.
22 **/ 22 **/
23 23
24 24
25 import be.uclouvain.orthanc.Callbacks; 25 import be.uclouvain.orthanc.Callbacks;
26 import be.uclouvain.orthanc.Functions;
27 26
28 import ca.uhn.fhir.context.FhirContext; 27 import ca.uhn.fhir.context.FhirContext;
29 import ca.uhn.fhir.rest.server.HardcodedServerAddressStrategy; 28 import ca.uhn.fhir.rest.server.HardcodedServerAddressStrategy;
30 import ca.uhn.fhir.rest.server.IResourceProvider; 29 import ca.uhn.fhir.rest.server.IResourceProvider;
31 import ca.uhn.fhir.rest.server.RestfulServer; 30 import ca.uhn.fhir.rest.server.RestfulServer;
32 import org.json.JSONArray;
33 import org.json.JSONObject;
34 import org.springframework.mock.web.MockServletConfig; 31 import org.springframework.mock.web.MockServletConfig;
35 32
33 import java.io.IOException;
34 import java.io.InputStream;
36 import java.util.ArrayList; 35 import java.util.ArrayList;
37 import java.util.HashMap;
38 import java.util.List; 36 import java.util.List;
39 import java.util.Map; 37 import java.util.Properties;
40 import javax.servlet.ServletException; 38 import javax.servlet.ServletException;
41 39
42 40
43 public class Main extends RestfulServer { 41 public class Main extends RestfulServer {
44 Main() throws ServletException { 42 Main() throws ServletException {
45 setFhirContext(FhirContext.forR5()); 43 setFhirContext(FhirContext.forR5());
44
45 setServerName("Orthanc FHIR server");
46
47 try (InputStream is = Main.class.getResourceAsStream("app.properties")) {
48 Properties properties = new Properties();
49 properties.load(is);
50 setServerVersion(properties.getProperty("orthanc_java.version"));
51 } catch (IOException e) {
52 // Ignore error
53 }
46 54
47 FhirConfiguration configuration = new FhirConfiguration(); 55 FhirConfiguration configuration = new FhirConfiguration();
48 setServerAddressStrategy(new HardcodedServerAddressStrategy(configuration.getServerBaseUrl())); 56 setServerAddressStrategy(new HardcodedServerAddressStrategy(configuration.getServerBaseUrl()));
49 57
50 configuration.getDicomWebBaseUrl(); 58 configuration.getDicomWebBaseUrl();