1. Project Clover database Sat Feb 2 2019 06:45:20 CET
  2. Package org.xwiki.refactoring.internal.job

File RestoreJob.java

 

Coverage histogram

../../../../../img/srcFileCovDistChart9.png
41% of files have more coverage

Code metrics

2
9
2
1
63
31
3
0.33
4.5
2
1.5

Classes

Class Line # Actions
RestoreJob 38 9 0% 3 2
0.8461538684.6%
 

Contributing tests

This file is covered by 5 tests. .

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 org.xwiki.refactoring.internal.job;
21   
22    import java.util.List;
23   
24    import javax.inject.Named;
25   
26    import org.xwiki.component.annotation.Component;
27    import org.xwiki.job.api.AbstractCheckRightsRequest;
28    import org.xwiki.refactoring.job.RefactoringJobs;
29   
30    /**
31    * A job that can restore entities.
32    *
33    * @version $Id: 940ccf31234603af8db936b325d5252d609c5e77 $
34    * @since 9.4RC1
35    */
36    @Component
37    @Named(RefactoringJobs.RESTORE)
 
38    public class RestoreJob extends AbstractDeletedDocumentsJob
39    {
 
40  43 toggle @Override
41    public String getType()
42    {
43  43 return RefactoringJobs.RESTORE;
44    }
45   
 
46  6 toggle @Override
47    protected void handleDeletedDocuments(List<Long> idsDeletedDocuments, AbstractCheckRightsRequest request)
48    {
49  6 this.progressManager.pushLevelProgress(idsDeletedDocuments.size(), this);
50   
51  6 for (Long idToRestore : idsDeletedDocuments) {
52  10 if (this.status.isCanceled()) {
53  0 break;
54    } else {
55  10 this.progressManager.startStep(this);
56  10 modelBridge.restoreDeletedDocument(idToRestore, request);
57  10 this.progressManager.endStep(this);
58    }
59    }
60   
61  6 this.progressManager.popLevelProgress(this);
62    }
63    }