1. Project Clover database Tue Dec 20 2016 21:24:09 CET
  2. Package com.xpn.xwiki.doc.rcs

File XWikiRCSNodeContent.java

 

Coverage histogram

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

Code metrics

0
7
8
1
104
44
8
1.14
0.88
8
1

Classes

Class Line # Actions
XWikiRCSNodeContent 32 7 0% 8 2
0.866666786.7%
 

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 com.xpn.xwiki.doc.rcs;
21   
22    import org.apache.commons.lang3.builder.ToStringBuilder;
23   
24    import com.xpn.xwiki.util.AbstractSimpleClass;
25   
26    /**
27    * Contains differences between document versions. Mutable.
28    *
29    * @version $Id: c835faa498667aafa6e5194988e1fd6cac5d0d9d $
30    * @since 1.2M1
31    */
 
32    public class XWikiRCSNodeContent extends AbstractSimpleClass
33    implements Comparable<XWikiRCSNodeContent>
34    {
35    /** composite primary id of class. Not null. */
36    private XWikiRCSNodeId id;
37   
38    /** Diff or full version of revision. Not null. */
39    private XWikiPatch patch;
40   
41    /**
42    * default constructor used in Hibernate to load this class.
43    */
 
44  5752 toggle public XWikiRCSNodeContent()
45    {
46    }
47   
48    /**
49    * @param id - primary key
50    */
 
51  825 toggle public XWikiRCSNodeContent(XWikiRCSNodeId id)
52    {
53  825 setId((XWikiRCSNodeId) id.clone());
54    }
55   
56    /**
57    * @return primary key
58    */
 
59  25361 toggle public XWikiRCSNodeId getId()
60    {
61  25361 return this.id;
62    }
63   
64    /**
65    * @param id = primary key
66    */
 
67  7784 toggle public void setId(XWikiRCSNodeId id)
68    {
69    // mutable, so clone is needed
70  7784 this.id = (XWikiRCSNodeId) id.clone();
71    }
72   
73    /**
74    * @return patch for this revision
75    * @see XWikiPatch
76    */
 
77  19652 toggle public XWikiPatch getPatch()
78    {
79  19652 return this.patch;
80    }
81   
82    /**
83    * @param patch - patch for this revision
84    * @see XWikiPatch
85    */
 
86  6577 toggle public void setPatch(XWikiPatch patch)
87    {
88  6577 this.patch = patch;
89    }
90   
 
91  0 toggle @Override
92    public String toString()
93    {
94  0 return new ToStringBuilder(this)
95    .append("id", getId())
96    .toString();
97    }
98   
 
99  6313 toggle @Override
100    public int compareTo(XWikiRCSNodeContent o)
101    {
102  6313 return getId().getVersion().compareTo(o.getId().getVersion());
103    }
104    }