| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
|
| 17 |
|
|
| 18 |
|
|
| 19 |
|
|
| 20 |
|
package com.xpn.xwiki.store; |
| 21 |
|
|
| 22 |
|
import java.util.Date; |
| 23 |
|
|
| 24 |
|
import javax.inject.Named; |
| 25 |
|
import javax.inject.Singleton; |
| 26 |
|
|
| 27 |
|
import org.suigeneris.jrcs.rcs.Archive; |
| 28 |
|
import org.suigeneris.jrcs.rcs.Version; |
| 29 |
|
import org.xwiki.component.annotation.Component; |
| 30 |
|
|
| 31 |
|
import com.xpn.xwiki.XWikiContext; |
| 32 |
|
import com.xpn.xwiki.XWikiException; |
| 33 |
|
import com.xpn.xwiki.doc.XWikiAttachment; |
| 34 |
|
import com.xpn.xwiki.doc.XWikiAttachmentArchive; |
| 35 |
|
|
| 36 |
|
|
| 37 |
|
|
| 38 |
|
|
| 39 |
|
|
| 40 |
|
|
| 41 |
|
@version |
| 42 |
|
@since |
| 43 |
|
|
| 44 |
|
@Component |
| 45 |
|
@Named("void") |
| 46 |
|
@Singleton |
| |
|
| 91.7% |
Uncovered Elements: 1 (12) |
Complexity: 6 |
Complexity Density: 1.2 |
|
| 47 |
|
public class VoidAttachmentVersioningStore implements AttachmentVersioningStore |
| 48 |
|
{ |
| 49 |
|
|
| 50 |
|
@link |
| 51 |
|
|
| 52 |
|
@param |
| 53 |
|
@deprecated |
| 54 |
|
|
| |
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
| 55 |
0 |
@Deprecated... |
| 56 |
|
public VoidAttachmentVersioningStore(XWikiContext context) |
| 57 |
|
{ |
| 58 |
|
} |
| 59 |
|
|
| 60 |
|
|
| 61 |
|
|
| 62 |
|
|
| |
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
| 63 |
2 |
public VoidAttachmentVersioningStore()... |
| 64 |
|
{ |
| 65 |
|
} |
| 66 |
|
|
| |
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
| 67 |
1 |
@Override... |
| 68 |
|
public void deleteArchive(XWikiAttachment attachment, XWikiContext context, boolean transaction) |
| 69 |
|
throws XWikiException |
| 70 |
|
{ |
| 71 |
|
|
| 72 |
|
} |
| 73 |
|
|
| |
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
| 74 |
1 |
@Override... |
| 75 |
|
public void saveArchive(XWikiAttachmentArchive archive, XWikiContext context, boolean transaction) |
| 76 |
|
throws XWikiException |
| 77 |
|
{ |
| 78 |
|
|
| 79 |
|
} |
| 80 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
| 81 |
4 |
@Override... |
| 82 |
|
public XWikiAttachmentArchive loadArchive(XWikiAttachment attachment, XWikiContext context, boolean transaction) |
| 83 |
|
throws XWikiException |
| 84 |
|
{ |
| 85 |
4 |
XWikiAttachmentArchive archive = attachment.getAttachment_archive(); |
| 86 |
4 |
if (!(archive instanceof VoidAttachmentArchive)) { |
| 87 |
2 |
archive = new VoidAttachmentArchive(attachment); |
| 88 |
|
} |
| 89 |
4 |
attachment.setAttachment_archive(archive); |
| 90 |
4 |
return archive; |
| 91 |
|
} |
| 92 |
|
|
| 93 |
|
|
| 94 |
|
|
| 95 |
|
|
| 96 |
|
|
| |
|
| 71.4% |
Uncovered Elements: 6 (21) |
Complexity: 11 |
Complexity Density: 1.22 |
|
| 97 |
|
public static class VoidAttachmentArchive extends XWikiAttachmentArchive |
| 98 |
|
{ |
| 99 |
|
|
| 100 |
|
|
| 101 |
|
|
| |
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
| 102 |
1 |
public VoidAttachmentArchive()... |
| 103 |
|
{ |
| 104 |
|
} |
| 105 |
|
|
| 106 |
|
|
| 107 |
|
|
| 108 |
|
|
| 109 |
|
@param |
| 110 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 111 |
3 |
public VoidAttachmentArchive(XWikiAttachment attachment)... |
| 112 |
|
{ |
| 113 |
3 |
setAttachment(attachment); |
| 114 |
|
} |
| 115 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 116 |
0 |
@Override... |
| 117 |
|
public void updateArchive(final byte[] data, final XWikiContext context) throws XWikiException |
| 118 |
|
{ |
| 119 |
0 |
updateArchive(context); |
| 120 |
|
} |
| 121 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 122 |
3 |
@Override... |
| 123 |
|
public void updateArchive(XWikiContext context) throws XWikiException |
| 124 |
|
{ |
| 125 |
3 |
getAttachment().incrementVersion(); |
| 126 |
3 |
getAttachment().setDate(new Date()); |
| 127 |
|
} |
| 128 |
|
|
| |
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
| 129 |
0 |
@Override... |
| 130 |
|
public void setArchive(byte[] data) throws XWikiException |
| 131 |
|
{ |
| 132 |
|
|
| 133 |
|
} |
| 134 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 135 |
0 |
@Override... |
| 136 |
|
public byte[] getArchive(XWikiContext context) throws XWikiException |
| 137 |
|
{ |
| 138 |
0 |
return new byte[0]; |
| 139 |
|
} |
| 140 |
|
|
| |
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
| 141 |
1 |
@Override... |
| 142 |
|
public void setRCSArchive(Archive archive) |
| 143 |
|
{ |
| 144 |
|
|
| 145 |
|
} |
| 146 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 147 |
2 |
@Override... |
| 148 |
|
public Version[] getVersions() |
| 149 |
|
{ |
| 150 |
2 |
return new Version[] { getAttachment().getRCSVersion() }; |
| 151 |
|
} |
| 152 |
|
|
| |
|
| 66.7% |
Uncovered Elements: 1 (3) |
Complexity: 2 |
Complexity Density: 2 |
|
| 153 |
2 |
@Override... |
| 154 |
|
public XWikiAttachment getRevision(XWikiAttachment attachment, String rev, XWikiContext context) |
| 155 |
|
throws XWikiException |
| 156 |
|
{ |
| 157 |
2 |
return (attachment.getVersion().equals(rev)) ? attachment : null; |
| 158 |
|
} |
| 159 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 160 |
1 |
@Override... |
| 161 |
|
public Object clone() |
| 162 |
|
{ |
| 163 |
|
|
| 164 |
1 |
super.clone(); |
| 165 |
1 |
return new VoidAttachmentArchive(getAttachment()); |
| 166 |
|
} |
| 167 |
|
} |
| 168 |
|
} |