Fix broken links in code system rendering of parents

This commit is contained in:
Grahame Grieve 2023-10-31 16:57:25 +11:00
parent e4a1a556a2
commit 809b2f68ea
4 changed files with 21 additions and 15 deletions

View File

@ -469,10 +469,12 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
tlog("$expand on " + txCache.summary(vs)); tlog("$expand on " + txCache.summary(vs));
try { try {
ValueSet result = txClient.expandValueset(vs, p, params); ValueSet result = txClient.expandValueset(vs, p, params);
if (!result.hasUrl()) if (result != null) {
result.setUrl(vs.getUrl()); if (!result.hasUrl())
if (!result.hasUrl()) result.setUrl(vs.getUrl());
throw new Error("no url in expand value set 2"); if (!result.hasUrl())
throw new Error("no url in expand value set 2");
}
res = new ValueSetExpansionOutcome(result).setTxLink(txLog.getLastId()); res = new ValueSetExpansionOutcome(result).setTxLink(txLog.getLastId());
} catch (Exception e) { } catch (Exception e) {
res = new ValueSetExpansionOutcome(e.getMessage() == null ? e.getClass().getName() : e.getMessage(), res = new ValueSetExpansionOutcome(e.getMessage() == null ? e.getClass().getName() : e.getMessage(),

View File

@ -805,11 +805,13 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
tlog("$expand on " + txCache.summary(vs)); tlog("$expand on " + txCache.summary(vs));
try { try {
ValueSet result = txClient.expandValueset(vs, p, params); ValueSet result = txClient.expandValueset(vs, p, params);
if (!result.hasUrl()) { if (result != null) {
result.setUrl(vs.getUrl()); if (!result.hasUrl()) {
} result.setUrl(vs.getUrl());
if (!result.hasUrl()) { }
throw new Error(formatMessage(I18nConstants.NO_URL_IN_EXPAND_VALUE_SET_2)); if (!result.hasUrl()) {
throw new Error(formatMessage(I18nConstants.NO_URL_IN_EXPAND_VALUE_SET_2));
}
} }
res = new ValueSetExpansionOutcome(result).setTxLink(txLog.getLastId()); res = new ValueSetExpansionOutcome(result).setTxLink(txLog.getLastId());
} catch (Exception e) { } catch (Exception e) {

View File

@ -952,11 +952,13 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
txLog("$expand on "+txCache.summary(vs)); txLog("$expand on "+txCache.summary(vs));
try { try {
ValueSet result = tcc.getClient().expandValueset(vs, p, params); ValueSet result = tcc.getClient().expandValueset(vs, p, params);
if (!result.hasUrl()) { if (result != null) {
result.setUrl(vs.getUrl()); if (!result.hasUrl()) {
} result.setUrl(vs.getUrl());
if (!result.hasUrl()) { }
throw new Error(formatMessage(I18nConstants.NO_URL_IN_EXPAND_VALUE_SET_2)); if (!result.hasUrl()) {
throw new Error(formatMessage(I18nConstants.NO_URL_IN_EXPAND_VALUE_SET_2));
}
} }
res = new ValueSetExpansionOutcome(result).setTxLink(txLog.getLastId()); res = new ValueSetExpansionOutcome(result).setTxLink(txLog.getLastId());
} catch (Exception e) { } catch (Exception e) {

View File

@ -542,7 +542,7 @@ public class CodeSystemRenderer extends TerminologyRenderer {
} else if (pcv.hasValueStringType() && Utilities.isAbsoluteUrlLinkable(pcv.getValue().primitiveValue())) { } else if (pcv.hasValueStringType() && Utilities.isAbsoluteUrlLinkable(pcv.getValue().primitiveValue())) {
td.ah(pcv.getValue().primitiveValue()).tx(pcv.getValue().primitiveValue()); td.ah(pcv.getValue().primitiveValue()).tx(pcv.getValue().primitiveValue());
} else if ("parent".equals(pcv.getCode())) { } else if ("parent".equals(pcv.getCode())) {
td.ah("#"+cs.getId()+"-"+pcv.getValue().primitiveValue()).addText(pcv.getValue().primitiveValue()); td.ah("#"+cs.getId()+"-"+Utilities.nmtokenize(pcv.getValue().primitiveValue())).addText(pcv.getValue().primitiveValue());
} else { } else {
td.addText(pcv.getValue().primitiveValue()); td.addText(pcv.getValue().primitiveValue());
} }