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

File XWikiRCSNodeId.java

 

Coverage histogram

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

Code metrics

0
14
11
1
139
59
12
0.86
1.27
11
1.09

Classes

Class Line # Actions
XWikiRCSNodeId 34 14 0% 12 3
0.8888%
 

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 java.io.Serializable;
23   
24    import org.suigeneris.jrcs.rcs.Version;
25   
26    import com.xpn.xwiki.util.AbstractSimpleClass;
27   
28    /**
29    * Composite ID component used in {@link XWikiRCSNodeInfo} and {@link XWikiRCSNodeContent}. Immutable.
30    *
31    * @version $Id: 033bc516d910f8fbffc7f9b03366af7baac8f8f2 $
32    * @since 1.2M1
33    */
 
34    public class XWikiRCSNodeId extends AbstractSimpleClass implements Serializable, Cloneable
35    {
36    /**
37    * @see com.xpn.xwiki.doc.XWikiDocument#getId()
38    */
39    private long docId;
40   
41    /**
42    * Version of document.
43    */
44    private Version version = new Version(1, 1);
45   
46    /**
47    * Default constructor used in Hibernate to load this class.
48    */
 
49  3656 toggle public XWikiRCSNodeId()
50    {
51    }
52   
53    /**
54    * @param docId = {@link com.xpn.xwiki.doc.XWikiDocument#getId()}
55    * @param version - version of document
56    */
 
57  5902 toggle public XWikiRCSNodeId(long docId, Version version)
58    {
59  5902 super();
60  5902 this.docId = docId;
61  5902 this.version = version;
62    }
63   
64    /**
65    * @return {@link com.xpn.xwiki.doc.XWikiDocument#getId()}
66    */
 
67  52669 toggle public long getDocId()
68    {
69  52669 return this.docId;
70    }
71   
72    /**
73    * @param docId = {@link com.xpn.xwiki.doc.XWikiDocument#getId()}
74    */
 
75  3656 toggle protected void setDocId(long docId)
76    {
77  3656 this.docId = docId;
78    }
79   
80    /**
81    * @return version of document
82    */
 
83  35697 toggle public Version getVersion()
84    {
85  35697 return this.version;
86    }
87   
88    /**
89    * @param ver - version of document
90    */
 
91  0 toggle protected void setVersion(Version ver)
92    {
93  0 this.version = ver;
94    }
95   
96    /**
97    * @return 1st number in version used in Hibernate to store this class
98    */
 
99  52669 toggle protected int getVersion1()
100    {
101  52669 return this.version.at(0);
102    }
103   
104    /**
105    * @return 2nd number in version used in Hibernate to store this class
106    */
 
107  52669 toggle protected int getVersion2()
108    {
109  52669 return this.version.at(1);
110    }
111   
112    /**
113    * @param v1 = 1st number in version used in Hibernate to load this class
114    */
 
115  3656 toggle protected void setVersion1(int v1)
116    {
117  3656 this.version = new Version(v1, this.version.at(1));
118    }
119   
120    /**
121    * @param v2 = 2nd number in version used in Hibernate to load this class
122    */
 
123  3656 toggle protected void setVersion2(int v2)
124    {
125  3656 this.version = new Version(this.version.at(0), v2);
126    }
127   
 
128  14361 toggle @Override
129    public Object clone()
130    {
131  14361 try {
132    // there are no mutable fields, so simple do super.clone()
133  14361 return super.clone();
134    } catch (CloneNotSupportedException e) {
135    // clone is supported. exception is nonsense.
136  0 throw new RuntimeException(e);
137    }
138    }
139    }