当前位置: 首页>>代码示例>>Java>>正文


Java Criteria.addLessThan方法代码示例

本文整理汇总了Java中org.apache.ojb.broker.query.Criteria.addLessThan方法的典型用法代码示例。如果您正苦于以下问题:Java Criteria.addLessThan方法的具体用法?Java Criteria.addLessThan怎么用?Java Criteria.addLessThan使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.ojb.broker.query.Criteria的用法示例。


在下文中一共展示了Criteria.addLessThan方法的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);
    }
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:28,代码来源:LookupDaoOjb.java

示例2: getSubmissionDelinquentDocumentHeaders

import org.apache.ojb.broker.query.Criteria; //导入方法依赖的package包/类
@Override
public List<LeaveCalendarDocumentHeader> getSubmissionDelinquentDocumentHeaders(String principalId, DateTime beforeDate) {
	Criteria crit = new Criteria();
    List<LeaveCalendarDocumentHeader> lstDocumentHeaders = new ArrayList<LeaveCalendarDocumentHeader>();

    crit.addEqualTo("principalId", principalId);
    crit.addLessThan("endDate", beforeDate.toDate());
    crit.addNotEqualTo("documentStatus", HrConstants.ROUTE_STATUS.INITIATED);
    crit.addNotEqualTo("documentStatus", HrConstants.ROUTE_STATUS.ENROUTE);
    crit.addNotEqualTo("documentStatus", HrConstants.ROUTE_STATUS.FINAL);
    QueryByCriteria query = new QueryByCriteria(LeaveCalendarDocumentHeader.class, crit);
    Collection c = this.getPersistenceBrokerTemplate().getCollectionByQuery(query);
    if (c != null) {
        lstDocumentHeaders.addAll(c);
    }
    return lstDocumentHeaders;
}
 
开发者ID:kuali-mirror,项目名称:kpme,代码行数:18,代码来源:LeaveCalendarDocumentHeaderDaoOjbImpl.java

示例3: getAllCalendarEntriesForCalendarIdWithinLeavePlanYear

import org.apache.ojb.broker.query.Criteria; //导入方法依赖的package包/类
public List<CalendarEntryBo> getAllCalendarEntriesForCalendarIdWithinLeavePlanYear(String hrCalendarId, String leavePlan, LocalDate dateWithinYear) {
	Criteria crit = new Criteria();
	List<CalendarEntryBo> ceList = new ArrayList<CalendarEntryBo>();
	crit.addEqualTo("hrCalendarId", hrCalendarId);
	DateTime leavePlanStart = HrServiceLocator.getLeavePlanService().getRolloverDayOfLeavePlan(leavePlan, dateWithinYear);
	DateTime leavePlanEnd = HrServiceLocator.getLeavePlanService().getFirstDayOfLeavePlan(leavePlan, dateWithinYear);
	crit.addGreaterOrEqualThan("endPeriodDateTime", leavePlanStart);
	crit.addLessThan("beginPeriodDateTime", leavePlanEnd);
	
	QueryByCriteria query = new QueryByCriteria(CalendarEntryBo.class, crit);
	Collection c = this.getPersistenceBrokerTemplate().getCollectionByQuery(query);
	if(c != null) {
		ceList.addAll(c);
	}
	return ceList;
}
 
开发者ID:kuali-mirror,项目名称:kpme,代码行数:17,代码来源:CalendarEntryDaoOjbImpl.java

示例4: findAssignmentsHistoryForPeriod

import org.apache.ojb.broker.query.Criteria; //导入方法依赖的package包/类
@SuppressWarnings({"unchecked", "rawtypes"})
@Override
public List<AssignmentBo> findAssignmentsHistoryForPeriod(String principalId, LocalDate startDate, LocalDate endDate) {
    List<AssignmentBo> assignments = new ArrayList<AssignmentBo>();
    Criteria root = new Criteria();

    Date start = new java.sql.Date(startDate.toDate().getTime());
    Date end = new java.sql.Date(endDate.toDate().getTime());
    root.addGreaterOrEqualThan("effectiveDate", start);
    root.addLessThan("effectiveDate", end);
    root.addEqualTo("principalId", principalId);

    ReportQueryByCriteria query = QueryFactory.newReportQuery(AssignmentBo.class, root);
    query.addOrderByAscending("effectiveDate");
    query.addOrderByAscending("timestamp");
    //query.setAttributes(new String[] {"/*+ no_query_transformation */ A0.tk_assignment_id", "principalId", "jobNumber", "effectiveDate",
    //        "workArea", "task", "active", "timestamp"});
    Collection c = this.getPersistenceBrokerTemplate().getCollectionByQuery(query);

    if (c != null) {
        assignments.addAll(c);
    }

    return assignments;
}
 
开发者ID:kuali-mirror,项目名称:kpme,代码行数:26,代码来源:AssignmentDaoOjbImpl.java

示例5: testSubQuery3

import org.apache.ojb.broker.query.Criteria; //导入方法依赖的package包/类
/**
 * test Subquery get all product groups with more than 10 articles, uses
 * attribute as value ! see testSubQuery4 for a better way
 * <p/>
 * test may fail if db does not support sub queries
 */
public void testSubQuery3()
{

    ReportQueryByCriteria subQuery;
    Criteria subCrit = new Criteria();
    Criteria crit = new Criteria();

    subCrit.addEqualToField("productGroupId", Criteria.PARENT_QUERY_PREFIX + "groupId");
    subQuery = QueryFactory.newReportQuery(Article.class, subCrit);
    subQuery.setAttributes(new String[]{"count(productGroupId)"});

    crit.addLessThan("10", subQuery); // MORE than 10 articles, uses
    // attribute as value !
    crit.addLessThan("groupId", PGROUP_ID_HI_WATERMARK);
    Query q = QueryFactory.newQuery(ProductGroup.class, crit);

    Collection results = broker.getCollectionByQuery(q);
    assertNotNull(results);
    assertEquals(4, results.size());
}
 
开发者ID:KualiCo,项目名称:ojb,代码行数:27,代码来源:QueryTest.java

示例6: addNumericCriteria

import org.apache.ojb.broker.query.Criteria; //导入方法依赖的package包/类
public static void addNumericCriteria(Criteria criteria, String propertyName, String propertyValue) {
    if (StringUtils.contains(propertyValue, SearchOperator.BETWEEN.op())) {
        String[] rangeValues = StringUtils.split(propertyValue, SearchOperator.BETWEEN.op());
        criteria.addBetween(propertyName, TKUtils.cleanNumeric(rangeValues[0]), TKUtils.cleanNumeric( rangeValues[1] ));
    } else if (propertyValue.startsWith(SearchOperator.GREATER_THAN_EQUAL.op())) {
        criteria.addGreaterOrEqualThan(propertyName, TKUtils.cleanNumeric(propertyValue));
    } else if (propertyValue.startsWith(SearchOperator.LESS_THAN_EQUAL.op())) {
        criteria.addLessOrEqualThan(propertyName, TKUtils.cleanNumeric(propertyValue));
    } else if (propertyValue.startsWith(SearchOperator.GREATER_THAN.op())) {
        criteria.addGreaterThan(propertyName, TKUtils.cleanNumeric( propertyValue ) );
    } else if (propertyValue.startsWith(SearchOperator.LESS_THAN.op())) {
        criteria.addLessThan(propertyName, TKUtils.cleanNumeric(propertyValue));
    } else {
        criteria.addEqualTo(propertyName, TKUtils.cleanNumeric(propertyValue));
    }
}
 
开发者ID:kuali-mirror,项目名称:kpme,代码行数:17,代码来源:OjbSubQueryUtil.java

示例7: purgeYearByChart

import org.apache.ojb.broker.query.Criteria; //导入方法依赖的package包/类
/**
 * Purge the sufficient funds balance table by year/chart
 *
 * @param chart the chart of balances to purge
 * @param year the university fiscal year of balances to purge
 */
@Override
public void purgeYearByChart(String chartOfAccountsCode, int year) {
    LOG.debug("purgeYearByChart() started");

    Criteria criteria = new Criteria();
    criteria.addEqualTo(KFSPropertyConstants.CHART_OF_ACCOUNTS_CODE, chartOfAccountsCode);
    criteria.addLessThan(KFSPropertyConstants.UNIVERSITY_FISCAL_YEAR, new Integer(year));

    getPersistenceBrokerTemplate().deleteByQuery(new QueryByCriteria(Balance.class, criteria));

    // This is required because if any deleted account balances are in the cache, deleteByQuery doesn't
    // remove them from the cache so a future select will retrieve these deleted account balances from
    // the cache and return them. Clearing the cache forces OJB to go to the database again.
    getPersistenceBrokerTemplate().clearCache();
}
 
开发者ID:kuali,项目名称:kfs,代码行数:22,代码来源:BalanceDaoOjb.java

示例8: getAllCalendarEntriesForCalendarIdAndYear

import org.apache.ojb.broker.query.Criteria; //导入方法依赖的package包/类
public List<CalendarEntryBo> getAllCalendarEntriesForCalendarIdAndYear(String hrCalendarId, String year) {
    Criteria crit = new Criteria();
    List<CalendarEntryBo> ceList = new ArrayList<CalendarEntryBo>();
    crit.addEqualTo("hrCalendarId", hrCalendarId);
    DateTimeFormatter formatter = DateTimeFormat.forPattern("yyyy");
    LocalDate currentYear = formatter.parseLocalDate(year);
    LocalDate nextYear = currentYear.plusYears(1);
    crit.addGreaterOrEqualThan("beginPeriodDateTime", currentYear.toDate());
    crit.addLessThan("beginPeriodDateTime", nextYear.toDate());
	 
    QueryByCriteria query = new QueryByCriteria(CalendarEntryBo.class, crit);
    Collection c = this.getPersistenceBrokerTemplate().getCollectionByQuery(query);
    if (c != null) {
    	ceList.addAll(c);
    }
    return ceList;
}
 
开发者ID:kuali-mirror,项目名称:kpme,代码行数:18,代码来源:CalendarEntryDaoOjbImpl.java

示例9: 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);
    }
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:30,代码来源:CriteriaLookupDaoOjb.java

示例10: 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);
      }
  }
 
开发者ID:kuali,项目名称:kc-rice,代码行数:38,代码来源:LookupDaoOjb.java

示例11: 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);
    }
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:38,代码来源:LookupDaoOjb.java

示例12: purgeAllSessionDocuments

import org.apache.ojb.broker.query.Criteria; //导入方法依赖的package包/类
public void purgeAllSessionDocuments(Timestamp expirationDate)throws DataAccessException {
  	Criteria criteria = new Criteria();
criteria.addLessThan(KRADPropertyConstants.LAST_UPDATED_DATE, expirationDate);
 getPersistenceBrokerTemplate().deleteByQuery(QueryFactory.newQuery(SessionDocument.class, criteria));
 //getPersistenceBrokerTemplate().clearCache();
       
  }
 
开发者ID:kuali,项目名称:kc-rice,代码行数:8,代码来源:SessionDocumentDaoOjb.java

示例13: purgeYearByChart

import org.apache.ojb.broker.query.Criteria; //导入方法依赖的package包/类
/**
 * Purge the table by year/chart.  Clears persistence broker template at the end to ensure OJB has to to DB again
 * to retrieve the post-purged state of the DB. 
 * 
 * @see org.kuali.ole.gl.dataaccess.CollectorDetailDao#purgeYearByChart(java.lang.String, int)
 */
public void purgeYearByChart(String chartOfAccountsCode, int universityFiscalYear) {
    LOG.debug("purgeYearByChart() started");

    Criteria criteria = new Criteria();
    criteria.addEqualTo(OLEPropertyConstants.CHART_OF_ACCOUNTS_CODE, chartOfAccountsCode);
    criteria.addLessThan(OLEPropertyConstants.UNIVERSITY_FISCAL_YEAR, new Integer(universityFiscalYear));
    
    getPersistenceBrokerTemplate().deleteByQuery(new QueryByCriteria(CollectorDetail.class, criteria));

    // This is required because if any deleted items are in the cache, deleteByQuery doesn't
    // remove them from the cache so a future select will retrieve these deleted account balances from
    // the cache and return them. Clearing the cache forces OJB to go to the database again.
    getPersistenceBrokerTemplate().clearCache();
}
 
开发者ID:VU-libtech,项目名称:OLE-INST,代码行数:21,代码来源:CollectorDetailDaoOjb.java

示例14: purgeYearByChart

import org.apache.ojb.broker.query.Criteria; //导入方法依赖的package包/类
/**
 * Purge an entire fiscal year for a single chart.
 * 
 * @param chartOfAccountsCode the chart of accounts code of account balances to purge
 * @param year the fiscal year of account balances to purge
 * @see org.kuali.ole.gl.dataaccess.AccountBalanceDao#purgeYearByChart(java.lang.String, int)
 */
public void purgeYearByChart(String chartOfAccountsCode, int year) {
    LOG.debug("purgeYearByChart() started");

    Criteria criteria = new Criteria();
    criteria.addEqualTo(OLEPropertyConstants.CHART_OF_ACCOUNTS_CODE, chartOfAccountsCode);
    criteria.addLessThan(OLEPropertyConstants.UNIVERSITY_FISCAL_YEAR, new Integer(year));

    getPersistenceBrokerTemplate().deleteByQuery(new QueryByCriteria(AccountBalance.class, criteria));

    // This is required because if any deleted account balances are in the cache, deleteByQuery doesn't
    // remove them from the cache so a future select will retrieve these deleted account balances from
    // the cache and return them. Clearing the cache forces OJB to go to the database again.
    getPersistenceBrokerTemplate().clearCache();
}
 
开发者ID:VU-libtech,项目名称:OLE-INST,代码行数:22,代码来源:AccountBalanceDaoOjb.java

示例15: purgeYearByChart

import org.apache.ojb.broker.query.Criteria; //导入方法依赖的package包/类
/**
 * Purge table by year/chart
 * 
 * @param chart the chart of sufficient fund balances to purge
 * @param year the year of sufficient fund balances to purge
 */
public void purgeYearByChart(String chartOfAccountsCode, int year) {
    LOG.debug("purgeYearByChart() started");

    Criteria criteria = new Criteria();
    criteria.addEqualTo(OLEPropertyConstants.CHART_OF_ACCOUNTS_CODE, chartOfAccountsCode);
    criteria.addLessThan(OLEPropertyConstants.UNIVERSITY_FISCAL_YEAR, new Integer(year));

    getPersistenceBrokerTemplate().deleteByQuery(new QueryByCriteria(SufficientFundBalances.class, criteria));

    // This is required because if any deleted account balances are in the cache, deleteByQuery doesn't
    // remove them from the cache so a future select will retrieve these deleted account balances from
    // the cache and return them. Clearing the cache forces OJB to go to the database again.
    getPersistenceBrokerTemplate().clearCache();
}
 
开发者ID:VU-libtech,项目名称:OLE-INST,代码行数:21,代码来源:SufficientFundsDaoOjb.java


注:本文中的org.apache.ojb.broker.query.Criteria.addLessThan方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。