Fix core
This commit is contained in:
parent
bcb0656ff5
commit
6232c54f15
|
@ -98,7 +98,7 @@ public class JavaExtensionsFactoryGenerator extends JavaBaseGenerator {
|
|||
ElementDefinition edRoot = sd.getSnapshot().getElementFirstRep();
|
||||
boolean repeats = !edRoot.getMax().equals("1");
|
||||
String verb = repeats ? "add" : "set";
|
||||
ElementDefinition edValue = sd.getSnapshot().getElementByPath("Extension.value[x]", false);
|
||||
ElementDefinition edValue = sd.getSnapshot().getElementByPath("Extension.value[x]");
|
||||
List<TypeTuple> types = analyseTypes(edValue);
|
||||
if (types.size() > 5) {
|
||||
src.append(" public static Extension make"+name+"(DataType value) {\r\n");
|
||||
|
|
|
@ -3969,12 +3969,12 @@ public class ProfileUtilities extends TranslatingUtilities {
|
|||
if (!isExtensionDefinition(sd)) {
|
||||
return false;
|
||||
}
|
||||
ElementDefinition value = sd.getSnapshot().getElementByPath("Extension.value", true);
|
||||
ElementDefinition value = sd.getSnapshot().getElementByPath("Extension.value");
|
||||
return value != null && !value.isProhibited();
|
||||
}
|
||||
|
||||
public static boolean isModifierExtension(StructureDefinition sd) {
|
||||
ElementDefinition defn = sd.getSnapshot().getElementByPath("Extension", true);
|
||||
ElementDefinition defn = sd.getSnapshot().getElementByPath("Extension");
|
||||
return defn.getIsModifier();
|
||||
}
|
||||
|
||||
|
|
|
@ -1451,7 +1451,7 @@ public class Element extends Base {
|
|||
if (property.getStructure().hasExtension(ToolingExtensions.EXT_RESOURCE_IMPLEMENTS)) {
|
||||
StructureDefinition sd = property.getContext().fetchResource(StructureDefinition.class, ExtensionsUtils.getExtensionString(property.getStructure(), ToolingExtensions.EXT_RESOURCE_IMPLEMENTS));
|
||||
if (sd != null) {
|
||||
ElementDefinition ed = sd.getSnapshot().getElementByPath(property.getDefinition().getPath().replace(property.getStructure().getType(), sd.getType()), true);
|
||||
ElementDefinition ed = sd.getSnapshot().getElementByPath(property.getDefinition().getPath().replace(property.getStructure().getType(), sd.getType()));
|
||||
if (ed != null) {
|
||||
return ed.getBase().getPath();
|
||||
}
|
||||
|
|
|
@ -301,9 +301,7 @@ public abstract class Element extends Base implements IBaseHasExtensions, IBaseE
|
|||
}
|
||||
|
||||
public boolean isEmpty() {
|
||||
boolean idIsEmpty = id == null || id.isEmpty();
|
||||
boolean extensionIsEmpty = extension == null || extension.size() == 0;
|
||||
return super.isEmpty() && idIsEmpty && extensionIsEmpty;
|
||||
return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(id, extension);
|
||||
}
|
||||
|
||||
// Manual code (from Configuration.txt):
|
||||
|
|
|
@ -130,8 +130,7 @@ public abstract class PrimitiveType<T> extends DataType implements IPrimitiveTyp
|
|||
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
String value = getValueAsString();
|
||||
return !super.isEmpty() || (value != null && value.length() > 0);
|
||||
return super.isEmpty() && StringUtils.isBlank(getValueAsString());
|
||||
}
|
||||
|
||||
public boolean isPrimitive() {
|
||||
|
|
|
@ -1233,15 +1233,12 @@ public class StructureDefinition extends CanonicalResource {
|
|||
|
||||
// added from java-adornments.txt:
|
||||
|
||||
public ElementDefinition getElementByPath(String path, boolean autoChoice) {
|
||||
if (autoChoice && path.endsWith("[x]")) {
|
||||
path = path.substring(0, path.length()-3);
|
||||
}
|
||||
public ElementDefinition getElementByPath(String path) {
|
||||
if (path == null) {
|
||||
return null;
|
||||
}
|
||||
for (ElementDefinition ed : getElement()) {
|
||||
if (path.equals(ed.getPath()) || (autoChoice && (path+"[x]").equals(ed.getPath()))) {
|
||||
if (path.equals(ed.getPath()) || (path+"[x]").equals(ed.getPath())) {
|
||||
return ed;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -129,7 +129,7 @@ public abstract class PEDefinition {
|
|||
type= type.substring(0, type.indexOf("."));
|
||||
}
|
||||
StructureDefinition sd = builder.getContext().fetchTypeDefinition(type);
|
||||
return sd.getSnapshot().getElementByPath(definition.getBase().getPath(), true);
|
||||
return sd.getSnapshot().getElementByPath(definition.getBase().getPath());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -21,8 +21,8 @@ public class PEDefinitionExtension extends PEDefinition {
|
|||
super(builder, name, profile, definition, ppath);
|
||||
this.sliceDefinition = sliceDefinition;
|
||||
this.extension= extension;
|
||||
eed = extension.getSnapshot().getElementByPath("Extension.extension", true);
|
||||
ved = extension.getSnapshot().getElementByPath("Extension.value[x]", true);
|
||||
eed = extension.getSnapshot().getElementByPath("Extension.extension");
|
||||
ved = extension.getSnapshot().getElementByPath("Extension.value[x]");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1060,7 +1060,7 @@ public class StructureMapValidator extends BaseValidator {
|
|||
if (sdt == null) {
|
||||
throw new Error("Unable to resolve "+url);
|
||||
} else {
|
||||
ElementDefinition t2 = sdt.getSnapshot().getElementByPath(path, true);
|
||||
ElementDefinition t2 = sdt.getSnapshot().getElementByPath(path);
|
||||
if (t2 == null) {
|
||||
throw new Error("Unable to resolve "+path+" in "+url);
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue