Skip to content

Commit d056f58

Browse files
committed
replicate checkin return DocumentFuture
1 parent cc43602 commit d056f58

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

logicaldoc-core/src/main/java/com/logicaldoc/core/document/DocumentManager.java

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,12 @@ public class DocumentManager {
139139
* @param newFile the file to use
140140
* @param transaction entry to log the event (set the user)
141141
*
142+
* @return A future to check the completion of all the checkin operations
143+
*
142144
* @throws PersistenceException error at data layer
143145
* @throws IOException I/O error
144146
*/
145-
public void replaceFile(long docId, String fileVersion, InputStream content, DocumentHistory transaction)
147+
public DocumentFuture replaceFile(long docId, String fileVersion, InputStream content, DocumentHistory transaction)
146148
throws IOException, PersistenceException {
147149
if (transaction == null)
148150
throw new IllegalArgumentException(TRANSACTION_CANNOT_BE_NULL);
@@ -152,7 +154,7 @@ public void replaceFile(long docId, String fileVersion, InputStream content, Doc
152154
try {
153155
if (content != null)
154156
FileUtil.writeFile(content, tmp.getPath());
155-
replaceFile(docId, fileVersion, tmp, transaction);
157+
return replaceFile(docId, fileVersion, tmp, transaction);
156158
} finally {
157159
FileUtils.deleteQuietly(tmp);
158160
}
@@ -166,6 +168,8 @@ public void replaceFile(long docId, String fileVersion, InputStream content, Doc
166168
* @param newFile the file to use
167169
* @param transaction entry to log the event (set the user)
168170
*
171+
* @return A future to check the completion of all the checkin operations
172+
*
169173
* @throws PersistenceException error at data layer
170174
* @throws IOException I/O error
171175
*/
@@ -241,18 +245,20 @@ private void validateTransaction(History transaction) {
241245
* during the checkin (optional)
242246
* @param transaction entry to log the event, set the user and comment
243247
*
248+
* @return A future to check the completion of all the checkin operations
249+
*
244250
* @throws IOException I/O error
245251
* @throws PersistenceException error at data layer
246252
*/
247-
public void checkin(long docId, InputStream content, String filename, boolean release, AbstractDocument docVO,
253+
public DocumentFuture checkin(long docId, InputStream content, String filename, boolean release, AbstractDocument docVO,
248254
DocumentHistory transaction) throws IOException, PersistenceException {
249255
validateTransaction(transaction);
250256

251257
// Write content to temporary file, then delete it
252258
File tmp = FileUtil.createTempFile("checkin", "." + FileUtil.getExtension(filename));
253259
try {
254260
FileUtil.writeFile(content, tmp.getPath());
255-
checkin(docId, tmp, filename, release, docVO, transaction);
261+
return checkin(docId, tmp, filename, release, docVO, transaction);
256262
} finally {
257263
FileUtils.deleteQuietly(tmp);
258264
}

0 commit comments

Comments
 (0)