⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 visitstats.java

📁 xwiki 源码
💻 JAVA
字号:
/**
 * ===================================================================
 *
 * Copyright (c) 2003,2004 Ludovic Dubost, All rights reserved.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details, published at 
 * http://www.gnu.org/copyleft/lesser.html or in lesser.txt in the
 * root folder of this distribution.

 * Created by
 * User: Ludovic Dubost
 * Date: 31 juil. 2004
 * Time: 18:44:45
 */
package com.xpn.xwiki.stats.impl;

import com.xpn.xwiki.objects.classes.BaseClass;

import java.util.Date;

public class VisitStats extends XWikiStats {
    protected VisitStats oldObject = null;

    public VisitStats() {
    }

    public VisitStats(String user, String uniqueID, String cookie, String ip, String userAgent, Date startDate, int periodtype) {
        super(startDate, periodtype);
        setName(user);
        setClassName("internal");
        setStartDate(startDate);
        setUniqueID(uniqueID);
        setCookie(cookie);
        setIP(ip);
        setUserAgent(userAgent);
    }

    public void rememberOldObject(VisitStats vobject) {
        if (oldObject==null)
         oldObject = vobject;
    }

    public VisitStats getOldObject() {
        return oldObject;
    }

    public int getPageSaves() {
        return getIntValue("pageSaves");
    }

    public void  setPageSaves(int pageSaves) {
        setIntValue("pageSaves", pageSaves);
    }

    public void  incPageSaves() {
        setIntValue("pageSaves", getPageSaves() + 1);
    }

    public int getDownloads() {
        return getIntValue("downloads");
    }

    public void  setDownloads(int downloads) {
        setIntValue("downloads", downloads);
    }

    public void  incDownloads() {
        setIntValue("downloads", getDownloads() + 1);
    }

    public Date getStartDate() {
        return getDateValue("startDate");
    }

    public void  setStartDate(Date startDate) {
        setDateValue("startDate", startDate);
    }

    public Date getEndDate() {
        return getDateValue("endDate");
    }

    public void  setEndDate(Date endDate) {
        setDateValue("endDate", endDate);
    }

    public String getUniqueID() {
        return getStringValue("uniqueID");
    }

    public void setUniqueID(String uniqueID) {
        // Changing the unique ID is changing the number
        if (getStartDate()!=null) {
         String nb =  uniqueID + getStartDate().getTime();
         setNumber(nb.hashCode());
        }
        setStringValue("uniqueID", uniqueID);
    }

    public String getCookie() {
        return getStringValue("cookie");
    }

    public void setCookie(String cookie) {
        setStringValue("cookie", cookie);
    }

    public String getIP() {
        return getStringValue("ip");
    }

    public void setIP(String ip) {
        setStringValue("ip", ip);
    }

    public String getUserAgent() {
        return getStringValue("userAgent");
    }

    public void setUserAgent(String userAgent) {
        setStringValue("userAgent", userAgent);
    }

    public String getUser() {
        return getName();
    }

    public void setUser(String user) {
        setName(user);
    }

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -