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();
  }
  /**
   * 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();
  }
  /**
   * 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();
  }
  /**
   * 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();
  }
  /**
   * Returns an ordered range of all the layout sets where groupId = ?.
   *
   * <p>Useful when paginating results. Returns a maximum of <code>end - start</code> instances.
   * <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result
   * set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start
   * </code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}
   * will return the full result set.
   *
   * @param groupId the group ID
   * @param start the lower bound of the range of layout sets
   * @param end the upper bound of the range of layout sets (not inclusive)
   * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
   * @return the ordered range of matching layout sets
   * @throws SystemException if a system exception occurred
   */
  public List<LayoutSet> findByGroupId(
      long groupId, int start, int end, OrderByComparator orderByComparator)
      throws SystemException {
    Object[] finderArgs =
        new Object[] {
          groupId, String.valueOf(start), String.valueOf(end), String.valueOf(orderByComparator)
        };

    List<LayoutSet> list =
        (List<LayoutSet>) FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_GROUPID, finderArgs, this);

    if (list == null) {
      StringBundler query = null;

      if (orderByComparator != null) {
        query = new StringBundler(3 + (orderByComparator.getOrderByFields().length * 3));
      } else {
        query = new StringBundler(2);
      }

      query.append(_SQL_SELECT_LAYOUTSET_WHERE);

      query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);

      if (orderByComparator != null) {
        appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, orderByComparator);
      }

      String sql = query.toString();

      Session session = null;

      try {
        session = openSession();

        Query q = session.createQuery(sql);

        QueryPos qPos = QueryPos.getInstance(q);

        qPos.add(groupId);

        list = (List<LayoutSet>) QueryUtil.list(q, getDialect(), start, end);
      } catch (Exception e) {
        throw processException(e);
      } finally {
        if (list == null) {
          FinderCacheUtil.removeResult(FINDER_PATH_FIND_BY_GROUPID, finderArgs);
        } else {
          cacheResult(list);

          FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_GROUPID, finderArgs, list);
        }

        closeSession(session);
      }
    }

    return list;
  }
  public List<ViewListTitleCompetencies> findByTitleId(
      int titleId, int start, int end, OrderByComparator obc) throws SystemException {
    Object[] finderArgs =
        new Object[] {
          new Integer(titleId), String.valueOf(start), String.valueOf(end), String.valueOf(obc)
        };

    List<ViewListTitleCompetencies> list =
        (List<ViewListTitleCompetencies>)
            FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_TITLEID, finderArgs, this);

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

      try {
        session = openSession();

        StringBuilder query = new StringBuilder();

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

        query.append("title_id = ?");

        query.append(" ");

        if (obc != null) {
          query.append("ORDER BY ");
          query.append(obc.getOrderBy());
        } else {
          query.append("ORDER BY ");

          query.append("competency_number_order ASC");
        }

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

        QueryPos qPos = QueryPos.getInstance(q);

        qPos.add(titleId);

        list = (List<ViewListTitleCompetencies>) QueryUtil.list(q, getDialect(), start, end);
      } catch (Exception e) {
        throw processException(e);
      } finally {
        if (list == null) {
          list = new ArrayList<ViewListTitleCompetencies>();
        }

        cacheResult(list);

        FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_TITLEID, finderArgs, list);

        closeSession(session);
      }
    }

    return list;
  }
  /**
   * Returns an ordered range of all the social equity histories.
   *
   * <p>Useful when paginating results. Returns a maximum of <code>end - start</code> instances.
   * <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result
   * set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start
   * </code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}
   * will return the full result set.
   *
   * @param start the lower bound of the range of social equity histories
   * @param end the upper bound of the range of social equity histories (not inclusive)
   * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
   * @return the ordered range of social equity histories
   * @throws SystemException if a system exception occurred
   */
  public List<SocialEquityHistory> findAll(int start, int end, OrderByComparator orderByComparator)
      throws SystemException {
    Object[] finderArgs =
        new Object[] {
          String.valueOf(start), String.valueOf(end), String.valueOf(orderByComparator)
        };

    List<SocialEquityHistory> list =
        (List<SocialEquityHistory>)
            FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL, finderArgs, this);

    if (list == null) {
      StringBundler query = null;
      String sql = null;

      if (orderByComparator != null) {
        query = new StringBundler(2 + (orderByComparator.getOrderByFields().length * 3));

        query.append(_SQL_SELECT_SOCIALEQUITYHISTORY);

        appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, orderByComparator);

        sql = query.toString();
      } else {
        sql = _SQL_SELECT_SOCIALEQUITYHISTORY;
      }

      Session session = null;

      try {
        session = openSession();

        Query q = session.createQuery(sql);

        if (orderByComparator == null) {
          list = (List<SocialEquityHistory>) QueryUtil.list(q, getDialect(), start, end, false);

          Collections.sort(list);
        } else {
          list = (List<SocialEquityHistory>) QueryUtil.list(q, getDialect(), start, end);
        }
      } catch (Exception e) {
        throw processException(e);
      } finally {
        if (list == null) {
          FinderCacheUtil.removeResult(FINDER_PATH_FIND_ALL, finderArgs);
        } else {
          cacheResult(list);

          FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs, list);
        }

        closeSession(session);
      }
    }

    return list;
  }
  /**
   * Returns the number of entries where userId = &#63; and emailAddress = &#63;.
   *
   * @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();
  }
  public List<SoPhongVanBanNoiBo> findBySoVanBanNoiBo(long soVanBanNoiBoId) throws SystemException {
    boolean finderClassNameCacheEnabled = SoPhongVanBanNoiBoModelImpl.CACHE_ENABLED;
    String finderClassName = SoPhongVanBanNoiBo.class.getName();
    String finderMethodName = "findBySoVanBanNoiBo";
    String[] finderParams = new String[] {Long.class.getName()};
    Object[] finderArgs = new Object[] {new Long(soVanBanNoiBoId)};

    Object result = null;

    if (finderClassNameCacheEnabled) {
      result =
          FinderCacheUtil.getResult(
              finderClassName, finderMethodName, finderParams, finderArgs, this);
    }

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

      try {
        session = openSession();

        StringBuilder query = new StringBuilder();

        query.append("FROM com.sgs.portlet.sovanbannoibo.model.SoPhongVanBanNoiBo WHERE ");

        query.append("soVanBanNoiBoId = ?");

        query.append(" ");

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

        QueryPos qPos = QueryPos.getInstance(q);

        qPos.add(soVanBanNoiBoId);

        List<SoPhongVanBanNoiBo> list = q.list();

        FinderCacheUtil.putResult(
            finderClassNameCacheEnabled,
            finderClassName,
            finderMethodName,
            finderParams,
            finderArgs,
            list);

        return list;
      } catch (Exception e) {
        throw processException(e);
      } finally {
        closeSession(session);
      }
    } else {
      return (List<SoPhongVanBanNoiBo>) result;
    }
  }
  public int countAll() throws SystemException {
    boolean finderClassNameCacheEnabled = PmlEdmLevelSendModelImpl.CACHE_ENABLED;
    String finderClassName = PmlEdmLevelSend.class.getName();
    String finderMethodName = "countAll";
    String[] finderParams = new String[] {};
    Object[] finderArgs = new Object[] {};

    Object result = null;

    if (finderClassNameCacheEnabled) {
      result =
          FinderCacheUtil.getResult(
              finderClassName, finderMethodName, finderParams, finderArgs, this);
    }

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

      try {
        session = openSession();

        Query q =
            session.createQuery(
                "SELECT COUNT(*) FROM com.sgs.portlet.pmllevelsend.model.PmlEdmLevelSend");

        Long count = null;

        Iterator<Long> itr = q.list().iterator();

        if (itr.hasNext()) {
          count = itr.next();
        }

        if (count == null) {
          count = new Long(0);
        }

        FinderCacheUtil.putResult(
            finderClassNameCacheEnabled,
            finderClassName,
            finderMethodName,
            finderParams,
            finderArgs,
            count);

        return count.intValue();
      } catch (Exception e) {
        throw processException(e);
      } finally {
        closeSession(session);
      }
    } else {
      return ((Long) result).intValue();
    }
  }
  public List<ViewListTitleCompetencies> findAll(int start, int end, OrderByComparator obc)
      throws SystemException {
    Object[] finderArgs =
        new Object[] {String.valueOf(start), String.valueOf(end), String.valueOf(obc)};

    List<ViewListTitleCompetencies> list =
        (List<ViewListTitleCompetencies>)
            FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL, finderArgs, this);

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

      try {
        session = openSession();

        StringBuilder query = new StringBuilder();

        query.append("FROM larion.progate.cds.model.ViewListTitleCompetencies ");

        if (obc != null) {
          query.append("ORDER BY ");
          query.append(obc.getOrderBy());
        } else {
          query.append("ORDER BY ");

          query.append("competency_number_order ASC");
        }

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

        if (obc == null) {
          list =
              (List<ViewListTitleCompetencies>) QueryUtil.list(q, getDialect(), start, end, false);

          Collections.sort(list);
        } else {
          list = (List<ViewListTitleCompetencies>) QueryUtil.list(q, getDialect(), start, end);
        }
      } catch (Exception e) {
        throw processException(e);
      } finally {
        if (list == null) {
          list = new ArrayList<ViewListTitleCompetencies>();
        }

        cacheResult(list);

        FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs, list);

        closeSession(session);
      }
    }

    return list;
  }
  /**
   * Returns the number of bars where text = &#63;.
   *
   * @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();
  }
Exemplo n.º 14
0
  /**
   * Returns the number of releases where servletContextName = &#63;.
   *
   * @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();
  }
  /**
   * Returns an ordered range of all the h r holidaies associated with the h r office.
   *
   * <p>Useful when paginating results. Returns a maximum of <code>end - start</code> instances.
   * <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result
   * set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start
   * </code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}
   * will return the full result set.
   *
   * @param pk the primary key of the h r office
   * @param start the lower bound of the range of h r offices
   * @param end the upper bound of the range of h r offices (not inclusive)
   * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
   * @return the ordered range of h r holidaies associated with the h r office
   * @throws SystemException if a system exception occurred
   */
  public List<com.liferay.hr.model.HRHoliday> getHRHolidaies(
      long pk, int start, int end, OrderByComparator orderByComparator) throws SystemException {
    Object[] finderArgs =
        new Object[] {
          pk, String.valueOf(start), String.valueOf(end), String.valueOf(orderByComparator)
        };

    List<com.liferay.hr.model.HRHoliday> list =
        (List<com.liferay.hr.model.HRHoliday>)
            FinderCacheUtil.getResult(FINDER_PATH_GET_HRHOLIDAIES, finderArgs, this);

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

      try {
        session = openSession();

        String sql = null;

        if (orderByComparator != null) {
          sql = _SQL_GETHRHOLIDAIES.concat(ORDER_BY_CLAUSE).concat(orderByComparator.getOrderBy());
        } else {
          sql = _SQL_GETHRHOLIDAIES;
        }

        SQLQuery q = session.createSQLQuery(sql);

        q.addEntity("HRHoliday", com.liferay.hr.model.impl.HRHolidayImpl.class);

        QueryPos qPos = QueryPos.getInstance(q);

        qPos.add(pk);

        list = (List<com.liferay.hr.model.HRHoliday>) QueryUtil.list(q, getDialect(), start, end);
      } catch (Exception e) {
        throw processException(e);
      } finally {
        if (list == null) {
          FinderCacheUtil.removeResult(FINDER_PATH_GET_HRHOLIDAIES, finderArgs);
        } else {
          hrHolidayPersistence.cacheResult(list);

          FinderCacheUtil.putResult(FINDER_PATH_GET_HRHOLIDAIES, finderArgs, list);
        }

        closeSession(session);
      }
    }

    return list;
  }
  /**
   * Returns the number of class names where value = &#63;.
   *
   * @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 d l syncs where companyId = &#63; and modifiedDate &gt; &#63; and
   * repositoryId = &#63;.
   *
   * @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();
  }
  /**
   * Returns the number of Tips of the Day Userses where companyId = &#63; and groupId = &#63; and
   * userId = &#63;.
   *
   * @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();
  }
  /**
   * Returns the number of announcements flags where userId = &#63; and entryId = &#63; and value =
   * &#63;.
   *
   * @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();
  }
  /**
   * Returns the number of shards where classNameId = &#63; and classPK = &#63;.
   *
   * @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();
  }
  /**
   * Returns the number of expando rows where tableId = &#63; and classPK = &#63;.
   *
   * @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();
  }
  /**
   * Returns the number of portal preferenceses where ownerId = &#63; and ownerType = &#63;.
   *
   * @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();
  }
  /**
   * Returns the number of layout sets where groupId = &#63; and privateLayout = &#63;.
   *
   * @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();
  }
  /**
   * Returns the number of images where size &lt; &#63;.
   *
   * @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();
  }
  /**
   * Returns the number of projects entries where userId = &#63;.
   *
   * @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();
  }
  /**
   * Returns the number of foos where field2 = &#63;.
   *
   * @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();
  }
  /**
   * Returns the number of d l sync events where modifiedTime &gt; &#63;.
   *
   * @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();
  }
  /**
   * Returns the number of j i r a change items where jiraChangeGroupId = &#63;.
   *
   * @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();
  }
  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();
  }
  /**
   * Returns the number of panic buttons where moduleId = &#63;.
   *
   * @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();
  }