From 8dad875cac56535fe9e84018a12293948428f0e4 Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Wed, 7 Sep 2022 11:38:27 +1000 Subject: [PATCH] qb url --- .../java/org/hl7/fhir/r5/utils/QuestionnaireBuilder.java | 7 +++++-- .../org/hl7/fhir/r5/test/QuestionnaireBuilderTester.java | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/QuestionnaireBuilder.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/QuestionnaireBuilder.java index 36e8759ac..15c153c45 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/QuestionnaireBuilder.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/QuestionnaireBuilder.java @@ -123,11 +123,13 @@ public class QuestionnaireBuilder { // we don't do the intensive parts of the work (save time) private Questionnaire prebuiltQuestionnaire; private ProfileUtilities profileUtilities; + private String rootPath; - public QuestionnaireBuilder(IWorkerContext context) { + public QuestionnaireBuilder(IWorkerContext context, String rootPath) { super(); this.context = context; profileUtilities = new ProfileUtilities(context, null, null); + this.rootPath = rootPath; } public Resource getReference() { @@ -235,7 +237,8 @@ public class QuestionnaireBuilder { questionnaire.addItem(item); item.setLinkId("meta"); item.getCode().addAll(profile.getKeyword()); - questionnaire.setId(nextId("qs-"+profile.getType())); + questionnaire.setId(nextId("qgen-"+profile.getId())); + questionnaire.setUrl(Utilities.pathURL(rootPath, "Questionnaire", questionnaire.getId())); } if (response != null) { diff --git a/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/QuestionnaireBuilderTester.java b/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/QuestionnaireBuilderTester.java index f2ddaf341..989c3240c 100644 --- a/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/QuestionnaireBuilderTester.java +++ b/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/QuestionnaireBuilderTester.java @@ -15,7 +15,7 @@ public class QuestionnaireBuilderTester { // private static final String TEST_DEST = Utilities.path("[tmp]", "questionnaires\\"); public static void main(String[] args) { - QuestionnaireBuilder b = new QuestionnaireBuilder(null); + QuestionnaireBuilder b = new QuestionnaireBuilder(null, "http://hl7.org/fhir/test"); for (String f : new File(TEST_PROFILE_DIR).list()) { if (f.endsWith(".profile.xml") && !f.contains("type-")) { System.out.println("process "+f);