Merge branch 'hapi3_refactor' of github.com:jamesagnew/hapi-fhir into hapi3_refactor
This commit is contained in:
commit
d851de7ffd
|
@ -320,8 +320,8 @@ public class FhirContext {
|
|||
|
||||
Map<String, Class<? extends IBaseResource>> nameToType = myVersionToNameToResourceType.get(theVersion);
|
||||
if (nameToType == null) {
|
||||
nameToType = new HashMap<String, Class<? extends IBaseResource>>();
|
||||
Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> existing = Collections.emptyMap();
|
||||
nameToType = new HashMap<>();
|
||||
Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> existing = new HashMap<>();
|
||||
ModelScanner.scanVersionPropertyFile(null, nameToType, theVersion, existing);
|
||||
|
||||
Map<FhirVersionEnum, Map<String, Class<? extends IBaseResource>>> newVersionToNameToResourceType = new HashMap<FhirVersionEnum, Map<String, Class<? extends IBaseResource>>>();
|
||||
|
@ -905,4 +905,24 @@ public class FhirContext {
|
|||
return retVal;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an unmodifiable set containing all resource names known to this
|
||||
* context
|
||||
*/
|
||||
public Set<String> getResourceNames() {
|
||||
Set<String> resourceNames= new HashSet<>();
|
||||
|
||||
if (myNameToResourceDefinition.isEmpty()) {
|
||||
|
||||
}
|
||||
|
||||
for (RuntimeResourceDefinition next : myNameToResourceDefinition.values()) {
|
||||
resourceNames.add(next.getName());
|
||||
}
|
||||
|
||||
// Properties versionProperties = new Properties();
|
||||
// versionProperties.load(myVersion.getFhirVersionPropertiesFile());
|
||||
//
|
||||
return Collections.unmodifiableSet(resourceNames);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,25 @@
|
|||
package ca.uhn.fhir.parser;
|
||||
|
||||
/*-
|
||||
* #%L
|
||||
* HAPI FHIR - Core Library
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2017 University Health Network
|
||||
* %%
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* #L%
|
||||
*/
|
||||
|
||||
import static org.apache.commons.lang3.StringUtils.isBlank;
|
||||
import static org.apache.commons.lang3.StringUtils.isNotBlank;
|
||||
|
||||
|
|
|
@ -1,5 +1,25 @@
|
|||
package ca.uhn.fhir.rest.api.server;
|
||||
|
||||
/*-
|
||||
* #%L
|
||||
* HAPI FHIR - Core Library
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2017 University Health Network
|
||||
* %%
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* #L%
|
||||
*/
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
|
|
|
@ -1,5 +1,25 @@
|
|||
package ca.uhn.fhir.rest.api.server;
|
||||
|
||||
/*-
|
||||
* #%L
|
||||
* HAPI FHIR - Core Library
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2017 University Health Network
|
||||
* %%
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* #L%
|
||||
*/
|
||||
|
||||
public interface IServerMethodBinding {
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,25 @@
|
|||
package ca.uhn.fhir.rest.client.api;
|
||||
|
||||
/*-
|
||||
* #%L
|
||||
* HAPI FHIR - Core Library
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2017 University Health Network
|
||||
* %%
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* #L%
|
||||
*/
|
||||
|
||||
import org.hl7.fhir.instance.model.api.IBaseConformance;
|
||||
|
||||
import ca.uhn.fhir.rest.annotation.Metadata;
|
||||
|
|
|
@ -1,5 +1,25 @@
|
|||
package ca.uhn.fhir.rest.client.api;
|
||||
|
||||
/*-
|
||||
* #%L
|
||||
* HAPI FHIR - Core Library
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2017 University Health Network
|
||||
* %%
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* #L%
|
||||
*/
|
||||
|
||||
import org.hl7.fhir.instance.model.api.IBaseBundle;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
|
||||
|
|
|
@ -1,5 +1,25 @@
|
|||
package ca.uhn.fhir.rest.gclient;
|
||||
|
||||
/*-
|
||||
* #%L
|
||||
* HAPI FHIR - Core Library
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2017 University Health Network
|
||||
* %%
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* #L%
|
||||
*/
|
||||
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.rest.api.Constants;
|
||||
|
||||
|
|
|
@ -1,5 +1,25 @@
|
|||
package ca.uhn.fhir.rest.gclient;
|
||||
|
||||
/*-
|
||||
* #%L
|
||||
* HAPI FHIR - Core Library
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2017 University Health Network
|
||||
* %%
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* #L%
|
||||
*/
|
||||
|
||||
import ca.uhn.fhir.rest.api.MethodOutcome;
|
||||
import ca.uhn.fhir.rest.api.PreferReturnEnum;
|
||||
|
||||
|
|
|
@ -1,5 +1,25 @@
|
|||
package ca.uhn.fhir.rest.param;
|
||||
|
||||
/*-
|
||||
* #%L
|
||||
* HAPI FHIR - Core Library
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2017 University Health Network
|
||||
* %%
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* #L%
|
||||
*/
|
||||
|
||||
import static org.apache.commons.lang3.StringUtils.isBlank;
|
||||
|
||||
public abstract class BaseParamWithPrefix<T extends BaseParam> extends BaseParam {
|
||||
|
|
|
@ -1,5 +1,25 @@
|
|||
package ca.uhn.fhir.rest.param;
|
||||
|
||||
/*-
|
||||
* #%L
|
||||
* HAPI FHIR - Core Library
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2017 University Health Network
|
||||
* %%
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* #L%
|
||||
*/
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,5 +1,25 @@
|
|||
package ca.uhn.fhir.rest.param;
|
||||
|
||||
/*-
|
||||
* #%L
|
||||
* HAPI FHIR - Core Library
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2017 University Health Network
|
||||
* %%
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* #L%
|
||||
*/
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
public class QualifierDetails {
|
||||
|
|
|
@ -57,6 +57,8 @@ public abstract class BaseCommand implements Comparable<BaseCommand> {
|
|||
version = FhirVersionEnum.DSTU2;
|
||||
} else if ("dstu3".equals(specVersion)) {
|
||||
version = FhirVersionEnum.DSTU3;
|
||||
} else if ("r4".equals(specVersion)) {
|
||||
version = FhirVersionEnum.R4;
|
||||
} else {
|
||||
throw new ParseException("Unknown spec version: " + specVersion);
|
||||
}
|
||||
|
@ -66,4 +68,4 @@ public abstract class BaseCommand implements Comparable<BaseCommand> {
|
|||
return myFhirCtx;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -74,7 +74,7 @@ public class ExampleDataUploader extends BaseCommand {
|
|||
options.addOption(opt);
|
||||
|
||||
opt = new Option("c", "cache", false,
|
||||
"Cache the downloaded examples-json.zip file in the ~/.hapi-fhir-cli/cache directory. Use this file for 12 hours if it exists, instead of fetching it from the internet.");
|
||||
"Cache the downloaded examples-json.zip file in the ~/.hapi-fhir-cli/cache directory. Use this file for 12 hours if it exists, instead of fetching it from the internet.");
|
||||
opt.setRequired(false);
|
||||
options.addOption(opt);
|
||||
|
||||
|
@ -110,14 +110,17 @@ public class ExampleDataUploader extends BaseCommand {
|
|||
String specUrl;
|
||||
|
||||
switch (ctx.getVersion().getVersion()) {
|
||||
case DSTU2:
|
||||
specUrl = "http://hl7.org/fhir/dstu2/examples-json.zip";
|
||||
break;
|
||||
case DSTU3:
|
||||
specUrl = "http://build.fhir.org/examples-json.zip";
|
||||
break;
|
||||
default:
|
||||
throw new ParseException("Invalid spec version for this command: " + ctx.getVersion().getVersion());
|
||||
case DSTU2:
|
||||
specUrl = "http://hl7.org/fhir/dstu2/examples-json.zip";
|
||||
break;
|
||||
case DSTU3:
|
||||
specUrl = "http://hl7.org/fhir/STU3/examples-json.zip";
|
||||
break;
|
||||
case R4:
|
||||
specUrl = "http://build.fhir.org/examples-json.zip";
|
||||
break;
|
||||
default:
|
||||
throw new ParseException("Invalid spec version for this command: " + ctx.getVersion().getVersion());
|
||||
}
|
||||
|
||||
String filepath = theCommandLine.getOptionValue('d');
|
||||
|
@ -140,7 +143,7 @@ public class ExampleDataUploader extends BaseCommand {
|
|||
|
||||
if (suppliedFile.isDirectory()) {
|
||||
Collection<File> inputFiles;
|
||||
inputFiles = FileUtils.listFiles(suppliedFile, new String[] { "zip" }, false);
|
||||
inputFiles = FileUtils.listFiles(suppliedFile, new String[]{"zip"}, false);
|
||||
|
||||
for (File inputFile : inputFiles) {
|
||||
IBaseBundle bundle = getBundleFromFile(limit, inputFile, ctx);
|
||||
|
@ -197,21 +200,23 @@ public class ExampleDataUploader extends BaseCommand {
|
|||
|
||||
}
|
||||
|
||||
private IBaseBundle getBundleFromFile(Integer theLimit, File theSuppliedFile, FhirContext theCtx) throws ParseException, UnsupportedEncodingException, IOException {
|
||||
private IBaseBundle getBundleFromFile(Integer theLimit, File theSuppliedFile, FhirContext theCtx) throws ParseException, IOException {
|
||||
switch (theCtx.getVersion().getVersion()) {
|
||||
case DSTU2:
|
||||
return getBundleFromFileDstu2(theLimit, theSuppliedFile, theCtx);
|
||||
case DSTU3:
|
||||
return getBundleFromFileDstu3(theLimit, theSuppliedFile, theCtx);
|
||||
default:
|
||||
throw new ParseException("Invalid spec version for this command: " + theCtx.getVersion().getVersion());
|
||||
case DSTU2:
|
||||
return getBundleFromFileDstu2(theLimit, theSuppliedFile, theCtx);
|
||||
case DSTU3:
|
||||
return getBundleFromFileDstu3(theLimit, theSuppliedFile, theCtx);
|
||||
case R4:
|
||||
return getBundleFromFileDstu3(theLimit, theSuppliedFile, theCtx);
|
||||
default:
|
||||
throw new ParseException("Invalid spec version for this command: " + theCtx.getVersion().getVersion());
|
||||
}
|
||||
}
|
||||
|
||||
private void sendBundleToTarget(String targetServer, FhirContext ctx, IBaseBundle bundle) throws Exception, IOException {
|
||||
private void sendBundleToTarget(String targetServer, FhirContext ctx, IBaseBundle bundle) throws Exception {
|
||||
List<IBaseResource> resources = BundleUtil.toListOfResources(ctx, bundle);
|
||||
|
||||
for (Iterator<IBaseResource> iter = resources.iterator(); iter.hasNext();) {
|
||||
for (Iterator<IBaseResource> iter = resources.iterator(); iter.hasNext(); ) {
|
||||
IBaseResource next = iter.next();
|
||||
String nextType = ctx.getResourceDefinition(next).getName();
|
||||
if (nextType.endsWith("Definition")) {
|
||||
|
@ -223,13 +228,13 @@ public class ExampleDataUploader extends BaseCommand {
|
|||
}
|
||||
}
|
||||
|
||||
List<IBaseResource> subResourceList = new ArrayList<IBaseResource>();
|
||||
List<IBaseResource> subResourceList = new ArrayList<>();
|
||||
while (resources.size() > 0) {
|
||||
|
||||
IBaseResource nextAddedResource = resources.remove(0);
|
||||
subResourceList.add(nextAddedResource);
|
||||
|
||||
Set<String> checkedTargets = new HashSet<String>();
|
||||
Set<String> checkedTargets = new HashSet<>();
|
||||
|
||||
for (int i = 0; i < subResourceList.size(); i++) {
|
||||
IBaseResource nextCandidateSource = subResourceList.get(i);
|
||||
|
@ -313,14 +318,17 @@ public class ExampleDataUploader extends BaseCommand {
|
|||
|
||||
private void processBundle(FhirContext ctx, IBaseBundle bundle) {
|
||||
switch (ctx.getVersion().getVersion()) {
|
||||
case DSTU2:
|
||||
processBundleDstu2(ctx, (Bundle) bundle);
|
||||
break;
|
||||
case DSTU3:
|
||||
processBundleDstu3(ctx, (org.hl7.fhir.dstu3.model.Bundle) bundle);
|
||||
break;
|
||||
default:
|
||||
throw new IllegalStateException();
|
||||
case DSTU2:
|
||||
processBundleDstu2(ctx, (Bundle) bundle);
|
||||
break;
|
||||
case DSTU3:
|
||||
processBundleDstu3(ctx, (org.hl7.fhir.dstu3.model.Bundle) bundle);
|
||||
break;
|
||||
case R4:
|
||||
processBundleR4(ctx, (org.hl7.fhir.r4.model.Bundle) bundle);
|
||||
break;
|
||||
default:
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -329,12 +337,12 @@ public class ExampleDataUploader extends BaseCommand {
|
|||
Map<String, Integer> ids = new HashMap<String, Integer>();
|
||||
Set<String> fullIds = new HashSet<String>();
|
||||
|
||||
for (Iterator<Entry> iterator = bundle.getEntry().iterator(); iterator.hasNext();) {
|
||||
for (Iterator<Entry> iterator = bundle.getEntry().iterator(); iterator.hasNext(); ) {
|
||||
Entry next = iterator.next();
|
||||
|
||||
// DataElement have giant IDs that seem invalid, need to investigate this..
|
||||
if ("Subscription".equals(next.getResource().getResourceName()) || "DataElement".equals(next.getResource().getResourceName())
|
||||
|| "OperationOutcome".equals(next.getResource().getResourceName()) || "OperationDefinition".equals(next.getResource().getResourceName())) {
|
||||
|| "OperationOutcome".equals(next.getResource().getResourceName()) || "OperationDefinition".equals(next.getResource().getResourceName())) {
|
||||
ourLog.info("Skipping " + next.getResource().getResourceName() + " example");
|
||||
iterator.remove();
|
||||
} else {
|
||||
|
@ -355,7 +363,7 @@ public class ExampleDataUploader extends BaseCommand {
|
|||
}
|
||||
}
|
||||
Set<String> qualIds = new TreeSet<String>();
|
||||
for (Iterator<Entry> iterator = bundle.getEntry().iterator(); iterator.hasNext();) {
|
||||
for (Iterator<Entry> iterator = bundle.getEntry().iterator(); iterator.hasNext(); ) {
|
||||
Entry next = iterator.next();
|
||||
if (next.getResource().getId().getIdPart() != null) {
|
||||
String nextId = next.getResource().getId().getValue();
|
||||
|
@ -409,12 +417,12 @@ public class ExampleDataUploader extends BaseCommand {
|
|||
Map<String, Integer> ids = new HashMap<String, Integer>();
|
||||
Set<String> fullIds = new HashSet<String>();
|
||||
|
||||
for (Iterator<BundleEntryComponent> iterator = bundle.getEntry().iterator(); iterator.hasNext();) {
|
||||
for (Iterator<BundleEntryComponent> iterator = bundle.getEntry().iterator(); iterator.hasNext(); ) {
|
||||
BundleEntryComponent next = iterator.next();
|
||||
|
||||
// DataElement have giant IDs that seem invalid, need to investigate this..
|
||||
if ("Subscription".equals(next.getResource().getResourceType()) || "DataElement".equals(next.getResource().getResourceType())
|
||||
|| "OperationOutcome".equals(next.getResource().getResourceType()) || "OperationDefinition".equals(next.getResource().getResourceType())) {
|
||||
|| "OperationOutcome".equals(next.getResource().getResourceType()) || "OperationDefinition".equals(next.getResource().getResourceType())) {
|
||||
ourLog.info("Skipping " + next.getResource().getResourceType() + " example");
|
||||
iterator.remove();
|
||||
} else {
|
||||
|
@ -435,7 +443,7 @@ public class ExampleDataUploader extends BaseCommand {
|
|||
}
|
||||
}
|
||||
Set<String> qualIds = new TreeSet<String>();
|
||||
for (Iterator<BundleEntryComponent> iterator = bundle.getEntry().iterator(); iterator.hasNext();) {
|
||||
for (Iterator<BundleEntryComponent> iterator = bundle.getEntry().iterator(); iterator.hasNext(); ) {
|
||||
BundleEntryComponent next = iterator.next();
|
||||
if (next.getResource().getIdElement().getIdPart() != null) {
|
||||
String nextId = next.getResource().getIdElement().getValue();
|
||||
|
@ -484,6 +492,72 @@ public class ExampleDataUploader extends BaseCommand {
|
|||
|
||||
}
|
||||
|
||||
private void processBundleR4(FhirContext ctx, org.hl7.fhir.r4.model.Bundle bundle) {
|
||||
|
||||
Map<String, Integer> ids = new HashMap<String, Integer>();
|
||||
Set<String> fullIds = new HashSet<String>();
|
||||
|
||||
for (Iterator<org.hl7.fhir.r4.model.Bundle.BundleEntryComponent> iterator = bundle.getEntry().iterator(); iterator.hasNext(); ) {
|
||||
org.hl7.fhir.r4.model.Bundle.BundleEntryComponent next = iterator.next();
|
||||
|
||||
// DataElement have giant IDs that seem invalid, need to investigate this..
|
||||
if ("Subscription".equals(next.getResource().getResourceType()) || "DataElement".equals(next.getResource().getResourceType())
|
||||
|| "OperationOutcome".equals(next.getResource().getResourceType()) || "OperationDefinition".equals(next.getResource().getResourceType())) {
|
||||
ourLog.info("Skipping " + next.getResource().getResourceType() + " example");
|
||||
iterator.remove();
|
||||
} else {
|
||||
IdDt resourceId = new IdDt(next.getResource().getResourceType() + "/EX" + next.getResource().getIdElement().getIdPart());
|
||||
if (!fullIds.add(resourceId.toUnqualifiedVersionless().getValue())) {
|
||||
ourLog.info("Discarding duplicate resource: " + resourceId.getValue());
|
||||
iterator.remove();
|
||||
continue;
|
||||
}
|
||||
|
||||
String idPart = resourceId.getIdPart();
|
||||
if (idPart != null) {
|
||||
next.getResource().setId(resourceId);
|
||||
} else {
|
||||
ourLog.info("Discarding resource with not explicit ID");
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
Set<String> qualIds = new TreeSet<String>();
|
||||
for (Iterator<org.hl7.fhir.r4.model.Bundle.BundleEntryComponent> iterator = bundle.getEntry().iterator(); iterator.hasNext(); ) {
|
||||
org.hl7.fhir.r4.model.Bundle.BundleEntryComponent next = iterator.next();
|
||||
if (next.getResource().getIdElement().getIdPart() != null) {
|
||||
String nextId = next.getResource().getIdElement().getValue();
|
||||
next.getRequest().setMethod(org.hl7.fhir.r4.model.Bundle.HTTPVerb.PUT);
|
||||
next.getRequest().setUrl(nextId);
|
||||
}
|
||||
}
|
||||
|
||||
int goodRefs = 0;
|
||||
for (org.hl7.fhir.r4.model.Bundle.BundleEntryComponent next : bundle.getEntry()) {
|
||||
List<ResourceReferenceInfo> refs = ctx.newTerser().getAllResourceReferences(next.getResource());
|
||||
for (ResourceReferenceInfo nextRef : refs) {
|
||||
nextRef.getResourceReference().setResource(null);
|
||||
String value = nextRef.getResourceReference().getReferenceElement().toUnqualifiedVersionless().getValue();
|
||||
|
||||
if (isNotBlank(value)) {
|
||||
if (!qualIds.contains(value) && !nextRef.getResourceReference().getReferenceElement().isLocal()) {
|
||||
ourLog.info("Discarding unknown reference: {}", value);
|
||||
nextRef.getResourceReference().getReferenceElement().setValue(null);
|
||||
} else {
|
||||
goodRefs++;
|
||||
}
|
||||
}
|
||||
ourLog.info("Found ref: {}", value);
|
||||
}
|
||||
}
|
||||
|
||||
ourLog.info("{} good references", goodRefs);
|
||||
System.gc();
|
||||
|
||||
ourLog.info("Final bundle: {} entries", bundle.getEntry().size());
|
||||
|
||||
}
|
||||
|
||||
private Bundle getBundleFromFileDstu2(Integer limit, File inputFile, FhirContext ctx) throws IOException, UnsupportedEncodingException {
|
||||
|
||||
Bundle bundle = new Bundle();
|
||||
|
@ -614,7 +688,7 @@ public class ExampleDataUploader extends BaseCommand {
|
|||
continue;
|
||||
}
|
||||
if (!ctx.getResourceDefinition((Class<? extends IBaseResource>) nextResource.getClass()).getName().equals("Bundle")
|
||||
&& ctx.getResourceDefinition((Class<? extends IBaseResource>) nextResource.getClass()).getName().equals("SearchParameter")) {
|
||||
&& ctx.getResourceDefinition((Class<? extends IBaseResource>) nextResource.getClass()).getName().equals("SearchParameter")) {
|
||||
BundleEntryComponent entry = bundle.addEntry();
|
||||
entry.getRequest().setMethod(HTTPVerb.POST);
|
||||
entry.setResource((Resource) nextResource);
|
||||
|
|
|
@ -20,11 +20,9 @@ public class UploadTerminologyCommand extends BaseCommand {
|
|||
|
||||
@Override
|
||||
public String getCommandDescription() {
|
||||
//@formatter:off
|
||||
return "Uploads a terminology package (e.g. a SNOMED CT ZIP file) to a HAPI JPA server. "
|
||||
+ "Note that this command uses a custom operation that is only implemented on HAPI "
|
||||
+ "JPA servers that have been configured to accept it.";
|
||||
//@formatter:on
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -65,6 +65,8 @@ public class ValidationDataUploader extends BaseCommand {
|
|||
uploadDefinitionsDstu2(targetServer, ctx);
|
||||
} else if (ctx.getVersion().getVersion() == FhirVersionEnum.DSTU3){
|
||||
uploadDefinitionsDstu3(targetServer, ctx);
|
||||
} else if (ctx.getVersion().getVersion() == FhirVersionEnum.R4){
|
||||
uploadDefinitionsR4(targetServer, ctx);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -256,6 +258,95 @@ public class ValidationDataUploader extends BaseCommand {
|
|||
ourLog.info("Finished uploading definitions to server (took {} ms)", delay);
|
||||
}
|
||||
|
||||
private void uploadDefinitionsR4(String theTargetServer, FhirContext theCtx) throws CommandFailureException {
|
||||
IGenericClient client = newClient(theCtx, theTargetServer);
|
||||
ourLog.info("Uploading definitions to server: " + theTargetServer);
|
||||
|
||||
long start = System.currentTimeMillis();
|
||||
int total = 0;
|
||||
int count = 0;
|
||||
org.hl7.fhir.r4.model.Bundle bundle;
|
||||
String vsContents;
|
||||
|
||||
try {
|
||||
theCtx.getVersion().getPathToSchemaDefinitions();
|
||||
vsContents = IOUtils.toString(ValidationDataUploader.class.getResourceAsStream("/org/hl7/fhir/r4/model/valueset/"+"valuesets.xml"), "UTF-8");
|
||||
} catch (IOException e) {
|
||||
throw new CommandFailureException(e.toString());
|
||||
}
|
||||
bundle = theCtx.newXmlParser().parseResource(org.hl7.fhir.r4.model.Bundle.class, vsContents);
|
||||
|
||||
total = bundle.getEntry().size();
|
||||
count = 1;
|
||||
for (org.hl7.fhir.r4.model.Bundle.BundleEntryComponent i : bundle.getEntry()) {
|
||||
org.hl7.fhir.r4.model.Resource next = i.getResource();
|
||||
next.setId(next.getIdElement().toUnqualifiedVersionless());
|
||||
|
||||
int bytes = theCtx.newXmlParser().encodeResourceToString(next).length();
|
||||
|
||||
ourLog.info("Uploading ValueSet {}/{} : {} ({} bytes}", new Object[] { count, total, next.getIdElement().getValue(), bytes });
|
||||
try {
|
||||
IIdType id = client.update().resource(next).execute().getId();
|
||||
ourLog.info(" - Got ID: {}", id.getValue());
|
||||
} catch (UnprocessableEntityException e) {
|
||||
ourLog.warn("UnprocessableEntityException: " + e.toString());
|
||||
}
|
||||
count++;
|
||||
}
|
||||
|
||||
try {
|
||||
vsContents = IOUtils.toString(ValidationDataUploader.class.getResourceAsStream("/org/hl7/fhir/r4/model/valueset/"+"v3-codesystems.xml"), "UTF-8");
|
||||
} catch (IOException e) {
|
||||
throw new CommandFailureException(e.toString());
|
||||
}
|
||||
|
||||
bundle = theCtx.newXmlParser().parseResource(org.hl7.fhir.r4.model.Bundle.class, vsContents);
|
||||
total = bundle.getEntry().size();
|
||||
count = 1;
|
||||
for (org.hl7.fhir.r4.model.Bundle.BundleEntryComponent i : bundle.getEntry()) {
|
||||
org.hl7.fhir.r4.model.Resource next = i.getResource();
|
||||
next.setId(next.getIdElement().toUnqualifiedVersionless());
|
||||
|
||||
ourLog.info("Uploading v3-codesystems ValueSet {}/{} : {}", new Object[] { count, total, next.getIdElement().getValue() });
|
||||
client.update().resource(next).execute();
|
||||
|
||||
count++;
|
||||
}
|
||||
|
||||
try {
|
||||
vsContents = IOUtils.toString(ValidationDataUploader.class.getResourceAsStream("/org/hl7/fhir/r4/model/valueset/"+"v2-tables.xml"), "UTF-8");
|
||||
} catch (IOException e) {
|
||||
throw new CommandFailureException(e.toString());
|
||||
}
|
||||
bundle = theCtx.newXmlParser().parseResource(org.hl7.fhir.r4.model.Bundle.class, vsContents);
|
||||
total = bundle.getEntry().size();
|
||||
count = 1;
|
||||
for (org.hl7.fhir.r4.model.Bundle.BundleEntryComponent i : bundle.getEntry()) {
|
||||
org.hl7.fhir.r4.model.Resource next = i.getResource();
|
||||
if (next.getIdElement().isIdPartValidLong()) {
|
||||
next.setIdElement(new org.hl7.fhir.r4.model.IdType("v2-"+ next.getIdElement().getIdPart()));
|
||||
}
|
||||
next.setId(next.getIdElement().toUnqualifiedVersionless());
|
||||
|
||||
ourLog.info("Uploading v2-tables ValueSet {}/{} : {}", new Object[] { count, total, next.getIdElement().getValue() });
|
||||
client.update().resource(next).execute();
|
||||
count++;
|
||||
}
|
||||
|
||||
ourLog.info("Finished uploading ValueSets");
|
||||
|
||||
|
||||
uploadDstu3Profiles(theCtx, client, "profiles-resources");
|
||||
uploadDstu3Profiles(theCtx, client, "profiles-types");
|
||||
uploadDstu3Profiles(theCtx, client, "profiles-others");
|
||||
|
||||
ourLog.info("Finished uploading ValueSets");
|
||||
|
||||
long delay = System.currentTimeMillis() - start;
|
||||
|
||||
ourLog.info("Finished uploading definitions to server (took {} ms)", delay);
|
||||
}
|
||||
|
||||
private void uploadDstu3Profiles(FhirContext ctx, IGenericClient client, String name) throws CommandFailureException {
|
||||
int total;
|
||||
int count;
|
||||
|
|
|
@ -2,7 +2,7 @@ package ca.uhn.fhir.rest.client.apache;
|
|||
|
||||
/*
|
||||
* #%L
|
||||
* HAPI FHIR - Core Library
|
||||
* HAPI FHIR - Client Framework
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2017 University Health Network
|
||||
* %%
|
||||
|
|
|
@ -2,7 +2,7 @@ package ca.uhn.fhir.rest.client.apache;
|
|||
|
||||
/*
|
||||
* #%L
|
||||
* HAPI FHIR - Core Library
|
||||
* HAPI FHIR - Client Framework
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2017 University Health Network
|
||||
* %%
|
||||
|
|
|
@ -2,7 +2,7 @@ package ca.uhn.fhir.rest.client.apache;
|
|||
|
||||
/*
|
||||
* #%L
|
||||
* HAPI FHIR - Core Library
|
||||
* HAPI FHIR - Client Framework
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2017 University Health Network
|
||||
* %%
|
||||
|
|
|
@ -2,7 +2,7 @@ package ca.uhn.fhir.rest.client.apache;
|
|||
|
||||
/*
|
||||
* #%L
|
||||
* HAPI FHIR - Core Library
|
||||
* HAPI FHIR - Client Framework
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2017 University Health Network
|
||||
* %%
|
||||
|
|
|
@ -2,7 +2,7 @@ package ca.uhn.fhir.rest.client.apache;
|
|||
|
||||
/*-
|
||||
* #%L
|
||||
* HAPI FHIR - Core Library
|
||||
* HAPI FHIR - Client Framework
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2017 University Health Network
|
||||
* %%
|
||||
|
|
|
@ -2,7 +2,7 @@ package ca.uhn.fhir.rest.client.apache;
|
|||
|
||||
/*
|
||||
* #%L
|
||||
* HAPI FHIR - Core Library
|
||||
* HAPI FHIR - Client Framework
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2017 University Health Network
|
||||
* %%
|
||||
|
|
|
@ -2,7 +2,7 @@ package ca.uhn.fhir.rest.client.impl;
|
|||
|
||||
/*
|
||||
* #%L
|
||||
* HAPI FHIR - Core Library
|
||||
* HAPI FHIR - Client Framework
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2017 University Health Network
|
||||
* %%
|
||||
|
|
|
@ -2,7 +2,7 @@ package ca.uhn.fhir.rest.client.impl;
|
|||
|
||||
/*
|
||||
* #%L
|
||||
* HAPI FHIR - Core Library
|
||||
* HAPI FHIR - Client Framework
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2017 University Health Network
|
||||
* %%
|
||||
|
|
|
@ -2,7 +2,7 @@ package ca.uhn.fhir.rest.client.impl;
|
|||
|
||||
/*
|
||||
* #%L
|
||||
* HAPI FHIR - Core Library
|
||||
* HAPI FHIR - Client Framework
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2017 University Health Network
|
||||
* %%
|
||||
|
|
|
@ -2,7 +2,7 @@ package ca.uhn.fhir.rest.client.impl;
|
|||
|
||||
/*
|
||||
* #%L
|
||||
* HAPI FHIR - Core Library
|
||||
* HAPI FHIR - Client Framework
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2017 University Health Network
|
||||
* %%
|
||||
|
|
|
@ -2,7 +2,7 @@ package ca.uhn.fhir.rest.client.impl;
|
|||
|
||||
/*
|
||||
* #%L
|
||||
* HAPI FHIR - Core Library
|
||||
* HAPI FHIR - Client Framework
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2017 University Health Network
|
||||
* %%
|
||||
|
|
|
@ -18,7 +18,7 @@ import ca.uhn.fhir.rest.client.api.IGenericClient;
|
|||
|
||||
/*
|
||||
* #%L
|
||||
* HAPI FHIR - Core Library
|
||||
* HAPI FHIR - Client Framework
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2017 University Health Network
|
||||
* %%
|
||||
|
|
|
@ -2,7 +2,7 @@ package ca.uhn.fhir.rest.client.impl;
|
|||
|
||||
/*
|
||||
* #%L
|
||||
* HAPI FHIR - Core Library
|
||||
* HAPI FHIR - Client Framework
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2017 University Health Network
|
||||
* %%
|
||||
|
|
|
@ -2,7 +2,7 @@ package ca.uhn.fhir.rest.client.interceptor;
|
|||
|
||||
/*
|
||||
* #%L
|
||||
* HAPI FHIR - Core Library
|
||||
* HAPI FHIR - Client Framework
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2017 University Health Network
|
||||
* %%
|
||||
|
|
|
@ -2,7 +2,7 @@ package ca.uhn.fhir.rest.client.interceptor;
|
|||
|
||||
/*
|
||||
* #%L
|
||||
* HAPI FHIR - Core Library
|
||||
* HAPI FHIR - Client Framework
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2017 University Health Network
|
||||
* %%
|
||||
|
|
|
@ -1,5 +1,25 @@
|
|||
package ca.uhn.fhir.rest.client.interceptor;
|
||||
|
||||
/*-
|
||||
* #%L
|
||||
* HAPI FHIR - Client Framework
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2017 University Health Network
|
||||
* %%
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* #L%
|
||||
*/
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.http.HttpEntity;
|
||||
|
|
|
@ -1,5 +1,25 @@
|
|||
package ca.uhn.fhir.rest.client.interceptor;
|
||||
|
||||
/*-
|
||||
* #%L
|
||||
* HAPI FHIR - Client Framework
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2017 University Health Network
|
||||
* %%
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* #L%
|
||||
*/
|
||||
|
||||
import ca.uhn.fhir.rest.api.Constants;
|
||||
import ca.uhn.fhir.rest.client.api.*;
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ package ca.uhn.fhir.rest.client.interceptor;
|
|||
|
||||
/*
|
||||
* #%L
|
||||
* HAPI FHIR - Core Library
|
||||
* HAPI FHIR - Client Framework
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2017 University Health Network
|
||||
* %%
|
||||
|
|
|
@ -4,7 +4,7 @@ import static org.apache.commons.lang3.StringUtils.isNotBlank;
|
|||
|
||||
/*
|
||||
* #%L
|
||||
* HAPI FHIR - Core Library
|
||||
* HAPI FHIR - Client Framework
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2017 University Health Network
|
||||
* %%
|
||||
|
|
|
@ -2,7 +2,7 @@ package ca.uhn.fhir.rest.client.interceptor;
|
|||
|
||||
/*
|
||||
* #%L
|
||||
* HAPI FHIR - Core Library
|
||||
* HAPI FHIR - Client Framework
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2017 University Health Network
|
||||
* %%
|
||||
|
|
|
@ -2,7 +2,7 @@ package ca.uhn.fhir.rest.client.method;
|
|||
|
||||
/*
|
||||
* #%L
|
||||
* HAPI FHIR - Core Library
|
||||
* HAPI FHIR - Client Framework
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2017 University Health Network
|
||||
* %%
|
||||
|
|
|
@ -4,7 +4,7 @@ import static org.apache.commons.lang3.StringUtils.isNotBlank;
|
|||
|
||||
/*
|
||||
* #%L
|
||||
* HAPI FHIR - Core Library
|
||||
* HAPI FHIR - Client Framework
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2017 University Health Network
|
||||
* %%
|
||||
|
|
|
@ -1,5 +1,25 @@
|
|||
package ca.uhn.fhir.rest.client.method;
|
||||
|
||||
/*-
|
||||
* #%L
|
||||
* HAPI FHIR - Client Framework
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2017 University Health Network
|
||||
* %%
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* #L%
|
||||
*/
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Reader;
|
||||
import java.lang.reflect.Method;
|
||||
|
|
|
@ -1,5 +1,25 @@
|
|||
package ca.uhn.fhir.rest.client.method;
|
||||
|
||||
/*-
|
||||
* #%L
|
||||
* HAPI FHIR - Client Framework
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2017 University Health Network
|
||||
* %%
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* #L%
|
||||
*/
|
||||
|
||||
import java.io.Reader;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.*;
|
||||
|
|
|
@ -2,7 +2,7 @@ package ca.uhn.fhir.rest.client.method;
|
|||
|
||||
/*
|
||||
* #%L
|
||||
* HAPI FHIR - Core Library
|
||||
* HAPI FHIR - Client Framework
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2017 University Health Network
|
||||
* %%
|
||||
|
|
|
@ -2,7 +2,7 @@ package ca.uhn.fhir.rest.client.method;
|
|||
|
||||
/*
|
||||
* #%L
|
||||
* HAPI FHIR - Core Library
|
||||
* HAPI FHIR - Client Framework
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2017 University Health Network
|
||||
* %%
|
||||
|
|
|
@ -4,7 +4,7 @@ import static org.apache.commons.lang3.StringUtils.isNotBlank;
|
|||
|
||||
/*
|
||||
* #%L
|
||||
* HAPI FHIR - Core Library
|
||||
* HAPI FHIR - Client Framework
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2017 University Health Network
|
||||
* %%
|
||||
|
|
|
@ -1,5 +1,25 @@
|
|||
package ca.uhn.fhir.rest.client.method;
|
||||
|
||||
/*-
|
||||
* #%L
|
||||
* HAPI FHIR - Client Framework
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2017 University Health Network
|
||||
* %%
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* #L%
|
||||
*/
|
||||
|
||||
import java.io.Reader;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Modifier;
|
||||
|
|
|
@ -2,7 +2,7 @@ package ca.uhn.fhir.rest.client.method;
|
|||
|
||||
/*
|
||||
* #%L
|
||||
* HAPI FHIR - Core Library
|
||||
* HAPI FHIR - Client Framework
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2017 University Health Network
|
||||
* %%
|
||||
|
|
|
@ -2,7 +2,7 @@ package ca.uhn.fhir.rest.client.method;
|
|||
|
||||
/*
|
||||
* #%L
|
||||
* HAPI FHIR - Core Library
|
||||
* HAPI FHIR - Client Framework
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2017 University Health Network
|
||||
* %%
|
||||
|
|
|
@ -2,7 +2,7 @@ package ca.uhn.fhir.rest.client.method;
|
|||
|
||||
/*
|
||||
* #%L
|
||||
* HAPI FHIR - Core Library
|
||||
* HAPI FHIR - Client Framework
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2017 University Health Network
|
||||
* %%
|
||||
|
|
|
@ -4,7 +4,7 @@ import static org.apache.commons.lang3.StringUtils.isNotBlank;
|
|||
|
||||
/*
|
||||
* #%L
|
||||
* HAPI FHIR - Core Library
|
||||
* HAPI FHIR - Client Framework
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2017 University Health Network
|
||||
* %%
|
||||
|
|
|
@ -2,7 +2,7 @@ package ca.uhn.fhir.rest.client.method;
|
|||
|
||||
/*
|
||||
* #%L
|
||||
* HAPI FHIR - Core Library
|
||||
* HAPI FHIR - Client Framework
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2017 University Health Network
|
||||
* %%
|
||||
|
|
|
@ -2,7 +2,7 @@ package ca.uhn.fhir.rest.client.method;
|
|||
|
||||
/*
|
||||
* #%L
|
||||
* HAPI FHIR - Core Library
|
||||
* HAPI FHIR - Client Framework
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2017 University Health Network
|
||||
* %%
|
||||
|
|
|
@ -2,7 +2,7 @@ package ca.uhn.fhir.rest.client.method;
|
|||
|
||||
/*
|
||||
* #%L
|
||||
* HAPI FHIR - Core Library
|
||||
* HAPI FHIR - Client Framework
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2017 University Health Network
|
||||
* %%
|
||||
|
|
|
@ -2,7 +2,7 @@ package ca.uhn.fhir.rest.client.method;
|
|||
|
||||
/*
|
||||
* #%L
|
||||
* HAPI FHIR - Core Library
|
||||
* HAPI FHIR - Client Framework
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2017 University Health Network
|
||||
* %%
|
||||
|
|
|
@ -2,7 +2,7 @@ package ca.uhn.fhir.rest.client.method;
|
|||
|
||||
/*
|
||||
* #%L
|
||||
* HAPI FHIR - Core Library
|
||||
* HAPI FHIR - Client Framework
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2017 University Health Network
|
||||
* %%
|
||||
|
|
|
@ -2,7 +2,7 @@ package ca.uhn.fhir.rest.client.method;
|
|||
|
||||
/*
|
||||
* #%L
|
||||
* HAPI FHIR - Core Library
|
||||
* HAPI FHIR - Client Framework
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2017 University Health Network
|
||||
* %%
|
||||
|
|
|
@ -2,7 +2,7 @@ package ca.uhn.fhir.rest.client.method;
|
|||
|
||||
/*
|
||||
* #%L
|
||||
* HAPI FHIR - Core Library
|
||||
* HAPI FHIR - Client Framework
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2017 University Health Network
|
||||
* %%
|
||||
|
|
|
@ -2,7 +2,7 @@ package ca.uhn.fhir.rest.client.method;
|
|||
|
||||
/*
|
||||
* #%L
|
||||
* HAPI FHIR - Core Library
|
||||
* HAPI FHIR - Client Framework
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2017 University Health Network
|
||||
* %%
|
||||
|
|
|
@ -2,7 +2,7 @@ package ca.uhn.fhir.rest.client.method;
|
|||
|
||||
/*
|
||||
* #%L
|
||||
* HAPI FHIR - Core Library
|
||||
* HAPI FHIR - Client Framework
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2017 University Health Network
|
||||
* %%
|
||||
|
|
|
@ -2,7 +2,7 @@ package ca.uhn.fhir.rest.client.method;
|
|||
|
||||
/*
|
||||
* #%L
|
||||
* HAPI FHIR - Core Library
|
||||
* HAPI FHIR - Client Framework
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2017 University Health Network
|
||||
* %%
|
||||
|
|
|
@ -2,7 +2,7 @@ package ca.uhn.fhir.rest.client.method;
|
|||
|
||||
/*
|
||||
* #%L
|
||||
* HAPI FHIR - Core Library
|
||||
* HAPI FHIR - Client Framework
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2017 University Health Network
|
||||
* %%
|
||||
|
|
|
@ -2,7 +2,7 @@ package ca.uhn.fhir.rest.client.method;
|
|||
|
||||
/*
|
||||
* #%L
|
||||
* HAPI FHIR - Core Library
|
||||
* HAPI FHIR - Client Framework
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2017 University Health Network
|
||||
* %%
|
||||
|
|
|
@ -2,7 +2,7 @@ package ca.uhn.fhir.rest.client.method;
|
|||
|
||||
/*
|
||||
* #%L
|
||||
* HAPI FHIR - Core Library
|
||||
* HAPI FHIR - Client Framework
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2017 University Health Network
|
||||
* %%
|
||||
|
|
|
@ -2,7 +2,7 @@ package ca.uhn.fhir.rest.client.method;
|
|||
|
||||
/*
|
||||
* #%L
|
||||
* HAPI FHIR - Core Library
|
||||
* HAPI FHIR - Client Framework
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2017 University Health Network
|
||||
* %%
|
||||
|
|
|
@ -27,7 +27,7 @@ import ca.uhn.fhir.util.*;
|
|||
|
||||
/*
|
||||
* #%L
|
||||
* HAPI FHIR - Core Library
|
||||
* HAPI FHIR - Client Framework
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2017 University Health Network
|
||||
* %%
|
||||
|
|
|
@ -2,7 +2,7 @@ package ca.uhn.fhir.rest.client.method;
|
|||
|
||||
/*
|
||||
* #%L
|
||||
* HAPI FHIR - Core Library
|
||||
* HAPI FHIR - Client Framework
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2017 University Health Network
|
||||
* %%
|
||||
|
|
|
@ -2,7 +2,7 @@ package ca.uhn.fhir.rest.client.method;
|
|||
|
||||
/*
|
||||
* #%L
|
||||
* HAPI FHIR - Core Library
|
||||
* HAPI FHIR - Client Framework
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2017 University Health Network
|
||||
* %%
|
||||
|
|
|
@ -2,7 +2,7 @@ package ca.uhn.fhir.rest.client.method;
|
|||
|
||||
/*
|
||||
* #%L
|
||||
* HAPI FHIR - Core Library
|
||||
* HAPI FHIR - Client Framework
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2017 University Health Network
|
||||
* %%
|
||||
|
|
|
@ -1,5 +1,25 @@
|
|||
package ca.uhn.fhir.rest.client.method;
|
||||
|
||||
/*-
|
||||
* #%L
|
||||
* HAPI FHIR - Client Framework
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2017 University Health Network
|
||||
* %%
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* #L%
|
||||
*/
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
|
|
|
@ -2,7 +2,7 @@ package ca.uhn.fhir.rest.client.method;
|
|||
|
||||
/*
|
||||
* #%L
|
||||
* HAPI FHIR - Core Library
|
||||
* HAPI FHIR - Client Framework
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2017 University Health Network
|
||||
* %%
|
||||
|
|
|
@ -2,7 +2,7 @@ package ca.uhn.fhir.rest.client.method;
|
|||
|
||||
/*
|
||||
* #%L
|
||||
* HAPI FHIR - Core Library
|
||||
* HAPI FHIR - Client Framework
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2017 University Health Network
|
||||
* %%
|
||||
|
|
|
@ -2,7 +2,7 @@ package ca.uhn.fhir.rest.client.method;
|
|||
|
||||
/*
|
||||
* #%L
|
||||
* HAPI FHIR - Core Library
|
||||
* HAPI FHIR - Client Framework
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2017 University Health Network
|
||||
* %%
|
||||
|
|
|
@ -2,7 +2,7 @@ package ca.uhn.fhir.rest.client.method;
|
|||
|
||||
/*
|
||||
* #%L
|
||||
* HAPI FHIR - Core Library
|
||||
* HAPI FHIR - Client Framework
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2017 University Health Network
|
||||
* %%
|
||||
|
|
|
@ -1,5 +1,25 @@
|
|||
package ca.uhn.fhir.rest.client.method;
|
||||
|
||||
/*-
|
||||
* #%L
|
||||
* HAPI FHIR - Client Framework
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2017 University Health Network
|
||||
* %%
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* #L%
|
||||
*/
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
|
|
@ -2,7 +2,7 @@ package ca.uhn.fhir.rest.client.method;
|
|||
|
||||
/*
|
||||
* #%L
|
||||
* HAPI FHIR - Core Library
|
||||
* HAPI FHIR - Client Framework
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2017 University Health Network
|
||||
* %%
|
||||
|
|
|
@ -2,7 +2,7 @@ package ca.uhn.fhir.rest.client.method;
|
|||
|
||||
/*
|
||||
* #%L
|
||||
* HAPI FHIR - Core Library
|
||||
* HAPI FHIR - Client Framework
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2017 University Health Network
|
||||
* %%
|
||||
|
|
|
@ -2,7 +2,7 @@ package ca.uhn.fhir.rest.client.method;
|
|||
|
||||
/*
|
||||
* #%L
|
||||
* HAPI FHIR - Core Library
|
||||
* HAPI FHIR - Client Framework
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2017 University Health Network
|
||||
* %%
|
||||
|
|
|
@ -1,5 +1,25 @@
|
|||
package ca.uhn.fhir.rest.client.method;
|
||||
|
||||
/*-
|
||||
* #%L
|
||||
* HAPI FHIR - Client Framework
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2017 University Health Network
|
||||
* %%
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* #L%
|
||||
*/
|
||||
|
||||
class SinceOrAtParameter extends SearchParameter {
|
||||
|
||||
// private Class<?> myType;
|
||||
|
|
|
@ -2,7 +2,7 @@ package ca.uhn.fhir.rest.client.method;
|
|||
|
||||
/*
|
||||
* #%L
|
||||
* HAPI FHIR - Core Library
|
||||
* HAPI FHIR - Client Framework
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2017 University Health Network
|
||||
* %%
|
||||
|
|
|
@ -2,7 +2,7 @@ package ca.uhn.fhir.rest.client.method;
|
|||
|
||||
/*
|
||||
* #%L
|
||||
* HAPI FHIR - Core Library
|
||||
* HAPI FHIR - Client Framework
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2017 University Health Network
|
||||
* %%
|
||||
|
|
|
@ -1,5 +1,25 @@
|
|||
package ca.uhn.fhir.rest.client.method;
|
||||
|
||||
/*-
|
||||
* #%L
|
||||
* HAPI FHIR - Client Framework
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2017 University Health Network
|
||||
* %%
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* #L%
|
||||
*/
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
|
|
@ -1,5 +1,25 @@
|
|||
package ca.uhn.fhir.rest.client.method;
|
||||
|
||||
/*-
|
||||
* #%L
|
||||
* HAPI FHIR - Client Framework
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2017 University Health Network
|
||||
* %%
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* #L%
|
||||
*/
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.List;
|
||||
|
||||
|
|
|
@ -1,5 +1,25 @@
|
|||
package ca.uhn.fhir.rest.client.method;
|
||||
|
||||
/*-
|
||||
* #%L
|
||||
* HAPI FHIR - Client Framework
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2017 University Health Network
|
||||
* %%
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* #L%
|
||||
*/
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.util.*;
|
||||
|
|
|
@ -1,5 +1,25 @@
|
|||
package ca.uhn.fhir.rest.client.method;
|
||||
|
||||
/*-
|
||||
* #%L
|
||||
* HAPI FHIR - Client Framework
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2017 University Health Network
|
||||
* %%
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* #L%
|
||||
*/
|
||||
|
||||
import static org.apache.commons.lang3.StringUtils.isBlank;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
|
|
@ -2,7 +2,7 @@ package ca.uhn.fhir.rest.client.method;
|
|||
|
||||
/*
|
||||
* #%L
|
||||
* HAPI FHIR - Core Library
|
||||
* HAPI FHIR - Client Framework
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2017 University Health Network
|
||||
* %%
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,261 +1,282 @@
|
|||
package org.hl7.fhir.convertors;
|
||||
|
||||
|
||||
/*
|
||||
Copyright (c) 2011+, HL7, Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
* Neither the name of HL7 nor the names of its contributors may be used to
|
||||
endorse or promote products derived from this software without specific
|
||||
prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
|
||||
import org.hl7.fhir.utilities.CommaSeparatedStringBuilder;
|
||||
import org.hl7.fhir.utilities.xml.XMLUtil;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
|
||||
public class CDAUtilities {
|
||||
|
||||
private Document doc;
|
||||
|
||||
public CDAUtilities(InputStream stream) throws Exception {
|
||||
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
|
||||
factory.setNamespaceAware(true);
|
||||
DocumentBuilder builder = factory.newDocumentBuilder();
|
||||
|
||||
doc = builder.parse(stream);
|
||||
basicChecks();
|
||||
}
|
||||
|
||||
private void basicChecks() throws Exception {
|
||||
Element e = doc.getDocumentElement();
|
||||
rule(e.getNamespaceURI().equals("urn:hl7-org:v3"), "CDA namespace must be ");
|
||||
rule(e.getNodeName().equals("ClinicalDocument"), "CDA root name must be ClinicalDocument");
|
||||
|
||||
}
|
||||
|
||||
private void rule(boolean test, String message) throws Exception {
|
||||
if (!test)
|
||||
throw new Exception(message);
|
||||
|
||||
}
|
||||
|
||||
public Element getElement() {
|
||||
return doc.getDocumentElement();
|
||||
}
|
||||
|
||||
public void checkTemplateId(Element e, String templateId) throws Exception {
|
||||
rule(hasTemplateId(e, templateId), "Template Id '"+templateId+"' not found");
|
||||
|
||||
}
|
||||
|
||||
public Element getChild(Element e, String[] names) throws Exception {
|
||||
for (String n : names) {
|
||||
if (e == null)
|
||||
return null;
|
||||
e = getChild(e, n);
|
||||
}
|
||||
return e;
|
||||
}
|
||||
|
||||
public Element getChild(Element element, String name) throws Exception {
|
||||
if (element == null)
|
||||
return null;
|
||||
|
||||
Element e = null;
|
||||
Node n = element.getFirstChild();
|
||||
while (n != null) {
|
||||
if (n.getNodeType() == Node.ELEMENT_NODE && n.getNodeName().equals(name)) {
|
||||
if (e == null) {
|
||||
e = (Element) n;
|
||||
} else {
|
||||
throw new Exception("multiple matches found for "+name);
|
||||
}
|
||||
}
|
||||
n = n.getNextSibling();
|
||||
}
|
||||
return e;
|
||||
}
|
||||
|
||||
public Element getChildByAttribute(Element element, String name, String attrname, String value) throws Exception {
|
||||
if (element == null)
|
||||
return null;
|
||||
|
||||
Element e = null;
|
||||
Node n = element.getFirstChild();
|
||||
while (n != null) {
|
||||
if (n.getNodeType() == Node.ELEMENT_NODE && n.getNodeName().equals(name) && value.equals(((Element) n).getAttribute(attrname))) {
|
||||
if (e == null) {
|
||||
e = (Element) n;
|
||||
} else {
|
||||
throw new Exception("multiple matches found for "+name);
|
||||
}
|
||||
}
|
||||
n = n.getNextSibling();
|
||||
}
|
||||
return e;
|
||||
}
|
||||
|
||||
|
||||
public List<Element> getChildren(Element element, String name) {
|
||||
List<Element> l = new ArrayList<Element>();
|
||||
if (element != null) {
|
||||
Node n = element.getFirstChild();
|
||||
while (n != null) {
|
||||
if (n.getNodeType() == Node.ELEMENT_NODE && n.getNodeName().equals(name)) {
|
||||
l.add((Element) n);
|
||||
}
|
||||
n = n.getNextSibling();
|
||||
}
|
||||
}
|
||||
return l;
|
||||
}
|
||||
|
||||
public Element getDescendent(Element element, String path) throws Exception {
|
||||
String[] p = path.split("\\/");
|
||||
return getDescendent(element, p);
|
||||
}
|
||||
|
||||
public Element getDescendent(Element e, String[] path) throws Exception {
|
||||
for (String n : path) {
|
||||
if (e == null)
|
||||
return e;
|
||||
e = getChild(e, n);
|
||||
}
|
||||
return e;
|
||||
}
|
||||
|
||||
public boolean hasTemplateId(Element e, String tid) {
|
||||
if (e == null)
|
||||
return false;
|
||||
boolean found = false;
|
||||
Node n = e.getFirstChild();
|
||||
while (n != null && !found) {
|
||||
if (n.getNodeType() == Node.ELEMENT_NODE && n.getNodeName().equals("templateId") && tid.equals(((Element) n).getAttribute("root")))
|
||||
found = true;
|
||||
n = n.getNextSibling();
|
||||
}
|
||||
return found;
|
||||
}
|
||||
|
||||
public String getStatus(Element act) throws Exception {
|
||||
if (act == null)
|
||||
return null;
|
||||
Element sc = getChild(act, "statusCode");
|
||||
if (sc == null)
|
||||
return null;
|
||||
else
|
||||
return sc.getAttribute("code");
|
||||
}
|
||||
|
||||
public String getSeverity(Element observation) throws Exception {
|
||||
for (Element e : getChildren(observation, "entryRelationship")) {
|
||||
Element child = getChild(e, "observation");
|
||||
if (hasTemplateId(child, "2.16.840.1.113883.10.20.22.4.8"))
|
||||
return getChild(child, "value").getAttribute("code");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public String showTemplateIds(Element element) {
|
||||
List<Element> list = getChildren(element, "templateId");
|
||||
CommaSeparatedStringBuilder b = new CommaSeparatedStringBuilder();
|
||||
for (Element e : list) {
|
||||
if (e.hasAttribute("extension"))
|
||||
b.append(e.getAttribute("root")+"::"+e.getAttribute("extension"));
|
||||
else
|
||||
b.append(e.getAttribute("root"));
|
||||
}
|
||||
return b.toString();
|
||||
}
|
||||
|
||||
public Element getlastChild(Element e) {
|
||||
Node n = e.getLastChild();
|
||||
while (n != null && n.getNodeType() != Node.ELEMENT_NODE)
|
||||
n = n.getPreviousSibling();
|
||||
return n == null ? null : (Element) n;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method looks up an object by it's id, and only returns it if has a child by the given name
|
||||
* (resolving identifier based cross references)
|
||||
*
|
||||
* @param id
|
||||
* @param childName
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public Element getById(Element id, String childName) throws Exception {
|
||||
return getById(doc.getDocumentElement(), id, childName);
|
||||
}
|
||||
|
||||
private Element getById(Element e, Element id, String childName) throws Exception {
|
||||
Element c = XMLUtil.getFirstChild(e);
|
||||
while (c != null) {
|
||||
Element i = getChild(c, "id");
|
||||
if (i != null && matchesAsId(i, id) && getChild(c, childName) != null)
|
||||
return c;
|
||||
Element m = getById(c, id, childName);
|
||||
if (m != null)
|
||||
return m;
|
||||
c = XMLUtil.getNextSibling(c);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private boolean matchesAsId(Element i1, Element i2) {
|
||||
String r1 = i1.getAttribute("root");
|
||||
String r2 = i2.getAttribute("root");
|
||||
String e1 = i1.getAttribute("extension");
|
||||
String e2 = i2.getAttribute("extension");
|
||||
return (r1 != null && r1.equals(r2)) && ((e1 == null && e2 == null) || (e1 != null && e1.equals(e2)));
|
||||
}
|
||||
|
||||
public Element getByXmlId(String id) {
|
||||
return getByXmlId(doc.getDocumentElement(), id);
|
||||
}
|
||||
|
||||
private Element getByXmlId(Element e, String value) {
|
||||
Element c = XMLUtil.getFirstChild(e);
|
||||
while (c != null) {
|
||||
String id = c.getAttribute("ID");
|
||||
if (id != null && id.equals(value))
|
||||
return c;
|
||||
Element m = getByXmlId(c, value);
|
||||
if (m != null)
|
||||
return m;
|
||||
c = XMLUtil.getNextSibling(c);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
package org.hl7.fhir.convertors;
|
||||
|
||||
/*-
|
||||
* #%L
|
||||
* HAPI FHIR - Converter
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2017 University Health Network
|
||||
* %%
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* #L%
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/*
|
||||
Copyright (c) 2011+, HL7, Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
* Neither the name of HL7 nor the names of its contributors may be used to
|
||||
endorse or promote products derived from this software without specific
|
||||
prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
|
||||
import org.hl7.fhir.utilities.CommaSeparatedStringBuilder;
|
||||
import org.hl7.fhir.utilities.xml.XMLUtil;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
|
||||
public class CDAUtilities {
|
||||
|
||||
private Document doc;
|
||||
|
||||
public CDAUtilities(InputStream stream) throws Exception {
|
||||
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
|
||||
factory.setNamespaceAware(true);
|
||||
DocumentBuilder builder = factory.newDocumentBuilder();
|
||||
|
||||
doc = builder.parse(stream);
|
||||
basicChecks();
|
||||
}
|
||||
|
||||
private void basicChecks() throws Exception {
|
||||
Element e = doc.getDocumentElement();
|
||||
rule(e.getNamespaceURI().equals("urn:hl7-org:v3"), "CDA namespace must be ");
|
||||
rule(e.getNodeName().equals("ClinicalDocument"), "CDA root name must be ClinicalDocument");
|
||||
|
||||
}
|
||||
|
||||
private void rule(boolean test, String message) throws Exception {
|
||||
if (!test)
|
||||
throw new Exception(message);
|
||||
|
||||
}
|
||||
|
||||
public Element getElement() {
|
||||
return doc.getDocumentElement();
|
||||
}
|
||||
|
||||
public void checkTemplateId(Element e, String templateId) throws Exception {
|
||||
rule(hasTemplateId(e, templateId), "Template Id '"+templateId+"' not found");
|
||||
|
||||
}
|
||||
|
||||
public Element getChild(Element e, String[] names) throws Exception {
|
||||
for (String n : names) {
|
||||
if (e == null)
|
||||
return null;
|
||||
e = getChild(e, n);
|
||||
}
|
||||
return e;
|
||||
}
|
||||
|
||||
public Element getChild(Element element, String name) throws Exception {
|
||||
if (element == null)
|
||||
return null;
|
||||
|
||||
Element e = null;
|
||||
Node n = element.getFirstChild();
|
||||
while (n != null) {
|
||||
if (n.getNodeType() == Node.ELEMENT_NODE && n.getNodeName().equals(name)) {
|
||||
if (e == null) {
|
||||
e = (Element) n;
|
||||
} else {
|
||||
throw new Exception("multiple matches found for "+name);
|
||||
}
|
||||
}
|
||||
n = n.getNextSibling();
|
||||
}
|
||||
return e;
|
||||
}
|
||||
|
||||
public Element getChildByAttribute(Element element, String name, String attrname, String value) throws Exception {
|
||||
if (element == null)
|
||||
return null;
|
||||
|
||||
Element e = null;
|
||||
Node n = element.getFirstChild();
|
||||
while (n != null) {
|
||||
if (n.getNodeType() == Node.ELEMENT_NODE && n.getNodeName().equals(name) && value.equals(((Element) n).getAttribute(attrname))) {
|
||||
if (e == null) {
|
||||
e = (Element) n;
|
||||
} else {
|
||||
throw new Exception("multiple matches found for "+name);
|
||||
}
|
||||
}
|
||||
n = n.getNextSibling();
|
||||
}
|
||||
return e;
|
||||
}
|
||||
|
||||
|
||||
public List<Element> getChildren(Element element, String name) {
|
||||
List<Element> l = new ArrayList<Element>();
|
||||
if (element != null) {
|
||||
Node n = element.getFirstChild();
|
||||
while (n != null) {
|
||||
if (n.getNodeType() == Node.ELEMENT_NODE && n.getNodeName().equals(name)) {
|
||||
l.add((Element) n);
|
||||
}
|
||||
n = n.getNextSibling();
|
||||
}
|
||||
}
|
||||
return l;
|
||||
}
|
||||
|
||||
public Element getDescendent(Element element, String path) throws Exception {
|
||||
String[] p = path.split("\\/");
|
||||
return getDescendent(element, p);
|
||||
}
|
||||
|
||||
public Element getDescendent(Element e, String[] path) throws Exception {
|
||||
for (String n : path) {
|
||||
if (e == null)
|
||||
return e;
|
||||
e = getChild(e, n);
|
||||
}
|
||||
return e;
|
||||
}
|
||||
|
||||
public boolean hasTemplateId(Element e, String tid) {
|
||||
if (e == null)
|
||||
return false;
|
||||
boolean found = false;
|
||||
Node n = e.getFirstChild();
|
||||
while (n != null && !found) {
|
||||
if (n.getNodeType() == Node.ELEMENT_NODE && n.getNodeName().equals("templateId") && tid.equals(((Element) n).getAttribute("root")))
|
||||
found = true;
|
||||
n = n.getNextSibling();
|
||||
}
|
||||
return found;
|
||||
}
|
||||
|
||||
public String getStatus(Element act) throws Exception {
|
||||
if (act == null)
|
||||
return null;
|
||||
Element sc = getChild(act, "statusCode");
|
||||
if (sc == null)
|
||||
return null;
|
||||
else
|
||||
return sc.getAttribute("code");
|
||||
}
|
||||
|
||||
public String getSeverity(Element observation) throws Exception {
|
||||
for (Element e : getChildren(observation, "entryRelationship")) {
|
||||
Element child = getChild(e, "observation");
|
||||
if (hasTemplateId(child, "2.16.840.1.113883.10.20.22.4.8"))
|
||||
return getChild(child, "value").getAttribute("code");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public String showTemplateIds(Element element) {
|
||||
List<Element> list = getChildren(element, "templateId");
|
||||
CommaSeparatedStringBuilder b = new CommaSeparatedStringBuilder();
|
||||
for (Element e : list) {
|
||||
if (e.hasAttribute("extension"))
|
||||
b.append(e.getAttribute("root")+"::"+e.getAttribute("extension"));
|
||||
else
|
||||
b.append(e.getAttribute("root"));
|
||||
}
|
||||
return b.toString();
|
||||
}
|
||||
|
||||
public Element getlastChild(Element e) {
|
||||
Node n = e.getLastChild();
|
||||
while (n != null && n.getNodeType() != Node.ELEMENT_NODE)
|
||||
n = n.getPreviousSibling();
|
||||
return n == null ? null : (Element) n;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method looks up an object by it's id, and only returns it if has a child by the given name
|
||||
* (resolving identifier based cross references)
|
||||
*
|
||||
* @param id
|
||||
* @param childName
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public Element getById(Element id, String childName) throws Exception {
|
||||
return getById(doc.getDocumentElement(), id, childName);
|
||||
}
|
||||
|
||||
private Element getById(Element e, Element id, String childName) throws Exception {
|
||||
Element c = XMLUtil.getFirstChild(e);
|
||||
while (c != null) {
|
||||
Element i = getChild(c, "id");
|
||||
if (i != null && matchesAsId(i, id) && getChild(c, childName) != null)
|
||||
return c;
|
||||
Element m = getById(c, id, childName);
|
||||
if (m != null)
|
||||
return m;
|
||||
c = XMLUtil.getNextSibling(c);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private boolean matchesAsId(Element i1, Element i2) {
|
||||
String r1 = i1.getAttribute("root");
|
||||
String r2 = i2.getAttribute("root");
|
||||
String e1 = i1.getAttribute("extension");
|
||||
String e2 = i2.getAttribute("extension");
|
||||
return (r1 != null && r1.equals(r2)) && ((e1 == null && e2 == null) || (e1 != null && e1.equals(e2)));
|
||||
}
|
||||
|
||||
public Element getByXmlId(String id) {
|
||||
return getByXmlId(doc.getDocumentElement(), id);
|
||||
}
|
||||
|
||||
private Element getByXmlId(Element e, String value) {
|
||||
Element c = XMLUtil.getFirstChild(e);
|
||||
while (c != null) {
|
||||
String id = c.getAttribute("ID");
|
||||
if (id != null && id.equals(value))
|
||||
return c;
|
||||
Element m = getByXmlId(c, value);
|
||||
if (m != null)
|
||||
return m;
|
||||
c = XMLUtil.getNextSibling(c);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,13 +1,34 @@
|
|||
package org.hl7.fhir.convertors;
|
||||
|
||||
public class CcdaExtensions {
|
||||
public final static String DAF_NAME_RACE = "http://hl7.org/fhir/StructureDefinition/us-core-race";
|
||||
public final static String DAF_NAME_ETHNICITY = "http://hl7.org/fhir/StructureDefinition/us-core-ethnicity";
|
||||
|
||||
public final static String BASE = "http://hl7.org/ccda";
|
||||
public final static String NAME_RELIGION = BASE+"/religious-affiliation";
|
||||
public final static String NAME_BIRTHPLACE = BASE+"birthplace";
|
||||
public final static String NAME_LANG_PROF = BASE+"proficiency-level";
|
||||
|
||||
|
||||
}
|
||||
package org.hl7.fhir.convertors;
|
||||
|
||||
/*-
|
||||
* #%L
|
||||
* HAPI FHIR - Converter
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2017 University Health Network
|
||||
* %%
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* #L%
|
||||
*/
|
||||
|
||||
|
||||
public class CcdaExtensions {
|
||||
public final static String DAF_NAME_RACE = "http://hl7.org/fhir/StructureDefinition/us-core-race";
|
||||
public final static String DAF_NAME_ETHNICITY = "http://hl7.org/fhir/StructureDefinition/us-core-ethnicity";
|
||||
|
||||
public final static String BASE = "http://hl7.org/ccda";
|
||||
public final static String NAME_RELIGION = BASE+"/religious-affiliation";
|
||||
public final static String NAME_BIRTHPLACE = BASE+"birthplace";
|
||||
public final static String NAME_LANG_PROF = BASE+"proficiency-level";
|
||||
|
||||
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,5 +1,26 @@
|
|||
package org.hl7.fhir.convertors;
|
||||
|
||||
public class ConverterBase {
|
||||
|
||||
}
|
||||
package org.hl7.fhir.convertors;
|
||||
|
||||
/*-
|
||||
* #%L
|
||||
* HAPI FHIR - Converter
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2017 University Health Network
|
||||
* %%
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* #L%
|
||||
*/
|
||||
|
||||
|
||||
public class ConverterBase {
|
||||
|
||||
}
|
||||
|
|
|
@ -1,188 +1,209 @@
|
|||
package org.hl7.fhir.convertors;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
|
||||
import org.hl7.fhir.dstu3.formats.IParser.OutputStyle;
|
||||
import org.hl7.fhir.dstu3.formats.XmlParser;
|
||||
import org.hl7.fhir.dstu3.model.CodeSystem;
|
||||
import org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemHierarchyMeaning;
|
||||
import org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent;
|
||||
import org.hl7.fhir.dstu3.model.Coding;
|
||||
import org.hl7.fhir.dstu3.model.DateTimeType;
|
||||
import org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus;
|
||||
import org.hl7.fhir.dstu3.model.Identifier;
|
||||
import org.hl7.fhir.dstu3.model.ValueSet;
|
||||
import org.hl7.fhir.dstu3.terminologies.CodeSystemUtilities;
|
||||
import org.hl7.fhir.utilities.xml.XMLUtil;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
|
||||
/**
|
||||
* This is defined as a prototype ClaML importer
|
||||
*
|
||||
* @author Grahame
|
||||
*
|
||||
*/
|
||||
|
||||
public class ICPC2Importer {
|
||||
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
ICPC2Importer r = new ICPC2Importer();
|
||||
r.setSourceFileName("c:\\temp\\ICPC-2e-v5.0.xml");
|
||||
r.setTargetFileNameCS("C:\\temp\\icpc2.xml");
|
||||
r.setTargetFileNameVS("C:\\temp\\icpc2-vs.xml");
|
||||
r.go();
|
||||
System.out.println("Completed OK");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private String sourceFileName; // the ICPC2 ClaML file
|
||||
private String targetFileNameVS; // the value set to produce
|
||||
private String targetFileNameCS; // the value set to produce
|
||||
|
||||
public ICPC2Importer() {
|
||||
super();
|
||||
}
|
||||
public ICPC2Importer(String sourceFileName, String targetFileNameCS, String targetFileNameVS) {
|
||||
super();
|
||||
this.sourceFileName = sourceFileName;
|
||||
this.targetFileNameCS = targetFileNameCS;
|
||||
this.targetFileNameVS = targetFileNameVS;
|
||||
}
|
||||
public String getSourceFileName() {
|
||||
return sourceFileName;
|
||||
}
|
||||
public void setSourceFileName(String sourceFileName) {
|
||||
this.sourceFileName = sourceFileName;
|
||||
}
|
||||
public String getTargetFileNameCS() {
|
||||
return targetFileNameCS;
|
||||
}
|
||||
public void setTargetFileNameCS(String targetFileName) {
|
||||
this.targetFileNameCS = targetFileName;
|
||||
}
|
||||
|
||||
public String getTargetFileNameVS() {
|
||||
return targetFileNameVS;
|
||||
}
|
||||
public void setTargetFileNameVS(String targetFileName) {
|
||||
this.targetFileNameVS = targetFileName;
|
||||
}
|
||||
|
||||
public void go() throws Exception {
|
||||
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
|
||||
factory.setNamespaceAware(false);
|
||||
DocumentBuilder builder = factory.newDocumentBuilder();
|
||||
Document doc = builder.parse(new FileInputStream(sourceFileName));
|
||||
|
||||
ValueSet vs = new ValueSet();
|
||||
vs.setUrl("http://hl7.org/fhir/sid/icpc2/vs");
|
||||
Element title = XMLUtil.getNamedChild(doc.getDocumentElement(), "Title");
|
||||
vs.setVersion(title.getAttribute("version"));
|
||||
vs.setName(title.getAttribute("name"));
|
||||
vs.setImmutable(true);
|
||||
Element identifier = XMLUtil.getNamedChild(doc.getDocumentElement(), "Identifier");
|
||||
vs.setPublisher(identifier.getAttribute("authority"));
|
||||
vs.addIdentifier(new Identifier().setValue(identifier.getAttribute("uid")));
|
||||
List<Element> authors = new ArrayList<Element>();
|
||||
XMLUtil.getNamedChildren(XMLUtil.getNamedChild(doc.getDocumentElement(), "Authors"), "Author", authors);
|
||||
for (Element a : authors)
|
||||
if (!a.getAttribute("name").contains("+"))
|
||||
vs.addContact().setName(a.getTextContent());
|
||||
vs.setCopyright("The copyright of ICPC, both in hard copy and in electronic form, is owned by Wonca. See http://www.kith.no/templates/kith_WebPage____1110.aspx");
|
||||
vs.setStatus(PublicationStatus.ACTIVE);
|
||||
vs.setDateElement(new DateTimeType(title.getAttribute("date")));
|
||||
|
||||
vs.getCompose().addInclude().setSystem("http://hl7.org/fhir/sid/icpc2");
|
||||
CodeSystem cs = new CodeSystem();
|
||||
cs.setUrl("http://hl7.org/fhir/sid/icpc2");
|
||||
cs.setVersion(title.getAttribute("version"));
|
||||
cs.setName(title.getAttribute("name"));
|
||||
identifier = XMLUtil.getNamedChild(doc.getDocumentElement(), "Identifier");
|
||||
cs.setPublisher(identifier.getAttribute("authority"));
|
||||
cs.setIdentifier(new Identifier().setValue(identifier.getAttribute("uid")));
|
||||
cs.setHierarchyMeaning(CodeSystemHierarchyMeaning.CLASSIFIEDWITH);
|
||||
authors = new ArrayList<Element>();
|
||||
XMLUtil.getNamedChildren(XMLUtil.getNamedChild(doc.getDocumentElement(), "Authors"), "Author", authors);
|
||||
for (Element a : authors)
|
||||
if (!a.getAttribute("name").contains("+"))
|
||||
cs.addContact().setName(a.getTextContent());
|
||||
cs.setCopyright("The copyright of ICPC, both in hard copy and in electronic form, is owned by Wonca. See http://www.kith.no/templates/kith_WebPage____1110.aspx");
|
||||
cs.setStatus(PublicationStatus.ACTIVE);
|
||||
cs.setDateElement(new DateTimeType(title.getAttribute("date")));
|
||||
cs.setValueSet(vs.getUrl());
|
||||
|
||||
Map<String, ConceptDefinitionComponent> concepts = new HashMap<String, ConceptDefinitionComponent>();
|
||||
List<Element> classes = new ArrayList<Element>();
|
||||
XMLUtil.getNamedChildren(doc.getDocumentElement(), "Class", classes);
|
||||
for (Element cls : classes) {
|
||||
processClass(cls, concepts, cs);
|
||||
}
|
||||
|
||||
XmlParser xml = new XmlParser();
|
||||
xml.setOutputStyle(OutputStyle.PRETTY);
|
||||
xml.compose(new FileOutputStream(targetFileNameVS), vs);
|
||||
xml.compose(new FileOutputStream(targetFileNameCS), cs);
|
||||
}
|
||||
|
||||
private void processClass(Element cls, Map<String, ConceptDefinitionComponent> concepts, CodeSystem define) {
|
||||
ConceptDefinitionComponent concept = new ConceptDefinitionComponent();
|
||||
concept.setCode(cls.getAttribute("code"));
|
||||
concept.setDefinition(getRubric(cls, "preferred"));
|
||||
String s = getRubric(cls, "shortTitle");
|
||||
if (s != null && !s.equals(concept.getDefinition()))
|
||||
concept.addDesignation().setUse(new Coding().setSystem("http://hl7.org/fhir/sid/icpc2/rubrics").setCode("shortTitle")).setValue(s);
|
||||
s = getRubric(cls, "inclusion");
|
||||
if (s != null)
|
||||
concept.addDesignation().setUse(new Coding().setSystem("http://hl7.org/fhir/sid/icpc2/rubrics").setCode("inclusion")).setValue(s);
|
||||
s = getRubric(cls, "exclusion");
|
||||
if (s != null)
|
||||
concept.addDesignation().setUse(new Coding().setSystem("http://hl7.org/fhir/sid/icpc2/rubrics").setCode("exclusion")).setValue(s);
|
||||
s = getRubric(cls, "criteria");
|
||||
if (s != null)
|
||||
concept.addDesignation().setUse(new Coding().setSystem("http://hl7.org/fhir/sid/icpc2/rubrics").setCode("criteria")).setValue(s);
|
||||
s = getRubric(cls, "consider");
|
||||
if (s != null)
|
||||
concept.addDesignation().setUse(new Coding().setSystem("http://hl7.org/fhir/sid/icpc2/rubrics").setCode("consider")).setValue(s);
|
||||
s = getRubric(cls, "note");
|
||||
if (s != null)
|
||||
concept.addDesignation().setUse(new Coding().setSystem("http://hl7.org/fhir/sid/icpc2/rubrics").setCode("note")).setValue(s);
|
||||
|
||||
concepts.put(concept.getCode(), concept);
|
||||
List<Element> children = new ArrayList<Element>();
|
||||
XMLUtil.getNamedChildren(cls, "SubClass", children);
|
||||
if (children.size() > 0)
|
||||
CodeSystemUtilities.setNotSelectable(define, concept);
|
||||
|
||||
Element parent = XMLUtil.getNamedChild(cls, "SuperClass");
|
||||
if (parent == null) {
|
||||
define.addConcept(concept);
|
||||
} else {
|
||||
ConceptDefinitionComponent p = concepts.get(parent.getAttribute("code"));
|
||||
p.getConcept().add(concept);
|
||||
}
|
||||
}
|
||||
|
||||
private String getRubric(Element cls, String kind) {
|
||||
List<Element> rubrics = new ArrayList<Element>();
|
||||
XMLUtil.getNamedChildren(cls, "Rubric", rubrics);
|
||||
for (Element r : rubrics) {
|
||||
if (r.getAttribute("kind").equals(kind))
|
||||
return XMLUtil.getNamedChild(r, "Label").getTextContent();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
package org.hl7.fhir.convertors;
|
||||
|
||||
/*-
|
||||
* #%L
|
||||
* HAPI FHIR - Converter
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2017 University Health Network
|
||||
* %%
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* #L%
|
||||
*/
|
||||
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
|
||||
import org.hl7.fhir.dstu3.formats.IParser.OutputStyle;
|
||||
import org.hl7.fhir.dstu3.formats.XmlParser;
|
||||
import org.hl7.fhir.dstu3.model.CodeSystem;
|
||||
import org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemHierarchyMeaning;
|
||||
import org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent;
|
||||
import org.hl7.fhir.dstu3.model.Coding;
|
||||
import org.hl7.fhir.dstu3.model.DateTimeType;
|
||||
import org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus;
|
||||
import org.hl7.fhir.dstu3.model.Identifier;
|
||||
import org.hl7.fhir.dstu3.model.ValueSet;
|
||||
import org.hl7.fhir.dstu3.terminologies.CodeSystemUtilities;
|
||||
import org.hl7.fhir.utilities.xml.XMLUtil;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
|
||||
/**
|
||||
* This is defined as a prototype ClaML importer
|
||||
*
|
||||
* @author Grahame
|
||||
*
|
||||
*/
|
||||
|
||||
public class ICPC2Importer {
|
||||
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
ICPC2Importer r = new ICPC2Importer();
|
||||
r.setSourceFileName("c:\\temp\\ICPC-2e-v5.0.xml");
|
||||
r.setTargetFileNameCS("C:\\temp\\icpc2.xml");
|
||||
r.setTargetFileNameVS("C:\\temp\\icpc2-vs.xml");
|
||||
r.go();
|
||||
System.out.println("Completed OK");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private String sourceFileName; // the ICPC2 ClaML file
|
||||
private String targetFileNameVS; // the value set to produce
|
||||
private String targetFileNameCS; // the value set to produce
|
||||
|
||||
public ICPC2Importer() {
|
||||
super();
|
||||
}
|
||||
public ICPC2Importer(String sourceFileName, String targetFileNameCS, String targetFileNameVS) {
|
||||
super();
|
||||
this.sourceFileName = sourceFileName;
|
||||
this.targetFileNameCS = targetFileNameCS;
|
||||
this.targetFileNameVS = targetFileNameVS;
|
||||
}
|
||||
public String getSourceFileName() {
|
||||
return sourceFileName;
|
||||
}
|
||||
public void setSourceFileName(String sourceFileName) {
|
||||
this.sourceFileName = sourceFileName;
|
||||
}
|
||||
public String getTargetFileNameCS() {
|
||||
return targetFileNameCS;
|
||||
}
|
||||
public void setTargetFileNameCS(String targetFileName) {
|
||||
this.targetFileNameCS = targetFileName;
|
||||
}
|
||||
|
||||
public String getTargetFileNameVS() {
|
||||
return targetFileNameVS;
|
||||
}
|
||||
public void setTargetFileNameVS(String targetFileName) {
|
||||
this.targetFileNameVS = targetFileName;
|
||||
}
|
||||
|
||||
public void go() throws Exception {
|
||||
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
|
||||
factory.setNamespaceAware(false);
|
||||
DocumentBuilder builder = factory.newDocumentBuilder();
|
||||
Document doc = builder.parse(new FileInputStream(sourceFileName));
|
||||
|
||||
ValueSet vs = new ValueSet();
|
||||
vs.setUrl("http://hl7.org/fhir/sid/icpc2/vs");
|
||||
Element title = XMLUtil.getNamedChild(doc.getDocumentElement(), "Title");
|
||||
vs.setVersion(title.getAttribute("version"));
|
||||
vs.setName(title.getAttribute("name"));
|
||||
vs.setImmutable(true);
|
||||
Element identifier = XMLUtil.getNamedChild(doc.getDocumentElement(), "Identifier");
|
||||
vs.setPublisher(identifier.getAttribute("authority"));
|
||||
vs.addIdentifier(new Identifier().setValue(identifier.getAttribute("uid")));
|
||||
List<Element> authors = new ArrayList<Element>();
|
||||
XMLUtil.getNamedChildren(XMLUtil.getNamedChild(doc.getDocumentElement(), "Authors"), "Author", authors);
|
||||
for (Element a : authors)
|
||||
if (!a.getAttribute("name").contains("+"))
|
||||
vs.addContact().setName(a.getTextContent());
|
||||
vs.setCopyright("The copyright of ICPC, both in hard copy and in electronic form, is owned by Wonca. See http://www.kith.no/templates/kith_WebPage____1110.aspx");
|
||||
vs.setStatus(PublicationStatus.ACTIVE);
|
||||
vs.setDateElement(new DateTimeType(title.getAttribute("date")));
|
||||
|
||||
vs.getCompose().addInclude().setSystem("http://hl7.org/fhir/sid/icpc2");
|
||||
CodeSystem cs = new CodeSystem();
|
||||
cs.setUrl("http://hl7.org/fhir/sid/icpc2");
|
||||
cs.setVersion(title.getAttribute("version"));
|
||||
cs.setName(title.getAttribute("name"));
|
||||
identifier = XMLUtil.getNamedChild(doc.getDocumentElement(), "Identifier");
|
||||
cs.setPublisher(identifier.getAttribute("authority"));
|
||||
cs.setIdentifier(new Identifier().setValue(identifier.getAttribute("uid")));
|
||||
cs.setHierarchyMeaning(CodeSystemHierarchyMeaning.CLASSIFIEDWITH);
|
||||
authors = new ArrayList<Element>();
|
||||
XMLUtil.getNamedChildren(XMLUtil.getNamedChild(doc.getDocumentElement(), "Authors"), "Author", authors);
|
||||
for (Element a : authors)
|
||||
if (!a.getAttribute("name").contains("+"))
|
||||
cs.addContact().setName(a.getTextContent());
|
||||
cs.setCopyright("The copyright of ICPC, both in hard copy and in electronic form, is owned by Wonca. See http://www.kith.no/templates/kith_WebPage____1110.aspx");
|
||||
cs.setStatus(PublicationStatus.ACTIVE);
|
||||
cs.setDateElement(new DateTimeType(title.getAttribute("date")));
|
||||
cs.setValueSet(vs.getUrl());
|
||||
|
||||
Map<String, ConceptDefinitionComponent> concepts = new HashMap<String, ConceptDefinitionComponent>();
|
||||
List<Element> classes = new ArrayList<Element>();
|
||||
XMLUtil.getNamedChildren(doc.getDocumentElement(), "Class", classes);
|
||||
for (Element cls : classes) {
|
||||
processClass(cls, concepts, cs);
|
||||
}
|
||||
|
||||
XmlParser xml = new XmlParser();
|
||||
xml.setOutputStyle(OutputStyle.PRETTY);
|
||||
xml.compose(new FileOutputStream(targetFileNameVS), vs);
|
||||
xml.compose(new FileOutputStream(targetFileNameCS), cs);
|
||||
}
|
||||
|
||||
private void processClass(Element cls, Map<String, ConceptDefinitionComponent> concepts, CodeSystem define) {
|
||||
ConceptDefinitionComponent concept = new ConceptDefinitionComponent();
|
||||
concept.setCode(cls.getAttribute("code"));
|
||||
concept.setDefinition(getRubric(cls, "preferred"));
|
||||
String s = getRubric(cls, "shortTitle");
|
||||
if (s != null && !s.equals(concept.getDefinition()))
|
||||
concept.addDesignation().setUse(new Coding().setSystem("http://hl7.org/fhir/sid/icpc2/rubrics").setCode("shortTitle")).setValue(s);
|
||||
s = getRubric(cls, "inclusion");
|
||||
if (s != null)
|
||||
concept.addDesignation().setUse(new Coding().setSystem("http://hl7.org/fhir/sid/icpc2/rubrics").setCode("inclusion")).setValue(s);
|
||||
s = getRubric(cls, "exclusion");
|
||||
if (s != null)
|
||||
concept.addDesignation().setUse(new Coding().setSystem("http://hl7.org/fhir/sid/icpc2/rubrics").setCode("exclusion")).setValue(s);
|
||||
s = getRubric(cls, "criteria");
|
||||
if (s != null)
|
||||
concept.addDesignation().setUse(new Coding().setSystem("http://hl7.org/fhir/sid/icpc2/rubrics").setCode("criteria")).setValue(s);
|
||||
s = getRubric(cls, "consider");
|
||||
if (s != null)
|
||||
concept.addDesignation().setUse(new Coding().setSystem("http://hl7.org/fhir/sid/icpc2/rubrics").setCode("consider")).setValue(s);
|
||||
s = getRubric(cls, "note");
|
||||
if (s != null)
|
||||
concept.addDesignation().setUse(new Coding().setSystem("http://hl7.org/fhir/sid/icpc2/rubrics").setCode("note")).setValue(s);
|
||||
|
||||
concepts.put(concept.getCode(), concept);
|
||||
List<Element> children = new ArrayList<Element>();
|
||||
XMLUtil.getNamedChildren(cls, "SubClass", children);
|
||||
if (children.size() > 0)
|
||||
CodeSystemUtilities.setNotSelectable(define, concept);
|
||||
|
||||
Element parent = XMLUtil.getNamedChild(cls, "SuperClass");
|
||||
if (parent == null) {
|
||||
define.addConcept(concept);
|
||||
} else {
|
||||
ConceptDefinitionComponent p = concepts.get(parent.getAttribute("code"));
|
||||
p.getConcept().add(concept);
|
||||
}
|
||||
}
|
||||
|
||||
private String getRubric(Element cls, String kind) {
|
||||
List<Element> rubrics = new ArrayList<Element>();
|
||||
XMLUtil.getNamedChildren(cls, "Rubric", rubrics);
|
||||
for (Element r : rubrics) {
|
||||
if (r.getAttribute("kind").equals(kind))
|
||||
return XMLUtil.getNamedChild(r, "Label").getTextContent();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,15 +1,36 @@
|
|||
package org.hl7.fhir.convertors;
|
||||
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
|
||||
public interface VersionConvertorAdvisor30 {
|
||||
boolean ignoreEntry(org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent src);
|
||||
|
||||
// called ?
|
||||
org.hl7.fhir.instance.model.Resource convert(org.hl7.fhir.dstu3.model.Resource resource) throws FHIRException;
|
||||
|
||||
// called when an r2 value set has a codeSystem in it
|
||||
void handleCodeSystem(org.hl7.fhir.dstu3.model.CodeSystem tgtcs, org.hl7.fhir.dstu3.model.ValueSet source);
|
||||
|
||||
org.hl7.fhir.dstu3.model.CodeSystem getCodeSystem(org.hl7.fhir.dstu3.model.ValueSet src);
|
||||
}
|
||||
package org.hl7.fhir.convertors;
|
||||
|
||||
/*-
|
||||
* #%L
|
||||
* HAPI FHIR - Converter
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2017 University Health Network
|
||||
* %%
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* #L%
|
||||
*/
|
||||
|
||||
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
|
||||
public interface VersionConvertorAdvisor30 {
|
||||
boolean ignoreEntry(org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent src);
|
||||
|
||||
// called ?
|
||||
org.hl7.fhir.instance.model.Resource convert(org.hl7.fhir.dstu3.model.Resource resource) throws FHIRException;
|
||||
|
||||
// called when an r2 value set has a codeSystem in it
|
||||
void handleCodeSystem(org.hl7.fhir.dstu3.model.CodeSystem tgtcs, org.hl7.fhir.dstu3.model.ValueSet source);
|
||||
|
||||
org.hl7.fhir.dstu3.model.CodeSystem getCodeSystem(org.hl7.fhir.dstu3.model.ValueSet src);
|
||||
}
|
||||
|
|
|
@ -1,16 +1,37 @@
|
|||
package org.hl7.fhir.convertors;
|
||||
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
|
||||
public interface VersionConvertorAdvisor40 {
|
||||
boolean ignoreEntry(org.hl7.fhir.r4.model.Bundle.BundleEntryComponent src);
|
||||
|
||||
// called ?
|
||||
org.hl7.fhir.instance.model.Resource convertR2(org.hl7.fhir.r4.model.Resource resource) throws FHIRException;
|
||||
org.hl7.fhir.dstu3.model.Resource convertR3(org.hl7.fhir.r4.model.Resource resource) throws FHIRException;
|
||||
|
||||
// called when an r2 value set has a codeSystem in it
|
||||
void handleCodeSystem(org.hl7.fhir.r4.model.CodeSystem tgtcs, org.hl7.fhir.r4.model.ValueSet source);
|
||||
|
||||
org.hl7.fhir.r4.model.CodeSystem getCodeSystem(org.hl7.fhir.r4.model.ValueSet src);
|
||||
}
|
||||
package org.hl7.fhir.convertors;
|
||||
|
||||
/*-
|
||||
* #%L
|
||||
* HAPI FHIR - Converter
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2017 University Health Network
|
||||
* %%
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* #L%
|
||||
*/
|
||||
|
||||
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
|
||||
public interface VersionConvertorAdvisor40 {
|
||||
boolean ignoreEntry(org.hl7.fhir.r4.model.Bundle.BundleEntryComponent src);
|
||||
|
||||
// called ?
|
||||
org.hl7.fhir.instance.model.Resource convertR2(org.hl7.fhir.r4.model.Resource resource) throws FHIRException;
|
||||
org.hl7.fhir.dstu3.model.Resource convertR3(org.hl7.fhir.r4.model.Resource resource) throws FHIRException;
|
||||
|
||||
// called when an r2 value set has a codeSystem in it
|
||||
void handleCodeSystem(org.hl7.fhir.r4.model.CodeSystem tgtcs, org.hl7.fhir.r4.model.ValueSet source);
|
||||
|
||||
org.hl7.fhir.r4.model.CodeSystem getCodeSystem(org.hl7.fhir.r4.model.ValueSet src);
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -53,26 +53,6 @@
|
|||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-structures-dstu</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-structures-dstu</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<classifier>sources</classifier>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-structures-dstu</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<classifier>javadoc</classifier>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-structures-dstu2</artifactId>
|
||||
|
@ -152,7 +132,27 @@
|
|||
<classifier>javadoc</classifier>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-structures-r4</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-structures-r4</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<classifier>sources</classifier>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-structures-r4</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<classifier>javadoc</classifier>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-validation-resources-dstu2</artifactId>
|
||||
|
@ -168,7 +168,12 @@
|
|||
<artifactId>hapi-fhir-validation-resources-dstu3</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-validation-resources-r4</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-cli-app</artifactId>
|
||||
|
|
|
@ -495,8 +495,8 @@ public abstract class BaseHapiFhirDao<T extends IBaseResource> implements IDao {
|
|||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private <T extends BaseResourceIndexedSearchParam> void findMissingSearchParams(ResourceTable theEntity, Set<Entry<String, RuntimeSearchParam>> activeSearchParams, RestSearchParameterTypeEnum type,
|
||||
Set<T> paramCollection) {
|
||||
private <RT extends BaseResourceIndexedSearchParam> void findMissingSearchParams(ResourceTable theEntity, Set<Entry<String, RuntimeSearchParam>> activeSearchParams, RestSearchParameterTypeEnum type,
|
||||
Set<RT> paramCollection) {
|
||||
for (Entry<String, RuntimeSearchParam> nextEntry : activeSearchParams) {
|
||||
String nextParamName = nextEntry.getKey();
|
||||
if (nextEntry.getValue().getParamType() == type) {
|
||||
|
@ -538,7 +538,7 @@ public abstract class BaseHapiFhirDao<T extends IBaseResource> implements IDao {
|
|||
param.setResource(theEntity);
|
||||
param.setMissing(true);
|
||||
param.setParamName(nextParamName);
|
||||
paramCollection.add((T) param);
|
||||
paramCollection.add((RT) param);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1278,35 +1278,35 @@ public abstract class BaseHapiFhirDao<T extends IBaseResource> implements IDao {
|
|||
theEntity.setPublished(theUpdateTime);
|
||||
}
|
||||
|
||||
Collection<ResourceIndexedSearchParamString> paramsString = new ArrayList<ResourceIndexedSearchParamString>();
|
||||
Collection<ResourceIndexedSearchParamString> paramsString = new ArrayList<>();
|
||||
if (theEntity.isParamsStringPopulated()) {
|
||||
paramsString.addAll(theEntity.getParamsString());
|
||||
}
|
||||
Collection<ResourceIndexedSearchParamToken> paramsToken = new ArrayList<ResourceIndexedSearchParamToken>();
|
||||
Collection<ResourceIndexedSearchParamToken> paramsToken = new ArrayList<>();
|
||||
if (theEntity.isParamsTokenPopulated()) {
|
||||
paramsToken.addAll(theEntity.getParamsToken());
|
||||
}
|
||||
Collection<ResourceIndexedSearchParamNumber> paramsNumber = new ArrayList<ResourceIndexedSearchParamNumber>();
|
||||
Collection<ResourceIndexedSearchParamNumber> paramsNumber = new ArrayList<>();
|
||||
if (theEntity.isParamsNumberPopulated()) {
|
||||
paramsNumber.addAll(theEntity.getParamsNumber());
|
||||
}
|
||||
Collection<ResourceIndexedSearchParamQuantity> paramsQuantity = new ArrayList<ResourceIndexedSearchParamQuantity>();
|
||||
Collection<ResourceIndexedSearchParamQuantity> paramsQuantity = new ArrayList<>();
|
||||
if (theEntity.isParamsQuantityPopulated()) {
|
||||
paramsQuantity.addAll(theEntity.getParamsQuantity());
|
||||
}
|
||||
Collection<ResourceIndexedSearchParamDate> paramsDate = new ArrayList<ResourceIndexedSearchParamDate>();
|
||||
Collection<ResourceIndexedSearchParamDate> paramsDate = new ArrayList<>();
|
||||
if (theEntity.isParamsDatePopulated()) {
|
||||
paramsDate.addAll(theEntity.getParamsDate());
|
||||
}
|
||||
Collection<ResourceIndexedSearchParamUri> paramsUri = new ArrayList<ResourceIndexedSearchParamUri>();
|
||||
Collection<ResourceIndexedSearchParamUri> paramsUri = new ArrayList<>();
|
||||
if (theEntity.isParamsUriPopulated()) {
|
||||
paramsUri.addAll(theEntity.getParamsUri());
|
||||
}
|
||||
Collection<ResourceIndexedSearchParamCoords> paramsCoords = new ArrayList<ResourceIndexedSearchParamCoords>();
|
||||
Collection<ResourceIndexedSearchParamCoords> paramsCoords = new ArrayList<>();
|
||||
if (theEntity.isParamsCoordsPopulated()) {
|
||||
paramsCoords.addAll(theEntity.getParamsCoords());
|
||||
}
|
||||
Collection<ResourceLink> existingResourceLinks = new ArrayList<ResourceLink>();
|
||||
Collection<ResourceLink> existingResourceLinks = new ArrayList<>();
|
||||
if (theEntity.isHasLinks()) {
|
||||
existingResourceLinks.addAll(theEntity.getResourceLinks());
|
||||
}
|
||||
|
@ -1524,7 +1524,7 @@ public abstract class BaseHapiFhirDao<T extends IBaseResource> implements IDao {
|
|||
* those by path and not by parameter name.
|
||||
*/
|
||||
if (thePerformIndexing) {
|
||||
Map<String, Boolean> presentSearchParams = new HashMap<String, Boolean>();
|
||||
Map<String, Boolean> presentSearchParams = new HashMap<>();
|
||||
for (String nextKey : populatedResourceLinkParameters) {
|
||||
presentSearchParams.put(nextKey, Boolean.TRUE);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,25 @@
|
|||
package ca.uhn.fhir.jpa.dao;
|
||||
|
||||
/*-
|
||||
* #%L
|
||||
* HAPI FHIR JPA Server
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2017 University Health Network
|
||||
* %%
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* #L%
|
||||
*/
|
||||
|
||||
import org.hl7.fhir.instance.model.api.IAnyResource;
|
||||
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
|
@ -31,4 +51,4 @@ final class MetadataKeyResourcePid extends ResourceMetadataKeySupportingAnyResou
|
|||
public void put(IResource theResource, Long theObject) {
|
||||
theResource.getResourceMetadata().put(IDao.RESOURCE_PID, theObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -104,8 +104,9 @@ public class FhirResourceDaoSubscriptionR4 extends FhirResourceDaoR4<Subscriptio
|
|||
return retVal;
|
||||
}
|
||||
|
||||
@Transactional(propagation = Propagation.NOT_SUPPORTED)
|
||||
public int pollForNewUndeliveredResources() {
|
||||
return pollForNewUndeliveredResources((String) null);
|
||||
return pollForNewUndeliveredResources(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,5 +1,25 @@
|
|||
package ca.uhn.fhir.jpa.term;
|
||||
|
||||
/*-
|
||||
* #%L
|
||||
* HAPI FHIR JPA Server
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2017 University Health Network
|
||||
* %%
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* #L%
|
||||
*/
|
||||
|
||||
import org.hl7.fhir.r4.hapi.ctx.IValidationSupport;
|
||||
|
||||
public interface IHapiTerminologySvcR4 extends IHapiTerminologySvc, IValidationSupport {
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue