* ignore canonical resources found in the examples package

This commit is contained in:
Grahame Grieve 2021-12-22 22:33:50 +11:00
parent 66ab13dba7
commit 939b377fe2
3 changed files with 70 additions and 59 deletions

View File

@ -312,7 +312,9 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
map = new HashMap<String, ResourceProxy>();
allResourcesById.put(r.getType(), map);
}
if ((packageInfo == null || !packageInfo.isExamplesPackage()) || !map.containsKey(r.getId())) {
map.put(r.getId(), new ResourceProxy(r));
}
String url = r.getUrl();
if (!allowLoadingDuplicates && hasResource(r.getType(), url)) {
@ -382,6 +384,8 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
}
if ((packageInfo == null || !packageInfo.isExamplesPackage()) || !map.containsKey(r.getId())) {
map.put(r.getId(), new ResourceProxy(r));
} else {
System.out.println("Ingore "+r.fhirType()+"/"+r.getId()+" from package "+packageInfo.toString());
}
if (r instanceof CodeSystem || r instanceof NamingSystem) {

View File

@ -236,7 +236,7 @@ public class CanonicalResourceManager<T extends CanonicalResource> {
}
}
CachedCanonicalResource<T> existing = cr.hasVersion() ? map.get(cr.getUrl()+"|"+cr.getVersion()) : map.get(cr.getUrl()+"|#0");
if (existing != null && (cr.getPackageInfo() != null && cr.getPackageInfo().isExamplesPackage())) {
if (map.get(cr.getUrl()) != null && (cr.getPackageInfo() != null && cr.getPackageInfo().isExamplesPackage())) {
return;
}
if (existing != null) {
@ -245,6 +245,7 @@ public class CanonicalResourceManager<T extends CanonicalResource> {
list.add(cr);
map.put(cr.getId(), cr); // we do this so we can drop by id
map.put(cr.getUrl(), cr);
if (cr.getUrl() != null) {
// first, this is the correct reosurce for this version (if it has a version)

View File

@ -171,8 +171,14 @@ public interface IWorkerContext {
return version;
}
public boolean isExamplesPackage() {
return !(id.startsWith("hl7.fhir.") && id.endsWith(".example"));
boolean b = id.startsWith("hl7.fhir.") && id.endsWith(".examples");
return b;
}
@Override
public String toString() {
return id+"#"+version;
}
}
public class PackageDetails extends PackageVersion {