Example #1
0
 public List<StatisticDetailsBean> getViewDetailsStatisticData(
     Date from, Date to, String pageTitle) {
   try {
     List<StatisticDetailsBean> results = new ArrayList<StatisticDetailsBean>();
     if (StringUtils.isEmpty(pageTitle)) {
       return results;
     }
     List<List<String>> gaData = null;
     if (from == null && to == null) {
       gaData = GoogleAnalyticsManager.getInstance().getAllViewDetailsAnalyticsData(pageTitle);
     } else {
       String startDate = DateUtil.convertDateToStringFormat(from, DateUtil.GOOGLE_DATE_FORMAT);
       String endDate = DateUtil.convertDateToStringFormat(to, DateUtil.GOOGLE_DATE_FORMAT);
       gaData =
           GoogleAnalyticsManager.getInstance()
               .getViewDetailsAnalyticsData(startDate, endDate, pageTitle);
     }
     for (List<String> row : gaData) {
       StatisticDetailsBean viewDetailBean = initStatisticBeanFromGaData(row);
       results.add(viewDetailBean);
     }
     return results;
   } catch (Exception e) {
     throw new RuntimeException(
         "Failed to get view details statistic data [pageTitle = " + pageTitle + "]", e);
   }
 }
Example #2
0
 public List<StatisticDetailsBean> getViewsStatisticData(Date from, Date to) {
   try {
     List<List<String>> gaData = null;
     if (from == null && to == null) {
       gaData = GoogleAnalyticsManager.getInstance().getAllViewAnalyticsData();
     } else {
       String startDate = DateUtil.convertDateToStringFormat(from, DateUtil.GOOGLE_DATE_FORMAT);
       String endDate = DateUtil.convertDateToStringFormat(to, DateUtil.GOOGLE_DATE_FORMAT);
       gaData = GoogleAnalyticsManager.getInstance().getViewAnalyticsData(startDate, endDate);
     }
     List<StatisticDetailsBean> results = buildStatisicBeanFromGaData(gaData);
     return results;
   } catch (Exception e) {
     throw new RuntimeException("Failed to get Views statistic data", e);
   }
 }
Example #3
0
 private void buildViewStatisticBean(
     List<OverviewStatisticBean> statisticBeans,
     Date toDate,
     Date fromLast7Days,
     Date fromLast30Days)
     throws IOException {
   int total = GoogleAnalyticsManager.getInstance().getTotalPageViews();
   String endDate = DateUtil.convertDateToStringFormat(toDate, DateUtil.GOOGLE_DATE_FORMAT);
   String startDate =
       DateUtil.convertDateToStringFormat(fromLast7Days, DateUtil.GOOGLE_DATE_FORMAT);
   int last7Days = GoogleAnalyticsManager.getInstance().getPageviews(startDate, endDate);
   startDate = DateUtil.convertDateToStringFormat(fromLast30Days, DateUtil.GOOGLE_DATE_FORMAT);
   int last30Days = GoogleAnalyticsManager.getInstance().getPageviews(startDate, endDate);
   OverviewStatisticBean statisticBean =
       new OverviewStatisticBean(
           "View", total, last7Days, last30Days, WebConstants.FixValue.VIEW_REPORT);
   statisticBeans.add(statisticBean);
 }
Example #4
0
  public List<OverviewStatisticBean> getOverviewStatisticData() {
    try {
      List<OverviewStatisticBean> statisticBeans = new ArrayList<OverviewStatisticBean>();
      Date toDate = new Date();
      Date back7Date = DateUtil.getDateBeforeDays(7);
      Date back30Date = DateUtil.getDateBeforeDays(30);

      buildRegisterStatisticBean(statisticBeans, toDate, back7Date, back30Date);
      buildResumeStatisticBean(statisticBeans, toDate, back7Date, back30Date);
      buildCareerStatisticBean(statisticBeans, toDate, back7Date, back30Date);
      buildCompanyStatisticBean(statisticBeans, toDate, back7Date, back30Date);
      buildContactUsStatisticBean(statisticBeans, toDate, back7Date, back30Date);
      buildViewStatisticBean(statisticBeans, toDate, back7Date, back30Date);

      return statisticBeans;
    } catch (Exception e) {
      throw new RuntimeException("Failed to get overview statistic data", e);
    }
  }
Example #5
0
 private StatisticDetailsBean initStatisticBeanFromGaData(List<String> row) {
   String info = row.get(0);
   String date = row.get(1);
   String hour = row.get(2);
   String minute = row.get(3);
   Date viewDate = DateUtil.convertStringToDate(date + hour + minute, "yyyyMMddhhmm");
   StatisticDetailsBean viewDetailsBean = new StatisticDetailsBean();
   viewDetailsBean.setInfo(info);
   viewDetailsBean.setSubmitDate(new Timestamp(viewDate.getTime()));
   return viewDetailsBean;
 }