Skip to content

Commit 02410e4

Browse files
committed
[26348] rework omnivore outsorce, save after setting JPA doc null
1 parent c14302d commit 02410e4

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

bundles/ch.elexis.omnivore.model/src/ch/elexis/omnivore/model/DocumentDocHandle.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -338,12 +338,14 @@ public boolean exportToFileSystem() {
338338
return true;
339339
}
340340
IVirtualFilesystemHandle vfsHandle = getStorageFile(true);
341-
try (OutputStream out = vfsHandle.openOutputStream()) {
342-
out.write(doc);
343-
getEntity().setDoc(null);
344-
} catch (IOException ios) {
345-
LoggerFactory.getLogger(getClass()).error("Exporting dochandle [" + getId() + "] to filesystem fails."); //$NON-NLS-1$ //$NON-NLS-2$
346-
return false;
341+
if (vfsHandle != null) {
342+
try (OutputStream out = vfsHandle.openOutputStream()) {
343+
out.write(doc);
344+
getEntity().setDoc(null);
345+
} catch (IOException ios) {
346+
LoggerFactory.getLogger(getClass()).error("Exporting dochandle [" + getId() + "] to filesystem fails."); //$NON-NLS-1$ //$NON-NLS-2$
347+
return false;
348+
}
347349
}
348350
return true;
349351
}

bundles/ch.elexis.omnivore.ui/src/ch/elexis/omnivore/ui/jobs/OutsourceUiJob.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ public void run(IProgressMonitor monitor) throws InvocationTargetException, Inte
3939
if (!docHandle.exportToFileSystem()) {
4040
SWTHelper.showError(Messages.DocHandle_writeErrorCaption2,
4141
Messages.DocHandle_writeErrorCaption2, "Fehlerdetails siehe Logdatei");
42+
} else {
43+
OmnivoreModelServiceHolder.get().save(docHandle);
4244
}
4345
monitor.worked(1);
4446
}

0 commit comments

Comments
 (0)