track by-product files rendering resources

This commit is contained in:
Grahame Grieve 2024-01-10 06:15:42 +11:00
parent 4581849e72
commit 7d7988597c
2 changed files with 14 additions and 0 deletions

View File

@ -768,6 +768,7 @@ public class PatientRenderer extends ResourceRenderer {
} else {
String n = UUID.randomUUID().toString().toLowerCase()+ext;
TextFile.bytesToFile(att.getData(), new File(Utilities.path(context.getDestDir(), n)));
context.registerFile(n);
td.img(n, "patient photo");
}
return;

View File

@ -188,6 +188,7 @@ public class RenderingContext {
private boolean copyButton;
private ProfileKnowledgeProvider pkp;
private String changeVersion;
private List<String> files = new ArrayList<String>(); // files created as by-products in destDir
private Map<KnownLinkType, String> links = new HashMap<>();
private Map<String, String> namedLinks = new HashMap<>();
@ -726,4 +727,16 @@ public class RenderingContext {
return namedLinks;
}
public void registerFile(String n) {
try {
files.add(Utilities.path(destDir, n));
} catch (IOException e) {
}
}
public List<String> getFiles() {
return files;
}
}