fix rendering for conditional references
This commit is contained in:
parent
76a3129b30
commit
3eda8580fc
|
@ -43,6 +43,8 @@ public class ContextUtilities implements ProfileKnowledgeProvider {
|
||||||
private XVerExtensionManager xverManager;
|
private XVerExtensionManager xverManager;
|
||||||
private Map<String, String> oidCache = new HashMap<>();
|
private Map<String, String> oidCache = new HashMap<>();
|
||||||
private List<StructureDefinition> allStructuresList = new ArrayList<StructureDefinition>();
|
private List<StructureDefinition> allStructuresList = new ArrayList<StructureDefinition>();
|
||||||
|
private List<String> canonicalResourceNames;
|
||||||
|
private List<String> concreteResourceNames;
|
||||||
|
|
||||||
public ContextUtilities(IWorkerContext context) {
|
public ContextUtilities(IWorkerContext context) {
|
||||||
super();
|
super();
|
||||||
|
@ -197,15 +199,19 @@ public class ContextUtilities implements ProfileKnowledgeProvider {
|
||||||
* @return a list of the resource names that are canonical resources defined for this version
|
* @return a list of the resource names that are canonical resources defined for this version
|
||||||
*/
|
*/
|
||||||
public List<String> getCanonicalResourceNames() {
|
public List<String> getCanonicalResourceNames() {
|
||||||
List<String> names = new ArrayList<>();
|
if (canonicalResourceNames == null) {
|
||||||
for (StructureDefinition sd : allStructures()) {
|
canonicalResourceNames = new ArrayList<>();
|
||||||
if (sd.getKind() == StructureDefinitionKind.RESOURCE && !sd.getAbstract() && hasUrlProperty(sd)) {
|
Set<String> names = new HashSet<>();
|
||||||
names.add(sd.getType());
|
for (StructureDefinition sd : allStructures()) {
|
||||||
|
if (sd.getKind() == StructureDefinitionKind.RESOURCE && !sd.getAbstract() && hasUrlProperty(sd)) {
|
||||||
|
names.add(sd.getType());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
canonicalResourceNames.addAll(Utilities.sorted(names));
|
||||||
}
|
}
|
||||||
return names;
|
return canonicalResourceNames;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return a list of all structure definitions, with snapshots generated (if possible)
|
* @return a list of all structure definitions, with snapshots generated (if possible)
|
||||||
*/
|
*/
|
||||||
|
@ -370,5 +376,19 @@ public class ContextUtilities implements ProfileKnowledgeProvider {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<String> getConcreteResources() {
|
||||||
|
if (concreteResourceNames == null) {
|
||||||
|
concreteResourceNames = new ArrayList<>();
|
||||||
|
Set<String> names = new HashSet<>();
|
||||||
|
for (StructureDefinition sd : allStructures()) {
|
||||||
|
if (sd.getKind() == StructureDefinitionKind.RESOURCE && !sd.getAbstract()) {
|
||||||
|
names.add(sd.getType());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
concreteResourceNames.addAll(Utilities.sorted(names));
|
||||||
|
}
|
||||||
|
return concreteResourceNames;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -223,12 +223,15 @@ public abstract class ResourceRenderer extends DataRenderer {
|
||||||
tr = resolveReference(rw, r.getReference());
|
tr = resolveReference(rw, r.getReference());
|
||||||
|
|
||||||
if (!r.getReference().startsWith("#")) {
|
if (!r.getReference().startsWith("#")) {
|
||||||
if (tr != null && tr.getReference() != null)
|
if (tr != null && tr.getReference() != null) {
|
||||||
c = x.ah(tr.getReference());
|
c = x.ah(tr.getReference());
|
||||||
else
|
} else if (r.getReference().contains("?")) {
|
||||||
|
x.tx("Conditional Reference: ");
|
||||||
|
c = x.code("");
|
||||||
|
} else {
|
||||||
c = x.ah(r.getReference());
|
c = x.ah(r.getReference());
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
c = x.ah(r.getReference());
|
c = x.ah(r.getReference());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -150,7 +150,9 @@ public abstract class XhtmlFluent {
|
||||||
|
|
||||||
|
|
||||||
public XhtmlNode code(String text) {
|
public XhtmlNode code(String text) {
|
||||||
return addTag("code").tx(text);
|
XhtmlNode code = addTag("code");
|
||||||
|
code.tx(text);
|
||||||
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
public XhtmlNode code() {
|
public XhtmlNode code() {
|
||||||
|
|
Loading…
Reference in New Issue