Search in sources :

Example 16 with Criteria

use of org.apache.ojb.broker.query.Criteria in project cu-kfs by CU-CommunityApps.

the class AccountGlobalSearchDaoOjb method getAccountsByOrgHierarchy.

public Collection getAccountsByOrgHierarchy(String chartOfAccountsCode, String organizationCode, Map<String, String> parameters) {
    Criteria criteria = new Criteria();
    Criteria orgCriteria = new Criteria();
    orgCriteria.addEqualTo(KFSPropertyConstants.CHART_OF_ACCOUNTS_CODE, chartOfAccountsCode);
    orgCriteria.addEqualTo(KFSPropertyConstants.ORGANIZATION_CODE, organizationCode);
    criteria.addOrCriteria(orgCriteria);
    List<Organization> reportingOrgs = getReportingOrgs(chartOfAccountsCode, organizationCode, new HashSet<Organization>());
    for (Organization reportingOrg : reportingOrgs) {
        orgCriteria = new Criteria();
        orgCriteria.addEqualTo(KFSPropertyConstants.CHART_OF_ACCOUNTS_CODE, reportingOrg.getChartOfAccountsCode());
        orgCriteria.addEqualTo(KFSPropertyConstants.ORGANIZATION_CODE, reportingOrg.getOrganizationCode());
        criteria.addOrCriteria(orgCriteria);
    }
    // Add the rest of the criteria for the lookup
    parameters.remove(KFSPropertyConstants.CHART_OF_ACCOUNTS_CODE);
    parameters.remove(KFSPropertyConstants.ORGANIZATION_CODE);
    criteria.addAndCriteria(lookupDao.getCollectionCriteriaFromMap(new Account(), parameters));
    return getPersistenceBrokerTemplate().getCollectionByQuery(QueryFactory.newQuery(Account.class, criteria));
}
Also used : Account(org.kuali.kfs.coa.businessobject.Account) Organization(org.kuali.kfs.coa.businessobject.Organization) Criteria(org.apache.ojb.broker.query.Criteria)

Example 17 with Criteria

use of org.apache.ojb.broker.query.Criteria in project cu-kfs by CU-CommunityApps.

the class AccountReversionDaoOjb method getAccountReversionsByBudgetReversionAcount.

/**
 * @see edu.cornell.kfs.coa.dataaccess.AccountReversionDao#getAccountReversionsByBudgetReversionAcount(java.lang.String, java.lang.String)
 */
@Override
public List<AccountReversion> getAccountReversionsByBudgetReversionAcount(String budgetReversionChartOfAccountsCode, String budgetReversionAccountNumber) {
    LOG.debug("getAccountReversionsByBudgetReversionAcount() started");
    Criteria criteria = new Criteria();
    criteria.addEqualTo(CUKFSPropertyConstants.ACCT_REVERSION_BUDGET_REVERSION_CHART_OF_ACCT_CODE, budgetReversionChartOfAccountsCode);
    criteria.addEqualTo(CUKFSPropertyConstants.ACCT_REVERSION_BUDGET_REVERSION_ACCT_NUMBER, budgetReversionAccountNumber);
    criteria.addEqualTo(CUKFSPropertyConstants.ACCT_REVERSION_ACTIVE, true);
    QueryByCriteria q = QueryFactory.newQuery(AccountReversion.class, criteria);
    return (List) getPersistenceBrokerTemplate().getCollectionByQuery(q);
}
Also used : QueryByCriteria(org.apache.ojb.broker.query.QueryByCriteria) List(java.util.List) QueryByCriteria(org.apache.ojb.broker.query.QueryByCriteria) Criteria(org.apache.ojb.broker.query.Criteria)

Example 18 with Criteria

use of org.apache.ojb.broker.query.Criteria in project cu-kfs by CU-CommunityApps.

the class AccountReversionDaoOjb method getByPrimaryId.

/**
 * @see org.kuali.kfs.coa.dataaccess.OrganizationReversionDao#getByPrimaryId(java.lang.Integer, java.lang.String,
 *      java.lang.String)
 */
public AccountReversion getByPrimaryId(Integer universityFiscalYear, String financialChartOfAccountsCode, String accountNumber) {
    LOG.debug("getByPrimaryId() started");
    Criteria criteria = new Criteria();
    criteria.addEqualTo("universityFiscalYear", universityFiscalYear);
    criteria.addEqualTo("chartOfAccountsCode", financialChartOfAccountsCode);
    criteria.addEqualTo("accountNumber", accountNumber);
    return (AccountReversion) getPersistenceBrokerTemplate().getObjectByQuery(QueryFactory.newQuery(AccountReversion.class, criteria));
}
Also used : AccountReversion(edu.cornell.kfs.coa.businessobject.AccountReversion) QueryByCriteria(org.apache.ojb.broker.query.QueryByCriteria) Criteria(org.apache.ojb.broker.query.Criteria)

Example 19 with Criteria

use of org.apache.ojb.broker.query.Criteria in project cu-kfs by CU-CommunityApps.

the class AchBundlerAdviceDaoObj method getAchPaymentDetailsNeedingAdviceNotificationByDisbursementNumber.

// KFSPTS--1460
/**
 * Returns all PaymentDetail records needing ACH advice email notifications for a given disbursement number
 *
 * NOTE:
 * This method was made transactional per fix described in KULRICE-6914 for the iterator no longer
 * containing the data and iter.hasNext() causing a run time exception.
 *
 * @return an iterator of PaymentDetail records matching the given criteria
 */
@Transactional
public List<PaymentDetail> getAchPaymentDetailsNeedingAdviceNotificationByDisbursementNumber(Integer disbursementNumber) {
    LOG.debug("getAchPaymentDetailsNeedingAdviceNotificationByDisbursementNumber() started");
    Criteria criteria = new Criteria();
    criteria.addEqualTo(PdpPropertyConstants.PaymentDetail.PAYMENT_GROUP + "." + PdpPropertyConstants.PaymentGroup.PAYMENT_GROUP_DISBURSEMENT_TYPE_CODE, PdpConstants.DisbursementTypeCodes.ACH);
    criteria.addEqualTo(PdpPropertyConstants.PaymentDetail.PAYMENT_GROUP + "." + PdpPropertyConstants.PaymentGroup.PAYMENT_GROUP_PAYMENT_STATUS_CODE, PdpConstants.PaymentStatusCodes.EXTRACTED);
    criteria.addEqualTo(PdpPropertyConstants.PaymentDetail.PAYMENT_GROUP + "." + PdpPropertyConstants.PaymentGroup.PAYMENT_GROUP_DISBURSEMENT_NBR, disbursementNumber);
    criteria.addIsNull(PdpPropertyConstants.PaymentDetail.PAYMENT_GROUP + "." + PdpPropertyConstants.ADVICE_EMAIL_SENT_DATE);
    QueryByCriteria paymentDetailsQuery = QueryFactory.newQuery(PaymentDetail.class, criteria);
    List paymentDetailByDisbursementNumberList = (List) getPersistenceBrokerTemplate().getCollectionByQuery(paymentDetailsQuery);
    DynamicCollectionComparator.sort(paymentDetailByDisbursementNumberList, PdpPropertyConstants.PaymentDetail.PAYMENT_DISBURSEMENT_FINANCIAL_DOCUMENT_TYPE_CODE, PdpPropertyConstants.PaymentDetail.PAYMENT_DISBURSEMENT_CUST_PAYMENT_DOC_NBR);
    return paymentDetailByDisbursementNumberList;
}
Also used : QueryByCriteria(org.apache.ojb.broker.query.QueryByCriteria) List(java.util.List) QueryByCriteria(org.apache.ojb.broker.query.QueryByCriteria) Criteria(org.apache.ojb.broker.query.Criteria) Transactional(org.springframework.transaction.annotation.Transactional)

Example 20 with Criteria

use of org.apache.ojb.broker.query.Criteria in project cu-kfs by CU-CommunityApps.

the class AchBundlerAdviceDaoObj method getDistinctDisbursementNumbersForAchPaymentsNeedingAdviceNotification.

// KFSPTS-1460
/**
 * Returns distinct disbursement numbers for ACH payments needing advice email notifications.
 *
 * NOTE:
 * This method was made transactional per fix described in KULRICE-6914 for the iterator no longer
 * containing the data and iter.hasNext() causing a run time exception.
 *
 * @return an iterator of Disbursement Numbers matching the given criteria
 */
@Transactional
public HashSet<Integer> getDistinctDisbursementNumbersForAchPaymentsNeedingAdviceNotification() {
    LOG.debug("getDistinctDisbursementNumbersForAchPaymentsNeedingAdviceNotification() started");
    Criteria criteria = new Criteria();
    criteria.addEqualTo(PdpPropertyConstants.PaymentGroup.PAYMENT_GROUP_PAYMENT_STATUS_CODE, PdpConstants.PaymentStatusCodes.EXTRACTED);
    criteria.addEqualTo(PdpPropertyConstants.PaymentGroup.PAYMENT_GROUP_DISBURSEMENT_TYPE_CODE, PdpConstants.DisbursementTypeCodes.ACH);
    criteria.addIsNull(PdpPropertyConstants.ADVICE_EMAIL_SENT_DATE);
    QueryByCriteria disbursementNumbersQuery = QueryFactory.newQuery(PaymentGroup.class, criteria);
    Iterator iter = getPersistenceBrokerTemplate().getIteratorByQuery(disbursementNumbersQuery);
    // used to pair down to distinct disbursement numbers
    HashSet<Integer> results = new HashSet<Integer>();
    while (iter.hasNext()) {
        PaymentGroup pg = (PaymentGroup) iter.next();
        results.add(new Integer(pg.getDisbursementNbr().toString()));
    }
    return results;
}
Also used : PaymentGroup(org.kuali.kfs.pdp.businessobject.PaymentGroup) QueryByCriteria(org.apache.ojb.broker.query.QueryByCriteria) Iterator(java.util.Iterator) QueryByCriteria(org.apache.ojb.broker.query.QueryByCriteria) Criteria(org.apache.ojb.broker.query.Criteria) HashSet(java.util.HashSet) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

Criteria (org.apache.ojb.broker.query.Criteria)32 QueryByCriteria (org.apache.ojb.broker.query.QueryByCriteria)27 List (java.util.List)19 ArrayList (java.util.ArrayList)6 ReportQueryByCriteria (org.apache.ojb.broker.query.ReportQueryByCriteria)4 Timestamp (java.sql.Timestamp)3 GregorianCalendar (java.util.GregorianCalendar)3 Iterator (java.util.Iterator)3 PaymentGroup (org.kuali.kfs.pdp.businessobject.PaymentGroup)2 Transactional (org.springframework.transaction.annotation.Transactional)2 AccountReversion (edu.cornell.kfs.coa.businessobject.AccountReversion)1 EzraProposalAward (edu.cornell.kfs.module.ezra.businessobject.EzraProposalAward)1 CuAutoClosePurchaseOrderView (edu.cornell.kfs.module.purap.businessobject.CuAutoClosePurchaseOrderView)1 Date (java.sql.Date)1 ParseException (java.text.ParseException)1 SimpleDateFormat (java.text.SimpleDateFormat)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 RemovalAwareCollection (org.apache.ojb.broker.util.collections.RemovalAwareCollection)1 Account (org.kuali.kfs.coa.businessobject.Account)1