• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java QueryFactory类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



QueryFactory类属于org.apache.ojb.broker.query包,在下文中一共展示了QueryFactory类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: findByDocumentHeaderIds

import org.apache.ojb.broker.query.QueryFactory; //导入依赖的package包/类
/**
 * Retrieve a List of Document instances with the given ids
 *
 * @param clazz
 * @param idList
 * @return List
 */
@Override
public <T extends Document> List<T> findByDocumentHeaderIds(Class<T> clazz, List<String> idList) {
    Criteria criteria = new Criteria();
    criteria.addIn(KRADPropertyConstants.DOCUMENT_NUMBER, idList);

    QueryByCriteria query = QueryFactory.newQuery(clazz, criteria);
    
    // this cast is correct because OJB produces a collection which contains elements of the class defined on the query
    @SuppressWarnings("unchecked")
    List<T> tempList = new ArrayList<T>(this.getPersistenceBrokerTemplate().getCollectionByQuery(query));
    
    for (T doc : tempList) {
    	documentAdHocService.addAdHocs(doc);
    }
    return tempList;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:24,代码来源:DocumentDaoOjb.java


示例2: findBySinglePrimaryKey

import org.apache.ojb.broker.query.QueryFactory; //导入依赖的package包/类
/**
 * @see org.kuali.rice.krad.dao.BusinessObjectDao#findBySinglePrimaryKey(java.lang.Class, java.lang.Object)
 */
public <T extends BusinessObject> T findBySinglePrimaryKey(Class<T> clazz, Object primaryKey) {
	if (primaryKey.getClass().getName().startsWith("java.lang.")
               || primaryKey.getClass().getName().startsWith("java.sql.")
               || primaryKey.getClass().getName().startsWith("java.math.")
               || primaryKey.getClass().getName().startsWith("java.util.")) {
		try {
			return (T) getPersistenceBrokerTemplate().getObjectById(clazz, primaryKey);
		} catch (  ObjectRetrievalFailureException ex  ) {
    		// it doesn't exist, just return null
			return null;
		}
	} else {
		Criteria criteria = buildCriteria(clazz, primaryKey);

        return (T) getPersistenceBrokerTemplate().getObjectByQuery(QueryFactory.newQuery(clazz, criteria));
	}
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:21,代码来源:BusinessObjectDaoOjb.java


示例3: getLockingDocumentNumber

import org.apache.ojb.broker.query.QueryFactory; //导入依赖的package包/类
/**
 * @see org.kuali.rice.krad.dao.MaintenanceDocumentDao#getLockingDocumentNumber(java.lang.String, java.lang.String)
 */
public String getLockingDocumentNumber(String lockingRepresentation, String documentNumber) {

    String lockingDocNumber = "";

    // build the query criteria
    Criteria criteria = new Criteria();
    criteria.addEqualTo("lockingRepresentation", lockingRepresentation);

    // if a docHeaderId is specified, then it will be excluded from the
    // locking representation test.
    if (StringUtils.isNotBlank(documentNumber)) {
        criteria.addNotEqualTo(KRADPropertyConstants.DOCUMENT_NUMBER, documentNumber);
    }

    // attempt to retrieve a document based off this criteria
    MaintenanceLock maintenanceLock = (MaintenanceLock) getPersistenceBrokerTemplate().getObjectByQuery(QueryFactory.newQuery(MaintenanceLock.class, criteria));

    // if a document was found, then there's already one out there pending, and
    // we consider it 'locked' and we return the docnumber.
    if (maintenanceLock != null) {
        lockingDocNumber = maintenanceLock.getDocumentNumber();
    }
    return lockingDocNumber;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:28,代码来源:MaintenanceDocumentDaoOjb.java


示例4: getCOAsCount

import org.apache.ojb.broker.query.QueryFactory; //导入依赖的package包/类
/**
 * This method returns the number of records found resulting from a join of the organization table and the account table
 * 
 * @param fiscalYear
 * @return
 */
protected Object getCOAsCount() {
    LOG.debug("DepreciableAssetsDaoOjb.getCOAsCount() -  started");
    LOG.info(CamsConstants.Depreciation.DEPRECIATION_BATCH + "Getting the number of campus plant fund accounts.");

    Criteria criteria = new Criteria();
    Object[] data;
    ReportQueryByCriteria q = QueryFactory.newReportQuery(Account.class, criteria);
    q.setAttributes(new String[] { "count(" + KFSPropertyConstants.ORGANIZATION + "." + KFSPropertyConstants.CAMPUS_PLANT_ACCOUNT_NUMBER + ")" });
    Iterator<Object> i = getPersistenceBrokerTemplate().getReportQueryIteratorByQuery(q);
    if (!i.hasNext()) {
        data = new Object[1];
        data[0] = new BigDecimal(0);
    }
    else {
        data = (Object[]) i.next();
    }

    LOG.debug("DepreciableAssetsDaoOjb.getCOAsCount() -  ended");
    LOG.info(CamsConstants.Depreciation.DEPRECIATION_BATCH + "Finised getting the number of campus plant fund accounts.");
    return data[0];
}
 
开发者ID:kuali,项目名称:kfs,代码行数:28,代码来源:DepreciableAssetsDaoOjb.java


示例5: getPositionReportTypeList

import org.apache.ojb.broker.query.QueryFactory; //导入依赖的package包/类
@Override
	public List<PositionReportTypeBo> getPositionReportTypeList(String positionReportType, LocalDate asOfDate) {
		List<PositionReportTypeBo> prtList = new ArrayList<PositionReportTypeBo>();
		Criteria root = new Criteria();
		if(StringUtils.isNotEmpty(positionReportType) 
				&& !ValidationUtils.isWildCard(positionReportType)) {
			root.addEqualTo("positionReportType", positionReportType); 
		}
//		if(StringUtils.isNotEmpty(groupKeyCode)) {
//			root.addEqualTo("groupKeyCode", groupKeyCode); 
//		}
        root.addEqualTo("effectiveDate", OjbSubQueryUtil.getEffectiveDateSubQuery(PositionReportTypeBo.class, asOfDate, PositionReportTypeBo.BUSINESS_KEYS, false));
        root.addEqualTo("timestamp", OjbSubQueryUtil.getTimestampSubQuery(PositionReportTypeBo.class, PositionReportTypeBo.BUSINESS_KEYS, false));
        
        Criteria activeFilter = new Criteria();
        activeFilter.addEqualTo("active", true);
        root.addAndCriteria(activeFilter);
        Query query = QueryFactory.newQuery(PositionReportTypeBo.class, root);
        
        Collection c = this.getPersistenceBrokerTemplate().getCollectionByQuery(query);
		if(!c.isEmpty())
			prtList.addAll(c);
		
		return prtList;
	}
 
开发者ID:kuali-mirror,项目名称:kpme,代码行数:26,代码来源:PositionReportTypeDaoObjImpl.java


示例6: findDistinctFiscalYears

import org.apache.ojb.broker.query.QueryFactory; //导入依赖的package包/类
/**
 * @see org.kuali.kfs.gl.dataaccess.LedgerBalanceHistoryBalancingDao#findDistinctFiscalYears()
 */
public List<Integer> findDistinctFiscalYears() {
    Criteria crit = new Criteria();
    ReportQueryByCriteria q = QueryFactory.newReportQuery(BalanceHistory.class, crit);
    q.setAttributes(new String[] { KFSPropertyConstants.UNIVERSITY_FISCAL_YEAR });
    q.setDistinct(true);

    Iterator<Object[]> years = getPersistenceBrokerTemplate().getReportQueryIteratorByQuery(q);
    List<Integer> yearList = new ArrayList<Integer>();
    
    while (years != null && years.hasNext()) {
        Object[] year = years.next();
        yearList.add(new Integer(year[0].toString()));
    }
    
    return yearList;
}
 
开发者ID:kuali,项目名称:kfs,代码行数:20,代码来源:BalanceHistoryDaoOjb.java


示例7: getAllActiveLeaveJobs

import org.apache.ojb.broker.query.QueryFactory; //导入依赖的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;
}
 
开发者ID:kuali-mirror,项目名称:kpme,代码行数:18,代码来源:JobDaoOjbImpl.java


示例8: getDepartmentsWithGroupKeys

import org.apache.ojb.broker.query.QueryFactory; //导入依赖的package包/类
@Override
public List<DepartmentBo> getDepartmentsWithGroupKeys(List<String> groupKeyCodes, LocalDate asOfDate) {
    Criteria root = new Criteria();

    root.addIn("groupKeyCode", groupKeyCodes);
    root.addEqualTo("effectiveDate", OjbSubQueryUtil.getEffectiveDateSubQuery(DepartmentBo.class, asOfDate, DepartmentBo.BUSINESS_KEYS, false));
    root.addEqualTo("timestamp", OjbSubQueryUtil.getTimestampSubQuery(DepartmentBo.class, DepartmentBo.BUSINESS_KEYS, false));

    Criteria activeFilter = new Criteria(); // Inner Join For Activity
    activeFilter.addEqualTo("active", true);
    root.addAndCriteria(activeFilter);

    Query query = QueryFactory.newQuery(DepartmentBo.class, root);

    Collection c = this.getPersistenceBrokerTemplate().getCollectionByQuery(query);
    List<DepartmentBo> d = new ArrayList<DepartmentBo>(c.size());
    d.addAll(c);

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


示例9: getLockingDocumentNumber

import org.apache.ojb.broker.query.QueryFactory; //导入依赖的package包/类
/**
 * @see org.kuali.ole.coa.dataaccess.AccountDelegateDao#getLockingDocumentNumber(java.lang.String, java.lang.String)
 */

public String getLockingDocumentNumber(String lockingRepresentation, String documentNumber) {
    String lockingDocNumber = "";

    // build the query criteria
    Criteria criteria = new Criteria();
    criteria.addEqualTo("lockingRepresentation", lockingRepresentation);

    // if a docHeaderId is specified, then it will be excluded from the
    // locking representation test.
    if (StringUtils.isNotBlank(documentNumber)) {
        criteria.addNotEqualTo(KRADPropertyConstants.DOCUMENT_NUMBER, documentNumber);
    }

    // attempt to retrieve a document based off this criteria
    MaintenanceLock maintenanceLock = (MaintenanceLock) getPersistenceBrokerTemplate().getObjectByQuery(QueryFactory.newQuery(MaintenanceLock.class, criteria));

    // if a document was found, then there's already one out there pending, and
    // we consider it 'locked' and we return the docnumber.
    if (maintenanceLock != null) {
        lockingDocNumber = maintenanceLock.getDocumentNumber();
    }
    return lockingDocNumber;
}
 
开发者ID:VU-libtech,项目名称:OLE-INST,代码行数:28,代码来源:AccountDelegateDaoOjb.java


示例10: getYearList

import org.apache.ojb.broker.query.QueryFactory; //导入依赖的package包/类
/**
 * @see org.kuali.ole.coa.dataaccess.ObjectCodeDao#getYearList(java.lang.String, java.lang.String)
 */
public List getYearList(String chartOfAccountsCode, String financialObjectCode) {

    List returnList = new ArrayList();
    Criteria criteria = new Criteria();
    criteria.addEqualTo("chartOfAccountsCode", chartOfAccountsCode);
    criteria.addEqualTo("financialObjectCode", financialObjectCode);
    Collection years = getPersistenceBrokerTemplate().getCollectionByQuery(QueryFactory.newQuery(ObjectCode.class, criteria));
    for (Iterator iter = years.iterator(); iter.hasNext();) {
        ObjectCode o = (ObjectCode) iter.next();
        if (o != null) {
            returnList.add(o.getUniversityFiscalYear());
        }
    }
    return returnList;


}
 
开发者ID:VU-libtech,项目名称:OLE-INST,代码行数:21,代码来源:ObjectCodeDaoOjb.java


示例11: getVoteRecords

import org.apache.ojb.broker.query.QueryFactory; //导入依赖的package包/类
@SuppressWarnings({"unchecked", "rawtypes"})
@Override
public List<EdoVoteRecordBo> getVoteRecords(String edoDossierID) {
    List<EdoVoteRecordBo> voteRecords = new ArrayList<EdoVoteRecordBo>();

    Criteria criteria = new Criteria();
    criteria.addEqualTo("edoDossierId", edoDossierID);

    QueryByCriteria query = QueryFactory.newQuery(EdoVoteRecordBo.class, criteria);
    // TODO: add sorting after reviewLayerDefinition is done
    //query.addOrderByAscending("reviewLayerDefinition.reviewLevel");
    query.addOrderByAscending("vote_round");
    query.addOrderByAscending("vote_subround");

    Collection c =  this.getPersistenceBrokerTemplate().getCollectionByQuery(query);
    
    if (c != null && c.size() != 0) {
    	voteRecords.addAll(c);
    }
    
    return voteRecords;
}
 
开发者ID:kuali-mirror,项目名称:kpme,代码行数:23,代码来源:EdoVoteRecordDaoImpl.java


示例12: getEarnCodeGroupsForEarnCode

import org.apache.ojb.broker.query.QueryFactory; //导入依赖的package包/类
@Override
public List<EarnCodeGroupBo> getEarnCodeGroupsForEarnCode(String earnCode, LocalDate asOfDate) {
	
	Criteria root = new Criteria();
	Criteria earnCodeJoin = new Criteria();

	earnCodeJoin.addEqualToField("hrEarnCodeGroupId", Criteria.PARENT_QUERY_PREFIX + "hrEarnCodeGroupId");
	earnCodeJoin.addEqualTo("UPPER(earnCode)", earnCode.toUpperCase());
	ReportQueryByCriteria earnCodeSubQuery = QueryFactory.newReportQuery(EarnCodeGroupDefinitionBo.class, earnCodeJoin);
	earnCodeSubQuery.setAttributes(new String[]{"hr_earn_code_group_id"});
	
	root.addEqualTo("hrEarnCodeGroupId",earnCodeSubQuery);
       root.addEqualTo("effectiveDate", OjbSubQueryUtil.getEffectiveDateSubQuery(EarnCodeGroupBo.class, asOfDate, EarnCodeGroupBo.BUSINESS_KEYS, false));
       root.addEqualTo("timestamp", OjbSubQueryUtil.getTimestampSubQuery(EarnCodeGroupBo.class, EarnCodeGroupBo.BUSINESS_KEYS, false));

	Criteria activeFilter = new Criteria(); // Inner Join For Activity
	activeFilter.addEqualTo("active", true);
	root.addAndCriteria(activeFilter);
	
	Query query = QueryFactory.newQuery(EarnCodeGroupBo.class, root);
      
    List<EarnCodeGroupBo> results = new ArrayList<EarnCodeGroupBo>();
    results.addAll(getPersistenceBrokerTemplate().getCollectionByQuery(query));
    
    return results;
}
 
开发者ID:kuali-mirror,项目名称:kpme,代码行数:27,代码来源:EarnCodeGroupDaoOjbImpl.java


示例13: queryPrincipalHasAccountRole

import org.apache.ojb.broker.query.QueryFactory; //导入依赖的package包/类
/**
 * Determines if any non-closed accounts exist where the principal id is in the role of the role name
 * 
 * @param principalId the principal id to check
 * @param principalRoleName the name of the field on account to check for the principal id in
 * @return true if the principal has that account role, false otherwise
 */
protected boolean queryPrincipalHasAccountRole(String principalId, String principalRoleName) {
    Criteria criteria = new Criteria();
    criteria.addEqualTo(principalRoleName, principalId);
    criteria.addEqualTo("active", "Y");

    ReportQueryByCriteria reportQuery = QueryFactory.newReportQuery(Account.class, criteria);
    reportQuery.setAttributes(new String[] { "count(*)" });

    int resultCount = 0;
    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;
}
 
开发者ID:kuali,项目名称:kfs,代码行数:24,代码来源:AccountDaoOjb.java


示例14: getValidReviewLevelNodeNames

import org.apache.ojb.broker.query.QueryFactory; //导入依赖的package包/类
public List<String> getValidReviewLevelNodeNames(String workflowId) {
    List<String> nodeNames = new LinkedList<String>();
    List<EdoReviewLayerDefinitionBo> results = new LinkedList<EdoReviewLayerDefinitionBo>();

    Criteria criteria = new Criteria();
    //criteria.addColumnNotNull("review_level");
    criteria.addEqualTo("workflowId", workflowId);

    Query query = QueryFactory.newQuery(EdoReviewLayerDefinitionBo.class, criteria);
    Collection collection = this.getPersistenceBrokerTemplate().getCollectionByQuery(query);

    if (CollectionUtils.isNotEmpty(collection)) {
        results.addAll(collection);
        for (EdoReviewLayerDefinitionBo edoReviewLayerDefinition : results) {
            nodeNames.add(edoReviewLayerDefinition.getNodeName());
        }
    }

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


示例15: getFirstFiscalYearDate

import org.apache.ojb.broker.query.QueryFactory; //导入依赖的package包/类
/**
 * Returns the first university date for a given fiscal year
 * 
 * @param fiscalYear the fiscal year to find the first date for
 * @return a UniversityDate record for the first day of the given fiscal year, or null if nothing can be found
 * @see org.kuali.ole.sys.dataaccess.UniversityDateDao#getFirstFiscalYearDate(java.lang.Integer)
 */
@Override
public UniversityDate getFirstFiscalYearDate(Integer fiscalYear) {
    ReportQueryByCriteria subQuery;
    Criteria subCrit = new Criteria();
    Criteria crit = new Criteria();

    subCrit.addEqualTo(OLEPropertyConstants.UNIVERSITY_FISCAL_YEAR, fiscalYear);
    subQuery = QueryFactory.newReportQuery(UniversityDate.class, subCrit);
    subQuery.setAttributes(new String[] { "min(univ_dt)" });

    crit.addGreaterOrEqualThan(OLEPropertyConstants.UNIVERSITY_DATE, subQuery);

    QueryByCriteria qbc = QueryFactory.newQuery(UniversityDate.class, crit);

    return (UniversityDate) getPersistenceBrokerTemplate().getObjectByQuery(qbc);
}
 
开发者ID:VU-libtech,项目名称:OLE-INST,代码行数:24,代码来源:UniversityDateDaoOjb.java


示例16: getNextCalendarEntryByCalendarId

import org.apache.ojb.broker.query.QueryFactory; //导入依赖的package包/类
@Override
public CalendarEntryBo getNextCalendarEntryByCalendarId(String hrCalendarId, CalendarEntryContract calendarEntry) {
    Criteria root = new Criteria();
    Criteria beginDate = new Criteria();
    Criteria endDate = new Criteria();

    beginDate.addEqualToField("hrCalendarId", Criteria.PARENT_QUERY_PREFIX + "hrCalendarId");
    beginDate.addGreaterThan("beginPeriodDateTime", calendarEntry.getBeginPeriodFullDateTime().toDate());
    ReportQueryByCriteria beginDateSubQuery = QueryFactory.newReportQuery(CalendarEntryBo.class, beginDate);
    beginDateSubQuery.setAttributes(new String[]{"min(beginPeriodDateTime)"});

    endDate.addEqualToField("hrCalendarId", Criteria.PARENT_QUERY_PREFIX + "hrCalendarId");
    endDate.addGreaterThan("endPeriodDateTime", calendarEntry.getEndPeriodFullDateTime().toDate());
    ReportQueryByCriteria endDateSubQuery = QueryFactory.newReportQuery(CalendarEntryBo.class, endDate);
    endDateSubQuery.setAttributes(new String[]{"min(endPeriodDateTime)"});

    root.addEqualTo("hrCalendarId", hrCalendarId);
    root.addEqualTo("beginPeriodDateTime", beginDateSubQuery);
    root.addEqualTo("endPeriodDateTime", endDateSubQuery);

    Query query = QueryFactory.newQuery(CalendarEntryBo.class, root);

    CalendarEntryBo pce = (CalendarEntryBo) this.getPersistenceBrokerTemplate().getObjectByQuery(query);
    return pce;
}
 
开发者ID:kuali-mirror,项目名称:kpme,代码行数:26,代码来源:CalendarEntryDaoOjbImpl.java


示例17: queryPrincipalIsAccountDelegate

import org.apache.ojb.broker.query.QueryFactory; //导入依赖的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;
}
 
开发者ID:kuali,项目名称:kfs,代码行数:29,代码来源:AccountDelegateDaoOjb.java


示例18: testGetReportQueryIteratorBySQL

import org.apache.ojb.broker.query.QueryFactory; //导入依赖的package包/类
/**
 * Testing the getReportQueryIteratorBySQL functionality
 */
public void testGetReportQueryIteratorBySQL()
{
    String sql =
            "SELECT * FROM Artikel A, Kategorien PG"
            + " WHERE A.Kategorie_Nr = PG.Kategorie_Nr"
            + " AND PG.Kategorie_Nr = 2";
    Query q = QueryFactory.newQuery(Article.class, sql);

    Iterator iter = broker.getReportQueryIteratorByQuery(q);

    while (iter.hasNext())
    {
        Object[] arr = (Object[]) iter.next();
        for (int i = 0; i < arr.length; i++)
        {
            //System.out.print(arr[i] + ", ");
        }
        //System.out.println();
    }
}
 
开发者ID:KualiCo,项目名称:ojb,代码行数:24,代码来源:PersistenceBrokerTest.java


示例19: testPathExpressionForAbstractExtent

import org.apache.ojb.broker.query.QueryFactory; //导入依赖的package包/类
/**
 * test PathExpression pointing to abstract class (InterfaceArticle)
 */
public void testPathExpressionForAbstractExtent()
{
    ArrayList list = new java.util.ArrayList();

    Criteria crit = new Criteria();
    crit.addLike("allArticlesInGroup.articleName", "Chef%");
    Criteria crit1 = new Criteria();
    crit1.addEqualTo("allArticlesInGroup.articleName", "Faust");
    crit.addOrCriteria(crit1);

    QueryByCriteria q = QueryFactory.newQuery(ProductGroupWithAbstractArticles.class, crit, true);
    q.addOrderByAscending("groupId");

    Iterator iter = broker.getIteratorByQuery(q);
    while(iter.hasNext())
    {
        list.add(iter.next());
    }

    // Groups 2, 5
    assertEquals("check size", 2, list.size());

    assertEquals("Group 2", 2, ((InterfaceProductGroup) list.get(0)).getId().intValue());
    assertEquals("Group 5", 5, ((InterfaceProductGroup) list.get(1)).getId().intValue());
}
 
开发者ID:KualiCo,项目名称:ojb,代码行数:29,代码来源:QueryTest.java


示例20: getUniquePayCalendars

import org.apache.ojb.broker.query.QueryFactory; //导入依赖的package包/类
@Override
@SuppressWarnings("rawtypes")
   public List<String> getUniquePayCalendars(List<String> principalIds) {
       List<String> payCalendars = new ArrayList<String>();
       
       Criteria root = new Criteria();
       root.addIn("principalId", principalIds);
       root.addEqualTo("active", true);
       
       ReportQueryByCriteria query = QueryFactory.newReportQuery(PrincipalHRAttributesBo.class, root, true);
       query.setDistinct(true);
       query.setAttributes(new String[] {"payCalendar"});
       Iterator iterator = getPersistenceBrokerTemplate().getReportQueryIteratorByQuery(query);
       while (iterator.hasNext()) {
           Object[] values = (Object[]) iterator.next();
           String leaveCalendar = (String) values[0];
           if (StringUtils.isNotBlank(leaveCalendar)) {
           	payCalendars.add(leaveCalendar);
           }
       }
       
       return payCalendars;
   }
 
开发者ID:kuali-mirror,项目名称:kpme,代码行数:24,代码来源:PrincipalHRAttributesDaoOjbImpl.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java JsonFile类代码示例发布时间:2022-05-23
下一篇:
Java Mapping类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap