List of usage examples for org.hibernate Query setParameterList
Query<R> setParameterList(int position, Object[] values);
From source file:edu.ur.hibernate.ir.institution.db.HbDeletedInstitutionalItemVersionDAO.java
License:Apache License
/** * Get the items ordered by id that are greater than or equal to the given deleted date. This will include * those items that were deleted on the date. Will grab max results * of where ids are greater than the given id. * /*from w w w .ja v a2 s . co m*/ * @param lastDeletedInstitutionalItemVersionId - last institutional item id. Use 0 if no items have yet been processed. Will grab max results * of where ids are greater than the given id. * @param fromDeletedDate - starting from deleted date * @param institutional collection ids - the collections to look within * @param maxResults - maximum number of results to return * * @return list of institutional item versions greater than the given id and greater than or equal to * the given from deleted date. */ @SuppressWarnings("unchecked") public List<DeletedInstitutionalItemVersion> getItemsIdOrderFromDeletedDate( long lastDeletedInstitutionalItemVersionId, Date fromDeletedDate, List<Long> institutionalCollectionIds, int maxResults) { Query q = hbCrudDAO.getSessionFactory().getCurrentSession() .getNamedQuery("getDeletedInstitutionalItemVersionByLastIdSetFromDateOrderedById"); q.setParameterList("collectionIds", institutionalCollectionIds); q.setParameter("lastId", lastDeletedInstitutionalItemVersionId); q.setParameter("fromDate", fromDeletedDate); q.setMaxResults(maxResults); return (List<DeletedInstitutionalItemVersion>) q.list(); }
From source file:edu.ur.hibernate.ir.institution.db.HbDeletedInstitutionalItemVersionDAO.java
License:Apache License
/** * Get the items ordered by id that are less than or equal to the given deleted date. * This will include those items that were deleted on the date. Will grab max results * of where ids are greater than the given id. //from ww w.j av a 2s . c om * @param lastDeletedInstitutionalItemVersionId * @param untilDeletedDate - deleted date the items must be less than or equal to * @param institutional collection ids - the collections to look within * @param maxResults - maximum number of results to return * * @return list of items id ordered that are less than or equal to the given date and belong to * the specified set id */ @SuppressWarnings("unchecked") public List<DeletedInstitutionalItemVersion> getItemsIdOrderUntilDeletedDate( long lastDeletedInstitutionalItemVersionId, Date untilDeletedDate, List<Long> institutionalCollectionIds, int maxResults) { Query q = hbCrudDAO.getSessionFactory().getCurrentSession() .getNamedQuery("getDeletedInstitutionalItemVersionByLastIdSetUntilDateOrderedById"); q.setParameterList("collectionIds", institutionalCollectionIds); q.setParameter("lastId", lastDeletedInstitutionalItemVersionId); q.setParameter("untilDate", untilDeletedDate); q.setMaxResults(maxResults); return (List<DeletedInstitutionalItemVersion>) q.list(); }
From source file:edu.ur.hibernate.ir.institution.db.HbDeletedInstitutionalItemVersionDAO.java
License:Apache License
/** * Get the items ordered by id that are between the given from and until deleted dates. Will return * only items greater than the given last institutional item ids. * /*from w ww . jav a 2 s.c o m*/ * This will include those items that were deleted on the given dates. Will grab max results * where ids are greater than the given id. * @param lastDeletedInstitutionalItemVersionId - id that institutional item versions must be greater than * @param fromDeletedDate - items deleted date must be greater than or equal to * @param untilDeletedDate - items deleted date must be less than or equal to * @param institutional collection ids - the collections to look within * @param maxResults - maximum number of results to return * * @return - list of items that meet the specified criteria. */ @SuppressWarnings("unchecked") public List<DeletedInstitutionalItemVersion> getItemsIdOrderBetweenDeletedDates( long lastDeletedInstitutionalItemVersionId, Date fromDeletedDate, Date untilDeletedDate, List<Long> institutionalCollectionIds, int maxResults) { Query q = hbCrudDAO.getSessionFactory().getCurrentSession() .getNamedQuery("getDeletedInstitutionalItemVersionByLastIdSetBetweenDatesOrderedById"); q.setParameterList("collectionIds", institutionalCollectionIds); q.setParameter("lastId", lastDeletedInstitutionalItemVersionId); q.setParameter("fromDate", fromDeletedDate); q.setParameter("untilDate", untilDeletedDate); q.setMaxResults(maxResults); return (List<DeletedInstitutionalItemVersion>) q.list(); }
From source file:edu.ur.hibernate.ir.institution.db.HbInstitutionalItemDAO.java
License:Apache License
/** * get the publication count for given name id. * //w ww. j av a2 s . co m * @see edu.ur.ir.institution.InstitutionalItemDAO#getPublicationCountByPersonName(List) */ public Long getPublicationCountByPersonName(List<Long> personNameIds) { Query q = hbCrudDAO.getHibernateTemplate().getSessionFactory().getCurrentSession() .getNamedQuery("getPublicationCountByPersonNameId"); q.setParameterList("personNameIds", personNameIds); Long count = (Long) q.uniqueResult(); return count; }
From source file:edu.ur.hibernate.ir.institution.db.HbInstitutionalItemVersionDAO.java
License:Apache License
/** * Get the publications for a given set of names ordered by title. * // www.j a v a 2 s . c o m * @param rowStart - start position * @param maxResults - maximum number of results to return * @param personNameIds - set of name ids to get * @param orderType - way to order the set * @return */ @SuppressWarnings("unchecked") public List<InstitutionalItemVersionDownloadCount> getPublicationVersionsForNamesByTitle(final int rowStart, final int maxResults, final List<Long> personNameIds, final OrderType orderType) { Query q = null; if (orderType.equals(OrderType.DESCENDING_ORDER)) { q = hbCrudDAO.getSessionFactory().getCurrentSession() .getNamedQuery("getPublicationVersionsByPersonNameIdTitleDesc"); } else { q = hbCrudDAO.getSessionFactory().getCurrentSession() .getNamedQuery("getPublicationVersionsByPersonNameIdTitleAsc"); } q.setParameterList("personNameIds", personNameIds); q.setFirstResult(rowStart); q.setMaxResults(maxResults); q.setFetchSize(maxResults); return (List<InstitutionalItemVersionDownloadCount>) q.list(); }
From source file:edu.ur.hibernate.ir.institution.db.HbInstitutionalItemVersionDAO.java
License:Apache License
/** * Get the publications for a given set of names by title. * //from ww w. j a v a 2 s. co m * @param rowStart - start position * @param maxResults - maximum number of results to return * @param personNameIds - set of name ids to get * @param orderType - way to order the set * @return */ @SuppressWarnings("unchecked") public List<InstitutionalItemVersionDownloadCount> getPublicationVersionsForNamesByDownload(final int rowStart, final int maxResults, final List<Long> personNameIds, final OrderType orderType) { Query q = null; if (orderType.equals(OrderType.DESCENDING_ORDER)) { q = hbCrudDAO.getSessionFactory().getCurrentSession() .getNamedQuery("getPublicationVersionsByPersonNameIdDownloadDesc"); } else { q = hbCrudDAO.getSessionFactory().getCurrentSession() .getNamedQuery("getPublicationVersionsByPersonNameIdDownloadAsc"); } q.setParameterList("personNameIds", personNameIds); q.setFirstResult(rowStart); q.setMaxResults(maxResults); q.setFetchSize(maxResults); return (List<InstitutionalItemVersionDownloadCount>) q.list(); }
From source file:edu.ur.hibernate.ir.institution.db.HbInstitutionalItemVersionDAO.java
License:Apache License
/** * Get the download counts for a set of person names. * //from w w w . ja v a2s. co m * @see edu.ur.ir.institution.InstitutionalItemVersionDAO#getDownloadCountByPersonName(java.util.List) */ public Long getDownloadCountByPersonName(List<Long> personNameIds) { Query q = hbCrudDAO.getSessionFactory().getCurrentSession().getNamedQuery("getDownloadCountByPersonNames"); q.setParameterList("personNameIds", personNameIds); Long count = (Long) q.uniqueResult(); if (count == null) { count = Long.valueOf(0l); } return count; }
From source file:edu.ur.hibernate.ir.institution.db.HbInstitutionalItemVersionDAO.java
License:Apache License
/** * Get list of downloads by submission date. * //from w ww . j a v a2s.c om * @see edu.ur.ir.institution.InstitutionalItemVersionDAO#getPublicationVersionsForNamesBySubmissionDate(int, * int, java.util.List, edu.ur.order.OrderType) */ @SuppressWarnings("unchecked") public List<InstitutionalItemVersionDownloadCount> getPublicationVersionsForNamesBySubmissionDate( final int rowStart, final int maxResults, final List<Long> personNameIds, final OrderType orderType) { Query q = null; if (orderType.equals(OrderType.DESCENDING_ORDER)) { q = hbCrudDAO.getSessionFactory().getCurrentSession() .getNamedQuery("getPublicationVersionsByPersonNameIdSubmissionDateDesc"); } else { q = hbCrudDAO.getSessionFactory().getCurrentSession() .getNamedQuery("getPublicationVersionsByPersonNameIdSubmissionDateAsc"); } q.setParameterList("personNameIds", personNameIds); q.setFirstResult(rowStart); q.setMaxResults(maxResults); q.setFetchSize(maxResults); return (List<InstitutionalItemVersionDownloadCount>) q.list(); }
From source file:edu.ur.hibernate.ir.researcher.db.HbResearcherFolderDAO.java
License:Apache License
/** * Get all root folders not within the given set. * // ww w . ja v a2 s . co m * @see edu.ur.ir.researcher.ResearcherFolderDAO#getAllOtherRootFolders(java.util.List, java.lang.Long) */ @SuppressWarnings("unchecked") public List<ResearcherFolder> getAllOtherRootFolders(final List<Long> rootFolderIds, final Long researcherId) { List<ResearcherFolder> foundFolders = new LinkedList<ResearcherFolder>(); if (rootFolderIds.size() > 0) { Query q = hbCrudDAO.getSessionFactory().getCurrentSession() .getNamedQuery("getAllOtherRootResearcherFolders"); q.setLong("researcherId", researcherId); q.setParameterList("folders", rootFolderIds); foundFolders = (List<ResearcherFolder>) q.list(); } return foundFolders; }
From source file:edu.ur.hibernate.ir.researcher.db.HbResearcherFolderDAO.java
License:Apache License
/** * Find the specified folders./*from w ww . java 2s.c om*/ * * @see edu.ur.ir.researcher.ResearcherFolderDAO#getFolders(java.lang.Long, java.util.List) */ @SuppressWarnings("unchecked") public List<ResearcherFolder> getFolders(final Long researcherId, final List<Long> folderIds) { List<ResearcherFolder> foundFolders = new LinkedList<ResearcherFolder>(); if (folderIds.size() > 0) { Query q = hbCrudDAO.getSessionFactory().getCurrentSession() .getNamedQuery("getAllResearcherFoldersInList"); q.setLong("researcherId", researcherId); q.setParameterList("folders", folderIds); foundFolders = (List<ResearcherFolder>) q.list(); } return foundFolders; }