This commit is contained in:
Grahame Grieve 2022-09-07 11:38:27 +10:00
parent fc2e2fe9bc
commit 8dad875cac
2 changed files with 6 additions and 3 deletions

View File

@ -123,11 +123,13 @@ public class QuestionnaireBuilder {
// we don't do the intensive parts of the work (save time) // we don't do the intensive parts of the work (save time)
private Questionnaire prebuiltQuestionnaire; private Questionnaire prebuiltQuestionnaire;
private ProfileUtilities profileUtilities; private ProfileUtilities profileUtilities;
private String rootPath;
public QuestionnaireBuilder(IWorkerContext context) { public QuestionnaireBuilder(IWorkerContext context, String rootPath) {
super(); super();
this.context = context; this.context = context;
profileUtilities = new ProfileUtilities(context, null, null); profileUtilities = new ProfileUtilities(context, null, null);
this.rootPath = rootPath;
} }
public Resource getReference() { public Resource getReference() {
@ -235,7 +237,8 @@ public class QuestionnaireBuilder {
questionnaire.addItem(item); questionnaire.addItem(item);
item.setLinkId("meta"); item.setLinkId("meta");
item.getCode().addAll(profile.getKeyword()); 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) { if (response != null) {

View File

@ -15,7 +15,7 @@ public class QuestionnaireBuilderTester {
// private static final String TEST_DEST = Utilities.path("[tmp]", "questionnaires\\"); // private static final String TEST_DEST = Utilities.path("[tmp]", "questionnaires\\");
public static void main(String[] args) { 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()) { for (String f : new File(TEST_PROFILE_DIR).list()) {
if (f.endsWith(".profile.xml") && !f.contains("type-")) { if (f.endsWith(".profile.xml") && !f.contains("type-")) {
System.out.println("process "+f); System.out.println("process "+f);