1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.store.legacy.store.internal; |
21 |
|
|
22 |
|
import java.io.File; |
23 |
|
import java.util.ArrayList; |
24 |
|
import java.util.List; |
25 |
|
|
26 |
|
import com.xpn.xwiki.doc.XWikiAttachmentArchive; |
27 |
|
import org.suigeneris.jrcs.rcs.Version; |
28 |
|
import org.xwiki.store.FileDeleteTransactionRunnable; |
29 |
|
import org.xwiki.store.StartableTransactionRunnable; |
30 |
|
import org.xwiki.store.filesystem.internal.AttachmentFileProvider; |
31 |
|
import org.xwiki.store.filesystem.internal.FilesystemStoreTools; |
32 |
|
|
33 |
|
|
34 |
|
|
35 |
|
|
36 |
|
|
37 |
|
|
38 |
|
@version |
39 |
|
@since |
40 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (10) |
Complexity: 2 |
Complexity Density: 0.29 |
|
41 |
|
public class AttachmentArchiveDeleteRunnable extends StartableTransactionRunnable |
42 |
|
{ |
43 |
|
|
44 |
|
@param |
45 |
|
@param |
46 |
|
@param |
47 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (9) |
Complexity: 2 |
Complexity Density: 0.29 |
|
48 |
1 |
public AttachmentArchiveDeleteRunnable(final XWikiAttachmentArchive archive,... |
49 |
|
final FilesystemStoreTools fileTools, |
50 |
|
final AttachmentFileProvider provider) |
51 |
|
{ |
52 |
1 |
final List<File> toDelete = new ArrayList<File>(); |
53 |
1 |
toDelete.add(provider.getAttachmentVersioningMetaFile()); |
54 |
|
|
55 |
1 |
final Version[] versions = archive.getVersions(); |
56 |
4 |
for (int i = 0; i < versions.length; i++) { |
57 |
3 |
toDelete.add(provider.getAttachmentVersionContentFile(versions[i].toString())); |
58 |
|
} |
59 |
|
|
60 |
1 |
for (File file : toDelete) { |
61 |
4 |
new FileDeleteTransactionRunnable(file, |
62 |
|
fileTools.getBackupFile(file), |
63 |
|
fileTools.getLockForFile(file)).runIn(this); |
64 |
|
} |
65 |
|
} |
66 |
|
} |