Package com.salas.bb.persistence.domain

Examples of com.salas.bb.persistence.domain.VisitStats


                rs = stmt.executeQuery();

                stats = new LinkedList<VisitStats>();
                while (rs.next())
                {
                    stats.add(new VisitStats(
                        rs.getInt("GUIDEID"),
                        rs.getString("TITLE"),
                        rs.getLong("COUNT_TOTAL"),
                        rs.getLong("COUNT_RESET"),
                        rs.getLong("INIT_TIME"),
View Full Code Here


                rs = stmt.executeQuery();

                stats = new LinkedList<VisitStats>();
                while (rs.next())
                {
                    stats.add(new VisitStats(
                        rs.getInt("FEEDID"),
                        rs.getString("TITLE"),
                        rs.getLong("COUNT_TOTAL"),
                        rs.getLong("COUNT_RESET"),
                        rs.getLong("INIT_TIME"),
View Full Code Here

     */
    public void testAddGuide()
        throws PersistenceException, SQLException
    {
        // Check if the row is there
        VisitStats stats = getGuideVisitStats(guide.getID());
        assertNotNull(stats);
        assertEquals(0, stats.getCountTotal());
        assertEquals(0, stats.getCountReset());
        assertTrue("Failed range check. initTime = " + stats.getInitTime() + ", now=" + creationTime,
            Math.abs(stats.getInitTime() - creationTime) < MS_RANGE);
        assertTrue("Failed range check. resetTime = " + stats.getResetTime() + ", now=" + creationTime,
            Math.abs(stats.getResetTime() - creationTime) < MS_RANGE);
    }
View Full Code Here

     */
    public void testAddFeed()
        throws PersistenceException, SQLException
    {
        // Check if the row is there
        VisitStats stats = getFeedVisitStats(feed.getID());
        assertNotNull(stats);
        assertEquals(0, stats.getCountTotal());
        assertEquals(0, stats.getCountReset());
        assertTrue("Failed range check. initTime = " + stats.getInitTime() + ", now=" + creationTime,
            Math.abs(stats.getInitTime() - creationTime) < MS_RANGE);
        assertTrue("Failed range check. resetTime = " + stats.getResetTime() + ", now=" + creationTime,
            Math.abs(stats.getResetTime() - creationTime) < MS_RANGE);
    }
View Full Code Here

    {
        // Visit a guide
        pm.guideVisited(guide);

        // Check
        VisitStats stats = getGuideVisitStats(guide.getID());
        assertEquals(guide.getTitle(), stats.getObjectTitle());
        assertEquals(1, stats.getCountTotal());
        assertEquals(1, stats.getCountReset());
    }
View Full Code Here

    {
        // Visit a feed
        pm.feedVisited(feed);

        // Check
        VisitStats stats = getFeedVisitStats(feed.getID());
        assertEquals(feed.getTitle(), stats.getObjectTitle());
        assertEquals(1, stats.getCountTotal());
        assertEquals(1, stats.getCountReset());
    }
View Full Code Here

     *
     * @return stats or <code>NULL</code> if row isn't there.
     */
    private VisitStats getGuideVisitStats(long id)
    {
        VisitStats stats = null;

        try
        {
            Statement stmt = pm.getConnection().createStatement();
            ResultSet rs = stmt.executeQuery(
                "SELECT GS.*, G.TITLE TITLE " +
                "FROM GUIDESTATS GS, GUIDES G " +
                "WHERE G.ID=GUIDEID AND GUIDEID = " + id);
            if (rs.next())
            {
                stats = new VisitStats((int)id,
                    rs.getString("TITLE"),
                    rs.getLong("COUNT_TOTAL"),
                    rs.getLong("COUNT_RESET"),
                    rs.getLong("INIT_TIME"),
                    rs.getLong("RESET_TIME"));
View Full Code Here

     *
     * @return stats or <code>NULL</code> if row isn't there.
     */
    private VisitStats getFeedVisitStats(long id)
    {
        VisitStats stats = null;

        try
        {
            Statement stmt = pm.getConnection().createStatement();
            ResultSet rs = stmt.executeQuery(
                "SELECT FS.*, COALESCE(DF.TITLE, DF.XMLURL, QF.TITLE, SF.TITLE) TITLE " +
                "FROM FEEDSTATS FS LEFT JOIN DIRECTFEEDS DF ON DF.FEEDID=FS.FEEDID " +
                    "LEFT JOIN QUERYFEEDS QF ON QF.FEEDID=FS.FEEDID " +
                    "LEFT JOIN SEARCHFEEDS SF ON SF.FEEDID=FS.FEEDID " +
                "WHERE FEEDID = " + id);
            if (rs.next())
            {
                stats = new VisitStats((int)id,
                    rs.getString("TITLE"),
                    rs.getLong("COUNT_TOTAL"),
                    rs.getLong("COUNT_RESET"),
                    rs.getLong("INIT_TIME"),
                    rs.getLong("RESET_TIME"));
View Full Code Here

TOP

Related Classes of com.salas.bb.persistence.domain.VisitStats

Copyright © 2018 www.massapicom. 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.