예제 #1
0
  public String replaceOrderBy(String sql, OrderByComparator obc) {
    if (obc == null) {
      return sql;
    }

    return removeOrderBy(sql).concat(_ORDER_BY_CLAUSE).concat(obc.getOrderBy());
  }
  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;
  }
  public PmlEdmLevelSend[] findByLevelSendName_PrevAndNext(
      int levelSendId, String levelSendName, OrderByComparator obc)
      throws NoSuchPmlEdmLevelSendException, SystemException {
    PmlEdmLevelSend pmlEdmLevelSend = findByPrimaryKey(levelSendId);

    int count = countByLevelSendName(levelSendName);

    Session session = null;

    try {
      session = openSession();

      StringBuilder query = new StringBuilder();

      query.append("FROM com.sgs.portlet.pmllevelsend.model.PmlEdmLevelSend WHERE ");

      if (levelSendName == null) {
        query.append("levelsendname LIKE null");
      } else {
        query.append("levelsendname LIKE ?");
      }

      query.append(" ");

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

        query.append("levelsendname ASC");
      }

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

      QueryPos qPos = QueryPos.getInstance(q);

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

      Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc, pmlEdmLevelSend);

      PmlEdmLevelSend[] array = new PmlEdmLevelSendImpl[3];

      array[0] = (PmlEdmLevelSend) objArray[0];
      array[1] = (PmlEdmLevelSend) objArray[1];
      array[2] = (PmlEdmLevelSend) objArray[2];

      return array;
    } catch (Exception e) {
      throw processException(e);
    } finally {
      closeSession(session);
    }
  }
  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;
  }
  public SoPhongVanBanNoiBo[] findByPhongVanBanNoiBo_PrevAndNext(
      SoPhongVanBanNoiBoPK soPhongVanBanNoiBoPK, String phongVanBanNoiBoId, OrderByComparator obc)
      throws NoSuchSoPhongVanBanNoiBoException, SystemException {
    SoPhongVanBanNoiBo soPhongVanBanNoiBo = findByPrimaryKey(soPhongVanBanNoiBoPK);

    int count = countByPhongVanBanNoiBo(phongVanBanNoiBoId);

    Session session = null;

    try {
      session = openSession();

      StringBuilder query = new StringBuilder();

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

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

      query.append(" ");

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

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

      QueryPos qPos = QueryPos.getInstance(q);

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

      Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc, soPhongVanBanNoiBo);

      SoPhongVanBanNoiBo[] array = new SoPhongVanBanNoiBoImpl[3];

      array[0] = (SoPhongVanBanNoiBo) objArray[0];
      array[1] = (SoPhongVanBanNoiBo) objArray[1];
      array[2] = (SoPhongVanBanNoiBo) objArray[2];

      return array;
    } catch (Exception e) {
      throw processException(e);
    } finally {
      closeSession(session);
    }
  }
  /**
   * 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;
  }
  public ViewListTitleCompetencies[] findByTitleId_PrevAndNext(
      String id, int titleId, OrderByComparator obc)
      throws NoSuchViewListTitleCompetenciesException, SystemException {
    ViewListTitleCompetencies viewListTitleCompetencies = findByPrimaryKey(id);

    int count = countByTitleId(titleId);

    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);

      Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc, viewListTitleCompetencies);

      ViewListTitleCompetencies[] array = new ViewListTitleCompetenciesImpl[3];

      array[0] = (ViewListTitleCompetencies) objArray[0];
      array[1] = (ViewListTitleCompetencies) objArray[1];
      array[2] = (ViewListTitleCompetencies) objArray[2];

      return array;
    } catch (Exception e) {
      throw processException(e);
    } finally {
      closeSession(session);
    }
  }
  public List<PmlEdmLevelSend> findAll(int start, int end, OrderByComparator obc)
      throws SystemException {
    boolean finderClassNameCacheEnabled = PmlEdmLevelSendModelImpl.CACHE_ENABLED;
    String finderClassName = PmlEdmLevelSend.class.getName();
    String finderMethodName = "findAll";
    String[] finderParams =
        new String[] {
          "java.lang.Integer",
          "java.lang.Integer",
          "com.liferay.portal.kernel.util.OrderByComparator"
        };
    Object[] finderArgs =
        new Object[] {String.valueOf(start), String.valueOf(end), String.valueOf(obc)};

    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.pmllevelsend.model.PmlEdmLevelSend ");

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

          query.append("levelsendname ASC");
        }

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

        List<PmlEdmLevelSend> list =
            (List<PmlEdmLevelSend>) QueryUtil.list(q, getDialect(), start, end);

        if (obc == null) {
          Collections.sort(list);
        }

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

        return list;
      } catch (Exception e) {
        throw processException(e);
      } finally {
        closeSession(session);
      }
    } else {
      return (List<PmlEdmLevelSend>) result;
    }
  }
  public List<SoPhongVanBanNoiBo> findBySoVanBanNoiBo_PhongVanBanNoiBo(
      long soVanBanNoiBoId, String phongVanBanNoiBoId, int start, int end, OrderByComparator obc)
      throws SystemException {
    boolean finderClassNameCacheEnabled = SoPhongVanBanNoiBoModelImpl.CACHE_ENABLED;
    String finderClassName = SoPhongVanBanNoiBo.class.getName();
    String finderMethodName = "findBySoVanBanNoiBo_PhongVanBanNoiBo";
    String[] finderParams =
        new String[] {
          Long.class.getName(),
          String.class.getName(),
          "java.lang.Integer",
          "java.lang.Integer",
          "com.liferay.portal.kernel.util.OrderByComparator"
        };
    Object[] finderArgs =
        new Object[] {
          new Long(soVanBanNoiBoId),
          phongVanBanNoiBoId,
          String.valueOf(start),
          String.valueOf(end),
          String.valueOf(obc)
        };

    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(" AND ");

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

        query.append(" ");

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

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

        QueryPos qPos = QueryPos.getInstance(q);

        qPos.add(soVanBanNoiBoId);

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

        List<SoPhongVanBanNoiBo> list =
            (List<SoPhongVanBanNoiBo>) QueryUtil.list(q, getDialect(), start, end);

        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 DebateItemReference[] findByDebateItemIdItemVersionStatus_PrevAndNext(
      Long debateItemReferencePK,
      Long debateItemId,
      Long itemVersion,
      String status,
      OrderByComparator obc)
      throws NoSuchDebateItemReferenceException, SystemException {
    DebateItemReference debateItemReference = findByPrimaryKey(debateItemReferencePK);

    int count = countByDebateItemIdItemVersionStatus(debateItemId, itemVersion, status);

    Session session = null;

    try {
      session = openSession();

      StringBuilder query = new StringBuilder();

      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(" ");

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

      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);
      }

      Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc, debateItemReference);

      DebateItemReference[] array = new DebateItemReferenceImpl[3];

      array[0] = (DebateItemReference) objArray[0];
      array[1] = (DebateItemReference) objArray[1];
      array[2] = (DebateItemReference) objArray[2];

      return array;
    } catch (Exception e) {
      throw processException(e);
    } finally {
      closeSession(session);
    }
  }
  public List<DebateItemReference> findByDebateItemIdItemVersionStatus(
      Long debateItemId, Long itemVersion, String status, int start, int end, OrderByComparator obc)
      throws SystemException {
    Object[] finderArgs =
        new Object[] {
          debateItemId,
          itemVersion,
          status,
          String.valueOf(start),
          String.valueOf(end),
          String.valueOf(obc)
        };

    List<DebateItemReference> list =
        (List<DebateItemReference>)
            FinderCacheUtil.getResult(
                FINDER_PATH_FIND_BY_OBC_DEBATEITEMIDITEMVERSIONSTATUS, finderArgs, this);

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

      try {
        session = openSession();

        StringBuilder query = new StringBuilder();

        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(" ");

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

        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);
        }

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

        cacheResult(list);

        FinderCacheUtil.putResult(
            FINDER_PATH_FIND_BY_OBC_DEBATEITEMIDITEMVERSIONSTATUS, finderArgs, list);

        closeSession(session);
      }
    }

    return list;
  }