1. Project Clover database Sat Feb 2 2019 06:45:20 CET
  2. Package com.xpn.xwiki.internal.doc

File DeletedDocumentRevisionProvider.java

 

Coverage histogram

../../../../../img/srcFileCovDistChart0.png
86% of files have more coverage

Code metrics

2
5
3
1
70
36
4
0.8
1.67
3
1.33

Classes

Class Line # Actions
DeletedDocumentRevisionProvider 45 5 0% 4 10
0.00%
 

Contributing tests

No tests hitting this source file were found.

Source view

1    /*
2    * See the NOTICE file distributed with this work for additional
3    * information regarding copyright ownership.
4    *
5    * This is free software; you can redistribute it and/or modify it
6    * under the terms of the GNU Lesser General Public License as
7    * published by the Free Software Foundation; either version 2.1 of
8    * the License, or (at your option) any later version.
9    *
10    * This software is distributed in the hope that it will be useful,
11    * but WITHOUT ANY WARRANTY; without even the implied warranty of
12    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13    * Lesser General Public License for more details.
14    *
15    * You should have received a copy of the GNU Lesser General Public
16    * License along with this software; if not, write to the Free
17    * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18    * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
19    */
20    package com.xpn.xwiki.internal.doc;
21   
22    import javax.inject.Inject;
23    import javax.inject.Named;
24    import javax.inject.Provider;
25    import javax.inject.Singleton;
26   
27    import org.xwiki.component.annotation.Component;
28    import org.xwiki.model.reference.DocumentReference;
29   
30    import com.xpn.xwiki.XWikiContext;
31    import com.xpn.xwiki.XWikiException;
32    import com.xpn.xwiki.doc.DocumentRevisionProvider;
33    import com.xpn.xwiki.doc.XWikiDeletedDocument;
34    import com.xpn.xwiki.doc.XWikiDocument;
35   
36    /**
37    * Get deleted document revisions from the database.
38    *
39    * @version $Id: a53800f0d0eb1c7af32d129715526c90a505410c $
40    * @since 9.4RC1
41    */
42    @Component
43    @Named("deleted")
44    @Singleton
 
45    public class DeletedDocumentRevisionProvider implements DocumentRevisionProvider
46    {
47    @Inject
48    private Provider<XWikiContext> xcontextProvider;
49   
 
50  0 toggle private XWikiDocument getRevision(String revision) throws XWikiException
51    {
52  0 XWikiContext xcontext = this.xcontextProvider.get();
53   
54  0 XWikiDeletedDocument deletedDocument = xcontext.getWiki().getDeletedDocument(Long.valueOf(revision), xcontext);
55   
56  0 return deletedDocument != null ? deletedDocument.restoreDocument(xcontext) : null;
57    }
58   
 
59  0 toggle @Override
60    public XWikiDocument getRevision(DocumentReference reference, String revision) throws XWikiException
61    {
62  0 return getRevision(revision);
63    }
64   
 
65  0 toggle @Override
66    public XWikiDocument getRevision(XWikiDocument document, String revision) throws XWikiException
67    {
68  0 return getRevision(revision);
69    }
70    }