diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/context/BaseWorkerContext.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/context/BaseWorkerContext.java index bc88d2009..47eabea03 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/context/BaseWorkerContext.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/context/BaseWorkerContext.java @@ -1,33 +1,33 @@ package org.hl7.fhir.r5.context; -/* - 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. - - */ +/* + 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.FileNotFoundException; @@ -260,40 +260,54 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte } throw new DefinitionException(formatMessage(I18nConstants.DUPLICATE_RESOURCE_, url)); } - if ("StructureDefinition".equals(r.getType())) { - StructureDefinition sd = (StructureDefinition) r.getResource(); - if ("1.4.0".equals(version)) { - fixOldSD(sd); - } - structures.register(r, packageInfo); - } else if ("ValueSet".equals(r.getType())) { - valueSets.register(r, packageInfo); - } else if ("CodeSystem".equals(r.getType())) { - codeSystems.register(r, packageInfo); - } else if ("ImplementationGuide".equals(r.getType())) { - guides.register(r, packageInfo); - } else if ("CapabilityStatement".equals(r.getType())) { - capstmts.register(r, packageInfo); - } else if ("Measure".equals(r.getType())) { - measures.register(r, packageInfo); - } else if ("Library".equals(r.getType())) { - libraries.register(r, packageInfo); - } else if ("SearchParameter".equals(r.getType())) { - searchParameters.register(r, packageInfo); - } else if ("PlanDefinition".equals(r.getType())) { - plans.register(r, packageInfo); - } else if ("OperationDefinition".equals(r.getType())) { - operations.register(r, packageInfo); - } else if ("Questionnaire".equals(r.getType())) { - questionnaires.register(r, packageInfo); - } else if ("ConceptMap".equals(r.getType())) { - maps.register(r, packageInfo); - } else if ("StructureMap".equals(r.getType())) { - transforms.register(r, packageInfo); - } else if ("NamingSystem".equals(r.getType())) { - systems.register(r, packageInfo); + switch(r.getType()) { + case "StructureDefinition": + StructureDefinition sd = (StructureDefinition) r.getResource(); + if ("1.4.0".equals(version)) { + fixOldSD(sd); + } + structures.register(r, packageInfo); + break; + case "ValueSet": + valueSets.register(r, packageInfo); + break; + case "CodeSystem": + codeSystems.register(r, packageInfo); + break; + case "ImplementationGuide": + guides.register(r, packageInfo); + break; + case "CapabilityStatement": + capstmts.register(r, packageInfo); + break; + case "Measure": + measures.register(r, packageInfo); + break; + case "Library": + libraries.register(r, packageInfo); + break; + case "SearchParameter": + searchParameters.register(r, packageInfo); + break; + case "PlanDefinition": + plans.register(r, packageInfo); + break; + case "OperationDefinition": + operations.register(r, packageInfo); + break; + case "Questionnaire": + questionnaires.register(r, packageInfo); + break; + case "ConceptMap": + maps.register(r, packageInfo); + break; + case "StructureMap": + transforms.register(r, packageInfo); + break; + case "NamingSystem": + systems.register(r, packageInfo); + break; } - } } @@ -997,8 +1011,8 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte if (res != null) return (T) res; } - return null; - } + return null; + } if (supportedCodeSystems.contains(uri)) return null; throw new FHIRException(formatMessage(I18nConstants.NOT_DONE_YET_CANT_FETCH_, uri));