Clover Coverage Report - XWiki Rendering - Parent POM 4.0-SNAPSHOT (Aggregated)
Coverage timestamp: Mon Mar 12 2012 18:03:13 CET
../../../../../img/srcFileCovDistChart10.png 0% of files have more coverage
7   88   7   1.4
4   31   1   5
5     1.4  
1    
 
  DocumentResourceReference       Line # 30 7 0% 7 0 100% 1.0
 
  (66)
 
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.rendering.listener.reference;
21   
22    import org.apache.commons.lang3.StringUtils;
23   
24    /**
25    * Represents a reference to a Document.
26    *
27    * @version $Id: 97beeaf9d84d337d0718b338f54516462bb484da $
28    * @since 2.5RC1
29    */
 
30    public class DocumentResourceReference extends ResourceReference
31    {
32    /**
33    * The name of the parameter representing the Query String.
34    */
35    public static final String QUERY_STRING = "queryString";
36   
37    /**
38    * The name of the parameter representing the Anchor.
39    */
40    public static final String ANCHOR = "anchor";
41   
42    /**
43    * @param reference see {@link #getReference()}
44    */
 
45  154 toggle public DocumentResourceReference(String reference)
46    {
47  154 super(reference, ResourceType.DOCUMENT);
48    }
49   
50    /**
51    * @return the query string for specifying parameters that will be used in the rendered URL or null if no query
52    * string has been specified. Example: "mydata1=5&mydata2=Hello"
53    */
 
54  5 toggle public String getQueryString()
55    {
56  5 return getParameter(QUERY_STRING);
57    }
58   
59    /**
60    * @param queryString see {@link #getQueryString()}
61    */
 
62  86 toggle public void setQueryString(String queryString)
63    {
64  86 if (!StringUtils.isEmpty(queryString)) {
65  9 setParameter(QUERY_STRING, queryString);
66    }
67    }
68   
69    /**
70    * @return the anchor name pointing to an anchor defined in the referenced document or null if no anchor has been
71    * specified (in which case the reference points to the top of the document). Note that in XWiki anchors are
72    * automatically created for titles. Example: "TableOfContentAnchor"
73    */
 
74  5 toggle public String getAnchor()
75    {
76  5 return getParameter(ANCHOR);
77    }
78   
79    /**
80    * @param anchor see {@link #getAnchor()}
81    */
 
82  132 toggle public void setAnchor(String anchor)
83    {
84  132 if (!StringUtils.isEmpty(anchor)) {
85  60 setParameter(ANCHOR, anchor);
86    }
87    }
88    }