Examples of AggregateStatistics


Examples of org.apache.jetspeed.statistics.AggregateStatistics

        Context velocityContext = getContext(request);
        PortletSession session = request.getPortletSession();

        StatisticsQueryCriteria sqc = (StatisticsQueryCriteria) session
                .getAttribute(SESSION_CRITERIA);
        AggregateStatistics stats = (AggregateStatistics) session
                .getAttribute(SESSION_RESULTS);
        if (stats == null)
        {
            if (sqc == null)
            {
View Full Code Here

Examples of org.apache.jetspeed.statistics.AggregateStatistics

        criteria.setTimePeriod(timeperiod);
        String queryType = request.getParameter("queryType");

        criteria.setQueryType(queryType);
        AggregateStatistics stats = statistics.getDefaultEmptyAggregateStatistics();
        try
        {
            statistics.forceFlush();
            stats = statistics.queryStatistics(criteria);
        } catch (InvalidCriteriaException e)
View Full Code Here

Examples of org.apache.jetspeed.statistics.AggregateStatistics

        Context velocityContext = getContext(request);
        PortletSession session = request.getPortletSession();

        StatisticsQueryCriteria sqc = (StatisticsQueryCriteria) session
                .getAttribute(SESSION_CRITERIA);
        AggregateStatistics stats = (AggregateStatistics) session
                .getAttribute(SESSION_RESULTS);
        if (stats == null)
        {
            if (sqc == null)
            {
View Full Code Here

Examples of org.apache.jetspeed.statistics.AggregateStatistics

        criteria.setTimePeriod(timeperiod);
        String queryType = request.getParameter("queryType");

        criteria.setQueryType(queryType);
        AggregateStatistics stats = statistics.getDefaultEmptyAggregateStatistics();
        try
        {
            statistics.forceFlush();
            stats = statistics.queryStatistics(criteria);
        } catch (InvalidCriteriaException e)
View Full Code Here

Examples of org.apache.jetspeed.statistics.AggregateStatistics

     * @see org.apache.jetspeed.statistics.PortalStatistics#queryStatistics(org.apache.jetspeed.statistics.StatisticsQueryCriteria)
     */
    public AggregateStatistics queryStatistics(StatisticsQueryCriteria criteria)
            throws InvalidCriteriaException
    {
        AggregateStatistics as = new AggregateStatisticsImpl();
        String query;
        String query2;

        String tableName;
        String groupColumn;

        Date end = new Date();
        Date start = getStartDateFromPeriod(criteria.getTimePeriod(), end);

        String queryType = criteria.getQueryType();
       

        if (PortalStatistics.QUERY_TYPE_USER.equals(queryType))
        {
            tableName = "USER_STATISTICS";
            groupColumn = "USER_NAME";
        } else if (PortalStatistics.QUERY_TYPE_PORTLET.equals(queryType))
        {
            tableName = "PORTLET_STATISTICS";
            groupColumn = "PORTLET";
        } else if (PortalStatistics.QUERY_TYPE_PAGE.equals(queryType))
        {
            tableName = "PAGE_STATISTICS";
            groupColumn = "PAGE";
        } else
        {
            throw new InvalidCriteriaException(
                    " invalid queryType passed to queryStatistics");
        }
        String orderColumn = "itemcount";

        String ascDesc = "DESC";

        if (!PortalStatistics.QUERY_TYPE_USER.equals(queryType))
        {
            query = "select count(*) as itemcount , MIN(ELAPSED_TIME) as amin ,AVG(ELAPSED_TIME) as aavg ,MAX(ELAPSED_TIME) as amax from "
                    + tableName + " where time_stamp > ? and time_stamp < ?";
            query2 = "select count(*) as itemcount ,"
                    + groupColumn
                    + ", MIN(ELAPSED_TIME) as amin ,AVG(ELAPSED_TIME) as aavg ,MAX(ELAPSED_TIME) as amax "
                    + "from " + tableName
                    + " where time_stamp > ? and time_stamp < ? group by "
                    + groupColumn + "  order by " + orderColumn + " " + ascDesc;
        } else
        {
            query = "select count(*) as itemcount , MIN(ELAPSED_TIME) as amin,AVG(ELAPSED_TIME) as aavg ,MAX(ELAPSED_TIME) as amax from "
                    + tableName
                    + " where time_stamp > ? and time_stamp < ? and status = 2";
            query2 = "select count(*) as itemcount ,"
                    + groupColumn
                    + ", MIN(ELAPSED_TIME) as amin ,AVG(ELAPSED_TIME) as aavg ,MAX(ELAPSED_TIME) as amax "
                    + "from "
                    + tableName
                    + " where time_stamp > ? and time_stamp < ? and status = 2 group by "
                    + groupColumn + "  order by " + orderColumn + " " + ascDesc;
        }
        Connection con = null;
        try
        {
            con = ds.getConnection();
            PreparedStatement pstmt = con.prepareStatement(query);
            pstmt.setTimestamp(1, new Timestamp(start.getTime()));
            pstmt.setTimestamp(2, new Timestamp(end.getTime()));
            ResultSet rs = pstmt.executeQuery();
            float denominator = 1.0f;
            if (PortalStatistics.QUERY_TYPE_USER.equals(queryType))
            {
                denominator = 1000f * 60f; // this should convert from mS to
                                           // minutes
            }
            if (rs.next())
            {
                as.setHitCount(rs.getInt("itemcount"));

                as.setMinProcessingTime(rs.getFloat("amin") / denominator);
                as.setAvgProcessingTime(rs.getFloat("aavg") / denominator);
                as.setMaxProcessingTime(rs.getFloat("amax") / denominator);

            }
            PreparedStatement pstmt2 = con.prepareStatement(query2);
            pstmt2.setTimestamp(1, new Timestamp(start.getTime()));
            pstmt2.setTimestamp(2, new Timestamp(end.getTime()));
            ResultSet rs2 = pstmt2.executeQuery();

            int rowCount = 0;
            int totalRows = 5;
            String listsizeStr = criteria.getListsize();
            int temp = -1;
            try
            {
                temp = Integer.parseInt(listsizeStr);
            }
            catch (NumberFormatException e)
            {
            }
            if(temp != -1) {
                totalRows = temp;
            }
           
            while ((rs2.next()) && (rowCount < totalRows))
            {
                Map row = new HashMap();
                row.put("count", "" + rs2.getInt("itemcount"));
                String col = rs2.getString(groupColumn);
                int maxColLen = 35;
                if (col != null)
                {

                    if (col.length() > maxColLen)
                    {
                        col = col.substring(0, maxColLen);
                    }
                }

                row.put("groupColumn", col);
                row.put("min", ""
                        + floatFormatter(rs2.getFloat("amin") / denominator));
                row.put("avg", ""
                        + floatFormatter(rs2.getFloat("aavg") / denominator));
                row.put("max", ""
                        + floatFormatter(rs2.getFloat("amax") / denominator));
                as.addRow(row);
                rowCount++;
            }

        }
        catch (SQLException e)
View Full Code Here

Examples of org.apache.jetspeed.statistics.AggregateStatistics

     * @see org.apache.jetspeed.statistics.PortalStatistics#queryStatistics(org.apache.jetspeed.statistics.StatisticsQueryCriteria)
     */
    public AggregateStatistics queryStatistics(StatisticsQueryCriteria criteria)
            throws InvalidCriteriaException
    {
        AggregateStatistics as = new AggregateStatisticsImpl();
        String query;
        String query2;

        String tableName;
        String groupColumn;

        Date end = new Date();
        Date start = getStartDateFromPeriod(criteria.getTimePeriod(), end);

        String queryType = criteria.getQueryType();
       

        if (PortalStatistics.QUERY_TYPE_USER.equals(queryType))
        {
            tableName = "USER_STATISTICS";
            groupColumn = "USER_NAME";
        } else if (PortalStatistics.QUERY_TYPE_PORTLET.equals(queryType))
        {
            tableName = "PORTLET_STATISTICS";
            groupColumn = "PORTLET";
        } else if (PortalStatistics.QUERY_TYPE_PAGE.equals(queryType))
        {
            tableName = "PAGE_STATISTICS";
            groupColumn = "PAGE";
        } else
        {
            throw new InvalidCriteriaException(
                    " invalid queryType passed to queryStatistics");
        }
        String orderColumn = "itemcount";

        String ascDesc = "DESC";

        if (!PortalStatistics.QUERY_TYPE_USER.equals(queryType))
        {
            query = "select count(*) as itemcount , MIN(ELAPSED_TIME) as amin ,AVG(ELAPSED_TIME) as aavg ,MAX(ELAPSED_TIME) as amax from "
                    + tableName + " where time_stamp > ? and time_stamp < ?";
            query2 = "select count(*) as itemcount ,"
                    + groupColumn
                    + ", MIN(ELAPSED_TIME) as amin ,AVG(ELAPSED_TIME) as aavg ,MAX(ELAPSED_TIME) as amax "
                    + "from " + tableName
                    + " where time_stamp > ? and time_stamp < ? group by "
                    + groupColumn + "  order by " + orderColumn + " " + ascDesc;
        } else
        {
            query = "select count(*) as itemcount , MIN(ELAPSED_TIME) as amin,AVG(ELAPSED_TIME) as aavg ,MAX(ELAPSED_TIME) as amax from "
                    + tableName
                    + " where time_stamp > ? and time_stamp < ? and status = 2";
            query2 = "select count(*) as itemcount ,"
                    + groupColumn
                    + ", MIN(ELAPSED_TIME) as amin ,AVG(ELAPSED_TIME) as aavg ,MAX(ELAPSED_TIME) as amax "
                    + "from "
                    + tableName
                    + " where time_stamp > ? and time_stamp < ? and status = 2 group by "
                    + groupColumn + "  order by " + orderColumn + " " + ascDesc;
        }
        Connection con = null;
        try
        {
            con = ds.getConnection();
            PreparedStatement pstmt = con.prepareStatement(query);
            pstmt.setTimestamp(1, new Timestamp(start.getTime()));
            pstmt.setTimestamp(2, new Timestamp(end.getTime()));
            ResultSet rs = pstmt.executeQuery();
            float denominator = 1.0f;
            if (PortalStatistics.QUERY_TYPE_USER.equals(queryType))
            {
                denominator = 1000f * 60f; // this should convert from mS to
                                           // minutes
            }
            if (rs.next())
            {
                as.setHitCount(rs.getInt("itemcount"));

                as.setMinProcessingTime(rs.getFloat("amin") / denominator);
                as.setAvgProcessingTime(rs.getFloat("aavg") / denominator);
                as.setMaxProcessingTime(rs.getFloat("amax") / denominator);

            }
            PreparedStatement pstmt2 = con.prepareStatement(query2);
            pstmt2.setTimestamp(1, new Timestamp(start.getTime()));
            pstmt2.setTimestamp(2, new Timestamp(end.getTime()));
            ResultSet rs2 = pstmt2.executeQuery();

            int rowCount = 0;
            int totalRows = 5;
            String listsizeStr = criteria.getListsize();
            int temp = -1;
            try
            {
                temp = Integer.parseInt(listsizeStr);
            }
            catch (NumberFormatException e)
            {
            }
            if(temp != -1) {
                totalRows = temp;
            }
           
            while ((rs2.next()) && (rowCount < totalRows))
            {
                Map row = new HashMap();
                row.put("count", "" + rs2.getInt("itemcount"));
                String col = rs2.getString(groupColumn);
                int maxColLen = 35;
                if (col != null)
                {

                    if (col.length() > maxColLen)
                    {
                        col = col.substring(0, maxColLen);
                    }
                }

                row.put("groupColumn", col);
                row.put("min", ""
                        + floatFormatter(rs2.getFloat("amin") / denominator));
                row.put("avg", ""
                        + floatFormatter(rs2.getFloat("aavg") / denominator));
                row.put("max", ""
                        + floatFormatter(rs2.getFloat("amax") / denominator));
                as.addRow(row);
                rowCount++;
            }

        }
        catch (SQLException e)
View Full Code Here

Examples of org.apache.jetspeed.statistics.AggregateStatistics

     * @see org.apache.jetspeed.statistics.PortalStatistics#queryStatistics(org.apache.jetspeed.statistics.StatisticsQueryCriteria)
     */
    public AggregateStatistics queryStatistics(StatisticsQueryCriteria criteria)
            throws InvalidCriteriaException
    {
        AggregateStatistics as = new AggregateStatisticsImpl();
        String query;
        String query2;

        String tableName;
        String groupColumn;

        Date end = new Date();
        Date start = getStartDateFromPeriod(criteria.getTimePeriod(), end);

        String queryType = criteria.getQueryType();
       

        if (PortalStatistics.QUERY_TYPE_USER.equals(queryType))
        {
            tableName = "USER_STATISTICS";
            groupColumn = "USER_NAME";
        } else if (PortalStatistics.QUERY_TYPE_PORTLET.equals(queryType))
        {
            tableName = "PORTLET_STATISTICS";
            groupColumn = "PORTLET";
        } else if (PortalStatistics.QUERY_TYPE_PAGE.equals(queryType))
        {
            tableName = "PAGE_STATISTICS";
            groupColumn = "PAGE";
        } else
        {
            throw new InvalidCriteriaException(
                    " invalid queryType passed to queryStatistics");
        }
        String orderColumn = "itemcount";

        String ascDesc = "DESC";

        if (!PortalStatistics.QUERY_TYPE_USER.equals(queryType))
        {
            query = "select count(*) as itemcount , MIN(ELAPSED_TIME) as amin ,AVG(ELAPSED_TIME) as aavg ,MAX(ELAPSED_TIME) as amax from "
                    + tableName + " where time_stamp > ? and time_stamp < ?";
            query2 = "select count(*) as itemcount ,"
                    + groupColumn
                    + ", MIN(ELAPSED_TIME) as amin ,AVG(ELAPSED_TIME) as aavg ,MAX(ELAPSED_TIME) as amax "
                    + "from " + tableName
                    + " where time_stamp > ? and time_stamp < ? group by "
                    + groupColumn + "  order by " + orderColumn + " " + ascDesc;
        } else
        {
            query = "select count(*) as itemcount , MIN(ELAPSED_TIME) as amin,AVG(ELAPSED_TIME) as aavg ,MAX(ELAPSED_TIME) as amax from "
                    + tableName
                    + " where time_stamp > ? and time_stamp < ? and status = 2";
            query2 = "select count(*) as itemcount ,"
                    + groupColumn
                    + ", MIN(ELAPSED_TIME) as amin ,AVG(ELAPSED_TIME) as aavg ,MAX(ELAPSED_TIME) as amax "
                    + "from "
                    + tableName
                    + " where time_stamp > ? and time_stamp < ? and status = 2 group by "
                    + groupColumn + "  order by " + orderColumn + " " + ascDesc;
        }
        Connection con = null;
        try
        {
            con = ds.getConnection();
            PreparedStatement pstmt = con.prepareStatement(query);
            pstmt.setTimestamp(1, new Timestamp(start.getTime()));
            pstmt.setTimestamp(2, new Timestamp(end.getTime()));
            ResultSet rs = pstmt.executeQuery();
            float denominator = 1.0f;
            if (PortalStatistics.QUERY_TYPE_USER.equals(queryType))
            {
                denominator = 1000f * 60f; // this should convert from mS to
                                           // minutes
            }
            if (rs.next())
            {
                as.setHitCount(rs.getInt("itemcount"));

                as.setMinProcessingTime(rs.getFloat("amin") / denominator);
                as.setAvgProcessingTime(rs.getFloat("aavg") / denominator);
                as.setMaxProcessingTime(rs.getFloat("amax") / denominator);

            }
            PreparedStatement pstmt2 = con.prepareStatement(query2);
            pstmt2.setTimestamp(1, new Timestamp(start.getTime()));
            pstmt2.setTimestamp(2, new Timestamp(end.getTime()));
            ResultSet rs2 = pstmt2.executeQuery();

            int rowCount = 0;
            int totalRows = 5;
            String listsizeStr = criteria.getListsize();
            int temp = -1;
            try
            {
                temp = Integer.parseInt(listsizeStr);
            }
            catch (NumberFormatException e)
            {
            }
            if(temp != -1) {
                totalRows = temp;
            }
           
            while ((rs2.next()) && (rowCount < totalRows))
            {
                Map row = new HashMap();
                row.put("count", "" + rs2.getInt("itemcount"));
                String col = rs2.getString(groupColumn);
                int maxColLen = 35;
                if (col != null)
                {

                    if (col.length() > maxColLen)
                    {
                        col = col.substring(0, maxColLen);
                    }
                }

                row.put("groupColumn", col);
                row.put("min", ""
                        + floatFormatter(rs2.getFloat("amin") / denominator));
                row.put("avg", ""
                        + floatFormatter(rs2.getFloat("aavg") / denominator));
                row.put("max", ""
                        + floatFormatter(rs2.getFloat("amax") / denominator));
                as.addRow(row);
                rowCount++;
            }

        }
        catch (SQLException e)
View Full Code Here

Examples of org.apache.jetspeed.statistics.AggregateStatistics

     * @see org.apache.jetspeed.statistics.PortalStatistics#queryStatistics(org.apache.jetspeed.statistics.StatisticsQueryCriteria)
     */
    public AggregateStatistics queryStatistics(StatisticsQueryCriteria criteria)
            throws InvalidCriteriaException
    {
        AggregateStatistics as = new AggregateStatisticsImpl();
        String query;
        String query2;

        String tableName;
        String groupColumn;

        Date end = new Date();
        Date start = getStartDateFromPeriod(criteria.getTimePeriod(), end);

        String queryType = criteria.getQueryType();
       

        if (PortalStatistics.QUERY_TYPE_USER.equals(queryType))
        {
            tableName = "USER_STATISTICS";
            groupColumn = "USER_NAME";
        } else if (PortalStatistics.QUERY_TYPE_PORTLET.equals(queryType))
        {
            tableName = "PORTLET_STATISTICS";
            groupColumn = "PORTLET";
        } else if (PortalStatistics.QUERY_TYPE_PAGE.equals(queryType))
        {
            tableName = "PAGE_STATISTICS";
            groupColumn = "PAGE";
        } else
        {
            throw new InvalidCriteriaException(
                    " invalid queryType passed to queryStatistics");
        }
        String orderColumn = "itemcount";

        String ascDesc = "DESC";

        if (!PortalStatistics.QUERY_TYPE_USER.equals(queryType))
        {
            query = "select count(*) as itemcount , MIN(ELAPSED_TIME) as amin ,AVG(ELAPSED_TIME) as aavg ,MAX(ELAPSED_TIME) as amax from "
                    + tableName + " where time_stamp > ? and time_stamp < ?";
            query2 = "select count(*) as itemcount ,"
                    + groupColumn
                    + ", MIN(ELAPSED_TIME) as amin ,AVG(ELAPSED_TIME) as aavg ,MAX(ELAPSED_TIME) as amax "
                    + "from " + tableName
                    + " where time_stamp > ? and time_stamp < ? group by "
                    + groupColumn + "  order by " + orderColumn + " " + ascDesc;
        } else
        {
            query = "select count(*) as itemcount , MIN(ELAPSED_TIME) as amin,AVG(ELAPSED_TIME) as aavg ,MAX(ELAPSED_TIME) as amax from "
                    + tableName
                    + " where time_stamp > ? and time_stamp < ? and status = 2";
            query2 = "select count(*) as itemcount ,"
                    + groupColumn
                    + ", MIN(ELAPSED_TIME) as amin ,AVG(ELAPSED_TIME) as aavg ,MAX(ELAPSED_TIME) as amax "
                    + "from "
                    + tableName
                    + " where time_stamp > ? and time_stamp < ? and status = 2 group by "
                    + groupColumn + "  order by " + orderColumn + " " + ascDesc;
        }
        Connection con = null;
        try
        {
            con = ds.getConnection();
            PreparedStatement pstmt = con.prepareStatement(query);
            pstmt.setTimestamp(1, new Timestamp(start.getTime()));
            pstmt.setTimestamp(2, new Timestamp(end.getTime()));
            ResultSet rs = pstmt.executeQuery();
            float denominator = 1.0f;
            if (PortalStatistics.QUERY_TYPE_USER.equals(queryType))
            {
                denominator = 1000f * 60f; // this should convert from mS to
                                           // minutes
            }
            if (rs.next())
            {
                as.setHitCount(rs.getInt("itemcount"));

                as.setMinProcessingTime(rs.getFloat("amin") / denominator);
                as.setAvgProcessingTime(rs.getFloat("aavg") / denominator);
                as.setMaxProcessingTime(rs.getFloat("amax") / denominator);

            }
            PreparedStatement pstmt2 = con.prepareStatement(query2);
            pstmt2.setTimestamp(1, new Timestamp(start.getTime()));
            pstmt2.setTimestamp(2, new Timestamp(end.getTime()));
            ResultSet rs2 = pstmt2.executeQuery();

            int rowCount = 0;
            int totalRows = 5;
            String listsizeStr = criteria.getListsize();
            int temp = -1;
            try
            {
                temp = Integer.parseInt(listsizeStr);
            }
            catch (NumberFormatException e)
            {
            }
            if(temp != -1) {
                totalRows = temp;
            }
           
            while ((rs2.next()) && (rowCount < totalRows))
            {
                Map row = new HashMap();
                row.put("count", "" + rs2.getInt("itemcount"));
                String col = rs2.getString(groupColumn);
                int maxColLen = 35;
                if (col != null)
                {

                    if (col.length() > maxColLen)
                    {
                        col = col.substring(0, maxColLen);
                    }
                }

                row.put("groupColumn", col);
                row.put("min", ""
                        + floatFormatter(rs2.getFloat("amin") / denominator));
                row.put("avg", ""
                        + floatFormatter(rs2.getFloat("aavg") / denominator));
                row.put("max", ""
                        + floatFormatter(rs2.getFloat("amax") / denominator));
                as.addRow(row);
                rowCount++;
            }

        }
        catch (SQLException e)
View Full Code Here

Examples of org.apache.jetspeed.statistics.AggregateStatistics

        Context velocityContext = getContext(request);
        PortletSession session = request.getPortletSession();

        StatisticsQueryCriteria sqc = (StatisticsQueryCriteria) session
                .getAttribute(SESSION_CRITERIA);
        AggregateStatistics stats = (AggregateStatistics) session
                .getAttribute(SESSION_RESULTS);
        if (stats == null)
        {
            if (sqc == null)
            {
View Full Code Here

Examples of org.apache.jetspeed.statistics.AggregateStatistics

        criteria.setTimePeriod(timeperiod);
        String queryType = request.getParameter("queryType");

        criteria.setQueryType(queryType);
        AggregateStatistics stats = statistics.getDefaultEmptyAggregateStatistics();
        try
        {
            statistics.forceFlush();
            stats = statistics.queryStatistics(criteria);
        } catch (InvalidCriteriaException e)
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.