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

File PermanentlyDeleteJob.java

 

Coverage histogram

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

Code metrics

4
12
3
1
77
40
5
0.42
4
3
1.67

Classes

Class Line # Actions
PermanentlyDeleteJob 38 12 0% 5 2
0.894736889.5%
 

Contributing tests

This file is covered by 6 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 permanently delete an entity already in the recycle bin.
32    *
33    * @version $Id: 65975393f1b9c8e40444460f4c5c84b959a6569b $
34    * @since 10.10RC1
35    */
36    @Component
37    @Named(RefactoringJobs.PERMANENTLY_DELETE)
 
38    public class PermanentlyDeleteJob extends AbstractDeletedDocumentsJob
39    {
 
40  31 toggle @Override
41    public String getType()
42    {
43  31 return RefactoringJobs.PERMANENTLY_DELETE;
44    }
45   
 
46  4 toggle @Override
47    protected void handleDeletedDocuments(List<Long> idsDeletedDocuments, AbstractCheckRightsRequest request)
48    {
49   
50    // if the list is empty we delete all documents from the recycle bin
51  4 if (idsDeletedDocuments.isEmpty()) {
52  1 this.modelBridge.permanentlyDeleteAllDocuments(this, request);
53   
54    // else we delete the specified list
55    } else {
56  3 this.handleDeleteSomeDocumentsFromRecycleBin(idsDeletedDocuments, request);
57    }
58    }
59   
 
60  3 toggle private void handleDeleteSomeDocumentsFromRecycleBin(List<Long> idsDeletedDocuments,
61    AbstractCheckRightsRequest request)
62    {
63  3 this.progressManager.pushLevelProgress(idsDeletedDocuments.size(), this);
64   
65  3 for (Long idToDelete : idsDeletedDocuments) {
66  7 if (this.status.isCanceled()) {
67  0 break;
68    } else {
69  7 this.progressManager.startStep(this);
70  7 modelBridge.permanentlyDeleteDocument(idToDelete, request);
71  7 this.progressManager.endStep(this);
72    }
73    }
74   
75  3 this.progressManager.popLevelProgress(this);
76    }
77    }