Rev 1814 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1814 | Rev 1827 | ||
---|---|---|---|
1 | package pt.estgp.estgweb.services.urlstat; |
1 | package pt.estgp.estgweb.services.urlstat; |
2 | 2 | ||
- | 3 | import jomm.utils.BytesUtils; |
|
- | 4 | import jomm.utils.DatesUtils; |
|
3 | import jomm.utils.MessageResources; |
5 | import jomm.utils.MessageResources; |
4 | import jomm.utils.MyCalendar; |
6 | import jomm.utils.MyCalendar; |
5 | import org.apache.log4j.Logger; |
- | |
6 | import org.apache.commons.httpclient.util.URIUtil; |
- | |
7 | import org.apache.commons.httpclient.URIException; |
7 | import org.apache.commons.httpclient.URIException; |
- | 8 | import org.apache.commons.httpclient.util.URIUtil; |
|
- | 9 | import org.apache.log4j.Logger; |
|
8 | import org.jfree.chart.ChartFactory; |
10 | import org.jfree.chart.ChartFactory; |
9 | import org.jfree.chart.ChartUtilities; |
11 | import org.jfree.chart.ChartUtilities; |
10 | import org.jfree.chart.JFreeChart; |
12 | import org.jfree.chart.JFreeChart; |
11 | import org.jfree.chart.axis.DateAxis; |
13 | import org.jfree.chart.axis.DateAxis; |
12 | import org.jfree.chart.plot.XYPlot; |
14 | import org.jfree.chart.plot.XYPlot; |
13 | import org.jfree.data.time.Day; |
15 | import org.jfree.data.time.Day; |
- | 16 | import org.jfree.data.time.Month; |
|
14 | import org.jfree.data.time.TimeSeries; |
17 | import org.jfree.data.time.TimeSeries; |
15 | import org.jfree.data.time.TimeSeriesCollection; |
18 | import org.jfree.data.time.TimeSeriesCollection; |
16 | import org.jfree.data.time.Month; |
- | |
17 | import pt.estgp.estgweb.domain.UrlStat; |
19 | import pt.estgp.estgweb.domain.UrlStat; |
18 | import pt.estgp.estgweb.domain.UrlStatDay; |
20 | import pt.estgp.estgweb.domain.UrlStatDay; |
19 | import pt.estgp.estgweb.domain.UrlStatMonth; |
21 | import pt.estgp.estgweb.domain.UrlStatMonth; |
20 | import pt.estgp.estgweb.domain.dao.DaoFactory; |
22 | import pt.estgp.estgweb.domain.dao.DaoFactory; |
21 | import pt.estgp.estgweb.services.expceptions.ServiceException; |
23 | import pt.estgp.estgweb.services.expceptions.ServiceException; |
22 | import pt.estgp.estgweb.utils.Globals; |
24 | import pt.estgp.estgweb.utils.Globals; |
23 | import jomm.utils.DatesUtils; |
- | |
24 | import jomm.utils.BytesUtils; |
- | |
25 | import jomm.dao.impl.AbstractDao; |
- | |
26 | import jomm.web.utils.TestHttpServletRequest; |
- | |
27 | import pt.utl.ist.berserk.logic.serviceManager.IService; |
25 | import pt.utl.ist.berserk.logic.serviceManager.IService; |
28 | 26 | ||
29 | import javax.servlet.http.HttpServletRequest; |
27 | import javax.servlet.http.HttpServletRequest; |
30 | import java.awt.*; |
28 | import java.awt.*; |
31 | import java.io.File; |
29 | import java.io.File; |
32 | import java.io.IOException; |
30 | import java.io.IOException; |
- | 31 | import java.text.SimpleDateFormat; |
|
33 | import java.util.Date; |
32 | import java.util.Date; |
34 | import java.util.List; |
33 | import java.util.List; |
35 | import java.util.ArrayList; |
- | |
36 | import java.text.SimpleDateFormat; |
- | |
37 | 34 | ||
38 | 35 | ||
39 | /** |
36 | /** |
40 | * @author Jorge Machado |
37 | * @author Jorge Machado |
41 | * @date 15/Mar/2008 |
38 | * @date 15/Mar/2008 |
42 | * @time 6:55:38 |
39 | * @time 6:55:38 |
43 | * @see pt.estgp.estgweb.services.urlstat |
40 | * @see pt.estgp.estgweb.services.urlstat |
44 | */ |
41 | */ |
45 | public class ChartBuilderService implements IService |
42 | public class ChartBuilderService implements IService |
46 | { |
43 | { |
47 | private static final 1.5.0/docs/api/java/util/logging/Logger.html">Logger logger = 1.5.0/docs/api/java/util/logging/Logger.html">Logger.getLogger(ChartBuilderService.class); |
44 | private static final 1.5.0/docs/api/java/util/logging/Logger.html">Logger logger = 1.5.0/docs/api/java/util/logging/Logger.html">Logger.getLogger(ChartBuilderService.class); |
48 | 45 | ||
49 | public static final long LINK_CHART_EXPIRE_INTERVAL = Globals.URL_STAT_CHART_EXPIRE_INTERVAL; |
46 | public static final long LINK_CHART_EXPIRE_INTERVAL = Globals.URL_STAT_CHART_EXPIRE_INTERVAL; |
50 | public static final 1.5.0/docs/api/java/lang/String.html">String LINK_CHART_TMP_DIR = Globals.URL_STAT_CHART_TMP_DIR; |
47 | public static final 1.5.0/docs/api/java/lang/String.html">String LINK_CHART_TMP_DIR = Globals.URL_STAT_CHART_TMP_DIR; |
51 | 48 | ||
52 | /** |
49 | /** |
53 | * Return file image location |
50 | * Return file image location |
54 | * |
51 | * |
55 | * @param relativePaths to analysis |
52 | * @param relativePaths to analysis |
56 | * @param request to get user language |
53 | * @param request to get user language |
57 | * @param type of chart |
54 | * @param type of chart |
58 | * @return image location |
55 | * @return image location |
59 | * @throws ServiceException error executing |
56 | * @throws ServiceException error executing |
60 | 57 | ||
61 | */ |
58 | */ |
62 | public 1.5.0/docs/api/java/lang/String.html">String run(HttpServletRequest request, List<String> relativePaths, ChartTypeEnum type) throws ServiceException |
59 | public 1.5.0/docs/api/java/lang/String.html">String run(HttpServletRequest request, List<String> relativePaths, ChartTypeEnum type) throws ServiceException |
63 | { |
60 | { |
64 | MyCalendar c = new MyCalendar(); |
61 | MyCalendar c = new MyCalendar(); |
65 | int day = c.getDay(); |
62 | int day = c.getDay(); |
66 | int month = c.getMonth(); |
63 | int month = c.getMonth(); |
67 | int year = c.getYear(); |
64 | int year = c.getYear(); |
68 | if(type == ChartTypeEnum.weekDays) |
65 | if(type == ChartTypeEnum.weekDays) |
69 | return build(request,type.getMessageKey(), relativePaths, year,month,day,7,type); |
66 | return build(request,type.getMessageKey(), relativePaths, year,month,day,7,type); |
70 | else if(type == ChartTypeEnum.monthDays) |
67 | else if(type == ChartTypeEnum.monthDays) |
71 | return build(request,type.getMessageKey(), relativePaths, year,month,day,31,type); |
68 | return build(request,type.getMessageKey(), relativePaths, year,month,day,31,type); |
72 | else if(type == ChartTypeEnum.trimestreDays) |
69 | else if(type == ChartTypeEnum.trimestreDays) |
73 | return build(request,type.getMessageKey(), relativePaths, year,month,day,90,type); |
70 | return build(request,type.getMessageKey(), relativePaths, year,month,day,90,type); |
74 | else if(type == ChartTypeEnum.semestreDays) |
71 | else if(type == ChartTypeEnum.semestreDays) |
75 | return build(request,type.getMessageKey(), relativePaths, year,month,day,180,type); |
72 | return build(request,type.getMessageKey(), relativePaths, year,month,day,180,type); |
76 | else if(type == ChartTypeEnum.yearDays) |
73 | else if(type == ChartTypeEnum.yearDays) |
77 | return build(request,type.getMessageKey(), relativePaths, year,month,day,365,type); |
74 | return build(request,type.getMessageKey(), relativePaths, year,month,day,365,type); |
78 | else if(type == ChartTypeEnum.trimestreMonths) |
75 | else if(type == ChartTypeEnum.trimestreMonths) |
79 | return build(request,type.getMessageKey(), relativePaths, year,month,3,type); |
76 | return build(request,type.getMessageKey(), relativePaths, year,month,3,type); |
80 | else if(type == ChartTypeEnum.semestreMonths) |
77 | else if(type == ChartTypeEnum.semestreMonths) |
81 | return build(request,type.getMessageKey(), relativePaths, year,month,6,type); |
78 | return build(request,type.getMessageKey(), relativePaths, year,month,6,type); |
82 | else if(type == ChartTypeEnum.yearMonths) |
79 | else if(type == ChartTypeEnum.yearMonths) |
83 | return build(request,type.getMessageKey(), relativePaths, year,month,12,type); |
80 | return build(request,type.getMessageKey(), relativePaths, year,month,12,type); |
84 | else if(type == ChartTypeEnum.twoYearsMonths) |
81 | else if(type == ChartTypeEnum.twoYearsMonths) |
85 | return build(request,type.getMessageKey(), relativePaths, year,month,24,type); |
82 | return build(request,type.getMessageKey(), relativePaths, year,month,24,type); |
86 | return null; |
83 | return null; |
87 | } |
84 | } |
88 | 85 | ||
89 | 86 | ||
90 | private 1.5.0/docs/api/java/lang/String.html">String build(HttpServletRequest request, 1.5.0/docs/api/java/lang/String.html">String messageTitle, List<String> relativePaths, int untilYear, int untilMonth, int untilDay, int days, ChartTypeEnum type) |
87 | private 1.5.0/docs/api/java/lang/String.html">String build(HttpServletRequest request, 1.5.0/docs/api/java/lang/String.html">String messageTitle, List<String> relativePaths, int untilYear, int untilMonth, int untilDay, int days, ChartTypeEnum type) |
91 | { |
88 | { |
92 | 5+0%2Fdocs%2Fapi+Date">Date startDate = DatesUtils.getStartDate(untilYear,untilMonth,untilDay,days); |
89 | 5+0%2Fdocs%2Fapi+Date">Date startDate = DatesUtils.getStartDate(untilYear,untilMonth,untilDay,days); |
93 | MyCalendar c = new MyCalendar(untilYear,untilMonth, untilDay); |
90 | MyCalendar c = new MyCalendar(untilYear,untilMonth, untilDay); |
94 | 5+0%2Fdocs%2Fapi+Date">Date endDate = c.getTime(); |
91 | 5+0%2Fdocs%2Fapi+Date">Date endDate = c.getTime(); |
95 | return build(request,messageTitle,relativePaths,startDate,endDate,type); |
92 | return build(request,messageTitle,relativePaths,startDate,endDate,type); |
96 | } |
93 | } |
97 | 94 | ||
98 | private 1.5.0/docs/api/java/lang/String.html">String build(HttpServletRequest request, 1.5.0/docs/api/java/lang/String.html">String messageTitle, List<String> relativePaths, int untilYear, int untilMonth, int months,ChartTypeEnum type) |
95 | private 1.5.0/docs/api/java/lang/String.html">String build(HttpServletRequest request, 1.5.0/docs/api/java/lang/String.html">String messageTitle, List<String> relativePaths, int untilYear, int untilMonth, int months,ChartTypeEnum type) |
99 | { |
96 | { |
100 | 5+0%2Fdocs%2Fapi+Date">Date startDate = DatesUtils.getStartDate(untilYear,untilMonth,months); |
97 | 5+0%2Fdocs%2Fapi+Date">Date startDate = DatesUtils.getStartDate(untilYear,untilMonth,months); |
101 | MyCalendar c = new MyCalendar(untilYear,untilMonth, 1); |
98 | MyCalendar c = new MyCalendar(untilYear,untilMonth, 1); |
102 | 5+0%2Fdocs%2Fapi+Date">Date endDate = c.getTime(); |
99 | 5+0%2Fdocs%2Fapi+Date">Date endDate = c.getTime(); |
103 | return build(request,messageTitle,relativePaths,startDate,endDate,type); |
100 | return build(request,messageTitle,relativePaths,startDate,endDate,type); |
104 | } |
101 | } |
105 | 102 | ||
106 | private 1.5.0/docs/api/java/lang/String.html">String build(HttpServletRequest request, 1.5.0/docs/api/java/lang/String.html">String messageTitle, List<String> relativePaths, 5+0%2Fdocs%2Fapi+Date">Date startDate, 5+0%2Fdocs%2Fapi+Date">Date endDate,ChartTypeEnum type) |
103 | private 1.5.0/docs/api/java/lang/String.html">String build(HttpServletRequest request, 1.5.0/docs/api/java/lang/String.html">String messageTitle, List<String> relativePaths, 5+0%2Fdocs%2Fapi+Date">Date startDate, 5+0%2Fdocs%2Fapi+Date">Date endDate,ChartTypeEnum type) |
107 | { |
104 | { |
108 | 1.5.0/docs/api/java/lang/String.html">String location = linkToFileNameEncode(relativePaths,startDate,endDate,type.getScale(),true); |
105 | 1.5.0/docs/api/java/lang/String.html">String location = linkToFileNameEncode(relativePaths,startDate,endDate,type.getScale(),true); |
109 | 1.5.0/docs/api/java/io/File.html">File img = new 1.5.0/docs/api/java/io/File.html">File(Globals.TMP_DIR + location); |
106 | 1.5.0/docs/api/java/io/File.html">File img = new 1.5.0/docs/api/java/io/File.html">File(Globals.TMP_DIR + location); |
110 | if(img.exists() && ((1.5.0/docs/api/java/lang/System.html">System.currentTimeMillis() - img.lastModified()) < LINK_CHART_EXPIRE_INTERVAL)) |
107 | if(img.exists() && ((1.5.0/docs/api/java/lang/System.html">System.currentTimeMillis() - img.lastModified()) < LINK_CHART_EXPIRE_INTERVAL)) |
111 | { |
108 | { |
112 | return location; |
109 | return location; |
113 | } |
110 | } |
114 | img.getParentFile().mkdirs(); |
111 | img.getParentFile().mkdirs(); |
115 | 112 | ||
116 | TimeSeriesCollection dataset = new TimeSeriesCollection(); |
113 | TimeSeriesCollection dataset = new TimeSeriesCollection(); |
117 | for(1.5.0/docs/api/java/lang/String.html">String relativePath: relativePaths) |
114 | for(1.5.0/docs/api/java/lang/String.html">String relativePath: relativePaths) |
118 | { |
115 | { |
119 | try |
116 | try |
120 | { |
117 | { |
121 | relativePath = BytesUtils.getMD5(URIUtil.encodeWithinQuery(relativePath,"ISO-8859-1")); |
118 | relativePath = BytesUtils.getMD5(URIUtil.encodeWithinQuery(relativePath,"ISO-8859-1")); |
122 | } |
119 | } |
123 | catch (1.5.0/docs/api/javax/print/URIException.html">URIException e) |
120 | catch (1.5.0/docs/api/javax/print/URIException.html">URIException e) |
124 | { |
121 | { |
125 | logger.error(e,e); |
122 | logger.error(e,e); |
126 | return null; |
123 | return null; |
127 | } |
124 | } |
128 | UrlStat urlStat = DaoFactory.getUrlStatDaoImpl().loadOrNull(relativePath); |
125 | UrlStat urlStat = DaoFactory.getUrlStatDaoImpl().loadOrNull(relativePath); |
129 | if(urlStat != null) |
126 | if(urlStat != null) |
130 | { |
127 | { |
131 | TimeSeries s = new TimeSeries(urlStat.getName(), type.getScale().getRegularTimePeriodClass()); |
128 | TimeSeries s = new TimeSeries(urlStat.getName(), type.getScale().getRegularTimePeriodClass()); |
132 | if(type.getScale() == TimeSeriesScaleEnum.days) |
129 | if(type.getScale() == TimeSeriesScaleEnum.days) |
133 | { |
130 | { |
134 | List<UrlStatDay> urlStatDays = DaoFactory.getUrlStatDayDaoImpl().loadDays(relativePath,startDate,endDate); |
131 | List<UrlStatDay> urlStatDays = DaoFactory.getUrlStatDayDaoImpl().loadDays(relativePath,startDate,endDate); |
135 | for(UrlStatDay urlStatDay: urlStatDays) |
132 | for(UrlStatDay urlStatDay: urlStatDays) |
136 | { |
133 | { |
137 | s.add(new Day( |
134 | s.add(new Day( |
138 | urlStatDay.getDate()), |
135 | urlStatDay.getDate()), |
139 | urlStatDay.getTotalClicks()); |
136 | urlStatDay.getTotalClicks()); |
140 | } |
137 | } |
141 | } |
138 | } |
142 | else if(type.getScale() == TimeSeriesScaleEnum.months) |
139 | else if(type.getScale() == TimeSeriesScaleEnum.months) |
143 | { |
140 | { |
144 | List<UrlStatMonth> urlStatMonths = DaoFactory.getUrlStatMonthDaoImpl().loadByMonth(relativePath,startDate,endDate); |
141 | List<UrlStatMonth> urlStatMonths = DaoFactory.getUrlStatMonthDaoImpl().loadByMonth(relativePath,startDate,endDate); |
145 | for(UrlStatMonth urlStatMonth: urlStatMonths) |
142 | for(UrlStatMonth urlStatMonth: urlStatMonths) |
146 | { |
143 | { |
147 | s.add(new Month( |
144 | s.add(new Month( |
148 | urlStatMonth.getDate()), |
145 | urlStatMonth.getDate()), |
149 | urlStatMonth.getTotalClicks()); |
146 | urlStatMonth.getTotalClicks()); |
150 | } |
147 | } |
151 | } |
148 | } |
152 | dataset.addSeries(s); |
149 | dataset.addSeries(s); |
153 | } |
150 | } |
154 | } |
151 | } |
155 | // dataset.setDomainIsPointsInTime(true); |
152 | // dataset.setDomainIsPointsInTime(true); |
156 | 153 | ||
157 | 154 | ||
158 | JFreeChart chart = ChartFactory.createTimeSeriesChart( |
155 | JFreeChart chart = ChartFactory.createTimeSeriesChart( |
159 | MessageResources.getMessage(request,messageTitle), |
156 | MessageResources.getMessage(request,messageTitle), |
160 | MessageResources.getMessage(request,"url.stat.days"), |
157 | MessageResources.getMessage(request,"url.stat.days"), |
161 | MessageResources.getMessage(request,"url.stat.access.clicks"), |
158 | MessageResources.getMessage(request,"url.stat.access.clicks"), |
162 | dataset, |
159 | dataset, |
163 | true, |
160 | true, |
164 | true, |
161 | true, |
165 | false |
162 | false |
166 | ); |
163 | ); |
167 | chart.setBackgroundImage(null); |
164 | chart.setBackgroundImage(null); |
168 | XYPlot plot = (XYPlot) chart.getPlot(); |
165 | XYPlot plot = (XYPlot) chart.getPlot(); |
169 | DateAxis axis = (DateAxis) plot.getDomainAxis(); |
166 | DateAxis axis = (DateAxis) plot.getDomainAxis(); |
170 | axis.setDateFormatOverride(type.getSimpleDateFormat()); |
167 | axis.setDateFormatOverride(type.getSimpleDateFormat()); |
171 | plot.setBackgroundPaint(1.5.0/docs/api/java/awt/Color.html">Color.lightGray); |
168 | plot.setBackgroundPaint(1.5.0/docs/api/java/awt/Color.html">Color.lightGray); |
172 | plot.setDomainGridlinePaint(1.5.0/docs/api/java/awt/Color.html">Color.white); |
169 | plot.setDomainGridlinePaint(1.5.0/docs/api/java/awt/Color.html">Color.white); |
173 | plot.setDomainGridlinesVisible(true); |
170 | plot.setDomainGridlinesVisible(true); |
174 | plot.setRangeGridlinePaint(1.5.0/docs/api/java/awt/Color.html">Color.white); |
171 | plot.setRangeGridlinePaint(1.5.0/docs/api/java/awt/Color.html">Color.white); |
175 | try |
172 | try |
176 | { |
173 | { |
177 | ChartUtilities.saveChartAsPNG(img, chart, 800, 300); |
174 | ChartUtilities.saveChartAsPNG(img, chart, 800, 300); |
178 | return location; |
175 | return location; |
179 | } |
176 | } |
180 | catch (1.5.0/docs/api/java/io/IOException.html">IOException e) |
177 | catch (1.5.0/docs/api/java/io/IOException.html">IOException e) |
181 | { |
178 | { |
182 | logger.error(e,e); |
179 | logger.error(e,e); |
183 | } |
180 | } |
184 | return null; |
181 | return null; |
185 | } |
182 | } |
186 | 183 | ||
187 | 184 | ||
188 | 185 | ||
189 | private static 1.5.0/docs/api/java/lang/String.html">String linkToFileName(List<String> relativePaths, 5+0%2Fdocs%2Fapi+Date">Date startDate, 5+0%2Fdocs%2Fapi+Date">Date endDate, TimeSeriesScaleEnum seriesScaleEnum) |
186 | private static 1.5.0/docs/api/java/lang/String.html">String linkToFileName(List<String> relativePaths, 5+0%2Fdocs%2Fapi+Date">Date startDate, 5+0%2Fdocs%2Fapi+Date">Date endDate, TimeSeriesScaleEnum seriesScaleEnum) |
190 | { |
187 | { |
191 | return linkToFileNameEncode(relativePaths,startDate,endDate,seriesScaleEnum,false); |
188 | return linkToFileNameEncode(relativePaths,startDate,endDate,seriesScaleEnum,false); |
192 | } |
189 | } |
193 | 190 | ||
194 | private static 1.5.0/docs/api/java/lang/String.html">String linkToFileNameEncode(List<String> relativePaths, 5+0%2Fdocs%2Fapi+Date">Date startDate, 5+0%2Fdocs%2Fapi+Date">Date endDate, TimeSeriesScaleEnum seriesScaleEnum,boolean encode) |
191 | private static 1.5.0/docs/api/java/lang/String.html">String linkToFileNameEncode(List<String> relativePaths, 5+0%2Fdocs%2Fapi+Date">Date startDate, 5+0%2Fdocs%2Fapi+Date">Date endDate, TimeSeriesScaleEnum seriesScaleEnum,boolean encode) |
195 | { |
192 | { |
196 | try |
193 | try |
197 | { |
194 | { |
198 | 1.5.0/docs/api/java/lang/String.html">String relativePathName = ""; |
195 | 1.5.0/docs/api/java/lang/String.html">String relativePathName = ""; |
199 | for(1.5.0/docs/api/java/lang/String.html">String relativePath: relativePaths) |
196 | for(1.5.0/docs/api/java/lang/String.html">String relativePath: relativePaths) |
200 | { |
197 | { |
201 | relativePathName += relativePath + "_"; |
198 | relativePathName += relativePath + "_"; |
202 | } |
199 | } |
203 | 1.5.0/docs/api/java/text/SimpleDateFormat.html">SimpleDateFormat sp = new 1.5.0/docs/api/java/text/SimpleDateFormat.html">SimpleDateFormat("yyyy_MM_dd"); |
200 | 1.5.0/docs/api/java/text/SimpleDateFormat.html">SimpleDateFormat sp = new 1.5.0/docs/api/java/text/SimpleDateFormat.html">SimpleDateFormat("yyyy_MM_dd"); |
204 | 1.5.0/docs/api/java/lang/String.html">String dates = sp.format(startDate) + "_UNTIL_" + sp.format(endDate) + "_" + seriesScaleEnum.getType(); |
201 | 1.5.0/docs/api/java/lang/String.html">String dates = sp.format(startDate) + "_UNTIL_" + sp.format(endDate) + "_" + seriesScaleEnum.getType(); |
205 | 1.5.0/docs/api/java/lang/String.html">String path; |
202 | 1.5.0/docs/api/java/lang/String.html">String path; |
206 | if(encode) |
203 | if(encode) |
207 | path = URIUtil.encodeWithinQuery(relativePathName.replaceAll("/","_"),"ISO-8859-1"); |
204 | path = URIUtil.encodeWithinQuery(relativePathName.replaceAll("/","_"),"ISO-8859-1"); |
208 | else |
205 | else |
209 | path = relativePathName.replaceAll("/","_"); |
206 | path = relativePathName.replaceAll("/","_"); |
210 | return LINK_CHART_TMP_DIR + "/" + path + "_" + dates + ".png"; |
207 | return LINK_CHART_TMP_DIR + "/" + path + "_" + dates + ".png"; |
211 | } |
208 | } |
212 | catch (1.5.0/docs/api/javax/print/URIException.html">URIException e) |
209 | catch (1.5.0/docs/api/javax/print/URIException.html">URIException e) |
213 | { |
210 | { |
214 | logger.fatal(e,e); |
211 | logger.fatal(e,e); |
215 | return null; |
212 | return null; |
216 | } |
213 | } |
217 | } |
214 | } |
218 | 215 | ||
219 | 216 | ||
220 | /** |
217 | /** |
221 | * Simple test to create link clicks from 2003 until now (PS: call first: UrlStatService.main) and generate charts of all types |
218 | * Simple test to create link clicks from 2003 until now (PS: call first: UrlStatService.main) and generate charts of all types |
222 | * @param args |
219 | * @param args |
223 | * @throws ServiceException |
220 | * @throws ServiceException |
224 | */ |
221 | */ |
225 | 222 | ||
226 | public static void main(1.5.0/docs/api/java/lang/String.html">String[] args) throws ServiceException, 1.5.0/docs/api/javax/print/URIException.html">URIException |
223 | public static void main(1.5.0/docs/api/java/lang/String.html">String[] args) throws ServiceException, 1.5.0/docs/api/javax/print/URIException.html">URIException |
227 | { |
224 | { |
228 | // UrlStatService.main(null); |
225 | // UrlStatService.main(null); |
229 | // AbstractDao.getCurrentSession().beginTransaction(); |
226 | // AbstractDao.getCurrentSession().beginTransaction(); |
230 | // List<String> relativePaths = new ArrayList<String>(); |
227 | // List<String> relativePaths = new ArrayList<String>(); |
231 | // relativePaths.add("/public/announcements/getFlashNews.jsp?sid=0.9998549583612295"); |
228 | // relativePaths.add("/public/announcements/getFlashNews.jsp?sid=0.9998549583612295"); |
232 | 1.5.0/docs/api/java/lang/System.html">System.out.println(URIUtil.decode(URIUtil.encodeWithinQuery("/public/announcements/getFlashNews.jsp?sid=0.9998549583612295&jorge=j","ISO-8859-1"))); |
229 | 1.5.0/docs/api/java/lang/System.html">System.out.println(URIUtil.decode(URIUtil.encodeWithinQuery("/public/announcements/getFlashNews.jsp?sid=0.9998549583612295&jorge=j","ISO-8859-1"))); |
233 | // relativePaths.add("/teste2"); |
230 | // relativePaths.add("/teste2"); |
234 | // System.out.println(new ChartBuilderService().run(new TestHttpServletRequest(),relativePaths, ChartTypeEnum.weekDays)); |
231 | // System.out.println(new ChartBuilderService().run(new TestHttpServletRequest(),relativePaths, ChartTypeEnum.weekDays)); |
235 | // System.out.println(new ChartBuilderService().run(new TestHttpServletRequest(),relativePaths, ChartTypeEnum.monthDays)); |
232 | // System.out.println(new ChartBuilderService().run(new TestHttpServletRequest(),relativePaths, ChartTypeEnum.monthDays)); |
236 | // System.out.println(new ChartBuilderService().run(new TestHttpServletRequest(),relativePaths, ChartTypeEnum.trimestreDays)); |
233 | // System.out.println(new ChartBuilderService().run(new TestHttpServletRequest(),relativePaths, ChartTypeEnum.trimestreDays)); |
237 | // System.out.println(new ChartBuilderService().run(new TestHttpServletRequest(),relativePaths, ChartTypeEnum.semestreDays)); |
234 | // System.out.println(new ChartBuilderService().run(new TestHttpServletRequest(),relativePaths, ChartTypeEnum.semestreDays)); |
238 | // System.out.println(new ChartBuilderService().run(new TestHttpServletRequest(),relativePaths, ChartTypeEnum.yearDays)); |
235 | // System.out.println(new ChartBuilderService().run(new TestHttpServletRequest(),relativePaths, ChartTypeEnum.yearDays)); |
239 | // System.out.println(new ChartBuilderService().run(new TestHttpServletRequest(),relativePaths, ChartTypeEnum.trimestreMonths)); |
236 | // System.out.println(new ChartBuilderService().run(new TestHttpServletRequest(),relativePaths, ChartTypeEnum.trimestreMonths)); |
240 | // System.out.println(new ChartBuilderService().run(new TestHttpServletRequest(),relativePaths, ChartTypeEnum.semestreMonths)); |
237 | // System.out.println(new ChartBuilderService().run(new TestHttpServletRequest(),relativePaths, ChartTypeEnum.semestreMonths)); |
241 | // System.out.println(new ChartBuilderService().run(new TestHttpServletRequest(),relativePaths, ChartTypeEnum.yearMonths)); |
238 | // System.out.println(new ChartBuilderService().run(new TestHttpServletRequest(),relativePaths, ChartTypeEnum.yearMonths)); |
242 | // System.out.println(new ChartBuilderService().run(new TestHttpServletRequest(),relativePaths, ChartTypeEnum.twoYearsMonths)); |
239 | // System.out.println(new ChartBuilderService().run(new TestHttpServletRequest(),relativePaths, ChartTypeEnum.twoYearsMonths)); |
243 | // AbstractDao.getCurrentSession().getTransaction().commit(); |
240 | // AbstractDao.getCurrentSession().getTransaction().commit(); |
244 | } |
241 | } |
245 | 242 | ||
246 | } |
243 | } |
247 | 244 |