示例#1
0
 public void onPeriodChange(int type, long current) {
   if (type == 1) {
     String period = DateUtil.toString(new Date(current), "yyyyMMdd");
     if (period.endsWith("01")) {
       this.isNewMonth = true;
       VisitCount.getInstance().clearType(getStatType(), true);
     } else {
       VisitCount.getInstance().clearType(getStatType(), false);
       VisitCount.getInstance().clearSubType(getStatType(), "Keyword", true);
       VisitCount.getInstance().clearSubType(getStatType(), "Referer", true);
     }
   }
 }
示例#2
0
 public void deal(Visit v) {
   if ("Unload".equals(v.Event)) {
     return;
   }
   if (!this.siteMap.containsKey(new Long(v.SiteID))) {
     VisitCount.getInstance().initLRUMap(v.SiteID, "Source", "Keyword", 1000, null);
     VisitCount.getInstance().initLRUMap(v.SiteID, "Source", "Referer", 1000, null);
     this.siteMap.put(new Long(v.SiteID), "");
   }
   VisitCount.getInstance().add(v.SiteID, "Source", "Host", v.Host);
   if (v.UVFlag)
     if ((StringUtil.isEmpty(v.Referer)) && (v.URL.indexOf("Result.jsp") < 0)) {
       VisitCount.getInstance().add(v.SiteID, "Source", "Direct", "0");
     } else {
       String[] se = getSearchEngine(v);
       if (se == null) {
         String domain = StatUtil.getDomain(v.Referer);
         if (!domain.equalsIgnoreCase(v.Host))
           VisitCount.getInstance().add(v.SiteID, "Source", "Referer", domain);
         else VisitCount.getInstance().add(v.SiteID, "Source", "Direct", "0");
       } else {
         VisitCount.getInstance().add(v.SiteID, "Source", "SearchEngine", se[0]);
         VisitCount.getInstance().add(v.SiteID, "Source", "Keyword", se[1]);
       }
     }
 }
示例#3
0
 public void update(
     Transaction tran, VisitCount vc, long current, boolean newMonthFlag, boolean isNewPeriod) {
   if (!newMonthFlag) {
     Date today = new Date(current);
     if (isNewPeriod) {
       today = DateUtil.addDay(today, -1);
     }
     String period = DateUtil.toString(today, "yyyyMM");
     long[] sites = vc.getSites();
     for (int i = 0; i < sites.length; ++i) {
       URLStat.dealNotNeedInsertItem(vc, period, sites[i], "Source", "Referer");
       URLStat.dealNotNeedInsertItem(vc, period, sites[i], "Source", "Keyword");
     }
   }
   super.update(tran, vc, current, newMonthFlag, isNewPeriod);
 }