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

File RefererStats.java

 

Coverage histogram

../../../../../img/srcFileCovDistChart0.png
83% of files have more coverage

Code metrics

2
13
5
2
112
46
7
0.54
2.6
2.5
1.4

Classes

Class Line # Actions
RefererStats 36 13 0% 7 20
0.00%
RefererStats.Property 48 0 - 0 0
-1.0 -
 

Contributing tests

No tests hitting this source file were found.

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.stats.impl;
21   
22    import java.net.MalformedURLException;
23    import java.net.URL;
24    import java.util.Date;
25   
26    import org.slf4j.Logger;
27    import org.slf4j.LoggerFactory;
28   
29    import com.xpn.xwiki.stats.impl.StatsUtil.PeriodType;
30   
31    /**
32    * The referer statistics database object.
33    *
34    * @version $Id: ac7cfe7e5a91229f68368f2472df6c4132b7020e $
35    */
 
36    public class RefererStats extends XWikiStats
37    {
38    /**
39    * Logging tools.
40    */
41    private static final Logger LOGGER = LoggerFactory.getLogger(RefererStats.class);
42   
43    /**
44    * The properties of document statistics object.
45    *
46    * @version $Id: ac7cfe7e5a91229f68368f2472df6c4132b7020e $
47    */
 
48    public enum Property
49    {
50    /**
51    * The referer.
52    */
53    referer
54    }
55   
56    /**
57    * Default {@link RefererStats} constructor.
58    */
 
59  0 toggle public RefererStats()
60    {
61    }
62   
63    /**
64    * @param docName the name of the wiki/space/document.
65    * @param referer the referer.
66    * @param periodDate the date of the period.
67    * @param periodType the type of the period.
68    */
 
69  0 toggle public RefererStats(String docName, String referer, Date periodDate, PeriodType periodType)
70    {
71  0 super(periodDate, periodType);
72   
73  0 setName(docName);
74  0 String nb = referer + getPeriod();
75  0 setNumber(nb.hashCode());
76  0 setReferer(referer);
77    }
78   
79    /**
80    * @return the referer.
81    */
 
82  0 toggle public String getReferer()
83    {
84  0 return getStringValue(Property.referer.toString());
85    }
86   
87    /**
88    * @param referer the referer.
89    */
 
90  0 toggle public void setReferer(String referer)
91    {
92  0 setStringValue(Property.referer.toString(), referer);
93    }
94   
95    /**
96    * @return the referer URL.
97    */
 
98  0 toggle public URL getURL()
99    {
100  0 URL url = null;
101   
102  0 try {
103  0 url = new URL(getReferer());
104    } catch (MalformedURLException e) {
105  0 if (LOGGER.isDebugEnabled()) {
106  0 LOGGER.debug("Failed to construct URL from referer", e);
107    }
108    }
109   
110  0 return url;
111    }
112    }