/**
   * Returns the number of social equity histories.
   *
   * @return the number of social equity histories
   * @throws SystemException if a system exception occurred
   */
  public int countAll() throws SystemException {
    Object[] finderArgs = new Object[0];

    Long count = (Long) FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL, finderArgs, this);

    if (count == null) {
      Session session = null;

      try {
        session = openSession();

        Query q = session.createQuery(_SQL_COUNT_SOCIALEQUITYHISTORY);

        count = (Long) q.uniqueResult();
      } catch (Exception e) {
        throw processException(e);
      } finally {
        if (count == null) {
          count = Long.valueOf(0);
        }

        FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs, count);

        closeSession(session);
      }
    }

    return count.intValue();
  }
コード例 #2
0
  /**
   * Returns the number of shopping item prices.
   *
   * @return the number of shopping item prices
   */
  @Override
  public int countAll() {
    Long count = (Long) finderCache.getResult(FINDER_PATH_COUNT_ALL, FINDER_ARGS_EMPTY, this);

    if (count == null) {
      Session session = null;

      try {
        session = openSession();

        Query q = session.createQuery(_SQL_COUNT_SHOPPINGITEMPRICE);

        count = (Long) q.uniqueResult();

        finderCache.putResult(FINDER_PATH_COUNT_ALL, FINDER_ARGS_EMPTY, count);
      } catch (Exception e) {
        finderCache.removeResult(FINDER_PATH_COUNT_ALL, FINDER_ARGS_EMPTY);

        throw processException(e);
      } finally {
        closeSession(session);
      }
    }

    return count.intValue();
  }
  public int countAll() throws SystemException {
    Object[] finderArgs = new Object[0];

    Long count = (Long) FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL, finderArgs, this);

    if (count == null) {
      Session session = null;

      try {
        session = openSession();

        Query q =
            session.createQuery(
                "SELECT COUNT(*) FROM com.ext.portlet.debaterevision.model.DebateItemReference");

        count = (Long) q.uniqueResult();
      } catch (Exception e) {
        throw processException(e);
      } finally {
        if (count == null) {
          count = Long.valueOf(0);
        }

        FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs, count);

        closeSession(session);
      }
    }

    return count.intValue();
  }
コード例 #4
0
  /**
   * Returns the number of class names.
   *
   * @return the number of class names
   * @throws SystemException if a system exception occurred
   */
  public int countAll() throws SystemException {
    Long count = (Long) FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL, FINDER_ARGS_EMPTY, this);

    if (count == null) {
      Session session = null;

      try {
        session = openSession();

        Query q = session.createQuery(_SQL_COUNT_CLASSNAME);

        count = (Long) q.uniqueResult();
      } catch (Exception e) {
        throw processException(e);
      } finally {
        if (count == null) {
          count = Long.valueOf(0);
        }

        FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, FINDER_ARGS_EMPTY, count);

        closeSession(session);
      }
    }

    return count.intValue();
  }
コード例 #5
0
  /**
   * Returns the number of projects entries.
   *
   * @return the number of projects entries
   * @throws SystemException if a system exception occurred
   */
  @Override
  public int countAll() throws SystemException {
    Long count = (Long) FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL, FINDER_ARGS_EMPTY, this);

    if (count == null) {
      Session session = null;

      try {
        session = openSession();

        Query q = session.createQuery(_SQL_COUNT_PROJECTSENTRY);

        count = (Long) q.uniqueResult();

        FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, FINDER_ARGS_EMPTY, count);
      } catch (Exception e) {
        FinderCacheUtil.removeResult(FINDER_PATH_COUNT_ALL, FINDER_ARGS_EMPTY);

        throw processException(e);
      } finally {
        closeSession(session);
      }
    }

    return count.intValue();
  }
  public int countAll() throws SystemException {
    Object[] finderArgs = new Object[0];

    Long count = (Long) FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL, finderArgs, this);

    if (count == null) {
      Session session = null;

      try {
        session = openSession();

        Query q =
            session.createQuery(
                "SELECT COUNT(*) FROM larion.progate.cds.model.ViewListTitleCompetencies");

        count = (Long) q.uniqueResult();
      } catch (Exception e) {
        throw processException(e);
      } finally {
        if (count == null) {
          count = Long.valueOf(0);
        }

        FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs, count);

        closeSession(session);
      }
    }

    return count.intValue();
  }
コード例 #7
0
  /**
   * Returns the number of entries where userId = ? and emailAddress = ?.
   *
   * @param userId the user ID
   * @param emailAddress the email address
   * @return the number of matching entries
   * @throws SystemException if a system exception occurred
   */
  @Override
  public int countByU_EA(long userId, String emailAddress) throws SystemException {
    FinderPath finderPath = FINDER_PATH_COUNT_BY_U_EA;

    Object[] finderArgs = new Object[] {userId, emailAddress};

    Long count = (Long) FinderCacheUtil.getResult(finderPath, finderArgs, this);

    if (count == null) {
      StringBundler query = new StringBundler(3);

      query.append(_SQL_COUNT_ENTRY_WHERE);

      query.append(_FINDER_COLUMN_U_EA_USERID_2);

      boolean bindEmailAddress = false;

      if (emailAddress == null) {
        query.append(_FINDER_COLUMN_U_EA_EMAILADDRESS_1);
      } else if (emailAddress.equals(StringPool.BLANK)) {
        query.append(_FINDER_COLUMN_U_EA_EMAILADDRESS_3);
      } else {
        bindEmailAddress = true;

        query.append(_FINDER_COLUMN_U_EA_EMAILADDRESS_2);
      }

      String sql = query.toString();

      Session session = null;

      try {
        session = openSession();

        Query q = session.createQuery(sql);

        QueryPos qPos = QueryPos.getInstance(q);

        qPos.add(userId);

        if (bindEmailAddress) {
          qPos.add(emailAddress);
        }

        count = (Long) q.uniqueResult();

        FinderCacheUtil.putResult(finderPath, finderArgs, count);
      } catch (Exception e) {
        FinderCacheUtil.removeResult(finderPath, finderArgs);

        throw processException(e);
      } finally {
        closeSession(session);
      }
    }

    return count.intValue();
  }
コード例 #8
0
  /**
   * Returns the number of bars where text = ?.
   *
   * @param text the text
   * @return the number of matching bars
   */
  @Override
  public int countByText(String text) {
    FinderPath finderPath = FINDER_PATH_COUNT_BY_TEXT;

    Object[] finderArgs = new Object[] {text};

    Long count = (Long) FinderCacheUtil.getResult(finderPath, finderArgs, this);

    if (count == null) {
      StringBundler query = new StringBundler(2);

      query.append(_SQL_COUNT_BAR_WHERE);

      boolean bindText = false;

      if (text == null) {
        query.append(_FINDER_COLUMN_TEXT_TEXT_1);
      } else if (text.equals(StringPool.BLANK)) {
        query.append(_FINDER_COLUMN_TEXT_TEXT_3);
      } else {
        bindText = true;

        query.append(_FINDER_COLUMN_TEXT_TEXT_2);
      }

      String sql = query.toString();

      Session session = null;

      try {
        session = openSession();

        Query q = session.createQuery(sql);

        QueryPos qPos = QueryPos.getInstance(q);

        if (bindText) {
          qPos.add(text);
        }

        count = (Long) q.uniqueResult();

        FinderCacheUtil.putResult(finderPath, finderArgs, count);
      } catch (Exception e) {
        FinderCacheUtil.removeResult(finderPath, finderArgs);

        throw processException(e);
      } finally {
        closeSession(session);
      }
    }

    return count.intValue();
  }
コード例 #9
0
  /**
   * Returns the number of releases where servletContextName = ?.
   *
   * @param servletContextName the servlet context name
   * @return the number of matching releases
   * @throws SystemException if a system exception occurred
   */
  public int countByServletContextName(String servletContextName) throws SystemException {
    FinderPath finderPath = FINDER_PATH_COUNT_BY_SERVLETCONTEXTNAME;

    Object[] finderArgs = new Object[] {servletContextName};

    Long count = (Long) FinderCacheUtil.getResult(finderPath, finderArgs, this);

    if (count == null) {
      StringBundler query = new StringBundler(2);

      query.append(_SQL_COUNT_RELEASE_WHERE);

      boolean bindServletContextName = false;

      if (servletContextName == null) {
        query.append(_FINDER_COLUMN_SERVLETCONTEXTNAME_SERVLETCONTEXTNAME_1);
      } else if (servletContextName.equals(StringPool.BLANK)) {
        query.append(_FINDER_COLUMN_SERVLETCONTEXTNAME_SERVLETCONTEXTNAME_3);
      } else {
        bindServletContextName = true;

        query.append(_FINDER_COLUMN_SERVLETCONTEXTNAME_SERVLETCONTEXTNAME_2);
      }

      String sql = query.toString();

      Session session = null;

      try {
        session = openSession();

        Query q = session.createQuery(sql);

        QueryPos qPos = QueryPos.getInstance(q);

        if (bindServletContextName) {
          qPos.add(servletContextName.toLowerCase());
        }

        count = (Long) q.uniqueResult();

        FinderCacheUtil.putResult(finderPath, finderArgs, count);
      } catch (Exception e) {
        FinderCacheUtil.removeResult(finderPath, finderArgs);

        throw processException(e);
      } finally {
        closeSession(session);
      }
    }

    return count.intValue();
  }
コード例 #10
0
  /**
   * Returns the number of class names where value = ?.
   *
   * @param value the value
   * @return the number of matching class names
   * @throws SystemException if a system exception occurred
   */
  public int countByValue(String value) throws SystemException {
    Object[] finderArgs = new Object[] {value};

    Long count = (Long) FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_VALUE, finderArgs, this);

    if (count == null) {
      StringBundler query = new StringBundler(2);

      query.append(_SQL_COUNT_CLASSNAME_WHERE);

      if (value == null) {
        query.append(_FINDER_COLUMN_VALUE_VALUE_1);
      } else {
        if (value.equals(StringPool.BLANK)) {
          query.append(_FINDER_COLUMN_VALUE_VALUE_3);
        } else {
          query.append(_FINDER_COLUMN_VALUE_VALUE_2);
        }
      }

      String sql = query.toString();

      Session session = null;

      try {
        session = openSession();

        Query q = session.createQuery(sql);

        QueryPos qPos = QueryPos.getInstance(q);

        if (value != null) {
          qPos.add(value);
        }

        count = (Long) q.uniqueResult();
      } catch (Exception e) {
        throw processException(e);
      } finally {
        if (count == null) {
          count = Long.valueOf(0);
        }

        FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_VALUE, finderArgs, count);

        closeSession(session);
      }
    }

    return count.intValue();
  }
  /**
   * Returns the number of semesters where beginYear = ? and endYear = ? and division =
   * ?.
   *
   * @param beginYear the begin year
   * @param endYear the end year
   * @param division the division
   * @return the number of matching semesters
   */
  @Override
  public int countByB_E_D(int beginYear, int endYear, int division) {
    FinderPath finderPath = FINDER_PATH_COUNT_BY_B_E_D;

    Object[] finderArgs = new Object[] {beginYear, endYear, division};

    Long count = (Long) finderCache.getResult(finderPath, finderArgs, this);

    if (count == null) {
      StringBundler query = new StringBundler(4);

      query.append(_SQL_COUNT_SEMESTER_WHERE);

      query.append(_FINDER_COLUMN_B_E_D_BEGINYEAR_2);

      query.append(_FINDER_COLUMN_B_E_D_ENDYEAR_2);

      query.append(_FINDER_COLUMN_B_E_D_DIVISION_2);

      String sql = query.toString();

      Session session = null;

      try {
        session = openSession();

        Query q = session.createQuery(sql);

        QueryPos qPos = QueryPos.getInstance(q);

        qPos.add(beginYear);

        qPos.add(endYear);

        qPos.add(division);

        count = (Long) q.uniqueResult();

        finderCache.putResult(finderPath, finderArgs, count);
      } catch (Exception e) {
        finderCache.removeResult(finderPath, finderArgs);

        throw processException(e);
      } finally {
        closeSession(session);
      }
    }

    return count.intValue();
  }
  /**
   * Returns the number of Tips of the Day Userses where companyId = ? and groupId = ? and
   * userId = ?.
   *
   * @param companyId the company ID
   * @param groupId the group ID
   * @param userId the user ID
   * @return the number of matching Tips of the Day Userses
   * @throws SystemException if a system exception occurred
   */
  @Override
  public int countByC_G_U(long companyId, long groupId, long userId) throws SystemException {
    FinderPath finderPath = FINDER_PATH_COUNT_BY_C_G_U;

    Object[] finderArgs = new Object[] {companyId, groupId, userId};

    Long count = (Long) FinderCacheUtil.getResult(finderPath, finderArgs, this);

    if (count == null) {
      StringBundler query = new StringBundler(4);

      query.append(_SQL_COUNT_TIPSOFTHEDAYUSERS_WHERE);

      query.append(_FINDER_COLUMN_C_G_U_COMPANYID_2);

      query.append(_FINDER_COLUMN_C_G_U_GROUPID_2);

      query.append(_FINDER_COLUMN_C_G_U_USERID_2);

      String sql = query.toString();

      Session session = null;

      try {
        session = openSession();

        Query q = session.createQuery(sql);

        QueryPos qPos = QueryPos.getInstance(q);

        qPos.add(companyId);

        qPos.add(groupId);

        qPos.add(userId);

        count = (Long) q.uniqueResult();

        FinderCacheUtil.putResult(finderPath, finderArgs, count);
      } catch (Exception e) {
        FinderCacheUtil.removeResult(finderPath, finderArgs);

        throw processException(e);
      } finally {
        closeSession(session);
      }
    }

    return count.intValue();
  }
コード例 #13
0
  /**
   * Returns the number of d l syncs where companyId = ? and modifiedDate > ? and
   * repositoryId = ?.
   *
   * @param companyId the company ID
   * @param modifiedDate the modified date
   * @param repositoryId the repository ID
   * @return the number of matching d l syncs
   * @throws SystemException if a system exception occurred
   */
  public int countByC_M_R(long companyId, long modifiedDate, long repositoryId)
      throws SystemException {
    FinderPath finderPath = FINDER_PATH_WITH_PAGINATION_COUNT_BY_C_M_R;

    Object[] finderArgs = new Object[] {companyId, modifiedDate, repositoryId};

    Long count = (Long) FinderCacheUtil.getResult(finderPath, finderArgs, this);

    if (count == null) {
      StringBundler query = new StringBundler(4);

      query.append(_SQL_COUNT_DLSYNC_WHERE);

      query.append(_FINDER_COLUMN_C_M_R_COMPANYID_2);

      query.append(_FINDER_COLUMN_C_M_R_MODIFIEDDATE_2);

      query.append(_FINDER_COLUMN_C_M_R_REPOSITORYID_2);

      String sql = query.toString();

      Session session = null;

      try {
        session = openSession();

        Query q = session.createQuery(sql);

        QueryPos qPos = QueryPos.getInstance(q);

        qPos.add(companyId);

        qPos.add(modifiedDate);

        qPos.add(repositoryId);

        count = (Long) q.uniqueResult();

        FinderCacheUtil.putResult(finderPath, finderArgs, count);
      } catch (Exception e) {
        FinderCacheUtil.removeResult(finderPath, finderArgs);

        throw processException(e);
      } finally {
        closeSession(session);
      }
    }

    return count.intValue();
  }
コード例 #14
0
  /**
   * Returns the number of announcements flags where userId = ? and entryId = ? and value =
   * ?.
   *
   * @param userId the user ID
   * @param entryId the entry ID
   * @param value the value
   * @return the number of matching announcements flags
   * @throws SystemException if a system exception occurred
   */
  public int countByU_E_V(long userId, long entryId, int value) throws SystemException {
    Object[] finderArgs = new Object[] {userId, entryId, value};

    Long count = (Long) FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_U_E_V, finderArgs, this);

    if (count == null) {
      StringBundler query = new StringBundler(4);

      query.append(_SQL_COUNT_ANNOUNCEMENTSFLAG_WHERE);

      query.append(_FINDER_COLUMN_U_E_V_USERID_2);

      query.append(_FINDER_COLUMN_U_E_V_ENTRYID_2);

      query.append(_FINDER_COLUMN_U_E_V_VALUE_2);

      String sql = query.toString();

      Session session = null;

      try {
        session = openSession();

        Query q = session.createQuery(sql);

        QueryPos qPos = QueryPos.getInstance(q);

        qPos.add(userId);

        qPos.add(entryId);

        qPos.add(value);

        count = (Long) q.uniqueResult();
      } catch (Exception e) {
        throw processException(e);
      } finally {
        if (count == null) {
          count = Long.valueOf(0);
        }

        FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_U_E_V, finderArgs, count);

        closeSession(session);
      }
    }

    return count.intValue();
  }
コード例 #15
0
  /**
   * Returns the number of shards where classNameId = ? and classPK = ?.
   *
   * @param classNameId the class name ID
   * @param classPK the class p k
   * @return the number of matching shards
   * @throws SystemException if a system exception occurred
   */
  @Override
  public int countByC_C(long classNameId, long classPK) throws SystemException {
    FinderPath finderPath = FINDER_PATH_COUNT_BY_C_C;

    Object[] finderArgs = new Object[] {classNameId, classPK};

    Long count = (Long) FinderCacheUtil.getResult(finderPath, finderArgs, this);

    if (count == null) {
      StringBundler query = new StringBundler(3);

      query.append(_SQL_COUNT_SHARD_WHERE);

      query.append(_FINDER_COLUMN_C_C_CLASSNAMEID_2);

      query.append(_FINDER_COLUMN_C_C_CLASSPK_2);

      String sql = query.toString();

      Session session = null;

      try {
        session = openSession();

        Query q = session.createQuery(sql);

        QueryPos qPos = QueryPos.getInstance(q);

        qPos.add(classNameId);

        qPos.add(classPK);

        count = (Long) q.uniqueResult();

        FinderCacheUtil.putResult(finderPath, finderArgs, count);
      } catch (Exception e) {
        FinderCacheUtil.removeResult(finderPath, finderArgs);

        throw processException(e);
      } finally {
        closeSession(session);
      }
    }

    return count.intValue();
  }
コード例 #16
0
  /**
   * Returns the number of expando rows where tableId = ? and classPK = ?.
   *
   * @param tableId the table ID
   * @param classPK the class p k
   * @return the number of matching expando rows
   * @throws SystemException if a system exception occurred
   */
  public int countByT_C(long tableId, long classPK) throws SystemException {
    Object[] finderArgs = new Object[] {tableId, classPK};

    Long count = (Long) FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_T_C, finderArgs, this);

    if (count == null) {
      StringBundler query = new StringBundler(3);

      query.append(_SQL_COUNT_EXPANDOROW_WHERE);

      query.append(_FINDER_COLUMN_T_C_TABLEID_2);

      query.append(_FINDER_COLUMN_T_C_CLASSPK_2);

      String sql = query.toString();

      Session session = null;

      try {
        session = openSession();

        Query q = session.createQuery(sql);

        QueryPos qPos = QueryPos.getInstance(q);

        qPos.add(tableId);

        qPos.add(classPK);

        count = (Long) q.uniqueResult();
      } catch (Exception e) {
        throw processException(e);
      } finally {
        if (count == null) {
          count = Long.valueOf(0);
        }

        FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_T_C, finderArgs, count);

        closeSession(session);
      }
    }

    return count.intValue();
  }
コード例 #17
0
  /**
   * Returns the number of portal preferenceses where ownerId = ? and ownerType = ?.
   *
   * @param ownerId the owner ID
   * @param ownerType the owner type
   * @return the number of matching portal preferenceses
   * @throws SystemException if a system exception occurred
   */
  public int countByO_O(long ownerId, int ownerType) throws SystemException {
    Object[] finderArgs = new Object[] {ownerId, ownerType};

    Long count = (Long) FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_O_O, finderArgs, this);

    if (count == null) {
      StringBundler query = new StringBundler(3);

      query.append(_SQL_COUNT_PORTALPREFERENCES_WHERE);

      query.append(_FINDER_COLUMN_O_O_OWNERID_2);

      query.append(_FINDER_COLUMN_O_O_OWNERTYPE_2);

      String sql = query.toString();

      Session session = null;

      try {
        session = openSession();

        Query q = session.createQuery(sql);

        QueryPos qPos = QueryPos.getInstance(q);

        qPos.add(ownerId);

        qPos.add(ownerType);

        count = (Long) q.uniqueResult();
      } catch (Exception e) {
        throw processException(e);
      } finally {
        if (count == null) {
          count = Long.valueOf(0);
        }

        FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_O_O, finderArgs, count);

        closeSession(session);
      }
    }

    return count.intValue();
  }
コード例 #18
0
  /**
   * Returns the number of layout sets where groupId = ? and privateLayout = ?.
   *
   * @param groupId the group ID
   * @param privateLayout the private layout
   * @return the number of matching layout sets
   * @throws SystemException if a system exception occurred
   */
  public int countByG_P(long groupId, boolean privateLayout) throws SystemException {
    Object[] finderArgs = new Object[] {groupId, privateLayout};

    Long count = (Long) FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_P, finderArgs, this);

    if (count == null) {
      StringBundler query = new StringBundler(3);

      query.append(_SQL_COUNT_LAYOUTSET_WHERE);

      query.append(_FINDER_COLUMN_G_P_GROUPID_2);

      query.append(_FINDER_COLUMN_G_P_PRIVATELAYOUT_2);

      String sql = query.toString();

      Session session = null;

      try {
        session = openSession();

        Query q = session.createQuery(sql);

        QueryPos qPos = QueryPos.getInstance(q);

        qPos.add(groupId);

        qPos.add(privateLayout);

        count = (Long) q.uniqueResult();
      } catch (Exception e) {
        throw processException(e);
      } finally {
        if (count == null) {
          count = Long.valueOf(0);
        }

        FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_P, finderArgs, count);

        closeSession(session);
      }
    }

    return count.intValue();
  }
コード例 #19
0
  /**
   * Returns the number of images where size < ?.
   *
   * @param size the size
   * @return the number of matching images
   * @throws SystemException if a system exception occurred
   */
  public int countByLtSize(int size) throws SystemException {
    Object[] finderArgs = new Object[] {size};

    Long count =
        (Long)
            FinderCacheUtil.getResult(
                FINDER_PATH_WITH_PAGINATION_COUNT_BY_LTSIZE, finderArgs, this);

    if (count == null) {
      StringBundler query = new StringBundler(2);

      query.append(_SQL_COUNT_IMAGE_WHERE);

      query.append(_FINDER_COLUMN_LTSIZE_SIZE_2);

      String sql = query.toString();

      Session session = null;

      try {
        session = openSession();

        Query q = session.createQuery(sql);

        QueryPos qPos = QueryPos.getInstance(q);

        qPos.add(size);

        count = (Long) q.uniqueResult();
      } catch (Exception e) {
        throw processException(e);
      } finally {
        if (count == null) {
          count = Long.valueOf(0);
        }

        FinderCacheUtil.putResult(FINDER_PATH_WITH_PAGINATION_COUNT_BY_LTSIZE, finderArgs, count);

        closeSession(session);
      }
    }

    return count.intValue();
  }
コード例 #20
0
  /**
   * Returns the number of projects entries where userId = ?.
   *
   * @param userId the user ID
   * @return the number of matching projects entries
   * @throws SystemException if a system exception occurred
   */
  @Override
  public int countByUserId(long userId) throws SystemException {
    FinderPath finderPath = FINDER_PATH_COUNT_BY_USERID;

    Object[] finderArgs = new Object[] {userId};

    Long count = (Long) FinderCacheUtil.getResult(finderPath, finderArgs, this);

    if (count == null) {
      StringBundler query = new StringBundler(2);

      query.append(_SQL_COUNT_PROJECTSENTRY_WHERE);

      query.append(_FINDER_COLUMN_USERID_USERID_2);

      String sql = query.toString();

      Session session = null;

      try {
        session = openSession();

        Query q = session.createQuery(sql);

        QueryPos qPos = QueryPos.getInstance(q);

        qPos.add(userId);

        count = (Long) q.uniqueResult();

        FinderCacheUtil.putResult(finderPath, finderArgs, count);
      } catch (Exception e) {
        FinderCacheUtil.removeResult(finderPath, finderArgs);

        throw processException(e);
      } finally {
        closeSession(session);
      }
    }

    return count.intValue();
  }
コード例 #21
0
  /**
   * Returns the number of foos where field2 = ?.
   *
   * @param field2 the field2
   * @return the number of matching foos
   */
  @Override
  public int countByField2(boolean field2) {
    FinderPath finderPath = FINDER_PATH_COUNT_BY_FIELD2;

    Object[] finderArgs = new Object[] {field2};

    Long count = (Long) FinderCacheUtil.getResult(finderPath, finderArgs, this);

    if (count == null) {
      StringBundler query = new StringBundler(2);

      query.append(_SQL_COUNT_FOO_WHERE);

      query.append(_FINDER_COLUMN_FIELD2_FIELD2_2);

      String sql = query.toString();

      Session session = null;

      try {
        session = openSession();

        Query q = session.createQuery(sql);

        QueryPos qPos = QueryPos.getInstance(q);

        qPos.add(field2);

        count = (Long) q.uniqueResult();

        FinderCacheUtil.putResult(finderPath, finderArgs, count);
      } catch (Exception e) {
        FinderCacheUtil.removeResult(finderPath, finderArgs);

        throw processException(e);
      } finally {
        closeSession(session);
      }
    }

    return count.intValue();
  }
コード例 #22
0
  /**
   * Returns the number of d l sync events where modifiedTime > ?.
   *
   * @param modifiedTime the modified time
   * @return the number of matching d l sync events
   * @throws SystemException if a system exception occurred
   */
  @Override
  public int countByModifiedTime(long modifiedTime) throws SystemException {
    FinderPath finderPath = FINDER_PATH_WITH_PAGINATION_COUNT_BY_MODIFIEDTIME;

    Object[] finderArgs = new Object[] {modifiedTime};

    Long count = (Long) FinderCacheUtil.getResult(finderPath, finderArgs, this);

    if (count == null) {
      StringBundler query = new StringBundler(2);

      query.append(_SQL_COUNT_DLSYNCEVENT_WHERE);

      query.append(_FINDER_COLUMN_MODIFIEDTIME_MODIFIEDTIME_2);

      String sql = query.toString();

      Session session = null;

      try {
        session = openSession();

        Query q = session.createQuery(sql);

        QueryPos qPos = QueryPos.getInstance(q);

        qPos.add(modifiedTime);

        count = (Long) q.uniqueResult();

        FinderCacheUtil.putResult(finderPath, finderArgs, count);
      } catch (Exception e) {
        FinderCacheUtil.removeResult(finderPath, finderArgs);

        throw processException(e);
      } finally {
        closeSession(session);
      }
    }

    return count.intValue();
  }
コード例 #23
0
  /**
   * Returns the number of shopping item prices where itemId = ?.
   *
   * @param itemId the item ID
   * @return the number of matching shopping item prices
   */
  @Override
  public int countByItemId(long itemId) {
    FinderPath finderPath = FINDER_PATH_COUNT_BY_ITEMID;

    Object[] finderArgs = new Object[] {itemId};

    Long count = (Long) finderCache.getResult(finderPath, finderArgs, this);

    if (count == null) {
      StringBundler query = new StringBundler(2);

      query.append(_SQL_COUNT_SHOPPINGITEMPRICE_WHERE);

      query.append(_FINDER_COLUMN_ITEMID_ITEMID_2);

      String sql = query.toString();

      Session session = null;

      try {
        session = openSession();

        Query q = session.createQuery(sql);

        QueryPos qPos = QueryPos.getInstance(q);

        qPos.add(itemId);

        count = (Long) q.uniqueResult();

        finderCache.putResult(finderPath, finderArgs, count);
      } catch (Exception e) {
        finderCache.removeResult(finderPath, finderArgs);

        throw processException(e);
      } finally {
        closeSession(session);
      }
    }

    return count.intValue();
  }
コード例 #24
0
  /**
   * Returns the number of j i r a change items where jiraChangeGroupId = ?.
   *
   * @param jiraChangeGroupId the jira change group ID
   * @return the number of matching j i r a change items
   * @throws SystemException if a system exception occurred
   */
  public int countByJiraChangeGroupId(long jiraChangeGroupId) throws SystemException {
    Object[] finderArgs = new Object[] {jiraChangeGroupId};

    Long count =
        (Long) FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_JIRACHANGEGROUPID, finderArgs, this);

    if (count == null) {
      StringBundler query = new StringBundler(2);

      query.append(_SQL_COUNT_JIRACHANGEITEM_WHERE);

      query.append(_FINDER_COLUMN_JIRACHANGEGROUPID_JIRACHANGEGROUPID_2);

      String sql = query.toString();

      Session session = null;

      try {
        session = openSession();

        Query q = session.createQuery(sql);

        QueryPos qPos = QueryPos.getInstance(q);

        qPos.add(jiraChangeGroupId);

        count = (Long) q.uniqueResult();
      } catch (Exception e) {
        throw processException(e);
      } finally {
        if (count == null) {
          count = Long.valueOf(0);
        }

        FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_JIRACHANGEGROUPID, finderArgs, count);

        closeSession(session);
      }
    }

    return count.intValue();
  }
コード例 #25
0
  public int countByTitleId(int titleId) throws SystemException {
    Object[] finderArgs = new Object[] {new Integer(titleId)};

    Long count = (Long) FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_TITLEID, finderArgs, this);

    if (count == null) {
      Session session = null;

      try {
        session = openSession();

        StringBuilder query = new StringBuilder();

        query.append("SELECT COUNT(*) ");
        query.append("FROM larion.progate.cds.model.ViewListTitleCompetencies WHERE ");

        query.append("title_id = ?");

        query.append(" ");

        Query q = session.createQuery(query.toString());

        QueryPos qPos = QueryPos.getInstance(q);

        qPos.add(titleId);

        count = (Long) q.uniqueResult();
      } catch (Exception e) {
        throw processException(e);
      } finally {
        if (count == null) {
          count = Long.valueOf(0);
        }

        FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_TITLEID, finderArgs, count);

        closeSession(session);
      }
    }

    return count.intValue();
  }
コード例 #26
0
  /**
   * Returns the number of panic buttons where moduleId = ?.
   *
   * @param moduleId the module ID
   * @return the number of matching panic buttons
   * @throws SystemException if a system exception occurred
   */
  public int countByByModule(long moduleId) throws SystemException {
    Object[] finderArgs = new Object[] {moduleId};

    Long count = (Long) FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_BYMODULE, finderArgs, this);

    if (count == null) {
      StringBundler query = new StringBundler(2);

      query.append(_SQL_COUNT_PANICBUTTON_WHERE);

      query.append(_FINDER_COLUMN_BYMODULE_MODULEID_2);

      String sql = query.toString();

      Session session = null;

      try {
        session = openSession();

        Query q = session.createQuery(sql);

        QueryPos qPos = QueryPos.getInstance(q);

        qPos.add(moduleId);

        count = (Long) q.uniqueResult();
      } catch (Exception e) {
        throw processException(e);
      } finally {
        if (count == null) {
          count = Long.valueOf(0);
        }

        FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_BYMODULE, finderArgs, count);

        closeSession(session);
      }
    }

    return count.intValue();
  }
  public int countByDebateItemIdItemVersionStatus(
      Long debateItemId, Long itemVersion, String status) throws SystemException {
    Object[] finderArgs = new Object[] {debateItemId, itemVersion, status};

    Long count =
        (Long)
            FinderCacheUtil.getResult(
                FINDER_PATH_COUNT_BY_DEBATEITEMIDITEMVERSIONSTATUS, finderArgs, this);

    if (count == null) {
      Session session = null;

      try {
        session = openSession();

        StringBuilder query = new StringBuilder();

        query.append("SELECT COUNT(*) ");
        query.append("FROM com.ext.portlet.debaterevision.model.DebateItemReference WHERE ");

        if (debateItemId == null) {
          query.append("debateItemId IS NULL");
        } else {
          query.append("debateItemId = ?");
        }

        query.append(" AND ");

        if (itemVersion == null) {
          query.append("itemVersion IS NULL");
        } else {
          query.append("itemVersion = ?");
        }

        query.append(" AND ");

        if (status == null) {
          query.append("status IS NULL");
        } else {
          query.append("status = ?");
        }

        query.append(" ");

        Query q = session.createQuery(query.toString());

        QueryPos qPos = QueryPos.getInstance(q);

        if (debateItemId != null) {
          qPos.add(debateItemId.longValue());
        }

        if (itemVersion != null) {
          qPos.add(itemVersion.longValue());
        }

        if (status != null) {
          qPos.add(status);
        }

        count = (Long) q.uniqueResult();
      } catch (Exception e) {
        throw processException(e);
      } finally {
        if (count == null) {
          count = Long.valueOf(0);
        }

        FinderCacheUtil.putResult(
            FINDER_PATH_COUNT_BY_DEBATEITEMIDITEMVERSIONSTATUS, finderArgs, count);

        closeSession(session);
      }
    }

    return count.intValue();
  }