Пример #1
0
  /**
   * Obtains report group Id of dashboard from database.
   *
   * @return
   */
  public static int getDashboardReportGroupID() {
    lastAccessed = System.currentTimeMillis();
    ResultSetWrapper rsw = null;
    SqlReader sqlReader = new SqlReader(false);
    int reportGroupID = -1;
    try {
      String sqlQuery = "select reportgroupid from tblreportgroup where description = 'Dashboard'";
      rsw = sqlReader.getInstanceResultSetWrapper(sqlQuery);

      if (rsw.next()) {
        reportGroupID = rsw.getInt("reportgroupid");
      }
    } catch (SQLException se) {
      CyberoamLogger.repLog.error(
          "SQLException ->getDashboardGroupID() -> ReportGroupBean: " + se, se);
    } catch (Exception e) {
      CyberoamLogger.repLog.error("Exception ->getDashboardGroupID() -> ReportGroupBean: " + e, e);
    } finally {
      try {
        sqlReader.close();
        rsw.close();
      } catch (Exception e) {
      }
    }
    return reportGroupID;
  }
Пример #2
0
 /**
  * Checks for duplicate report group based on title of report group.
  *
  * @return
  */
 public int checkForDuplicate() {
   lastAccessed = System.currentTimeMillis();
   String sqlQuery = null;
   int retStatus = -1;
   ResultSetWrapper rsw = null;
   SqlReader sqlReader = null;
   try {
     sqlReader = new SqlReader(false);
     sqlQuery =
         "select count(*) as count from tblreportgroup where title="
             + StringMaker.makeString(getTitle());
     rsw = sqlReader.getInstanceResultSetWrapper(sqlQuery, 120);
     if (rsw.next() && rsw.getInt("count") > 0) {
       retStatus = -4;
     }
     CyberoamLogger.appLog.error(
         "Exception->checkForDuplicate()->ReportGroupBean->retStatus: " + retStatus);
   } catch (Exception e) {
     CyberoamLogger.appLog.error("Exception->checkForDuplicate()->ReportGroupBean->: " + e);
     return -4;
   } finally {
     try {
       rsw.close();
       sqlReader.close();
     } catch (Exception e) {
     }
   }
   return retStatus;
 }
Пример #3
0
 /**
  * Obtains instance of report group by {@link ResultSetWrapper}.
  *
  * @param rsw
  * @return
  */
 public static ReportGroupBean getBeanByResultSetWrapper(ResultSetWrapper rsw) {
   ReportGroupBean reportGroupBean = new ReportGroupBean();
   try {
     reportGroupBean.setReportGroupId(rsw.getInt("reportgroupid"));
     reportGroupBean.setTitle(rsw.getString("title"));
     reportGroupBean.setDescription(rsw.getString("description"));
     reportGroupBean.setInputParams(rsw.getString("inputparams"));
     reportGroupBean.setGroupType(rsw.getInt("grouptype"));
     reportGroupBean.setMenuOrder(rsw.getDouble("menuorder"));
     reportGroupBean.setCategoryId(rsw.getInt("categoryid"));
   } catch (Exception e) {
     CyberoamLogger.repLog.error(
         "Exception->getBeanByResultSetWrapper()->ReportGroupBean: " + e, e);
   }
   return reportGroupBean;
 }