Skip to content

Commit 593acca

Browse files
authored
Merge pull request #1323 from b2ihealthcare/improvement/migrate-to-fhir-core
Migrate FHIR modules to use official HL7 FHIR libraries
2 parents d84c47d + dca22be commit 593acca

File tree

561 files changed

+2072
-159372
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

561 files changed

+2072
-159372
lines changed

commons/com.b2international.commons/src/com/b2international/commons/exceptions/ApiException.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2011-2023 B2i Healthcare, https://b2ihealthcare.com
2+
* Copyright 2011-2024 B2i Healthcare, https://b2ihealthcare.com
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

core/com.b2international.snowowl.core/src/com/b2international/snowowl/core/Resource.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public static final class Settings {
5353
/**
5454
* @since 8.0
5555
*/
56-
public static final class Fields {
56+
public static class Fields {
5757
public static final String ID = ResourceDocument.Fields.ID;
5858
public static final String TITLE = ResourceDocument.Fields.TITLE;
5959
public static final String URL = ResourceDocument.Fields.URL;

core/com.b2international.snowowl.core/src/com/b2international/snowowl/core/TerminologyResource.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,13 @@ public static abstract class Expand extends Resource.Expand {
9494

9595
}
9696

97+
public static abstract class Fields extends Resource.Fields {
98+
99+
public static final String TOOLING_ID = "toolingId";
100+
public static final String RESOURCE_URI = "resourceURI";
101+
102+
}
103+
97104
/**
98105
* @since 9.0
99106
*/

fhir/com.b2international.snowowl.fhir.core/META-INF/MANIFEST.MF

Lines changed: 9 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -6,55 +6,23 @@ Bundle-Version: 9.3.1.qualifier
66
Bundle-Vendor: B2i Healthcare
77
Bundle-RequiredExecutionEnvironment: JavaSE-17
88
Export-Package: com.b2international.snowowl.fhir.core,
9-
com.b2international.snowowl.fhir.core.codesystems,
109
com.b2international.snowowl.fhir.core.exceptions,
11-
com.b2international.snowowl.fhir.core.model,
12-
com.b2international.snowowl.fhir.core.model.capabilitystatement,
13-
com.b2international.snowowl.fhir.core.model.codesystem,
14-
com.b2international.snowowl.fhir.core.model.conceptmap,
15-
com.b2international.snowowl.fhir.core.model.converter,
16-
com.b2international.snowowl.fhir.core.model.dt,
17-
com.b2international.snowowl.fhir.core.model.operationdefinition,
18-
com.b2international.snowowl.fhir.core.model.property,
19-
com.b2international.snowowl.fhir.core.model.serialization,
20-
com.b2international.snowowl.fhir.core.model.structuredefinition,
21-
com.b2international.snowowl.fhir.core.model.typedproperty,
22-
com.b2international.snowowl.fhir.core.model.usagecontext,
23-
com.b2international.snowowl.fhir.core.model.valueset,
24-
com.b2international.snowowl.fhir.core.model.valueset.expansion,
2510
com.b2international.snowowl.fhir.core.request,
2611
com.b2international.snowowl.fhir.core.request.bundle,
2712
com.b2international.snowowl.fhir.core.request.codesystem,
2813
com.b2international.snowowl.fhir.core.request.conceptmap,
29-
com.b2international.snowowl.fhir.core.request.valueset,
30-
com.b2international.snowowl.fhir.core.search,
31-
org.linuxforhealth.fhir.core,
32-
org.linuxforhealth.fhir.core.util.handler,
33-
org.linuxforhealth.fhir.exception,
34-
org.linuxforhealth.fhir.model.annotation,
35-
org.linuxforhealth.fhir.model.builder,
36-
org.linuxforhealth.fhir.model.config,
37-
org.linuxforhealth.fhir.model.format,
38-
org.linuxforhealth.fhir.model.generator.exception,
39-
org.linuxforhealth.fhir.model.parser.exception,
40-
org.linuxforhealth.fhir.model.r5.annotation,
41-
org.linuxforhealth.fhir.model.r5.constraint.spi,
42-
org.linuxforhealth.fhir.model.r5.exception,
43-
org.linuxforhealth.fhir.model.r5.generator,
44-
org.linuxforhealth.fhir.model.r5.parser,
45-
org.linuxforhealth.fhir.model.r5.resource,
46-
org.linuxforhealth.fhir.model.r5.type,
47-
org.linuxforhealth.fhir.model.r5.type.code,
48-
org.linuxforhealth.fhir.model.r5.util,
49-
org.linuxforhealth.fhir.model.r5.visitor,
50-
org.linuxforhealth.fhir.model.ucum.util,
51-
org.linuxforhealth.fhir.model.util
52-
Import-Package: jakarta.validation;version="3.0.2",
14+
com.b2international.snowowl.fhir.core.request.valueset
15+
Import-Package: com.b2international.fhir;version="0.1.0",
16+
com.b2international.fhir.r5.operations;version="0.1.0",
17+
jakarta.validation;version="3.0.2",
5318
jakarta.validation.constraints;version="3.0.2",
54-
org.slf4j
19+
org.hl7.fhir.exceptions;version="6.3.25",
20+
org.hl7.fhir.r4.model.codesystems;version="6.3.25",
21+
org.hl7.fhir.r5.model;version="6.3.25",
22+
org.hl7.fhir.utilities.xhtml;version="6.3.25",
23+
org.slf4j;version="2.0.0"
5524
Require-Bundle: org.eclipse.core.runtime;bundle-version="3.9.0",
5625
com.b2international.snowowl.core;visibility:=reexport,
57-
org.apache.commons.lang3;bundle-version="3.14.0",
5826
io.swagger.core.v3.swagger-annotations.jakarta;bundle-version="2.2.20"
5927
Bundle-ClassPath: .
6028
Bundle-ActivationPolicy: lazy

fhir/com.b2international.snowowl.fhir.core/src/com/b2international/snowowl/fhir/core/FhirDates.java

Lines changed: 0 additions & 77 deletions
This file was deleted.
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
/*
2+
* Copyright 2024 B2i Healthcare, https://b2ihealthcare.com
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package com.b2international.snowowl.fhir.core;
17+
18+
import java.util.Date;
19+
20+
import org.hl7.fhir.r5.model.CanonicalType;
21+
import org.hl7.fhir.r5.model.DateTimeType;
22+
import org.hl7.fhir.r5.model.InstantType;
23+
import org.hl7.fhir.r5.model.Resource;
24+
25+
import com.b2international.commons.CompareUtils;
26+
import com.b2international.snowowl.core.ResourceURI;
27+
28+
/**
29+
* @since 9.3
30+
*/
31+
public class FhirModelHelpers {
32+
33+
public static final String OID_PREFIX = "urn:oid:";
34+
35+
public static ResourceURI resourceUriFrom(Resource resource) {
36+
return ResourceURI.of(resource.getResourceType().name().toLowerCase() + "s", resource.getId());
37+
}
38+
39+
public static DateTimeType toDateTimeElement(Long date) {
40+
return toDateTimeElement(date == null ? null : new Date(date));
41+
}
42+
43+
public static DateTimeType toDateTimeElement(Date date) {
44+
if (date == null) {
45+
return null;
46+
} else {
47+
var dateElement = new DateTimeType(date);
48+
dateElement.setTimeZoneZulu(true);
49+
return dateElement;
50+
}
51+
}
52+
53+
public static InstantType toInstantElement(Long date) {
54+
return toInstantElement(date == null ? null : new Date(date));
55+
}
56+
57+
public static InstantType toInstantElement(Date date) {
58+
if (date == null) {
59+
return null;
60+
} else {
61+
var instantElement = new InstantType(date);
62+
instantElement.setTimeZoneZulu(true);
63+
return instantElement;
64+
}
65+
}
66+
67+
public static final boolean isOid(CanonicalType system) {
68+
return system != null & isOid(system.getValue());
69+
}
70+
71+
public static final boolean isOid(String system) {
72+
return system != null && system.startsWith(OID_PREFIX);
73+
}
74+
75+
public static String getSystemWithoutOidPrefix(CanonicalType system) {
76+
return getSystemWithoutOidPrefix(system == null ? null : system.getValue());
77+
}
78+
79+
public static String getSystemWithoutOidPrefix(String system) {
80+
if (CompareUtils.isEmpty(system)) {
81+
return "";
82+
}
83+
84+
if (isOid(system)) {
85+
return system.substring(OID_PREFIX.length());
86+
}
87+
88+
return system;
89+
}
90+
91+
}

0 commit comments

Comments
 (0)