more fixing rendering
This commit is contained in:
parent
c221488463
commit
413c047b56
|
@ -62,6 +62,7 @@ public class BaseWrappers {
|
||||||
|
|
||||||
public interface BaseWrapper extends WrapperBase {
|
public interface BaseWrapper extends WrapperBase {
|
||||||
public Base getBase() throws UnsupportedEncodingException, IOException, FHIRException;
|
public Base getBase() throws UnsupportedEncodingException, IOException, FHIRException;
|
||||||
|
public ResourceWrapper getResource() throws UnsupportedEncodingException, IOException, FHIRException; // for contained, etc
|
||||||
public PropertyWrapper getChildByName(String tail);
|
public PropertyWrapper getChildByName(String tail);
|
||||||
public String fhirType();
|
public String fhirType();
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,6 +102,19 @@ public class DOMWrappers {
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResourceWrapper getResource() throws UnsupportedEncodingException, IOException, FHIRException {
|
||||||
|
Element r = XMLUtil.getFirstChild(element);
|
||||||
|
StructureDefinition sd = getContext().getContext().fetchTypeDefinition(r.getLocalName());
|
||||||
|
if (sd == null) {
|
||||||
|
throw new FHIRException("Unable to find definition for type "+type+" @ "+definition.getPath());
|
||||||
|
}
|
||||||
|
if (sd.getKind() != StructureDefinitionKind.RESOURCE) {
|
||||||
|
throw new FHIRException("Definition for type "+type+" is not for a resource @ "+definition.getPath());
|
||||||
|
}
|
||||||
|
return new ResourceWrapperElement(context, r, sd);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class PropertyWrapperElement extends RendererWrapperImpl implements PropertyWrapper {
|
public static class PropertyWrapperElement extends RendererWrapperImpl implements PropertyWrapper {
|
||||||
|
|
|
@ -5,6 +5,7 @@ import java.io.UnsupportedEncodingException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.hl7.fhir.exceptions.FHIRException;
|
||||||
import org.hl7.fhir.r5.model.Base;
|
import org.hl7.fhir.r5.model.Base;
|
||||||
import org.hl7.fhir.r5.model.CanonicalResource;
|
import org.hl7.fhir.r5.model.CanonicalResource;
|
||||||
import org.hl7.fhir.r5.model.DomainResource;
|
import org.hl7.fhir.r5.model.DomainResource;
|
||||||
|
@ -164,6 +165,11 @@ public class DirectWrappers {
|
||||||
return wrapped.fhirType();
|
return wrapped.fhirType();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResourceWrapper getResource() throws UnsupportedEncodingException, IOException, FHIRException {
|
||||||
|
return new DirectWrappers.ResourceWrapperDirect(getContext(), (Resource) wrapped);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class ResourceWrapperDirect extends WrapperBaseImpl implements ResourceWrapper {
|
public static class ResourceWrapperDirect extends WrapperBaseImpl implements ResourceWrapper {
|
||||||
|
|
|
@ -109,6 +109,11 @@ public class ElementWrappers {
|
||||||
return element.fhirType();
|
return element.fhirType();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResourceWrapper getResource() throws UnsupportedEncodingException, IOException, FHIRException {
|
||||||
|
return new ElementWrappers.ResourceWrapperMetaElement(getContext(), element);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class ResourceWrapperMetaElement extends WrapperBaseImpl implements ResourceWrapper {
|
public static class ResourceWrapperMetaElement extends WrapperBaseImpl implements ResourceWrapper {
|
||||||
|
|
Loading…
Reference in New Issue