You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by ta...@apache.org on 2005/11/08 01:25:56 UTC
svn commit: r331648 - in /portals/jetspeed-2/trunk:
applications/pam/src/java/org/apache/jetspeed/portlets/statistics/
components/statistics/src/java/org/apache/jetspeed/statistics/impl/
components/statistics/src/test/org/apache/jetspeed/statistics/ je...
Author: taylor
Date: Mon Nov 7 16:25:52 2005
New Revision: 331648
URL: http://svn.apache.org/viewcvs?rev=331648&view=rev
Log:
- use constants in query type
Modified:
portals/jetspeed-2/trunk/applications/pam/src/java/org/apache/jetspeed/portlets/statistics/StatisticsPortlet.java
portals/jetspeed-2/trunk/components/statistics/src/java/org/apache/jetspeed/statistics/impl/PortalStatisticsImpl.java
portals/jetspeed-2/trunk/components/statistics/src/test/org/apache/jetspeed/statistics/TestStatistics.java
portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/statistics/PortalStatistics.java
Modified: portals/jetspeed-2/trunk/applications/pam/src/java/org/apache/jetspeed/portlets/statistics/StatisticsPortlet.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/applications/pam/src/java/org/apache/jetspeed/portlets/statistics/StatisticsPortlet.java?rev=331648&r1=331647&r2=331648&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/applications/pam/src/java/org/apache/jetspeed/portlets/statistics/StatisticsPortlet.java (original)
+++ portals/jetspeed-2/trunk/applications/pam/src/java/org/apache/jetspeed/portlets/statistics/StatisticsPortlet.java Mon Nov 7 16:25:52 2005
@@ -1,8 +1,17 @@
/*
- * Created on Nov 3, 2005
- *
- * TODO To change the template for this generated file go to
- * Window - Preferences - Java - Code Style - Code Templates
+ * Copyright 2000-2001,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.jetspeed.portlets.statistics;
@@ -76,7 +85,7 @@
{
// if we get here, we're on the first startup.
sqc = new StatisticsQueryCriteriaImpl();
- sqc.setQueryType("portlets");
+ sqc.setQueryType(PortalStatistics.QUERY_TYPE_PORTLET);
sqc.setTimePeriod("1");
session.setAttribute(SESSION_CRITERIA, sqc);
Modified: portals/jetspeed-2/trunk/components/statistics/src/java/org/apache/jetspeed/statistics/impl/PortalStatisticsImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/statistics/src/java/org/apache/jetspeed/statistics/impl/PortalStatisticsImpl.java?rev=331648&r1=331647&r2=331648&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/statistics/src/java/org/apache/jetspeed/statistics/impl/PortalStatisticsImpl.java (original)
+++ portals/jetspeed-2/trunk/components/statistics/src/java/org/apache/jetspeed/statistics/impl/PortalStatisticsImpl.java Mon Nov 7 16:25:52 2005
@@ -595,15 +595,15 @@
Date start = getStartDateFromPeriod(criteria.getTimePeriod(), end);
String queryType = criteria.getQueryType();
- if ("user".equals(queryType))
+ if (PortalStatistics.QUERY_TYPE_USER.equals(queryType))
{
tableName = "USER_STATISTICS";
groupColumn = "USER_NAME";
- } else if ("portlet".equals(queryType))
+ } else if (PortalStatistics.QUERY_TYPE_PORTLET.equals(queryType))
{
tableName = "PORTLET_STATISTICS";
groupColumn = "PORTLET";
- } else if ("page".equals(queryType))
+ } else if (PortalStatistics.QUERY_TYPE_PAGE.equals(queryType))
{
tableName = "PAGE_STATISTICS";
groupColumn = "PAGE";
@@ -616,7 +616,7 @@
String ascDesc = "DESC";
- if (!"user".equals(queryType))
+ if (!PortalStatistics.QUERY_TYPE_USER.equals(queryType))
{
query = "select count(*) as count , MIN(ELAPSED_TIME),AVG(ELAPSED_TIME),MAX(ELAPSED_TIME) from "
+ tableName + " where time_stamp > ? and time_stamp < ?";
Modified: portals/jetspeed-2/trunk/components/statistics/src/test/org/apache/jetspeed/statistics/TestStatistics.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/statistics/src/test/org/apache/jetspeed/statistics/TestStatistics.java?rev=331648&r1=331647&r2=331648&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/statistics/src/test/org/apache/jetspeed/statistics/TestStatistics.java (original)
+++ portals/jetspeed-2/trunk/components/statistics/src/test/org/apache/jetspeed/statistics/TestStatistics.java Mon Nov 7 16:25:52 2005
@@ -249,13 +249,13 @@
{
System.out.println("testing Query System");
StatisticsQueryCriteria sqc = new StatisticsQueryCriteriaImpl();
- sqc.setQueryType("user");
+ sqc.setQueryType(PortalStatistics.QUERY_TYPE_USER);
AggregateStatistics as = statistics.queryStatistics(sqc);
System.out.println("user = " + as);
- sqc.setQueryType("portlet");
+ sqc.setQueryType(PortalStatistics.QUERY_TYPE_PORTLET);
as = statistics.queryStatistics(sqc);
System.out.println("user = " + as);
- sqc.setQueryType("page");
+ sqc.setQueryType(PortalStatistics.QUERY_TYPE_PAGE);
as = statistics.queryStatistics(sqc);
System.out.println("user = " + as);
Modified: portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/statistics/PortalStatistics.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/statistics/PortalStatistics.java?rev=331648&r1=331647&r2=331648&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/statistics/PortalStatistics.java (original)
+++ portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/statistics/PortalStatistics.java Mon Nov 7 16:25:52 2005
@@ -69,7 +69,10 @@
*/
public interface PortalStatistics
{
-
+ public static final String QUERY_TYPE_PORTLET = "portlet";
+ public static final String QUERY_TYPE_USER = "user";
+ public static final String QUERY_TYPE_PAGE = "page";
+
public static final String HTTP_OK = "200";
public static final String HTTP_UNAUTHORIZED = "401";
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org