1. Project Clover database Sat Feb 2 2019 06:45:20 CET
  2. Package com.xpn.xwiki.doc

File XWikiLink.java

 

Coverage histogram

../../../../img/srcFileCovDistChart10.png
0% of files have more coverage

Code metrics

4
22
11
1
117
68
13
0.59
2
11
1.18

Classes

Class Line # Actions
26 22 0% 13 2
0.945945994.6%
 

Contributing tests

This file is covered by 1 test. .

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;
21   
22    import java.io.Serializable;
23   
24    import org.apache.commons.lang3.builder.EqualsBuilder;
25   
 
26    public class XWikiLink implements Serializable
27    {
28    private long docId;
29   
30    private String link;
31   
32    private String fullName;
33   
 
34  1001 toggle public XWikiLink()
35    {
36  1001 this.setDocId(0);
37    }
38   
 
39  0 toggle public XWikiLink(long docId)
40    {
41  0 this.setDocId(docId);
42    }
43   
 
44  3 toggle public XWikiLink(long docId, String link, String fullName)
45    {
46  3 this.setDocId(docId);
47  3 this.setLink(link);
48  3 this.setFullName(fullName);
49    }
50   
51    /**
52    * @return the id of the document containing the link
53    */
 
54  3371 toggle public long getDocId()
55    {
56  3371 return this.docId;
57    }
58   
 
59  2005 toggle public void setDocId(long docId)
60    {
61  2005 this.docId = docId;
62    }
63   
 
64  2003 toggle public void setLink(String link)
65    {
66  2003 this.link = link;
67    }
68   
69    /**
70    * @return the serialized document reference of the link target (compact form without the wiki part if it matches
71    * the current wiki)
72    */
 
73  3011 toggle public String getLink()
74    {
75  3011 return this.link;
76    }
77   
78    /**
79    * @return the serialized reference of the document which contains the link (without the wiki part)
80    */
 
81  2012 toggle public String getFullName()
82    {
83  2012 return this.fullName;
84    }
85   
 
86  1004 toggle public void setFullName(String fullName)
87    {
88  1004 this.fullName = fullName;
89    }
90   
 
91  9 toggle @Override
92    public boolean equals(Object obj)
93    {
94  9 if (this == obj) {
95  1 return true;
96    }
97   
98  8 if (!(obj instanceof XWikiLink)) {
99  1 return false;
100    }
101   
102  7 XWikiLink o = (XWikiLink)obj;
103   
104  7 EqualsBuilder builder = new EqualsBuilder();
105  7 builder.append(getDocId(), o.getDocId());
106  7 builder.append(getLink(), o.getLink());
107  7 builder.append(getFullName(), o.getFullName());
108   
109  7 return builder.isEquals();
110    }
111   
 
112  1359 toggle @Override
113    public int hashCode()
114    {
115  1359 return ("" + getDocId() + this.link).hashCode();
116    }
117    }