本文整理了Java中org.hibernate.criterion.Restrictions.le
方法的一些代码示例,展示了Restrictions.le
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Restrictions.le
方法的具体详情如下:
包路径:org.hibernate.criterion.Restrictions
类名称:Restrictions
方法名:le
[英]Apply a "less than or equal" constraint to the named property
[中]对命名属性应用“小于或等于”约束
代码示例来源:origin: hibernate/hibernate-orm
/**
* Create a less-than-or-equal-to restriction based on this property
*
* @param value The value to check against
*
* @return The less-than-or-equal-to restriction
*
* @see Restrictions#le(String, Object)
*/
public SimpleExpression le(Object value) {
return Restrictions.le( getPropertyName(), value );
}
代码示例来源:origin: kaaproject/kaa
@Override
public List<LogAppender> findByAppIdAndSchemaVersion(String appId, int schemaVersion) {
LOG.debug("Searching log appenders by application id [{}] and schema version [{}]",
appId, schemaVersion);
List<LogAppender> appenders = Collections.emptyList();
if (isNotBlank(appId)) {
appenders = findListByCriterionWithAlias(APPLICATION_PROPERTY, APPLICATION_ALIAS,
Restrictions.and(
Restrictions.eq(APPLICATION_REFERENCE, Long.valueOf(appId)),
Restrictions.le(LOG_APPENDER_MIN_LOG_SCHEMA_VERSION, schemaVersion),
Restrictions.ge(LOG_APPENDER_MAX_LOG_SCHEMA_VERSION, schemaVersion))
);
}
if (LOG.isTraceEnabled()) {
LOG.trace("[{},{}] Search result: {}.", appId, schemaVersion,
Arrays.toString(appenders.toArray()));
} else {
LOG.debug("[{},{}] Search result: {}.", appId, schemaVersion, appenders.size());
}
return appenders;
}
代码示例来源:origin: kaaproject/kaa
@Override
public List<History> findBySeqNumberRange(String appId, int startSeqNum, int endSeqNum) {
List<History> histories = Collections.emptyList();
LOG.debug("Searching history by application id {} start sequence number {} and end {}",
appId, startSeqNum, endSeqNum);
if (isNotBlank(appId)) {
histories = findListByCriterionWithAlias(APPLICATION_PROPERTY, APPLICATION_ALIAS,
Restrictions.and(
Restrictions.eq(APPLICATION_REFERENCE, Long.valueOf(appId)),
Restrictions.gt(SEQUENCE_NUMBER_PROPERTY, startSeqNum),
Restrictions.le(SEQUENCE_NUMBER_PROPERTY, endSeqNum)));
}
if (LOG.isTraceEnabled()) {
LOG.trace("[{},{},{}] Search result: {}.",
appId, startSeqNum, endSeqNum, Arrays.toString(histories.toArray()));
} else {
LOG.debug("[{},{},{}] Search result: {}.",
appId, startSeqNum, endSeqNum, histories.size());
}
return histories;
}
代码示例来源:origin: openmrs/openmrs-core
@Override
public List<CohortMembership> getCohortMemberships(Integer patientId, Date activeOnDate, boolean includeVoided) {
Criteria criteria = sessionFactory.getCurrentSession().createCriteria(CohortMembership.class);
criteria.add(Restrictions.eq("patientId", patientId));
if (activeOnDate != null) {
criteria.add(Restrictions.le("startDate", activeOnDate));
criteria.add(Restrictions.or(
Restrictions.isNull("endDate"),
Restrictions.ge("endDate", activeOnDate)
));
}
if (!includeVoided) {
criteria.add(Restrictions.eq(VOIDED, false));
}
return criteria.list();
}
代码示例来源:origin: bill1012/AdminEAP
@Override
public DetachedCriteria getCriteria(DetachedCriteria criteria, String key, Object value) throws QueryException {
List values=(List) value;
if(values.size()==2){
if(values.get(0)==null){
if(values.get(1)!=null)
criteria.add(Restrictions.le(key,values.get(1)));
}else if(values.get(1)==null){
criteria.add(Restrictions.ge(key,values.get(0)));
}else{
criteria.add(Restrictions.between(key,values.get(0),values.get(1)));
}
}
return criteria;
}
};
代码示例来源:origin: openmrs/openmrs-core
crit.add(Restrictions.le("dateEnrolled", maxEnrollmentDate));
crit.add(Restrictions.le("dateCompleted", maxCompletionDate));
代码示例来源:origin: openmrs/openmrs-core
/**
* @see org.openmrs.api.db.CohortDAO#getCohortsContainingPatientId(Integer, boolean, Date)
*/
@Override
@SuppressWarnings("unchecked")
public List<Cohort> getCohortsContainingPatientId(Integer patientId, boolean includeVoided,
Date asOfDate) throws DAOException {
Disjunction orEndDate = Restrictions.disjunction();
orEndDate.add(Restrictions.isNull("m.endDate"));
orEndDate.add(Restrictions.gt("m.endDate", asOfDate));
Criteria criteria = sessionFactory.getCurrentSession().createCriteria(Cohort.class);
criteria.createAlias("memberships", "m");
if (asOfDate != null) {
criteria.add(Restrictions.le("m.startDate", asOfDate));
criteria.add(orEndDate);
}
criteria.add(Restrictions.eq("m.patientId", patientId));
criteria.setResultTransformer(CriteriaSpecification.DISTINCT_ROOT_ENTITY);
if (!includeVoided) {
criteria.add(Restrictions.eq(VOIDED, includeVoided));
}
return criteria.list();
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @see org.openmrs.api.db.VisitDAO#getNextVisit(Visit, Collection, Date)
*/
@Override
public Visit getNextVisit(Visit previousVisit, Collection<VisitType> visitTypes, Date maximumStartDate) {
Criteria criteria = getCurrentSession().createCriteria(Visit.class);
criteria.add(Restrictions.eq("voided", false)).add(
Restrictions.gt("visitId", (previousVisit != null) ? previousVisit.getVisitId() : 0)).addOrder(
Order.asc("visitId")).add(Restrictions.isNull("stopDatetime")).setMaxResults(1);
if (maximumStartDate != null) {
criteria.add(Restrictions.le("startDatetime", maximumStartDate));
}
if (CollectionUtils.isNotEmpty(visitTypes)) {
criteria.add(Restrictions.in("visitType", visitTypes));
}
return (Visit) criteria.uniqueResult();
}
}
代码示例来源:origin: openmrs/openmrs-core
criteria.add(Restrictions.le("obsDatetime", toDate));
代码示例来源:origin: bill1012/AdminEAP
@Override
public String getAttorneyByAssignee(String assignee, String moduleCode) {
String hql = "from Module where code='" + moduleCode + "'";
Module module = this.get(hql);
if(module==null)
return null;
DetachedCriteria criteria = DetachedCriteria.forClass(DelegateInfo.class);
criteria.add(Restrictions.eq("assignee", assignee));
Date now = new Date();
criteria.add(Restrictions.le("startTime", now));
criteria.add(Restrictions.ge("endTime", now));
criteria.add(Restrictions.like("moduleId", "%" + module.getId() + "%"));
criteria.add(Restrictions.eq("deleted", 0));
List<DelegateInfo> delegateInfos = this.findByCriteria(criteria);
if (delegateInfos.isEmpty()) {
return null;
} else {
return delegateInfos.get(0).getAttorney();
}
}
代码示例来源:origin: openmrs/openmrs-core
criteria.add(Restrictions.le("startDatetime", maxStartDatetime));
criteria.add(Restrictions.le("stopDatetime", maxEndDatetime));
代码示例来源:origin: openmrs/openmrs-core
crit.add(Restrictions.le("dateActivated", OpenmrsUtil.getLastMomentOfDay(cal.getTime())));
代码示例来源:origin: openmrs/openmrs-core
Restrictions.and(Restrictions.le("startDate", startEffectiveDate), Restrictions.ge("endDate",
startEffectiveDate))).add(
Restrictions.and(Restrictions.le("startDate", startEffectiveDate), Restrictions.isNull("endDate"))).add(
Restrictions.and(Restrictions.isNull("startDate"), Restrictions.ge("endDate", startEffectiveDate))).add(
Restrictions.and(Restrictions.isNull("startDate"), Restrictions.isNull("endDate"))));
Restrictions.and(Restrictions.le("startDate", endEffectiveDate), Restrictions
.ge("endDate", endEffectiveDate))).add(
Restrictions.and(Restrictions.le("startDate", endEffectiveDate), Restrictions.isNull("endDate"))).add(
Restrictions.and(Restrictions.isNull("startDate"), Restrictions.ge("endDate", endEffectiveDate))).add(
Restrictions.and(Restrictions.isNull("startDate"), Restrictions.isNull("endDate"))));
代码示例来源:origin: openmrs/openmrs-core
/**
* @see org.openmrs.api.db.OrderDAO#getActiveOrders(org.openmrs.Patient, java.util.List,
* org.openmrs.CareSetting, java.util.Date)
*/
@Override
@SuppressWarnings("unchecked")
public List<Order> getActiveOrders(Patient patient, List<OrderType> orderTypes, CareSetting careSetting, Date asOfDate) {
Criteria crit = createOrderCriteria(patient, careSetting, orderTypes, false, false);
crit.add(Restrictions.le("dateActivated", asOfDate));
Disjunction dateStoppedAndAutoExpDateDisjunction = Restrictions.disjunction();
Criterion stopAndAutoExpDateAreBothNull = Restrictions.and(Restrictions.isNull("dateStopped"), Restrictions
.isNull("autoExpireDate"));
dateStoppedAndAutoExpDateDisjunction.add(stopAndAutoExpDateAreBothNull);
Criterion autoExpireDateEqualToOrAfterAsOfDate = Restrictions.and(Restrictions.isNull("dateStopped"), Restrictions
.ge("autoExpireDate", asOfDate));
dateStoppedAndAutoExpDateDisjunction.add(autoExpireDateEqualToOrAfterAsOfDate);
dateStoppedAndAutoExpDateDisjunction.add(Restrictions.ge("dateStopped", asOfDate));
crit.add(dateStoppedAndAutoExpDateDisjunction);
return crit.list();
}
代码示例来源:origin: openmrs/openmrs-core
crit.add(Restrictions.le("encounterDatetime", searchCriteria.getToDate()));
代码示例来源:origin: org.grails/grails-datastore-gorm-hibernate-core
@Override
public Query le(String property, Object value) {
addToCriteria(Restrictions.le(calculatePropertyName(property), value));
return this;
}
代码示例来源:origin: org.wso2.bpel/ode-dao-hibernate
public Criterion evaluate(Object paramValue) {
Conjunction conj = Restrictions.conjunction();
if (!StringUtils.isEmpty(property.getNamespace())) {
conj.add(Restrictions.le(PROPERTY_NS_DB_FIELD, property.getNamespace()));
}
conj.add(Restrictions.le(PROPERTY_NAME_DB_FIELD, property.getName()));
conj.add(Restrictions.le(PROPERTY_VALUE_DB_FIELD, le.getValue().getValue()));
return conj;
};
代码示例来源:origin: com.arsframework/ars-database
/**
* 获取小于或等于条件匹配对象
*
* @param property 属性名称
* @param value 属性值
* @return 条件匹配对象
*/
protected Criterion getLessEqualCriterion(String property, Object value) {
ConditionWrapper condition = this.getConditionWrapper(property, value);
return Restrictions.le(this.getCriteriaAlias(condition.getProperty()), condition.getValue());
}
代码示例来源:origin: org.n52.sensorweb.sos/hibernate-utils
@Override
public Criterion filterInstantWithPeriod(String selfPosition, String otherPosition, Integer count) {
return Restrictions.and(Restrictions.ge(selfPosition, getStartPlaceHolder( count)),
Restrictions.le(selfPosition, getStartPlaceHolder(count)));
}
代码示例来源:origin: org.geomajas.plugin/geomajas-layer-hibernate
/** {@inheritDoc} */
@Override
public Object visit(PropertyIsLessThanOrEqualTo filter, Object userData) {
String propertyName = getPropertyName(filter.getExpression1());
String finalName = parsePropertyName(propertyName, userData);
Object literal = getLiteralValue(filter.getExpression2());
return Restrictions.le(finalName, castLiteral(literal, propertyName));
}
内容来源于网络,如有侵权,请联系作者删除!