本文整理汇总了Java中org.apache.ojb.broker.query.Criteria.addLessOrEqualThan方法的典型用法代码示例。如果您正苦于以下问题:Java Criteria.addLessOrEqualThan方法的具体用法?Java Criteria.addLessOrEqualThan怎么用?Java Criteria.addLessOrEqualThan使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.ojb.broker.query.Criteria
的用法示例。
在下文中一共展示了Criteria.addLessOrEqualThan方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addStringRangeCriteria
import org.apache.ojb.broker.query.Criteria; //导入方法依赖的package包/类
/**
* Adds to the criteria object based on query characters given
*/
private void addStringRangeCriteria(String propertyName, String propertyValue, Criteria criteria) {
try {
if (StringUtils.contains(propertyValue, SearchOperator.BETWEEN.op())) {
String[] rangeValues = StringUtils.split(propertyValue, SearchOperator.BETWEEN.op());
if (rangeValues.length < 2)
throw new IllegalArgumentException("Improper syntax of BETWEEN operator in " + propertyName);
criteria.addBetween(propertyName, rangeValues[0], rangeValues[1]);
} else if (propertyValue.startsWith(SearchOperator.GREATER_THAN_EQUAL.op())) {
criteria.addGreaterOrEqualThan(propertyName, ObjectUtils.clean(propertyValue));
} else if (propertyValue.startsWith(SearchOperator.LESS_THAN_EQUAL.op())) {
criteria.addLessOrEqualThan(propertyName, ObjectUtils.clean(propertyValue));
} else if (propertyValue.startsWith(SearchOperator.GREATER_THAN.op())) {
criteria.addGreaterThan(propertyName, ObjectUtils.clean(propertyValue));
} else if (propertyValue.startsWith(SearchOperator.LESS_THAN.op())) {
criteria.addLessThan(propertyName, ObjectUtils.clean(propertyValue));
} else {
criteria.addEqualTo(propertyName, ObjectUtils.clean(propertyValue));
}
} catch (IllegalArgumentException ex) {
GlobalVariables.getMessageMap().putError("lookupCriteria[" + propertyName + "]", RiceKeyConstants.ERROR_BETWEEN_SYNTAX, propertyName);
}
}
示例2: getLeaveBlocksWithAccrualCategory
import org.apache.ojb.broker.query.Criteria; //导入方法依赖的package包/类
@Override
public List<LeaveBlockBo> getLeaveBlocksWithAccrualCategory(String principalId, LocalDate beginDate, LocalDate endDate, String accrualCategory) {
List<LeaveBlockBo> leaveBlocks = new ArrayList<LeaveBlockBo>();
Criteria root = new Criteria();
root.addEqualTo("principalId", principalId);
root.addGreaterOrEqualThan("leaveDate", beginDate.toDate());
root.addLessOrEqualThan("leaveDate", endDate.toDate());
root.addEqualTo("accrualCategory", accrualCategory);
// root.addEqualTo("active", true);
Query query = QueryFactory.newQuery(LeaveBlockBo.class, root);
Collection c = this.getPersistenceBrokerTemplate().getCollectionByQuery(query);
if (c != null) {
leaveBlocks.addAll(c);
}
return leaveBlocks;
}
示例3: getLeaveBlocks
import org.apache.ojb.broker.query.Criteria; //导入方法依赖的package包/类
@Override
public List<LeaveBlockBo> getLeaveBlocks(String principalId, String leaveBlockType, String requestStatus, LocalDate beginDate, LocalDate endDate) {
List<LeaveBlockBo> leaveBlocks = new ArrayList<LeaveBlockBo>();
Criteria root = new Criteria();
root.addEqualTo("principalId", principalId);
root.addEqualTo("leaveBlockType", leaveBlockType);
root.addEqualTo("requestStatus", requestStatus);
if(beginDate != null) {
root.addGreaterOrEqualThan("leaveDate", beginDate.toDate());
}
if (endDate != null){
root.addLessOrEqualThan("leaveDate", endDate.toDate());
}
Query query = QueryFactory.newQuery(LeaveBlockBo.class, root);
Collection c = this.getPersistenceBrokerTemplate().getCollectionByQuery(query);
if(c!= null) {
leaveBlocks.addAll(c);
}
return leaveBlocks;
}
示例4: getAllActiveLeaveJobs
import org.apache.ojb.broker.query.Criteria; //导入方法依赖的package包/类
@Override
public List<JobBo> getAllActiveLeaveJobs(String principalId, LocalDate asOfDate) {
Criteria root = new Criteria();
root.addEqualTo("principalId", principalId);
root.addLessOrEqualThan("effectiveDate", asOfDate.toDate());
root.addEqualTo("active", true);
root.addEqualTo("eligibleForLeave", true);
Query query = QueryFactory.newQuery(JobBo.class, root);
Collection c = this.getPersistenceBrokerTemplate().getCollectionByQuery(query);
List<JobBo> jobs = new LinkedList<JobBo>();
if (c != null) {
jobs.addAll(c);
}
return jobs;
}
示例5: queryPrincipalIsAccountDelegate
import org.apache.ojb.broker.query.Criteria; //导入方法依赖的package包/类
/**
* Determines if any non-closed accounts exist where the principal id is an account delegate
*
* @param principalId the principal id to check
* @param primary whether to check primary delegations (if true) or secondary delegations (if false)
* @param currentSqlDate current sql date
* @return true if the principal has an account delegation
*/
protected boolean queryPrincipalIsAccountDelegate(String principalId, boolean primary, Date currentSqlDate) {
Criteria criteria = new Criteria();
criteria.addEqualTo("accountDelegateSystemId", principalId);
criteria.addEqualTo("accountsDelegatePrmrtIndicator", (primary ? "Y" : "N"));
criteria.addEqualTo("active", "Y");
criteria.addEqualTo("account.active", "Y");
criteria.addLessOrEqualThan("accountDelegateStartDate", currentSqlDate);
ReportQueryByCriteria reportQuery = QueryFactory.newReportQuery(AccountDelegate.class, criteria);
reportQuery.setAttributes(new String[] { "count(*)" });
int resultCount = 0;
// TODO: getReportQueryIteratorByQuery can be changed to getCount...
Iterator iter = getPersistenceBrokerTemplate().getReportQueryIteratorByQuery(reportQuery);
while (iter.hasNext()) {
final Object[] results = (Object[]) iter.next();
resultCount = (results[0] instanceof Number) ? ((Number) results[0]).intValue() : new Integer(results[0].toString()).intValue();
}
return resultCount > 0;
}
示例6: findInvoiceAmountByBillingChartAndOrg
import org.apache.ojb.broker.query.Criteria; //导入方法依赖的package包/类
/**
* @see org.kuali.kfs.module.ar.dataaccess.CustomerAgingReportDao#findInvoiceAmountByBillingChartAndOrg(java.lang.String,
* java.lang.String, java.sql.Date, java.sql.Date)
*/
@Override
public HashMap<String, KualiDecimal> findInvoiceAmountByBillingChartAndOrg(String chart, String org, java.sql.Date begin, java.sql.Date end) {
HashMap<String, KualiDecimal> map = new HashMap<String, KualiDecimal>();
Criteria criteria = new Criteria();
if (ObjectUtils.isNotNull(begin)) {
criteria.addGreaterOrEqualThan(ArPropertyConstants.CustomerInvoiceDetailFields.BILLING_DATE, begin);
}
if (ObjectUtils.isNotNull(end)) {
criteria.addLessOrEqualThan(ArPropertyConstants.CustomerInvoiceDetailFields.BILLING_DATE, end);
}
criteria.addEqualTo(ArPropertyConstants.CustomerInvoiceDetailFields.DOCUMENT_STATUS_CODE, KFSConstants.DocumentStatusCodes.APPROVED);
criteria.addEqualTo(ArPropertyConstants.CustomerInvoiceDetailFields.BILL_BY_CHART_OF_ACCOUNT_CODE, chart);
criteria.addEqualTo(ArPropertyConstants.CustomerInvoiceDetailFields.BILLED_BY_ORGANIZATION_CODE, org);
criteria.addEqualTo(ArPropertyConstants.CustomerInvoiceDetailFields.OPEN_INVOICE_IND, true);
ReportQueryByCriteria reportByCriteria = new ReportQueryByCriteria(CustomerInvoiceDetail.class, new String[] { ArPropertyConstants.CustomerInvoiceDetailFields.ACCOUNTS_RECEIVABLE_CUSTOMER_NUMBER, ArPropertyConstants.CustomerInvoiceDetailFields.ACCOUNTS_RECEIVABLE_CUSTOMER_NAME, "sum(" + ArPropertyConstants.CustomerInvoiceDetailFields.AMOUNT + ")" }, criteria);
reportByCriteria.addGroupBy(ArPropertyConstants.CustomerInvoiceDetailFields.ACCOUNTS_RECEIVABLE_CUSTOMER_NUMBER);
reportByCriteria.addGroupBy(ArPropertyConstants.CustomerInvoiceDetailFields.ACCOUNTS_RECEIVABLE_CUSTOMER_NAME);
Iterator<?> iterator = getPersistenceBrokerTemplate().getReportQueryIteratorByQuery(reportByCriteria);
while (ObjectUtils.isNotNull(iterator) && iterator.hasNext()) {
Object[] data = (Object[]) iterator.next();
map.put((String) data[0] + "-" + data[1], (KualiDecimal) data[2]);
}
return map;
}
示例7: addSingleValuePredicate
import org.apache.ojb.broker.query.Criteria; //导入方法依赖的package包/类
/** adds a single valued predicate to a Criteria. */
private void addSingleValuePredicate(SingleValuedPredicate p, Criteria parent) {
final Object value = getVal(p.getValue());
final String pp = p.getPropertyPath();
if (p instanceof EqualPredicate) {
parent.addEqualTo(pp, value);
} else if (p instanceof EqualIgnoreCasePredicate) {
parent.addEqualTo(genUpperFunc(pp), ((String) value).toUpperCase());
} else if (p instanceof GreaterThanOrEqualPredicate) {
parent.addGreaterOrEqualThan(pp, value);
} else if (p instanceof GreaterThanPredicate) {
parent.addGreaterThan(pp, value);
} else if (p instanceof LessThanOrEqualPredicate) {
parent.addLessOrEqualThan(pp, value);
} else if (p instanceof LessThanPredicate) {
parent.addLessThan(pp, value);
} else if (p instanceof LikePredicate) {
//no need to convert * or ? since ojb handles the conversion/escaping
parent.addLike(genUpperFunc(pp), ((String) value).toUpperCase());
} else if (p instanceof NotEqualPredicate) {
parent.addNotEqualTo(pp, value);
} else if (p instanceof NotEqualIgnoreCasePredicate) {
parent.addNotEqualTo(genUpperFunc(pp), ((String) value).toUpperCase());
} else if (p instanceof NotLikePredicate) {
parent.addNotLike(pp, value);
} else {
throw new UnsupportedPredicateException(p);
}
}
示例8: addInactivateableFromToCurrentCriteria
import org.apache.ojb.broker.query.Criteria; //导入方法依赖的package包/类
/**
* Translates criteria for current status to criteria on the active from field
*
* @param example - business object being queried on
* @param currentSearchValue - value for the current search field, should convert to boolean
* @param criteria - Criteria object being built
*/
protected void addInactivateableFromToCurrentCriteria(Object example, String currentSearchValue, Criteria criteria, Map searchValues) {
Criteria maxBeginDateCriteria = new Criteria();
Timestamp activeTimestamp = LookupUtils.getActiveDateTimestampForCriteria(searchValues);
maxBeginDateCriteria.addLessOrEqualThan(KRADPropertyConstants.ACTIVE_FROM_DATE, activeTimestamp);
List<String> groupByFieldList = dataDictionaryService.getGroupByAttributesForEffectiveDating(example
.getClass());
if (groupByFieldList == null) {
return;
}
// join back to main query with the group by fields
String[] groupBy = new String[groupByFieldList.size()];
for (int i = 0; i < groupByFieldList.size(); i++) {
String groupByField = groupByFieldList.get(i);
groupBy[i] = groupByField;
maxBeginDateCriteria.addEqualToField(groupByField, Criteria.PARENT_QUERY_PREFIX + groupByField);
}
String[] columns = new String[1];
columns[0] = "max(" + KRADPropertyConstants.ACTIVE_FROM_DATE + ")";
QueryByCriteria query = QueryFactory.newReportQuery(example.getClass(), columns, maxBeginDateCriteria, true);
query.addGroupBy(groupBy);
String currentBooleanStr = (String) (new OjbCharBooleanConversion()).javaToSql(currentSearchValue);
if (OjbCharBooleanConversion.DATABASE_BOOLEAN_TRUE_STRING_REPRESENTATION.equals(currentBooleanStr)) {
criteria.addIn(KRADPropertyConstants.ACTIVE_FROM_DATE, query);
} else if (OjbCharBooleanConversion.DATABASE_BOOLEAN_FALSE_STRING_REPRESENTATION.equals(currentBooleanStr)) {
criteria.addNotIn(KRADPropertyConstants.ACTIVE_FROM_DATE, query);
}
}
示例9: addDateRangeCriteria
import org.apache.ojb.broker.query.Criteria; //导入方法依赖的package包/类
/**
* Adds to the criteria object based on query characters given
*/
private void addDateRangeCriteria(String propertyName, String propertyValue, boolean treatWildcardsAndOperatorsAsLiteral, Criteria criteria) {
try {
if (StringUtils.contains(propertyValue, SearchOperator.BETWEEN.op())) {
if (treatWildcardsAndOperatorsAsLiteral)
throw new RuntimeException("Wildcards and operators are not allowed on this date field: " + propertyName);
String[] rangeValues = StringUtils.split(propertyValue, SearchOperator.BETWEEN.op());
if (rangeValues.length < 2)
throw new IllegalArgumentException("Improper syntax of BETWEEN operator in " + propertyName);
criteria.addBetween(propertyName, parseDate( ObjectUtils.clean(rangeValues[0] ) ), parseDate( ObjectUtils.clean(rangeValues[1] ) ) );
} else if (propertyValue.startsWith(SearchOperator.GREATER_THAN_EQUAL.op())) {
if (treatWildcardsAndOperatorsAsLiteral)
throw new RuntimeException("Wildcards and operators are not allowed on this date field: " + propertyName);
criteria.addGreaterOrEqualThan(propertyName, parseDate( ObjectUtils.clean(propertyValue) ) );
} else if (propertyValue.startsWith(SearchOperator.LESS_THAN_EQUAL.op())) {
if (treatWildcardsAndOperatorsAsLiteral)
throw new RuntimeException("Wildcards and operators are not allowed on this date field: " + propertyName);
criteria.addLessOrEqualThan(propertyName, parseDate( ObjectUtils.clean(propertyValue) ) );
} else if (propertyValue.startsWith(SearchOperator.GREATER_THAN.op())) {
if (treatWildcardsAndOperatorsAsLiteral)
throw new RuntimeException("Wildcards and operators are not allowed on this date field: " + propertyName);
criteria.addGreaterThan(propertyName, parseDate( ObjectUtils.clean(propertyValue) ) );
} else if (propertyValue.startsWith(SearchOperator.LESS_THAN.op())) {
if (treatWildcardsAndOperatorsAsLiteral)
throw new RuntimeException("Wildcards and operators are not allowed on this date field: " + propertyName);
criteria.addLessThan(propertyName, parseDate( ObjectUtils.clean(propertyValue) ) );
} else {
criteria.addEqualTo(propertyName, parseDate( ObjectUtils.clean(propertyValue) ) );
}
} catch (IllegalArgumentException ex) {
GlobalVariables.getMessageMap().putError("lookupCriteria[" + propertyName + "]", RiceKeyConstants.ERROR_BETWEEN_SYNTAX, propertyName);
}
}
示例10: addNumericRangeCriteria
import org.apache.ojb.broker.query.Criteria; //导入方法依赖的package包/类
/**
* Adds to the criteria object based on query characters given
*/
private void addNumericRangeCriteria(String propertyName, String propertyValue, boolean treatWildcardsAndOperatorsAsLiteral, Criteria criteria) {
try {
if (StringUtils.contains(propertyValue, SearchOperator.BETWEEN.op())) {
if (treatWildcardsAndOperatorsAsLiteral)
throw new RuntimeException("Cannot use wildcards and operators on numeric field " + propertyName);
String[] rangeValues = StringUtils.split(propertyValue, SearchOperator.BETWEEN.op());
if (rangeValues.length < 2)
throw new IllegalArgumentException("Improper syntax of BETWEEN operator in " + propertyName);
criteria.addBetween(propertyName, cleanNumeric( rangeValues[0] ), cleanNumeric( rangeValues[1] ));
} else if (propertyValue.startsWith(SearchOperator.GREATER_THAN_EQUAL.op())) {
if (treatWildcardsAndOperatorsAsLiteral)
throw new RuntimeException("Cannot use wildcards and operators on numeric field " + propertyName);
criteria.addGreaterOrEqualThan(propertyName, cleanNumeric(propertyValue));
} else if (propertyValue.startsWith(SearchOperator.LESS_THAN_EQUAL.op())) {
if (treatWildcardsAndOperatorsAsLiteral)
throw new RuntimeException("Cannot use wildcards and operators on numeric field " + propertyName);
criteria.addLessOrEqualThan(propertyName, cleanNumeric(propertyValue));
} else if (propertyValue.startsWith(SearchOperator.GREATER_THAN.op())) {
if (treatWildcardsAndOperatorsAsLiteral)
throw new RuntimeException("Cannot use wildcards and operators on numeric field " + propertyName);
criteria.addGreaterThan(propertyName, cleanNumeric( propertyValue ) );
} else if (propertyValue.startsWith(SearchOperator.LESS_THAN.op())) {
if (treatWildcardsAndOperatorsAsLiteral)
throw new RuntimeException("Cannot use wildcards and operators on numeric field " + propertyName);
criteria.addLessThan(propertyName, cleanNumeric(propertyValue));
} else {
criteria.addEqualTo(propertyName, cleanNumeric(propertyValue));
}
} catch (IllegalArgumentException ex) {
GlobalVariables.getMessageMap().putError("lookupCriteria[" + propertyName + "]", RiceKeyConstants.ERROR_BETWEEN_SYNTAX, propertyName);
}
}
示例11: getCalendarEntryByCalendarIdAndDateRange
import org.apache.ojb.broker.query.Criteria; //导入方法依赖的package包/类
@Override
public CalendarEntryBo getCalendarEntryByCalendarIdAndDateRange(
String hrCalendarId, DateTime beginDate, DateTime endDate) {
Criteria root = new Criteria();
root.addEqualTo("hrCalendarId", hrCalendarId);
//root.addEqualTo("beginPeriodDateTime", beginDateSubQuery);
root.addLessOrEqualThan("beginPeriodDateTime", endDate.toDate());
root.addGreaterThan("endPeriodDateTime", beginDate.toDate());
// root.addEqualTo("endPeriodDateTime", endDateSubQuery);
Query query = QueryFactory.newQuery(CalendarEntryBo.class, root);
CalendarEntryBo pce = (CalendarEntryBo) this.getPersistenceBrokerTemplate().getObjectByQuery(query);
return pce;
}
示例12: getProposalsToClose
import org.apache.ojb.broker.query.Criteria; //导入方法依赖的package包/类
/**
* @see org.kuali.ole.module.cg.dataaccess.ProposalDao#getProposalsToClose(org.kuali.ole.module.cg.businessobject.Close)
*/
public Collection<Proposal> getProposalsToClose(ProposalAwardCloseDocument close) {
Criteria criteria = new Criteria();
criteria.addIsNull("proposalClosingDate");
criteria.addLessOrEqualThan("proposalSubmissionDate", close.getCloseOnOrBeforeDate());
return (Collection<Proposal>) getPersistenceBrokerTemplate().getCollectionByQuery(QueryFactory.newQuery(Proposal.class, criteria));
}
示例13: getLeaveAdjustments
import org.apache.ojb.broker.query.Criteria; //导入方法依赖的package包/类
@Override
public List<LeaveAdjustment> getLeaveAdjustments(LocalDate fromEffdt, LocalDate toEffdt, String principalId, String accrualCategory, String earnCode) {
List<LeaveAdjustment> results = new ArrayList<LeaveAdjustment>();
Criteria root = new Criteria();
Criteria effectiveDateFilter = new Criteria();
if (fromEffdt != null) {
effectiveDateFilter.addGreaterOrEqualThan("effectiveDate", fromEffdt.toDate());
}
if (toEffdt != null) {
effectiveDateFilter.addLessOrEqualThan("effectiveDate", toEffdt.toDate());
}
if (fromEffdt == null && toEffdt == null) {
effectiveDateFilter.addLessOrEqualThan("effectiveDate", LocalDate.now().toDate());
}
root.addAndCriteria(effectiveDateFilter);
if (StringUtils.isNotBlank(principalId)) {
root.addLike("UPPER(principalId)", principalId.toUpperCase()); // KPME-2695 in case principal id is not a number
}
if (StringUtils.isNotBlank(accrualCategory)) {
root.addLike("UPPER(accrualCategory)", accrualCategory.toUpperCase()); // KPME-2695
}
if (StringUtils.isNotBlank(earnCode)) {
root.addLike("UPPER(earnCode)", earnCode.toUpperCase()); // KPME-2695
}
Query query = QueryFactory.newQuery(LeaveAdjustment.class, root);
results.addAll(getPersistenceBrokerTemplate().getCollectionByQuery(query));
return results;
}
示例14: getEligibleForAutoApproval
import org.apache.ojb.broker.query.Criteria; //导入方法依赖的package包/类
/**
* @see org.kuali.kfs.module.purap.document.dataaccess.PaymentRequestDao#getEligibleForAutoApproval()
*/
@Override
public List<String> getEligibleForAutoApproval(Date todayAtMidnight) {
Criteria criteria = new Criteria();
criteria.addLessOrEqualThan(PurapPropertyConstants.PAYMENT_REQUEST_PAY_DATE, todayAtMidnight);
criteria.addEqualTo("holdIndicator", "N");
criteria.addEqualTo("paymentRequestedCancelIndicator", "N");
criteria.addIn(KFSPropertyConstants.DOCUMENT_HEADER + "." + KFSPropertyConstants.APPLICATION_DOCUMENT_STATUS,
Arrays.asList(PurapConstants.PaymentRequestStatuses.PREQ_STATUSES_FOR_AUTO_APPROVE));
List<String> returnList = getDocumentNumbersOfPaymentRequestByCriteria(criteria, false);
return returnList;
}
示例15: getEligibleForAutoApproval
import org.apache.ojb.broker.query.Criteria; //导入方法依赖的package包/类
/**
* @see org.kuali.ole.module.purap.document.dataaccess.InvoiceDao#getEligibleForAutoApproval(Date)
*/
public List<String> getEligibleForAutoApproval(Date todayAtMidnight) {
Criteria criteria = new Criteria();
criteria.addLessOrEqualThan(PurapPropertyConstants.PAYMENT_REQUEST_PAY_DATE, todayAtMidnight);
criteria.addNotEqualTo("holdIndicator", "Y");
criteria.addNotEqualTo("invoiceCancelIndicator", "Y");
List<String> returnList = getDocumentNumbersOfInvoiceByCriteria(criteria, false);
return returnList;
}