Here are the examples of the java api org.hibernate.Criteria.addOrder() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
132 Examples
19
Source : DetachedCriteria.java
with GNU General Public License v2.0
from lamsfoundation
with GNU General Public License v2.0
from lamsfoundation
/**
* Adds an ordering
*
* @param order The ordering
*
* @return {@code this}, for method chaining
*/
public DetachedCriteria addOrder(Order order) {
criteria.addOrder(order);
return this;
}
18
Source : EntityCriteria.java
with MIT License
from theonedev
with MIT License
from theonedev
public EnreplacedyCriteria<T> addOrder(Order order) {
criteria.addOrder(order);
return this;
}
18
Source : HibernateApplicationDao.java
with Mozilla Public License 2.0
from secdec
with Mozilla Public License 2.0
from secdec
@Override
public List<Application> getSearchResults(Integer teamId, String searchString, int number, int page, Set<Integer> appIds, Set<Integer> teamIds) {
Criteria criteria = getSearchAppCriteria(teamId, searchString);
criteria.addOrder(Order.asc("name"));
addFiltering(criteria, teamIds, appIds);
return (List<Application>) criteria.setMaxResults(number).setFirstResult((page - 1) * number).list();
}
18
Source : InquiryValueDaoImpl.java
with GNU Lesser General Public License v2.1
from phoenixctms
with GNU Lesser General Public License v2.1
from phoenixctms
private static void applySortOrders(org.hibernate.Criteria inquiryCriteria) {
if (inquiryCriteria != null) {
inquiryCriteria.addOrder(Order.asc("trial"));
inquiryCriteria.addOrder(Order.asc("category"));
inquiryCriteria.addOrder(Order.asc("position"));
}
}
18
Source : ClientDetailsDaoImpl.java
with Apache License 2.0
from drajer-health
with Apache License 2.0
from drajer-health
public List<ClientDetails> getAllClientDetails() {
Criteria criteria = getSession().createCriteria(ClientDetails.clreplaced);
return criteria.addOrder(Order.desc("id")).list();
}
17
Source : ProbandGroupDaoImpl.java
with GNU Lesser General Public License v2.1
from phoenixctms
with GNU Lesser General Public License v2.1
from phoenixctms
@Override
protected Collection<ProbandGroup> handleFindByProbandSorted(Long probandId) throws Exception {
org.hibernate.Criteria probandGroupCriteria = createProbandGroupCriteria();
if (probandId != null) {
probandGroupCriteria.createCriteria("probandListEntries", CriteriaSpecification.INNER_JOIN).add(Restrictions.eq("proband.id", probandId.longValue()));
}
probandGroupCriteria.addOrder(Order.asc("trial"));
probandGroupCriteria.addOrder(Order.asc("replacedle"));
return CriteriaUtil.listDistinctRoot(probandGroupCriteria, this, "trial.id", "replacedle");
}
17
Source : SbiDataSetDAOImpl.java
with GNU Affero General Public License v3.0
from KnowageLabs
with GNU Affero General Public License v3.0
from KnowageLabs
private void sortedBy(Criteria cr, String sortByColumn, boolean reverse) {
if (StringUtils.isNotEmpty(sortByColumn)) {
Order orderBy = null;
if (!reverse) {
orderBy = Order.asc(sortByColumn);
} else {
orderBy = Order.desc(sortByColumn);
}
cr.addOrder(orderBy);
}
}
17
Source : EventLogDAOHibImpl.java
with GNU Affero General Public License v3.0
from KnowageLabs
with GNU Affero General Public License v3.0
from KnowageLabs
private void addOrderingCriteria(Criteria criteria, String sortingColumn, boolean sortingAscending) {
if (!StringUtilities.isEmpty(sortingColumn)) {
if (sortingAscending) {
criteria.addOrder(Order.asc(sortingColumn));
} else {
criteria.addOrder(Order.desc(sortingColumn));
}
} else {
// sorting descending by date as default
criteria.addOrder(Order.desc("date"));
}
}
17
Source : PatientSearchCriteria.java
with Apache License 2.0
from isstac
with Apache License 2.0
from isstac
private void addAliasForName(Criteria criteria, boolean orderByNames) {
criteria.createAlias("names", "name");
if (orderByNames) {
criteria.addOrder(Order.asc("name.givenName"));
criteria.addOrder(Order.asc("name.middleName"));
criteria.addOrder(Order.asc("name.familyName"));
}
}
17
Source : HibernateProviderDAO.java
with Apache License 2.0
from isstac
with Apache License 2.0
from isstac
/**
* @see org.openmrs.api.db.ProviderDAO#getProviders(String, Map, Integer, Integer, boolean)
*/
@Override
public List<Provider> getProviders(String name, Map<ProviderAttributeType, String> serializedAttributeValues, Integer start, Integer length, boolean includeRetired) {
Criteria criteria = prepareProviderCriteria(name, includeRetired);
if (start != null) {
criteria.setFirstResult(start);
}
if (length != null) {
criteria.setMaxResults(length);
}
if (includeRetired) {
// push retired Provider to the end of the returned list
criteria.addOrder(Order.asc("retired"));
}
List<Provider> providers = criteria.list();
if (serializedAttributeValues != null) {
CollectionUtils.filter(providers, new AttributeMatcherPredicate<Provider, ProviderAttributeType>(serializedAttributeValues));
}
return providers;
}
16
Source : SimpleHibernateDao.java
with GNU Affero General Public License v3.0
from wkeyuan
with GNU Affero General Public License v3.0
from wkeyuan
/* (non-Javadoc)
* @see com.key.common.orm.hibernate.ISimpleHibernateDao#getAll(java.lang.String, boolean)
*/
@Override
public List<T> getAll(String orderByProperty, boolean isAsc) {
Criteria c = createCriteria();
if (isAsc) {
c.addOrder(Order.asc(orderByProperty));
} else {
c.addOrder(Order.desc(orderByProperty));
}
return c.list();
}
16
Source : HibernateDao.java
with GNU Affero General Public License v3.0
from wkeyuan
with GNU Affero General Public License v3.0
from wkeyuan
@Override
public T findFirst(String orderByProperty, boolean isAsc, List<Criterion> criterions) {
Criteria c = createCriteria(criterions);
if (isAsc) {
c.addOrder(Order.asc(orderByProperty));
} else {
c.addOrder(Order.desc(orderByProperty));
}
c.setMaxResults(1);
return (T) c.uniqueResult();
}
16
Source : HibernateDao.java
with GNU Affero General Public License v3.0
from wkeyuan
with GNU Affero General Public License v3.0
from wkeyuan
@Override
public List<T> find(String orderByProperty, boolean isAsc, Criterion... criterions) {
Criteria c = createCriteria(criterions);
if (isAsc) {
c.addOrder(Order.asc(orderByProperty));
} else {
c.addOrder(Order.desc(orderByProperty));
}
return c.list();
}
16
Source : HibernateDao.java
with GNU Affero General Public License v3.0
from wkeyuan
with GNU Affero General Public License v3.0
from wkeyuan
@Override
public T findFirst(String orderByProperty, boolean isAsc, Criterion... criterions) {
Criteria c = createCriteria(criterions);
if (isAsc) {
c.addOrder(Order.asc(orderByProperty));
} else {
c.addOrder(Order.desc(orderByProperty));
}
c.setMaxResults(1);
return (T) c.uniqueResult();
}
16
Source : HibernateVulnerabilitySearchDao.java
with Mozilla Public License 2.0
from secdec
with Mozilla Public License 2.0
from secdec
private void addOrders(VulnerabilitySearchParameters parameters, Criteria criteria) {
for (String desc : parameters.getDescList()) {
criteria.addOrder(Order.desc(desc));
}
if (parameters.getAscList() == null || parameters.getAscList().size() == 0)
criteria.addOrder(Order.asc("surface.path"));
else
for (String asc : parameters.getAscList()) {
criteria.addOrder(Order.asc(asc));
}
}
16
Source : HibernateEventDao.java
with Mozilla Public License 2.0
from secdec
with Mozilla Public License 2.0
from secdec
@Override
public List<Event> retrieveAllByVulnerability(Vulnerability vulnerability) {
Criteria criteria = getSession().createCriteria(getClreplacedReference()).add(Restrictions.eq("active", true)).add(Restrictions.eq("vulnerability", vulnerability));
Order order = getOrder();
if (order != null) {
criteria.addOrder(order);
}
return criteria.list();
}
16
Source : HibernateEventDao.java
with Mozilla Public License 2.0
from secdec
with Mozilla Public License 2.0
from secdec
@Override
public List<Event> retrieveAllByScan(Scan scan) {
Criteria criteria = getSession().createCriteria(getClreplacedReference()).add(Restrictions.eq("active", true)).add(Restrictions.eq("scan", scan));
Order order = getOrder();
if (order != null) {
criteria.addOrder(order);
}
return criteria.list();
}
16
Source : HibernateEventDao.java
with Mozilla Public License 2.0
from secdec
with Mozilla Public License 2.0
from secdec
@Override
public List<Event> retrieveAllByDefect(Defect defect) {
Criteria criteria = getSession().createCriteria(getClreplacedReference()).add(Restrictions.eq("active", true)).add(Restrictions.eq("defect", defect));
Order order = getOrder();
if (order != null) {
criteria.addOrder(order);
}
return criteria.list();
}
16
Source : HibernateEventDao.java
with Mozilla Public License 2.0
from secdec
with Mozilla Public License 2.0
from secdec
@Override
public List<Event> retrieveAllByFinding(Finding finding) {
Criteria criteria = getSession().createCriteria(getClreplacedReference()).add(Restrictions.eq("active", true)).add(Restrictions.eq("finding", finding));
Order order = getOrder();
if (order != null) {
criteria.addOrder(order);
}
return criteria.list();
}
16
Source : HibernateEventDao.java
with Mozilla Public License 2.0
from secdec
with Mozilla Public License 2.0
from secdec
@Override
public List<Event> retrieveAllByPolicy(Policy policy) {
Criteria criteria = getSession().createCriteria(getClreplacedReference()).add(Restrictions.eq("active", true)).add(Restrictions.eq("policy", policy));
Order order = getOrder();
if (order != null) {
criteria.addOrder(order);
}
return criteria.list();
}
16
Source : HibernateEventDao.java
with Mozilla Public License 2.0
from secdec
with Mozilla Public License 2.0
from secdec
@Override
public List<Event> retrieveAllByApplication(Application application) {
Criteria criteria = getSession().createCriteria(getClreplacedReference()).add(Restrictions.eq("active", true)).add(Restrictions.eq("application", application));
Order order = getOrder();
if (order != null) {
criteria.addOrder(order);
}
return criteria.list();
}
16
Source : HibernateEventDao.java
with Mozilla Public License 2.0
from secdec
with Mozilla Public License 2.0
from secdec
@Override
public List<Event> retrieveAllByPolicyStatus(PolicyStatus policyStatus) {
Criteria criteria = getSession().createCriteria(getClreplacedReference()).add(Restrictions.eq("active", true)).add(Restrictions.eq("policyStatus", policyStatus));
Order order = getOrder();
if (order != null) {
criteria.addOrder(order);
}
return criteria.list();
}
16
Source : HibernateChannelTypeDao.java
with Mozilla Public License 2.0
from secdec
with Mozilla Public License 2.0
from secdec
@Override
public List<ChannelType> loadAllHasVulnMapping() {
Criteria criteria = getSession().createCriteria(getClreplacedReference()).createAlias("channelVulnerabilities", "channelVulns").setProjection(Projections.projectionList().add(Projections.groupProperty("name"), "name").add(Projections.groupProperty("id"), "id"));
Order order = getOrder();
if (order != null) {
criteria.addOrder(order);
}
criteria.setResultTransformer(Transformers.aliasToBean(ChannelType.clreplaced));
return criteria.list();
}
16
Source : AbstractObjectDao.java
with Mozilla Public License 2.0
from secdec
with Mozilla Public License 2.0
from secdec
@Override
public List<T> retrieveAll() {
Criteria criteria = getSession().createCriteria(getClreplacedReference());
Order order = getOrder();
if (order != null) {
criteria.addOrder(order);
}
return criteria.list();
}
16
Source : AbstractObjectDao.java
with Mozilla Public License 2.0
from secdec
with Mozilla Public License 2.0
from secdec
@Override
public List<T> retrieveAllActive() {
Criteria criteria = getSession().createCriteria(getClreplacedReference()).add(Restrictions.eq("active", true));
Order order = getOrder();
if (order != null) {
criteria.addOrder(order);
}
return criteria.list();
}
16
Source : OperationalDataRecordManager.java
with MIT License
from ria-ee
with MIT License
from ria-ee
private static Criteria createCriteria(Session session, long recordsFrom, long recordsTo, ClientId clientFilter, ClientId serviceProviderFilter, Set<String> outputFields) {
Criteria criteria = createCriteria(session, clientFilter, serviceProviderFilter, outputFields);
// BETWEEN treats the endpoint values as included in the range.
criteria.add(Restrictions.between(MONITORING_DATA_TS, recordsFrom, recordsTo));
criteria.addOrder(Order.asc(MONITORING_DATA_TS));
criteria.setMaxResults(maxRecordsInPayload);
return criteria;
}
16
Source : TrialDaoImpl.java
with GNU Lesser General Public License v2.1
from phoenixctms
with GNU Lesser General Public License v2.1
from phoenixctms
@Override
protected Collection<Trial> handleFindByStaffCoursesSorted(Long staffId, Boolean isRelevantForCourses) throws Exception {
org.hibernate.Criteria trialCriteria = createTrialCriteria(null);
trialCriteria.createCriteria("courses").createCriteria("participations").add(Restrictions.eq("staff.id", staffId.longValue()));
if (isRelevantForCourses != null) {
trialCriteria.createCriteria("status").add(Restrictions.eq("relevantForCourses", isRelevantForCourses.booleanValue()));
}
trialCriteria.addOrder(Order.asc("name"));
return CriteriaUtil.listDistinctRoot(trialCriteria, this, "name");
}
16
Source : ProbandListStatusEntryDaoImpl.java
with GNU Lesser General Public License v2.1
from phoenixctms
with GNU Lesser General Public License v2.1
from phoenixctms
@Override
protected ProbandListStatusEntry handleFindRecentStatus(Long trialId, Long probandId, Timestamp maxRealTimestamp) throws Exception {
org.hibernate.Criteria statusEntryCriteria = createStatusEntryCriteria(null);
if (maxRealTimestamp != null) {
statusEntryCriteria.add(Restrictions.le("realTimestamp", maxRealTimestamp));
}
if (trialId != null || probandId != null) {
Criteria listEntryCriteria = statusEntryCriteria.createCriteria("listEntry");
if (trialId != null) {
listEntryCriteria.add(Restrictions.eq("trial.id", trialId.longValue()));
}
if (probandId != null) {
listEntryCriteria.add(Restrictions.eq("proband.id", probandId.longValue()));
}
}
statusEntryCriteria.addOrder(Order.desc("realTimestamp"));
statusEntryCriteria.addOrder(Order.desc("id"));
statusEntryCriteria.setMaxResults(1);
return (ProbandListStatusEntry) statusEntryCriteria.uniqueResult();
}
16
Source : ProbandListStatusEntryDaoImpl.java
with GNU Lesser General Public License v2.1
from phoenixctms
with GNU Lesser General Public License v2.1
from phoenixctms
@Override
protected ProbandListStatusEntry handleFindLastStatus(Long probandListEntryId) throws Exception {
org.hibernate.Criteria statusEntryCriteria = createStatusEntryCriteria(null);
if (probandListEntryId != null) {
statusEntryCriteria.add(Restrictions.eq("listEntry.id", probandListEntryId.longValue()));
}
statusEntryCriteria.addOrder(Order.desc("id"));
statusEntryCriteria.setMaxResults(1);
return (ProbandListStatusEntry) statusEntryCriteria.uniqueResult();
}
16
Source : ProbandListEntryDaoImpl.java
with GNU Lesser General Public License v2.1
from phoenixctms
with GNU Lesser General Public License v2.1
from phoenixctms
@Override
protected Collection<ProbandListEntry> handleFindByTrialProbandSorted(Long trialId, Long probandId) throws Exception {
org.hibernate.Criteria listEntryCriteria = createListEntryCriteria();
if (trialId != null) {
listEntryCriteria.add(Restrictions.eq("trial.id", trialId.longValue()));
}
if (probandId != null) {
listEntryCriteria.add(Restrictions.eq("proband.id", probandId.longValue()));
}
listEntryCriteria.addOrder(Order.asc("trial"));
listEntryCriteria.addOrder(Order.asc("position"));
return listEntryCriteria.list();
}
16
Source : SearchWord.java
with GNU Affero General Public License v3.0
from KnowageLabs
with GNU Affero General Public License v3.0
from KnowageLabs
@Override
public Criteria evaluate(Session session) {
Criteria c = session.createCriteria(SbiGlWord.clreplaced);
c.addOrder(Order.asc("word"));
c.setProjection(Projections.projectionList().add(Projections.property("wordId"), "wordId").add(Projections.property("word"), "word")).setResultTransformer(Transformers.aliasToBean(SbiGlWord.clreplaced));
if (page != null && item_per_page != null) {
c.setFirstResult((page - 1) * item_per_page);
c.setMaxResults(item_per_page);
}
return c;
}
16
Source : SearchContentsByParent.java
with GNU Affero General Public License v3.0
from KnowageLabs
with GNU Affero General Public License v3.0
from KnowageLabs
@Override
public Criteria evaluate(Session session) {
Criteria c = session.createCriteria(SbiGlContents.clreplaced);
if (glossaryId != null)
c.add(Restrictions.eq("glossary.glossaryId", glossaryId));
if (parentId != null) {
c.add(Restrictions.eq("parent.contentId", parentId));
} else {
c.add(Restrictions.isNull("parent.contentId"));
}
c.addOrder((Order.asc("contentNm")));
return c;
}
16
Source : HibernateHL7DAO.java
with Apache License 2.0
from isstac
with Apache License 2.0
from isstac
/**
* @see org.openmrs.hl7.db.HL7DAO#getHL7Batch(Clreplaced, int, int, Integer, String)
*/
@Override
@SuppressWarnings({ "rawtypes", "unchecked" })
public <T> List<T> getHL7Batch(Clreplaced clazz, int start, int length, Integer messageState, String query) throws DAOException {
Criteria crit = getHL7SearchCriteria(clazz, messageState, query);
crit.setFirstResult(start);
crit.setMaxResults(length);
crit.addOrder(Order.asc("dateCreated"));
return crit.list();
}
16
Source : HibernateProviderDAO.java
with Apache License 2.0
from isstac
with Apache License 2.0
from isstac
private <T> List<T> getAll(boolean includeRetired, Clreplaced<T> clazz) {
Criteria criteria = getSession().createCriteria(clazz);
if (!includeRetired) {
criteria.add(Restrictions.eq("retired", false));
} else {
// push retired Provider to the end of the returned list
criteria.addOrder(Order.asc("retired"));
}
criteria.addOrder(Order.asc("name"));
return criteria.list();
}
16
Source : HibernateProviderDAO.java
with Apache License 2.0
from isstac
with Apache License 2.0
from isstac
/**
* @see org.openmrs.api.db.ProviderDAO#getProvidersByPerson(org.openmrs.Person, boolean)
*/
@Override
public Collection<Provider> getProvidersByPerson(Person person, boolean includeRetired) {
Criteria criteria = getSession().createCriteria(Provider.clreplaced);
if (!includeRetired) {
criteria.add(Restrictions.eq("retired", false));
} else {
// push retired Provider to the end of the returned list
criteria.addOrder(Order.asc("retired"));
}
criteria.add(Restrictions.eq("person", person));
criteria.addOrder(Order.asc("providerId"));
return criteria.list();
}
16
Source : HibernateAdministrationDAO.java
with Apache License 2.0
from isstac
with Apache License 2.0
from isstac
/**
* @see org.openmrs.api.db.AdministrationDAO#getAllGlobalProperties()
*/
@Override
@SuppressWarnings("unchecked")
public List<GlobalProperty> getAllGlobalProperties() throws DAOException {
Criteria criteria = sessionFactory.getCurrentSession().createCriteria(GlobalProperty.clreplaced);
return criteria.addOrder(Order.asc("property")).list();
}
16
Source : UserDaoImpl.java
with Apache License 2.0
from helicalinsight
with Apache License 2.0
from helicalinsight
@Override
public List<User> searchUser(int offset, int limit, LimitOffsetModel limitOffsetModel) {
Criteria criteria = sessionFactory.getCurrentSession().createCriteria(User.clreplaced);
criteria.setResultTransformer(Criteria.DISTINCT_ROOT_ENreplacedY);
criteria.addOrder(Order.asc("username"));
if (criteria.list().isEmpty()) {
limitOffsetModel.setTotalCount(0);
return null;
} else {
limitOffsetModel.setTotalCount(criteria.list().size());
}
criteria.setFirstResult(offset);
criteria.setMaxResults(limit);
return criteria.list();
}
16
Source : EicrDaoImpl.java
with Apache License 2.0
from drajer-health
with Apache License 2.0
from drajer-health
public List<Eicr> getEicrData(Map<String, String> searchParams) {
Criteria criteria = getSession().createCriteria(Eicr.clreplaced);
if (searchParams.get("eicrId") != null) {
criteria.add(Restrictions.eq("id", Integer.parseInt(searchParams.get("eicrId"))));
}
prepareCriteria(criteria, searchParams);
return criteria.addOrder(Order.desc("id")).list();
}
16
Source : EicrDaoImpl.java
with Apache License 2.0
from drajer-health
with Apache License 2.0
from drajer-health
public List<Eicr> getRRData(Map<String, String> searchParams) {
Criteria criteria = getSession().createCriteria(Eicr.clreplaced);
if (searchParams.get("responseDocId") != null) {
criteria.add(Restrictions.eq("responseDocId", searchParams.get("responseDocId")));
}
prepareCriteria(criteria, searchParams);
return criteria.addOrder(Order.desc("id")).list();
}
15
Source : GetHistoryActivitiyCommand.java
with Apache License 2.0
from youseries
with Apache License 2.0
from youseries
@SuppressWarnings("unchecked")
public List<HistoryActivity> execute(Context context) {
Criteria criteria = context.getSession().createCriteria(HistoryActivity.clreplaced);
if (isProcessInstanceId) {
criteria.add(Restrictions.eq("rootProcessInstanceId", instanceId));
} else {
criteria.add(Restrictions.eq("historyProcessInstanceId", instanceId));
}
criteria.addOrder(Order.desc("endDate"));
return criteria.list();
}
15
Source : HibernateDao.java
with GNU Affero General Public License v3.0
from wkeyuan
with GNU Affero General Public License v3.0
from wkeyuan
/* (non-Javadoc)
* @see com.key.common.orm.hibernate.IHibernateDao#findAll(com.key.common.orm.PageRequest, java.util.List)
*/
@Override
public List<T> findAll(final PageRequest pageRequest, final List<PropertyFilter> filters) {
Criterion[] criterions = buildCriterionByPropertyFilter(filters);
Criteria c = createCriteria(criterions);
if (pageRequest.isOrderBySetted()) {
for (PageRequest.Sort sort : pageRequest.getSort()) {
if (PageRequest.Sort.ASC.equals(sort.getDir())) {
c.addOrder(Order.asc(sort.getProperty()));
} else {
c.addOrder(Order.desc(sort.getProperty()));
}
}
}
return c.list();
}
15
Source : HibernateEventDao.java
with Mozilla Public License 2.0
from secdec
with Mozilla Public License 2.0
from secdec
@Override
public List<Event> retrieveAllByDefectTrackerId(Integer defectTrackerId) {
Criteria criteria = getSession().createCriteria(getClreplacedReference()).createAlias("defect.application.defectTracker", "defectTracker", Criteria.LEFT_JOIN).add(Restrictions.eq("active", true)).add(Restrictions.eq("defectTracker.id", defectTrackerId));
Order order = getOrder();
if (order != null) {
criteria.addOrder(order);
}
return criteria.list();
}
15
Source : VisitDaoImpl.java
with GNU Lesser General Public License v2.1
from phoenixctms
with GNU Lesser General Public License v2.1
from phoenixctms
@Override
protected Collection<Visit> handleFindVisits(Long trialId, String tokenInfix, String replacedleInfix, Integer limit) throws Exception {
Criteria visitCriteria = createVisitCriteria();
if (trialId != null) {
visitCriteria.add(Restrictions.eq("trial.id", trialId.longValue()));
}
CategoryCriterion.applyOr(visitCriteria, new CategoryCriterion(tokenInfix, "token", MatchMode.ANYWHERE), new CategoryCriterion(replacedleInfix, "replacedle", MatchMode.ANYWHERE));
visitCriteria.addOrder(Order.asc("token"));
CriteriaUtil.applyLimit(limit, Settings.getIntNullable(SettingCodes.VISIT_AUTOCOMPLETE_DEFAULT_RESULT_LIMIT, Bundle.SETTINGS, DefaultSettings.VISIT_AUTOCOMPLETE_DEFAULT_RESULT_LIMIT), visitCriteria);
return visitCriteria.list();
}
15
Source : TrialTagValueDaoImpl.java
with GNU Lesser General Public License v2.1
from phoenixctms
with GNU Lesser General Public License v2.1
from phoenixctms
@Override
protected Collection<TrialTagValue> handleFindByTrialExcelPayoffsSorted(Long trialId, Boolean excel, Boolean payoffs) throws Exception {
org.hibernate.Criteria tagValueCriteria = createTagValueCriteria();
tagValueCriteria.add(Restrictions.eq("trial.id", trialId.longValue()));
Criteria tagCriteria = tagValueCriteria.createCriteria("tag", CriteriaSpecification.INNER_JOIN);
if (excel != null) {
tagCriteria.add(Restrictions.eq("excel", excel.booleanValue()));
}
if (payoffs != null) {
tagCriteria.add(Restrictions.eq("payoffs", payoffs.booleanValue()));
}
tagCriteria.addOrder(Order.asc("nameL10nKey"));
return tagValueCriteria.list();
}
15
Source : TrialDaoImpl.java
with GNU Lesser General Public License v2.1
from phoenixctms
with GNU Lesser General Public License v2.1
from phoenixctms
@Override
protected Collection<Trial> handleFindByParticipatingProbandSorted(Long probandId) throws Exception {
org.hibernate.Criteria trialCriteria = createTrialCriteria(null);
trialCriteria.createCriteria("probandListEntries", CriteriaSpecification.INNER_JOIN).add(Restrictions.eq("proband.id", probandId.longValue()));
trialCriteria.addOrder(Order.asc("name"));
return trialCriteria.list();
}
15
Source : StaffTagValueDaoImpl.java
with GNU Lesser General Public License v2.1
from phoenixctms
with GNU Lesser General Public License v2.1
from phoenixctms
@Override
protected Collection<TrialTagValue> handleFindByStaffExcelTrainingRecordSorted(Long staffId, Boolean excel, Boolean trainingRecord) throws Exception {
org.hibernate.Criteria tagValueCriteria = createTagValueCriteria();
tagValueCriteria.add(Restrictions.eq("staff.id", staffId.longValue()));
Criteria tagCriteria = tagValueCriteria.createCriteria("tag", CriteriaSpecification.INNER_JOIN);
if (excel != null) {
tagCriteria.add(Restrictions.eq("excel", excel.booleanValue()));
}
if (trainingRecord != null) {
tagCriteria.add(Restrictions.eq("trainingRecord", trainingRecord.booleanValue()));
}
tagCriteria.addOrder(Order.asc("nameL10nKey"));
return tagValueCriteria.list();
}
15
Source : WhatifWorkflowDAOHibImpl.java
with GNU Affero General Public License v3.0
from KnowageLabs
with GNU Affero General Public License v3.0
from KnowageLabs
public List<SbiWhatifWorkflow> getWorkflowByModel(int modelId) {
logger.debug("IN");
Session aSession = null;
try {
aSession = getSession();
Criteria criteria = aSession.createCriteria(SbiWhatifWorkflow.clreplaced);
Criterion rest1 = Restrictions.eq("modelId", modelId);
criteria.add(rest1);
criteria.addOrder(Order.asc("sequcence"));
return criteria.list();
} catch (HibernateException he) {
logger.error("Error loading workflow for model" + modelId, he);
throw new SpagoBIRuntimeException("Error loading workflow for model" + modelId, he);
} finally {
if (aSession != null) {
if (aSession.isOpen())
aSession.close();
}
logger.debug("OUT");
}
}
15
Source : WhatifWorkflowDAOHibImpl.java
with GNU Affero General Public License v3.0
from KnowageLabs
with GNU Affero General Public License v3.0
from KnowageLabs
@Override
public List<Integer> getWorkflowUsersOfModel(int modelId) {
logger.debug("IN");
List list;
List<Integer> resultArray = new ArrayList<>();
Session aSession = null;
try {
aSession = getSession();
Criteria criteria = aSession.createCriteria(SbiWhatifWorkflow.clreplaced);
Criterion rest1 = Restrictions.eq("modelId", modelId);
criteria.add(rest1);
criteria.addOrder(Order.asc("sequcence"));
list = criteria.list();
Iterator it = list.iterator();
while (it.hasNext()) {
SbiWhatifWorkflow el = (SbiWhatifWorkflow) it.next();
resultArray.add(el.getUserId());
}
} catch (HibernateException he) {
logger.error("Exception loading workflow users", he);
throw new SpagoBIRuntimeException("Exception loading workflow users", he);
} finally {
if (aSession != null) {
if (aSession.isOpen())
aSession.close();
}
logger.debug("OUT");
}
return resultArray;
}
15
Source : SearchImages.java
with GNU Affero General Public License v3.0
from KnowageLabs
with GNU Affero General Public License v3.0
from KnowageLabs
@Override
public Criteria evaluate(Session session) {
Criteria c = session.createCriteria(SbiImages.clreplaced);
if (name != null && !name.isEmpty()) {
c.add(Restrictions.like("name", name, MatchMode.ANYWHERE).ignoreCase());
}
if (description != null && !description.isEmpty()) {
c.add(Restrictions.like("description", description, MatchMode.ANYWHERE).ignoreCase());
}
if (sort != null) {
for (Entry<OrderBy, Direction> entry : sort.entrySet()) {
String orderField = "";
switch(entry.getKey()) {
case name:
orderField = "name";
break;
case timeIn:
orderField = "commonInfo.timeIn";
break;
}
c.addOrder(Direction.asc.equals(entry.getValue()) ? Order.asc(orderField) : Order.desc(orderField));
}
}
return c;
}
15
Source : HibernateCohortDAO.java
with Apache License 2.0
from isstac
with Apache License 2.0
from isstac
/**
* @see org.openmrs.api.db.CohortDAO#getAllCohorts(boolean)
*/
@Override
@SuppressWarnings("unchecked")
public List<Cohort> getAllCohorts(boolean includeVoided) throws DAOException {
Criteria criteria = sessionFactory.getCurrentSession().createCriteria(Cohort.clreplaced);
criteria.addOrder(Order.asc("name"));
if (!includeVoided) {
criteria.add(Restrictions.eq("voided", false));
}
return (List<Cohort>) criteria.list();
}
See More Examples