Search in sources :

Example 21 with Criteria

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

the class AccountReversionDaoOjb method getAccountReversionsByCashReversionAcount.

/**
 * @see edu.cornell.kfs.coa.dataaccess.AccountReversionDao#getAccountReversionsByCashReversionAcount(java.lang.String, java.lang.String)
 */
@Override
public List<AccountReversion> getAccountReversionsByCashReversionAcount(String cashReversionFinancialChartOfAccountsCode, String cashReversionAccountNumber) {
    LOG.debug("getAccountReversionsByCashReversionAcount() started");
    Criteria criteria = new Criteria();
    criteria.addEqualTo(CUKFSPropertyConstants.ACCT_REVERSION_CASH_REVERSION_CHART_OF_ACCT_CODE, cashReversionFinancialChartOfAccountsCode);
    criteria.addEqualTo(CUKFSPropertyConstants.ACCT_REVERSION_CASH_REVERSION_ACCT_NUMBER, cashReversionAccountNumber);
    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 22 with Criteria

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

the class AccountReversionDaoOjb method getCategories.

/**
 * @see org.kuali.kfs.coa.dataaccess.OrganizationReversionDao#getCategories()
 */
public List<ReversionCategory> getCategories() {
    LOG.debug("getCategories() started");
    Criteria criteria = new Criteria();
    criteria.addEqualTo("active", true);
    QueryByCriteria q = QueryFactory.newQuery(ReversionCategory.class, criteria);
    q.addOrderByAscending("reversionSortCode");
    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 23 with Criteria

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

the class AccountReversionDaoOjb method getAccountReversionsByChartAndAccount.

/**
 * @see edu.cornell.kfs.coa.dataaccess.AccountReversionDao#getAccountReversionsByChartAndAccount(java.lang.String, java.lang.String)
 */
@Override
public List<AccountReversion> getAccountReversionsByChartAndAccount(String chartOfAccountsCode, String accountNumber) {
    LOG.debug("getAccountReversionsByChartAndAccount() started");
    Criteria criteria = new Criteria();
    criteria.addEqualTo(CUKFSPropertyConstants.ACCT_REVERSION_CHART_OF_ACCT_CODE, chartOfAccountsCode);
    criteria.addEqualTo(CUKFSPropertyConstants.ACCT_REVERSION_ACCT_NUMBER, accountNumber);
    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 24 with Criteria

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

the class CuDisbursementVoucherDaoOjb method getDocument.

/**
 * @see org.kuali.kfs.fp.dataaccess.DisbursementVoucherDao#getDocument(java.lang.String)
 */
public DisbursementVoucherDocument getDocument(String fdocNbr) {
    LOG.debug("getDocument() started");
    Criteria criteria = new Criteria();
    criteria.addEqualTo("documentNumber", fdocNbr);
    return (DisbursementVoucherDocument) getPersistenceBrokerTemplate().getObjectByQuery(new QueryByCriteria(getDisbursementVoucherDocumentClass(), criteria));
}
Also used : QueryByCriteria(org.apache.ojb.broker.query.QueryByCriteria) QueryByCriteria(org.apache.ojb.broker.query.QueryByCriteria) Criteria(org.apache.ojb.broker.query.Criteria) DisbursementVoucherDocument(org.kuali.kfs.fp.document.DisbursementVoucherDocument)

Example 25 with Criteria

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

the class CuBalanceDaoOjb method findReversionBalancesForFiscalYear.

/**
 * Returns a list of balances to return for the Organization Reversion year end job to process
 *
 * @param year the university fiscal year to find balances for
 * @param endOfYear if true, use currrent year accounts, otherwise use prior year accounts
 * @return an Iterator of Balances to process
 * @see org.kuali.kfs.gl.dataaccess.BalanceDao#findOrganizationReversionBalancesForFiscalYear(java.lang.Integer, boolean,
 *      org.kuali.kfs.sys.businessobject.SystemOptions, java.util.List)
 */
@SuppressWarnings({ "deprecation", "unchecked" })
public Iterator<Balance> findReversionBalancesForFiscalYear(Integer year, boolean endOfYear, SystemOptions options, List<ParameterEvaluator> parameterEvaluators) {
    LOG.debug("findReversionBalancesForFiscalYear() started");
    Criteria c = new Criteria();
    c.addEqualTo(KFSPropertyConstants.UNIVERSITY_FISCAL_YEAR, year);
    for (ParameterEvaluator parameterEvaluator : parameterEvaluators) {
        String currentRule = parameterEvaluator.getValue();
        if (endOfYear) {
            currentRule = currentRule.replaceAll("account\\.", "priorYearAccount.");
        }
        if (StringUtils.isNotBlank(currentRule)) {
            String propertyName = StringUtils.substringBefore(currentRule, "=");
            List<String> ruleValues = Arrays.asList(StringUtils.substringAfter(currentRule, "=").split(";"));
            if (propertyName != null && propertyName.length() > 0 && ruleValues.size() > 0 && !StringUtils.isBlank(ruleValues.get(0))) {
                if (parameterEvaluator.constraintIsAllow()) {
                    c.addIn(propertyName, ruleValues);
                } else {
                    c.addNotIn(propertyName, ruleValues);
                }
            }
        }
    }
    // we only ever calculate on CB, AC, and encumbrance types, so let's only select those
    List<String> reversionBalancesToSelect = new ArrayList<String>();
    reversionBalancesToSelect.add(options.getActualFinancialBalanceTypeCd());
    reversionBalancesToSelect.add(options.getFinObjTypeExpenditureexpCd());
    reversionBalancesToSelect.add(options.getCostShareEncumbranceBalanceTypeCd());
    reversionBalancesToSelect.add(options.getIntrnlEncumFinBalanceTypCd());
    reversionBalancesToSelect.add(KFSConstants.BALANCE_TYPE_CURRENT_BUDGET);
    c.addIn(KFSPropertyConstants.BALANCE_TYPE_CODE, reversionBalancesToSelect);
    QueryByCriteria query = QueryFactory.newQuery(Balance.class, c);
    query.addOrderByAscending(KFSPropertyConstants.CHART_OF_ACCOUNTS_CODE);
    query.addOrderByAscending(KFSPropertyConstants.ACCOUNT_NUMBER);
    query.addOrderByAscending(KFSPropertyConstants.SUB_ACCOUNT_NUMBER);
    query.addOrderByAscending(KFSPropertyConstants.OBJECT_CODE);
    query.addOrderByAscending(KFSPropertyConstants.SUB_OBJECT_CODE);
    query.addOrderByAscending(KFSPropertyConstants.BALANCE_TYPE_CODE);
    query.addOrderByAscending(KFSPropertyConstants.OBJECT_TYPE_CODE);
    return getPersistenceBrokerTemplate().getIteratorByQuery(query);
}
Also used : QueryByCriteria(org.apache.ojb.broker.query.QueryByCriteria) ArrayList(java.util.ArrayList) QueryByCriteria(org.apache.ojb.broker.query.QueryByCriteria) Criteria(org.apache.ojb.broker.query.Criteria) ParameterEvaluator(org.kuali.rice.core.api.parameter.ParameterEvaluator)

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