Skip to content

Commit f4f1a46

Browse files
authored
Add content file name to Library refresh output (#568)
* Remove null setting of content URL * Update content url to IG Canonical Base + '/Library-' + CQL file name * Add null checks
1 parent 238c9e7 commit f4f1a46

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

tooling/src/main/java/org/opencds/cqf/tooling/library/LibraryProcessor.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,6 @@ protected Library refreshGeneratedContent(Library sourceLibrary) {
236236
var translatorOptions = getCqlProcessor().getCqlTranslatorOptions();
237237
var formats = translatorOptions.getFormats();
238238
CqlProcessor.CqlSourceFileInformation info = getCqlProcessor().getFileInformation(attachment.getUrl());
239-
attachment.setUrlElement(null);
240239
if (info != null) {
241240
if (info.getElm() != null && emptyIfNull(formats).contains(Format.XML)) {
242241
sourceLibrary.addContent().setContentType("application/elm+xml").setData(info.getElm());
@@ -380,7 +379,9 @@ private Attachment loadFile(String fn) throws IOException {
380379
Attachment att = new Attachment();
381380
att.setContentType("text/cql");
382381
att.setData(TextFile.fileToBytes(f));
383-
att.setUrl(f.getAbsolutePath());
382+
if (this.parentContext != null && this.parentContext.getCanonicalBase() != null) {
383+
att.setUrl(this.parentContext.getCanonicalBase() + "/Library-" + f.getName());
384+
}
384385
return att;
385386
}
386387
}

tooling/src/main/java/org/opencds/cqf/tooling/processor/CqlProcessor.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,10 @@ public void execute() throws FHIRException {
200200
* @return
201201
*/
202202
public CqlSourceFileInformation getFileInformation(String filename) {
203+
if (filename == null) {
204+
return null;
205+
}
206+
203207
if (fileMap == null) {
204208
throw new IllegalStateException("CQL File map is not available, execute has not been called");
205209
}

0 commit comments

Comments
 (0)