List of usage examples for com.liferay.portal.kernel.dao.orm QueryUtil list
public static List<?> list(Query query, Dialect dialect, int start, int end, boolean unmodifiable)
From source file:at.meduni.liferay.portlet.rdconnect.service.persistence.AQRRatingPersistenceImpl.java
License:Open Source License
/** * Returns an ordered range of all the a q r ratings where masterCandidateId = ?. * * <p>//w w w.jav a 2 s . c o m * 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. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link at.meduni.liferay.portlet.rdconnect.model.impl.AQRRatingModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. * </p> * * @param masterCandidateId the master candidate ID * @param start the lower bound of the range of a q r ratings * @param end the upper bound of the range of a q r ratings (not inclusive) * @param orderByComparator the comparator to order the results by (optionally <code>null</code>) * @return the ordered range of matching a q r ratings * @throws SystemException if a system exception occurred */ @Override public List<AQRRating> findByMaster(long masterCandidateId, int start, int end, OrderByComparator orderByComparator) throws SystemException { boolean pagination = true; FinderPath finderPath = null; Object[] finderArgs = null; if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) && (orderByComparator == null)) { pagination = false; finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_MASTER; finderArgs = new Object[] { masterCandidateId }; } else { finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_MASTER; finderArgs = new Object[] { masterCandidateId, start, end, orderByComparator }; } List<AQRRating> list = (List<AQRRating>) FinderCacheUtil.getResult(finderPath, finderArgs, this); if ((list != null) && !list.isEmpty()) { for (AQRRating aqrRating : list) { if ((masterCandidateId != aqrRating.getMasterCandidateId())) { list = null; break; } } } if (list == null) { StringBundler query = null; if (orderByComparator != null) { query = new StringBundler(3 + (orderByComparator.getOrderByFields().length * 3)); } else { query = new StringBundler(3); } query.append(_SQL_SELECT_AQRRATING_WHERE); query.append(_FINDER_COLUMN_MASTER_MASTERCANDIDATEID_2); if (orderByComparator != null) { appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, orderByComparator); } else if (pagination) { query.append(AQRRatingModelImpl.ORDER_BY_JPQL); } String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); qPos.add(masterCandidateId); if (!pagination) { list = (List<AQRRating>) QueryUtil.list(q, getDialect(), start, end, false); Collections.sort(list); list = new UnmodifiableList<AQRRating>(list); } else { list = (List<AQRRating>) QueryUtil.list(q, getDialect(), start, end); } cacheResult(list); FinderCacheUtil.putResult(finderPath, finderArgs, list); } catch (Exception e) { FinderCacheUtil.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return list; }
From source file:at.meduni.liferay.portlet.rdconnect.service.persistence.AQRRatingPersistenceImpl.java
License:Open Source License
/** * Returns an ordered range of all the a q r ratings. * * <p>/*from ww w . j av a 2 s . c om*/ * 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. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link at.meduni.liferay.portlet.rdconnect.model.impl.AQRRatingModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. * </p> * * @param start the lower bound of the range of a q r ratings * @param end the upper bound of the range of a q r ratings (not inclusive) * @param orderByComparator the comparator to order the results by (optionally <code>null</code>) * @return the ordered range of a q r ratings * @throws SystemException if a system exception occurred */ @Override public List<AQRRating> findAll(int start, int end, OrderByComparator orderByComparator) throws SystemException { boolean pagination = true; FinderPath finderPath = null; Object[] finderArgs = null; if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) && (orderByComparator == null)) { pagination = false; finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL; finderArgs = FINDER_ARGS_EMPTY; } else { finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL; finderArgs = new Object[] { start, end, orderByComparator }; } List<AQRRating> list = (List<AQRRating>) FinderCacheUtil.getResult(finderPath, 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_AQRRATING); appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, orderByComparator); sql = query.toString(); } else { sql = _SQL_SELECT_AQRRATING; if (pagination) { sql = sql.concat(AQRRatingModelImpl.ORDER_BY_JPQL); } } Session session = null; try { session = openSession(); Query q = session.createQuery(sql); if (!pagination) { list = (List<AQRRating>) QueryUtil.list(q, getDialect(), start, end, false); Collections.sort(list); list = new UnmodifiableList<AQRRating>(list); } else { list = (List<AQRRating>) QueryUtil.list(q, getDialect(), start, end); } cacheResult(list); FinderCacheUtil.putResult(finderPath, finderArgs, list); } catch (Exception e) { FinderCacheUtil.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return list; }
From source file:at.meduni.liferay.portlet.rdconnect.service.persistence.CandidatePersistenceImpl.java
License:Open Source License
/** * Returns an ordered range of all the candidates where country LIKE ? and name LIKE ? and source LIKE ? and candidatetype LIKE ? and subunitof = ?. * * <p>/*from w w w .j a v a 2 s. c o m*/ * 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. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link at.meduni.liferay.portlet.rdconnect.model.impl.CandidateModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. * </p> * * @param country the country * @param name the name * @param source the source * @param candidatetype the candidatetype * @param subunitof the subunitof * @param start the lower bound of the range of candidates * @param end the upper bound of the range of candidates (not inclusive) * @param orderByComparator the comparator to order the results by (optionally <code>null</code>) * @return the ordered range of matching candidates * @throws SystemException if a system exception occurred */ @Override public List<Candidate> findByCNST(String country, String name, String source, String candidatetype, String subunitof, int start, int end, OrderByComparator orderByComparator) throws SystemException { boolean pagination = true; FinderPath finderPath = null; Object[] finderArgs = null; finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_CNST; finderArgs = new Object[] { country, name, source, candidatetype, subunitof, start, end, orderByComparator }; List<Candidate> list = (List<Candidate>) FinderCacheUtil.getResult(finderPath, finderArgs, this); if ((list != null) && !list.isEmpty()) { for (Candidate candidate : list) { if (!StringUtil.wildcardMatches(candidate.getCountry(), country, CharPool.UNDERLINE, CharPool.PERCENT, CharPool.BACK_SLASH, false) || !StringUtil.wildcardMatches(candidate.getName(), name, CharPool.UNDERLINE, CharPool.PERCENT, CharPool.BACK_SLASH, false) || !StringUtil.wildcardMatches(candidate.getSource(), source, CharPool.UNDERLINE, CharPool.PERCENT, CharPool.BACK_SLASH, false) || !StringUtil.wildcardMatches(candidate.getCandidatetype(), candidatetype, CharPool.UNDERLINE, CharPool.PERCENT, CharPool.BACK_SLASH, false) || !Validator.equals(subunitof, candidate.getSubunitof())) { list = null; break; } } } if (list == null) { StringBundler query = null; if (orderByComparator != null) { query = new StringBundler(7 + (orderByComparator.getOrderByFields().length * 3)); } else { query = new StringBundler(7); } query.append(_SQL_SELECT_CANDIDATE_WHERE); boolean bindCountry = false; if (country == null) { query.append(_FINDER_COLUMN_CNST_COUNTRY_1); } else if (country.equals(StringPool.BLANK)) { query.append(_FINDER_COLUMN_CNST_COUNTRY_3); } else { bindCountry = true; query.append(_FINDER_COLUMN_CNST_COUNTRY_2); } boolean bindName = false; if (name == null) { query.append(_FINDER_COLUMN_CNST_NAME_1); } else if (name.equals(StringPool.BLANK)) { query.append(_FINDER_COLUMN_CNST_NAME_3); } else { bindName = true; query.append(_FINDER_COLUMN_CNST_NAME_2); } boolean bindSource = false; if (source == null) { query.append(_FINDER_COLUMN_CNST_SOURCE_1); } else if (source.equals(StringPool.BLANK)) { query.append(_FINDER_COLUMN_CNST_SOURCE_3); } else { bindSource = true; query.append(_FINDER_COLUMN_CNST_SOURCE_2); } boolean bindCandidatetype = false; if (candidatetype == null) { query.append(_FINDER_COLUMN_CNST_CANDIDATETYPE_1); } else if (candidatetype.equals(StringPool.BLANK)) { query.append(_FINDER_COLUMN_CNST_CANDIDATETYPE_3); } else { bindCandidatetype = true; query.append(_FINDER_COLUMN_CNST_CANDIDATETYPE_2); } boolean bindSubunitof = false; if (subunitof == null) { query.append(_FINDER_COLUMN_CNST_SUBUNITOF_1); } else if (subunitof.equals(StringPool.BLANK)) { query.append(_FINDER_COLUMN_CNST_SUBUNITOF_3); } else { bindSubunitof = true; query.append(_FINDER_COLUMN_CNST_SUBUNITOF_2); } if (orderByComparator != null) { appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, orderByComparator); } else if (pagination) { query.append(CandidateModelImpl.ORDER_BY_JPQL); } String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); if (bindCountry) { qPos.add(country.toLowerCase()); } if (bindName) { qPos.add(name.toLowerCase()); } if (bindSource) { qPos.add(source.toLowerCase()); } if (bindCandidatetype) { qPos.add(candidatetype.toLowerCase()); } if (bindSubunitof) { qPos.add(subunitof); } if (!pagination) { list = (List<Candidate>) QueryUtil.list(q, getDialect(), start, end, false); Collections.sort(list); list = new UnmodifiableList<Candidate>(list); } else { list = (List<Candidate>) QueryUtil.list(q, getDialect(), start, end); } cacheResult(list); FinderCacheUtil.putResult(finderPath, finderArgs, list); } catch (Exception e) { FinderCacheUtil.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return list; }
From source file:at.meduni.liferay.portlet.rdconnect.service.persistence.CandidatePersistenceImpl.java
License:Open Source License
/** * Returns an ordered range of all the candidates where country LIKE ? and name LIKE ? and source LIKE ? and candidatetype LIKE ? and diseasesfreetext LIKE ? and diseasescodes LIKE ? and subunitof = ?. * * <p>/* w w w . j a v a2 s . c o m*/ * 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. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link at.meduni.liferay.portlet.rdconnect.model.impl.CandidateModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. * </p> * * @param country the country * @param name the name * @param source the source * @param candidatetype the candidatetype * @param diseasesfreetext the diseasesfreetext * @param diseasescodes the diseasescodes * @param subunitof the subunitof * @param start the lower bound of the range of candidates * @param end the upper bound of the range of candidates (not inclusive) * @param orderByComparator the comparator to order the results by (optionally <code>null</code>) * @return the ordered range of matching candidates * @throws SystemException if a system exception occurred */ @Override public List<Candidate> findByCNSTDD(String country, String name, String source, String candidatetype, String diseasesfreetext, String diseasescodes, String subunitof, int start, int end, OrderByComparator orderByComparator) throws SystemException { boolean pagination = true; FinderPath finderPath = null; Object[] finderArgs = null; finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_CNSTDD; finderArgs = new Object[] { country, name, source, candidatetype, diseasesfreetext, diseasescodes, subunitof, start, end, orderByComparator }; List<Candidate> list = (List<Candidate>) FinderCacheUtil.getResult(finderPath, finderArgs, this); if ((list != null) && !list.isEmpty()) { for (Candidate candidate : list) { if (!StringUtil.wildcardMatches(candidate.getCountry(), country, CharPool.UNDERLINE, CharPool.PERCENT, CharPool.BACK_SLASH, false) || !StringUtil.wildcardMatches(candidate.getName(), name, CharPool.UNDERLINE, CharPool.PERCENT, CharPool.BACK_SLASH, false) || !StringUtil.wildcardMatches(candidate.getSource(), source, CharPool.UNDERLINE, CharPool.PERCENT, CharPool.BACK_SLASH, false) || !StringUtil.wildcardMatches(candidate.getCandidatetype(), candidatetype, CharPool.UNDERLINE, CharPool.PERCENT, CharPool.BACK_SLASH, false) || !StringUtil.wildcardMatches(candidate.getDiseasesfreetext(), diseasesfreetext, CharPool.UNDERLINE, CharPool.PERCENT, CharPool.BACK_SLASH, false) || !StringUtil.wildcardMatches(candidate.getDiseasescodes(), diseasescodes, CharPool.UNDERLINE, CharPool.PERCENT, CharPool.BACK_SLASH, false) || !Validator.equals(subunitof, candidate.getSubunitof())) { list = null; break; } } } if (list == null) { StringBundler query = null; if (orderByComparator != null) { query = new StringBundler(9 + (orderByComparator.getOrderByFields().length * 3)); } else { query = new StringBundler(9); } query.append(_SQL_SELECT_CANDIDATE_WHERE); boolean bindCountry = false; if (country == null) { query.append(_FINDER_COLUMN_CNSTDD_COUNTRY_1); } else if (country.equals(StringPool.BLANK)) { query.append(_FINDER_COLUMN_CNSTDD_COUNTRY_3); } else { bindCountry = true; query.append(_FINDER_COLUMN_CNSTDD_COUNTRY_2); } boolean bindName = false; if (name == null) { query.append(_FINDER_COLUMN_CNSTDD_NAME_1); } else if (name.equals(StringPool.BLANK)) { query.append(_FINDER_COLUMN_CNSTDD_NAME_3); } else { bindName = true; query.append(_FINDER_COLUMN_CNSTDD_NAME_2); } boolean bindSource = false; if (source == null) { query.append(_FINDER_COLUMN_CNSTDD_SOURCE_1); } else if (source.equals(StringPool.BLANK)) { query.append(_FINDER_COLUMN_CNSTDD_SOURCE_3); } else { bindSource = true; query.append(_FINDER_COLUMN_CNSTDD_SOURCE_2); } boolean bindCandidatetype = false; if (candidatetype == null) { query.append(_FINDER_COLUMN_CNSTDD_CANDIDATETYPE_1); } else if (candidatetype.equals(StringPool.BLANK)) { query.append(_FINDER_COLUMN_CNSTDD_CANDIDATETYPE_3); } else { bindCandidatetype = true; query.append(_FINDER_COLUMN_CNSTDD_CANDIDATETYPE_2); } boolean bindDiseasesfreetext = false; if (diseasesfreetext == null) { query.append(_FINDER_COLUMN_CNSTDD_DISEASESFREETEXT_1); } else if (diseasesfreetext.equals(StringPool.BLANK)) { query.append(_FINDER_COLUMN_CNSTDD_DISEASESFREETEXT_3); } else { bindDiseasesfreetext = true; query.append(_FINDER_COLUMN_CNSTDD_DISEASESFREETEXT_2); } boolean bindDiseasescodes = false; if (diseasescodes == null) { query.append(_FINDER_COLUMN_CNSTDD_DISEASESCODES_1); } else if (diseasescodes.equals(StringPool.BLANK)) { query.append(_FINDER_COLUMN_CNSTDD_DISEASESCODES_3); } else { bindDiseasescodes = true; query.append(_FINDER_COLUMN_CNSTDD_DISEASESCODES_2); } boolean bindSubunitof = false; if (subunitof == null) { query.append(_FINDER_COLUMN_CNSTDD_SUBUNITOF_1); } else if (subunitof.equals(StringPool.BLANK)) { query.append(_FINDER_COLUMN_CNSTDD_SUBUNITOF_3); } else { bindSubunitof = true; query.append(_FINDER_COLUMN_CNSTDD_SUBUNITOF_2); } if (orderByComparator != null) { appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, orderByComparator); } else if (pagination) { query.append(CandidateModelImpl.ORDER_BY_JPQL); } String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); if (bindCountry) { qPos.add(country.toLowerCase()); } if (bindName) { qPos.add(name.toLowerCase()); } if (bindSource) { qPos.add(source.toLowerCase()); } if (bindCandidatetype) { qPos.add(candidatetype.toLowerCase()); } if (bindDiseasesfreetext) { qPos.add(diseasesfreetext.toLowerCase()); } if (bindDiseasescodes) { qPos.add(diseasescodes.toLowerCase()); } if (bindSubunitof) { qPos.add(subunitof); } if (!pagination) { list = (List<Candidate>) QueryUtil.list(q, getDialect(), start, end, false); Collections.sort(list); list = new UnmodifiableList<Candidate>(list); } else { list = (List<Candidate>) QueryUtil.list(q, getDialect(), start, end); } cacheResult(list); FinderCacheUtil.putResult(finderPath, finderArgs, list); } catch (Exception e) { FinderCacheUtil.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return list; }
From source file:at.meduni.liferay.portlet.rdconnect.service.persistence.CandidatePersistenceImpl.java
License:Open Source License
/** * Returns an ordered range of all the candidates where subunitof = ?. * * <p>//from w ww. ja va 2 s .co m * 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. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link at.meduni.liferay.portlet.rdconnect.model.impl.CandidateModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. * </p> * * @param subunitof the subunitof * @param start the lower bound of the range of candidates * @param end the upper bound of the range of candidates (not inclusive) * @param orderByComparator the comparator to order the results by (optionally <code>null</code>) * @return the ordered range of matching candidates * @throws SystemException if a system exception occurred */ @Override public List<Candidate> findBySubRemover(String subunitof, int start, int end, OrderByComparator orderByComparator) throws SystemException { boolean pagination = true; FinderPath finderPath = null; Object[] finderArgs = null; if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) && (orderByComparator == null)) { pagination = false; finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_SUBREMOVER; finderArgs = new Object[] { subunitof }; } else { finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_SUBREMOVER; finderArgs = new Object[] { subunitof, start, end, orderByComparator }; } List<Candidate> list = (List<Candidate>) FinderCacheUtil.getResult(finderPath, finderArgs, this); if ((list != null) && !list.isEmpty()) { for (Candidate candidate : list) { if (!Validator.equals(subunitof, candidate.getSubunitof())) { list = null; break; } } } if (list == null) { StringBundler query = null; if (orderByComparator != null) { query = new StringBundler(3 + (orderByComparator.getOrderByFields().length * 3)); } else { query = new StringBundler(3); } query.append(_SQL_SELECT_CANDIDATE_WHERE); boolean bindSubunitof = false; if (subunitof == null) { query.append(_FINDER_COLUMN_SUBREMOVER_SUBUNITOF_1); } else if (subunitof.equals(StringPool.BLANK)) { query.append(_FINDER_COLUMN_SUBREMOVER_SUBUNITOF_3); } else { bindSubunitof = true; query.append(_FINDER_COLUMN_SUBREMOVER_SUBUNITOF_2); } if (orderByComparator != null) { appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, orderByComparator); } else if (pagination) { query.append(CandidateModelImpl.ORDER_BY_JPQL); } String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); if (bindSubunitof) { qPos.add(subunitof); } if (!pagination) { list = (List<Candidate>) QueryUtil.list(q, getDialect(), start, end, false); Collections.sort(list); list = new UnmodifiableList<Candidate>(list); } else { list = (List<Candidate>) QueryUtil.list(q, getDialect(), start, end); } cacheResult(list); FinderCacheUtil.putResult(finderPath, finderArgs, list); } catch (Exception e) { FinderCacheUtil.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return list; }
From source file:at.meduni.liferay.portlet.rdconnect.service.persistence.CandidatePersistenceImpl.java
License:Open Source License
/** * Returns an ordered range of all the candidates where country = ?. * * <p>//from www . j a v a 2s . c o m * 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. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link at.meduni.liferay.portlet.rdconnect.model.impl.CandidateModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. * </p> * * @param country the country * @param start the lower bound of the range of candidates * @param end the upper bound of the range of candidates (not inclusive) * @param orderByComparator the comparator to order the results by (optionally <code>null</code>) * @return the ordered range of matching candidates * @throws SystemException if a system exception occurred */ @Override public List<Candidate> findByCountry(String country, int start, int end, OrderByComparator orderByComparator) throws SystemException { boolean pagination = true; FinderPath finderPath = null; Object[] finderArgs = null; if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) && (orderByComparator == null)) { pagination = false; finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COUNTRY; finderArgs = new Object[] { country }; } else { finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_COUNTRY; finderArgs = new Object[] { country, start, end, orderByComparator }; } List<Candidate> list = (List<Candidate>) FinderCacheUtil.getResult(finderPath, finderArgs, this); if ((list != null) && !list.isEmpty()) { for (Candidate candidate : list) { if (!Validator.equals(country, candidate.getCountry())) { list = null; break; } } } if (list == null) { StringBundler query = null; if (orderByComparator != null) { query = new StringBundler(3 + (orderByComparator.getOrderByFields().length * 3)); } else { query = new StringBundler(3); } query.append(_SQL_SELECT_CANDIDATE_WHERE); boolean bindCountry = false; if (country == null) { query.append(_FINDER_COLUMN_COUNTRY_COUNTRY_1); } else if (country.equals(StringPool.BLANK)) { query.append(_FINDER_COLUMN_COUNTRY_COUNTRY_3); } else { bindCountry = true; query.append(_FINDER_COLUMN_COUNTRY_COUNTRY_2); } if (orderByComparator != null) { appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, orderByComparator); } else if (pagination) { query.append(CandidateModelImpl.ORDER_BY_JPQL); } String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); if (bindCountry) { qPos.add(country); } if (!pagination) { list = (List<Candidate>) QueryUtil.list(q, getDialect(), start, end, false); Collections.sort(list); list = new UnmodifiableList<Candidate>(list); } else { list = (List<Candidate>) QueryUtil.list(q, getDialect(), start, end); } cacheResult(list); FinderCacheUtil.putResult(finderPath, finderArgs, list); } catch (Exception e) { FinderCacheUtil.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return list; }
From source file:at.meduni.liferay.portlet.rdconnect.service.persistence.CandidatePersistenceImpl.java
License:Open Source License
/** * Returns an ordered range of all the candidates. * * <p>/* ww w . j av a 2 s. c om*/ * 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. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link at.meduni.liferay.portlet.rdconnect.model.impl.CandidateModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. * </p> * * @param start the lower bound of the range of candidates * @param end the upper bound of the range of candidates (not inclusive) * @param orderByComparator the comparator to order the results by (optionally <code>null</code>) * @return the ordered range of candidates * @throws SystemException if a system exception occurred */ @Override public List<Candidate> findAll(int start, int end, OrderByComparator orderByComparator) throws SystemException { boolean pagination = true; FinderPath finderPath = null; Object[] finderArgs = null; if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) && (orderByComparator == null)) { pagination = false; finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL; finderArgs = FINDER_ARGS_EMPTY; } else { finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL; finderArgs = new Object[] { start, end, orderByComparator }; } List<Candidate> list = (List<Candidate>) FinderCacheUtil.getResult(finderPath, 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_CANDIDATE); appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, orderByComparator); sql = query.toString(); } else { sql = _SQL_SELECT_CANDIDATE; if (pagination) { sql = sql.concat(CandidateModelImpl.ORDER_BY_JPQL); } } Session session = null; try { session = openSession(); Query q = session.createQuery(sql); if (!pagination) { list = (List<Candidate>) QueryUtil.list(q, getDialect(), start, end, false); Collections.sort(list); list = new UnmodifiableList<Candidate>(list); } else { list = (List<Candidate>) QueryUtil.list(q, getDialect(), start, end); } cacheResult(list); FinderCacheUtil.putResult(finderPath, finderArgs, list); } catch (Exception e) { FinderCacheUtil.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return list; }
From source file:at.meduni.liferay.portlet.rdconnect.service.persistence.MasterCandidateLinkCandidatePersistenceImpl.java
License:Open Source License
/** * Returns an ordered range of all the master candidate link candidates. * * <p>// ww w . j a va 2 s .co m * 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. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link at.meduni.liferay.portlet.rdconnect.model.impl.MasterCandidateLinkCandidateModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. * </p> * * @param start the lower bound of the range of master candidate link candidates * @param end the upper bound of the range of master candidate link candidates (not inclusive) * @param orderByComparator the comparator to order the results by (optionally <code>null</code>) * @return the ordered range of master candidate link candidates * @throws SystemException if a system exception occurred */ @Override public List<MasterCandidateLinkCandidate> findAll(int start, int end, OrderByComparator orderByComparator) throws SystemException { boolean pagination = true; FinderPath finderPath = null; Object[] finderArgs = null; if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) && (orderByComparator == null)) { pagination = false; finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL; finderArgs = FINDER_ARGS_EMPTY; } else { finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL; finderArgs = new Object[] { start, end, orderByComparator }; } List<MasterCandidateLinkCandidate> list = (List<MasterCandidateLinkCandidate>) FinderCacheUtil .getResult(finderPath, 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_MASTERCANDIDATELINKCANDIDATE); appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, orderByComparator); sql = query.toString(); } else { sql = _SQL_SELECT_MASTERCANDIDATELINKCANDIDATE; if (pagination) { sql = sql.concat(MasterCandidateLinkCandidateModelImpl.ORDER_BY_JPQL); } } Session session = null; try { session = openSession(); Query q = session.createQuery(sql); if (!pagination) { list = (List<MasterCandidateLinkCandidate>) QueryUtil.list(q, getDialect(), start, end, false); Collections.sort(list); list = new UnmodifiableList<MasterCandidateLinkCandidate>(list); } else { list = (List<MasterCandidateLinkCandidate>) QueryUtil.list(q, getDialect(), start, end); } cacheResult(list); FinderCacheUtil.putResult(finderPath, finderArgs, list); } catch (Exception e) { FinderCacheUtil.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return list; }
From source file:at.meduni.liferay.portlet.rdconnect.service.persistence.MasterCandidatePersistenceImpl.java
License:Open Source License
/** * Returns an ordered range of all the master candidates where country LIKE ? and name LIKE ? and candidatetype LIKE ?. * * <p>//from w w w .j ava 2s .c o m * 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. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link at.meduni.liferay.portlet.rdconnect.model.impl.MasterCandidateModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. * </p> * * @param country the country * @param name the name * @param candidatetype the candidatetype * @param start the lower bound of the range of master candidates * @param end the upper bound of the range of master candidates (not inclusive) * @param orderByComparator the comparator to order the results by (optionally <code>null</code>) * @return the ordered range of matching master candidates * @throws SystemException if a system exception occurred */ @Override public List<MasterCandidate> findByCNST(String country, String name, String candidatetype, int start, int end, OrderByComparator orderByComparator) throws SystemException { boolean pagination = true; FinderPath finderPath = null; Object[] finderArgs = null; finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_CNST; finderArgs = new Object[] { country, name, candidatetype, start, end, orderByComparator }; List<MasterCandidate> list = (List<MasterCandidate>) FinderCacheUtil.getResult(finderPath, finderArgs, this); if ((list != null) && !list.isEmpty()) { for (MasterCandidate masterCandidate : list) { if (!StringUtil.wildcardMatches(masterCandidate.getCountry(), country, CharPool.UNDERLINE, CharPool.PERCENT, CharPool.BACK_SLASH, false) || !StringUtil.wildcardMatches(masterCandidate.getName(), name, CharPool.UNDERLINE, CharPool.PERCENT, CharPool.BACK_SLASH, false) || !StringUtil.wildcardMatches(masterCandidate.getCandidatetype(), candidatetype, CharPool.UNDERLINE, CharPool.PERCENT, CharPool.BACK_SLASH, false)) { list = null; break; } } } if (list == null) { StringBundler query = null; if (orderByComparator != null) { query = new StringBundler(5 + (orderByComparator.getOrderByFields().length * 3)); } else { query = new StringBundler(5); } query.append(_SQL_SELECT_MASTERCANDIDATE_WHERE); boolean bindCountry = false; if (country == null) { query.append(_FINDER_COLUMN_CNST_COUNTRY_1); } else if (country.equals(StringPool.BLANK)) { query.append(_FINDER_COLUMN_CNST_COUNTRY_3); } else { bindCountry = true; query.append(_FINDER_COLUMN_CNST_COUNTRY_2); } boolean bindName = false; if (name == null) { query.append(_FINDER_COLUMN_CNST_NAME_1); } else if (name.equals(StringPool.BLANK)) { query.append(_FINDER_COLUMN_CNST_NAME_3); } else { bindName = true; query.append(_FINDER_COLUMN_CNST_NAME_2); } boolean bindCandidatetype = false; if (candidatetype == null) { query.append(_FINDER_COLUMN_CNST_CANDIDATETYPE_1); } else if (candidatetype.equals(StringPool.BLANK)) { query.append(_FINDER_COLUMN_CNST_CANDIDATETYPE_3); } else { bindCandidatetype = true; query.append(_FINDER_COLUMN_CNST_CANDIDATETYPE_2); } if (orderByComparator != null) { appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, orderByComparator); } else if (pagination) { query.append(MasterCandidateModelImpl.ORDER_BY_JPQL); } String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); if (bindCountry) { qPos.add(country.toLowerCase()); } if (bindName) { qPos.add(name.toLowerCase()); } if (bindCandidatetype) { qPos.add(candidatetype.toLowerCase()); } if (!pagination) { list = (List<MasterCandidate>) QueryUtil.list(q, getDialect(), start, end, false); Collections.sort(list); list = new UnmodifiableList<MasterCandidate>(list); } else { list = (List<MasterCandidate>) QueryUtil.list(q, getDialect(), start, end); } cacheResult(list); FinderCacheUtil.putResult(finderPath, finderArgs, list); } catch (Exception e) { FinderCacheUtil.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return list; }
From source file:at.meduni.liferay.portlet.rdconnect.service.persistence.MasterCandidatePersistenceImpl.java
License:Open Source License
/** * Returns an ordered range of all the master candidates where country = ?. * * <p>/*from w w w . j a va 2s. com*/ * 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. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link at.meduni.liferay.portlet.rdconnect.model.impl.MasterCandidateModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. * </p> * * @param country the country * @param start the lower bound of the range of master candidates * @param end the upper bound of the range of master candidates (not inclusive) * @param orderByComparator the comparator to order the results by (optionally <code>null</code>) * @return the ordered range of matching master candidates * @throws SystemException if a system exception occurred */ @Override public List<MasterCandidate> findByCountry(String country, int start, int end, OrderByComparator orderByComparator) throws SystemException { boolean pagination = true; FinderPath finderPath = null; Object[] finderArgs = null; if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) && (orderByComparator == null)) { pagination = false; finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COUNTRY; finderArgs = new Object[] { country }; } else { finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_COUNTRY; finderArgs = new Object[] { country, start, end, orderByComparator }; } List<MasterCandidate> list = (List<MasterCandidate>) FinderCacheUtil.getResult(finderPath, finderArgs, this); if ((list != null) && !list.isEmpty()) { for (MasterCandidate masterCandidate : list) { if (!Validator.equals(country, masterCandidate.getCountry())) { list = null; break; } } } if (list == null) { StringBundler query = null; if (orderByComparator != null) { query = new StringBundler(3 + (orderByComparator.getOrderByFields().length * 3)); } else { query = new StringBundler(3); } query.append(_SQL_SELECT_MASTERCANDIDATE_WHERE); boolean bindCountry = false; if (country == null) { query.append(_FINDER_COLUMN_COUNTRY_COUNTRY_1); } else if (country.equals(StringPool.BLANK)) { query.append(_FINDER_COLUMN_COUNTRY_COUNTRY_3); } else { bindCountry = true; query.append(_FINDER_COLUMN_COUNTRY_COUNTRY_2); } if (orderByComparator != null) { appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, orderByComparator); } else if (pagination) { query.append(MasterCandidateModelImpl.ORDER_BY_JPQL); } String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); if (bindCountry) { qPos.add(country); } if (!pagination) { list = (List<MasterCandidate>) QueryUtil.list(q, getDialect(), start, end, false); Collections.sort(list); list = new UnmodifiableList<MasterCandidate>(list); } else { list = (List<MasterCandidate>) QueryUtil.list(q, getDialect(), start, end); } cacheResult(list); FinderCacheUtil.putResult(finderPath, finderArgs, list); } catch (Exception e) { FinderCacheUtil.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return list; }