1. Project Clover database Tue Dec 20 2016 21:24:09 CET
  2. Package org.xwiki.blame.internal

File DefaultBlameManager.java

 

Coverage histogram

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

Code metrics

6
8
1
1
58
26
5
0.62
8
1
5

Classes

Class Line # Actions
DefaultBlameManager 39 8 0% 5 2
0.866666786.7%
 

Contributing tests

This file is covered by 2 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   
21    package org.xwiki.blame.internal;
22   
23    import java.util.List;
24   
25    import javax.inject.Singleton;
26   
27    import org.xwiki.blame.AnnotatedContent;
28    import org.xwiki.blame.BlameManager;
29    import org.xwiki.component.annotation.Component;
30   
31    /**
32    * Default implementation of {@link org.xwiki.blame.BlameManager}.
33    *
34    * @version $Id: 6f38fd9ab7f80c42310e66c659bc81e106f5cdde $
35    * @since 6.2M2
36    */
37    @Component
38    @Singleton
 
39    public class DefaultBlameManager implements BlameManager
40    {
 
41  7 toggle @Override
42    public <R, E> AnnotatedContent<R, E> blame(AnnotatedContent<R, E> content, R revision, List<E> previous)
43    {
44  7 if (content == null) {
45  4 if (previous == null || revision == null) {
46  3 return null;
47    }
48  1 return new DefaultAnnotatedContent<R, E>(revision, previous);
49    }
50   
51  3 if (!(content instanceof DefaultAnnotatedContent)) {
52  0 throw new IllegalArgumentException("Incompatible annotated content type provided");
53    }
54   
55  3 ((DefaultAnnotatedContent<R, E>) content).analyseRevision(revision, previous);
56  3 return content;
57    }
58    }