コード例 #1
0
 @Override
 public int getDistinctCountByPeriodUser(
     List<WAPrimaryKey> primaryKeys,
     int action,
     String objectType,
     Date startDate,
     Date endDate,
     List<String> userIds) {
   int nb = 0;
   Connection con = getConnection();
   if (userIds != null && !userIds.isEmpty()) {
     Set<Integer> distinctObjectIds = new HashSet<Integer>(userIds.size());
     try {
       for (String userId : userIds) {
         List<Integer> objectIds =
             HistoryObjectDAO.getListObjectAccessByPeriodAndUser(
                 con, primaryKeys, objectType, startDate, endDate, userId);
         distinctObjectIds.addAll(objectIds);
       }
       nb = distinctObjectIds.size();
     } catch (Exception e) {
       throw new StatisticRuntimeException(
           "StatisticBmEJB().getDistinctCountByPeriod()",
           SilverpeasRuntimeException.ERROR,
           "statistic.CANNOT_GET_HISTORY_STATISTICS_PUBLICATION",
           e);
     } finally {
       DBUtil.close(con);
     }
   }
   return nb;
 }
コード例 #2
0
 @Override
 public int getCountByPeriodAndUser(
     List<WAPrimaryKey> primaryKeys,
     String objectType,
     Date startDate,
     Date endDate,
     List<String> userIds) {
   int nb = 0;
   Connection con = getConnection();
   try {
     if (!userIds.isEmpty()) {
       for (String userId : userIds) {
         for (WAPrimaryKey primaryKey : primaryKeys) {
           nb +=
               HistoryObjectDAO.getCountByPeriodAndUser(
                   con, primaryKey, objectType, startDate, endDate, userId);
         }
       }
     }
   } catch (Exception e) {
     throw new StatisticRuntimeException(
         "StatisticBmEJB().getCountByPeriodAndUser()",
         SilverpeasRuntimeException.ERROR,
         "statistic.CANNOT_GET_HISTORY_STATISTICS_PUBLICATION",
         e);
   } finally {
     DBUtil.close(con);
   }
   return nb;
 }
コード例 #3
0
 @Override
 public int getCount(ForeignPK foreignPK, int action, String objectType) {
   Connection con = getConnection();
   try {
     return HistoryObjectDAO.getCount(con, foreignPK, action, historyTableName, objectType);
   } catch (Exception e) {
     throw new StatisticRuntimeException(
         "StatisticBmEJB().getCount()",
         SilverpeasRuntimeException.ERROR,
         "statistic.CANNOT_GET_HISTORY_STATISTICS_PUBLICATION",
         e);
   } finally {
     DBUtil.close(con);
   }
 }
コード例 #4
0
 @Override
 public void addStat(String userId, ForeignPK foreignPK, int actionType, String objectType) {
   SilverTrace.info("statistic", "StatisticBmEJB.addObjectToHistory", "root.MSG_GEN_ENTER_METHOD");
   Connection con = getConnection();
   try {
     HistoryObjectDAO.add(con, historyTableName, userId, foreignPK, actionType, objectType);
   } catch (Exception e) {
     throw new StatisticRuntimeException(
         "StatisticBmEJB().addObjectToHistory()",
         SilverpeasRuntimeException.ERROR,
         "statistic.CANNOT_ADD_VISITE_NODE",
         e);
   } finally {
     DBUtil.close(con);
   }
 }
コード例 #5
0
 @Override
 public void deleteHistoryByAction(ForeignPK foreignPK, int action, String objectType) {
   SilverTrace.info(
       "statistic", "StatisticBmEJB.deleteHistoryByAction", "root.MSG_GEN_ENTER_METHOD");
   Connection con = getConnection();
   try {
     HistoryObjectDAO.deleteHistoryByObject(con, historyTableName, foreignPK, objectType);
   } catch (Exception e) {
     throw new StatisticRuntimeException(
         "StatisticBmEJB().deleteHistoryByAction",
         SilverpeasRuntimeException.ERROR,
         "statistic.CANNOT_DELETE_HISTORY_STATISTICS_PUBLICATION",
         e);
   } finally {
     DBUtil.close(con);
   }
 }
コード例 #6
0
 public void moveStat(ForeignPK toForeignPK, int actionType, String objectType) {
   SilverTrace.info(
       "statistic", "StatisticBmEJB.deleteHistoryByAction", "root.MSG_GEN_ENTER_METHOD");
   Connection con = null;
   try {
     con = getConnection();
     HistoryObjectDAO.move(con, historyTableName, toForeignPK, actionType, objectType);
   } catch (Exception e) {
     throw new StatisticRuntimeException(
         "StatisticBmEJB().addObjectToHistory()",
         SilverpeasRuntimeException.ERROR,
         "statistic.CANNOT_ADD_VISITE_NODE",
         e);
   } finally {
     freeConnection(con);
   }
 }
コード例 #7
0
 public int getCount(ForeignPK foreignPK, int action, String objectType) {
   int nb = 0;
   Connection con = null;
   try {
     con = getConnection();
     nb = HistoryObjectDAO.getCount(con, foreignPK, action, historyTableName, objectType);
     return nb;
   } catch (Exception e) {
     throw new StatisticRuntimeException(
         "StatisticBmEJB().getCount()",
         SilverpeasRuntimeException.ERROR,
         "statistic.CANNOT_GET_HISTORY_STATISTICS_PUBLICATION",
         e);
   } finally {
     freeConnection(con);
   }
 }
コード例 #8
0
 @Override
 public Collection<HistoryObjectDetail> getLastHistoryOfObjectsForUser(
     String userId, int actionType, String objectType, int nbObjects) {
   SilverTrace.info(
       "statistic", "StatisticBmEJB.getLastHistoryOfObjectsForUser", "root.MSG_GEN_ENTER_METHOD");
   Connection con = getConnection();
   try {
     return HistoryObjectDAO.getLastHistoryDetailOfObjectsForUser(
         con, userId, actionType, objectType, nbObjects);
   } catch (Exception e) {
     throw new StatisticRuntimeException(
         "StatisticBmEJB().getLastHistoryOfObjectsForUser()",
         SilverpeasRuntimeException.ERROR,
         "statistic.CANNOT_GET_HISTORY_STATISTICS_PUBLICATION",
         e);
   } finally {
     DBUtil.close(con);
   }
 }
コード例 #9
0
 @Override
 public Collection<HistoryObjectDetail> getHistoryByObjectAndUser(
     ForeignPK foreignPK, int action, String objectType, String userId) {
   SilverTrace.info(
       "statistic", "StatisticBmEJB.getHistoryByObjectAndUser", "root.MSG_GEN_ENTER_METHOD");
   Connection con = getConnection();
   try {
     return HistoryObjectDAO.getHistoryDetailByObjectAndUser(
         con, historyTableName, foreignPK, objectType, userId);
   } catch (Exception e) {
     throw new StatisticRuntimeException(
         "StatisticBmEJB().getHistoryByObjectAndUser()",
         SilverpeasRuntimeException.ERROR,
         "statistic.CANNOT_GET_HISTORY_STATISTICS_PUBLICATION",
         e);
   } finally {
     DBUtil.close(con);
   }
 }
コード例 #10
0
  /**
   * Method declaration
   *
   * @param foreignPK
   * @return
   * @see
   */
  public Collection<HistoryObjectDetail> getHistoryByAction(
      ForeignPK foreignPK, int action, String objectType) {
    SilverTrace.info("statistic", "StatisticBmEJB.getHistoryByAction", "root.MSG_GEN_ENTER_METHOD");
    Connection con = null;

    try {
      con = getConnection();
      Collection<HistoryObjectDetail> result =
          HistoryObjectDAO.getHistoryDetailByObject(con, historyTableName, foreignPK, objectType);

      return result;
    } catch (Exception e) {
      throw new StatisticRuntimeException(
          "StatisticBmEJB().getHistoryByAction()",
          SilverpeasRuntimeException.ERROR,
          "statistic.CANNOT_GET_HISTORY_STATISTICS_PUBLICATION",
          e);
    } finally {
      freeConnection(con);
    }
  }
コード例 #11
0
 @Override
 public int getDistinctCountByPeriod(
     List<WAPrimaryKey> primaryKeys, int action, String objectType, Date startDate, Date endDate) {
   int nb = 0;
   Connection con = getConnection();
   try {
     List<Integer> objectIds =
         HistoryObjectDAO.getListObjectAccessByPeriod(
             con, primaryKeys, objectType, startDate, endDate);
     Set<Integer> distinctObjectIds = new HashSet<Integer>(objectIds);
     nb = distinctObjectIds.size();
   } catch (Exception e) {
     throw new StatisticRuntimeException(
         "StatisticBmEJB().getDistinctCountByPeriod()",
         SilverpeasRuntimeException.ERROR,
         "statistic.CANNOT_GET_HISTORY_STATISTICS_PUBLICATION",
         e);
   } finally {
     DBUtil.close(con);
   }
   return nb;
 }