/** * @see org.kuali.kfs.module.ld.dataaccess.LaborLedgerBalanceDao#findBalancesForFiscalYear(java.lang.Integer) */ public Iterator<LedgerBalance> findBalancesForFiscalYear(Integer year) { LOG.debug("findBalancesForFiscalYear() started"); Criteria c = new Criteria(); c.addEqualTo(KFSPropertyConstants.UNIVERSITY_FISCAL_YEAR, year); QueryByCriteria query = QueryFactory.newQuery(LedgerBalance.class, c); query.addOrderByAscending(KFSPropertyConstants.CHART_OF_ACCOUNTS_CODE); query.addOrderByAscending(KFSPropertyConstants.ACCOUNT_NUMBER); query.addOrderByAscending(KFSPropertyConstants.SUB_ACCOUNT_NUMBER); query.addOrderByAscending(KFSPropertyConstants.FINANCIAL_OBJECT_CODE); query.addOrderByAscending(KFSPropertyConstants.FINANCIAL_SUB_OBJECT_CODE); query.addOrderByAscending(KFSPropertyConstants.FINANCIAL_BALANCE_TYPE_CODE); query.addOrderByAscending(KFSPropertyConstants.FINANCIAL_OBJECT_TYPE_CODE); return getPersistenceBrokerTemplate().getIteratorByQuery(query); }
/** * Returns an Iterator of all encumbrances that need to be closed for the fiscal year * * @param fiscalYear a fiscal year to find encumbrances for * @return an Iterator of encumbrances to close * @see org.kuali.kfs.gl.dataaccess.EncumbranceDao#getEncumbrancesToClose(java.lang.Integer) */ public Iterator getEncumbrancesToClose(Integer fiscalYear) { Criteria criteria = new Criteria(); criteria.addEqualTo(KFSPropertyConstants.UNIVERSITY_FISCAL_YEAR, fiscalYear); QueryByCriteria query = new QueryByCriteria(Encumbrance.class, criteria); 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); return getPersistenceBrokerTemplate().getIteratorByQuery(query); }
/** * @see org.kuali.rice.krad.dao.BusinessObjectDao#findAllOrderBy(java.lang.Class, java.lang.String, boolean) */ public <T extends BusinessObject> Collection<T> findAllOrderBy(Class<T> clazz, String sortField, boolean sortAscending) { QueryByCriteria queryByCriteria = new QueryByCriteria(clazz, (Criteria) null); if (sortAscending) { queryByCriteria.addOrderByAscending(sortField); } else { queryByCriteria.addOrderByDescending(sortField); } return (Collection<T>)getPersistenceBrokerTemplate().getCollectionByQuery(queryByCriteria); }
/** * Get list of all ElectronicInvoiceItemMappings */ public List getAll() { LOG.debug("getAll() started"); QueryByCriteria qbc = new QueryByCriteria(ElectronicInvoiceItemMapping.class); qbc.addOrderBy("id", true); List l = (List) getPersistenceBrokerTemplate().getCollectionByQuery(qbc); return l; }
public List getPendingElectronicInvoices() { LOG.debug("getPendingElectronicInvoices() started"); Criteria criteria = new Criteria(); criteria.addEqualTo("status.code", PurapConstants.PaymentRequestStatuses.PENDING_E_INVOICE); criteria.addEqualTo("isElectronicInvoice", Boolean.TRUE); List invoices = (List) getPersistenceBrokerTemplate().getCollectionByQuery(new QueryByCriteria(PaymentRequestDocument.class, criteria)); for (Iterator iter = invoices.iterator(); iter.hasNext();) { PaymentRequestDocument p = (PaymentRequestDocument) iter.next(); } return invoices; }
/** * @see org.kuali.kfs.module.endow.dataaccess.PooledFundValueDao#getPooledFundValueWhereLTProcessOnDateIsCurrentDate() */ public List<PooledFundValue> getPooledFundValueWhereLTProcessOnDateIsCurrentDate() { Criteria criteria = new Criteria(); criteria.addEqualTo(EndowPropertyConstants.DISTRIBUTE_LONG_TERM_GAIN_LOSS_ON_DATE, kemService.getCurrentDate()); criteria.addEqualTo(EndowPropertyConstants.LT_GAIN_LOSS_DISTR_COMPL, false); QueryByCriteria qbc = QueryFactory.newQuery(PooledFundValue.class, criteria); qbc.addOrderByAscending(EndowPropertyConstants.POOL_SECURITY_ID); qbc.addOrderByDescending(EndowPropertyConstants.VALUE_EFFECTIVE_DATE); return (List<PooledFundValue>) getPersistenceBrokerTemplate().getCollectionByQuery(qbc); }
/** * Document header IDs are ordered, so an ID less than the current will * always be previous to current. */ public TimesheetDocumentHeader getPreviousDocumentHeader(String principalId, DateTime payBeginDate) { Criteria crit = new Criteria(); crit.addEqualTo("principalId", principalId); // the pay begin date is the end date of the previous pay period crit.addEqualTo("endDate", payBeginDate.toDate()); QueryByCriteria query = new QueryByCriteria(TimesheetDocumentHeader.class, crit); query.addOrderByDescending("documentId"); query.setStartAtIndex(0); query.setEndAtIndex(1); return (TimesheetDocumentHeader) this.getPersistenceBrokerTemplate().getObjectByQuery(query); }
@Override public TimesheetDocumentHeader getNextDocumentHeader(String principalId, DateTime payEndDate) { Criteria crit = new Criteria(); crit.addEqualTo("principalId", principalId); // the pay end date is the begin date of the next pay period crit.addEqualTo("beginDate", payEndDate.toDate()); QueryByCriteria query = new QueryByCriteria(TimesheetDocumentHeader.class, crit); query.setStartAtIndex(0); query.setEndAtIndex(1); return (TimesheetDocumentHeader) this.getPersistenceBrokerTemplate().getObjectByQuery(query); }
/** * @see org.kuali.kfs.fp.document.dataaccess.TravelMileageRateDao#retrieveMostEffectiveMileageRates(java.sql.Timestamp) */ public Collection retrieveMostEffectiveMileageRates(Date effectiveDate) { Criteria criteria = new Criteria(); criteria.addLessOrEqualThan("disbursementVoucherMileageEffectiveDate", effectiveDate); QueryByCriteria queryByCriteria = new QueryByCriteria(TravelMileageRate.class, criteria); queryByCriteria.addOrderByDescending("disbursementVoucherMileageEffectiveDate"); queryByCriteria.addOrderByDescending("mileageLimitAmount"); Collection mostEffectiveRates = new ArrayList(); Collection rates = getPersistenceBrokerTemplate().getCollectionByQuery(queryByCriteria); Date mostEffectiveDate = ((TravelMileageRate) rates.iterator().next()).getDisbursementVoucherMileageEffectiveDate(); for (Iterator iter = rates.iterator(); iter.hasNext();) { TravelMileageRate rate = (TravelMileageRate) iter.next(); if (rate.getDisbursementVoucherMileageEffectiveDate().compareTo(mostEffectiveDate) == 0) { mostEffectiveRates.add(rate); } } return mostEffectiveRates; }
public void createChartForNextBudgetCycle() { // first we have to remove what's there // (the documentation says deleteByQuery (1) ignores object references and (2) does // not synchronize the cache. so, we clear the cache before and after.) getPersistenceBrokerTemplate().clearCache(); Criteria criteriaID = QueryByCriteria.CRITERIA_SELECT_ALL; QueryByCriteria killAcctQuery = new QueryByCriteria(BudgetConstructionAccountReports.class); killAcctQuery.setCriteria(criteriaID); getPersistenceBrokerTemplate().deleteByQuery(killAcctQuery); QueryByCriteria killOrgQuery = new QueryByCriteria(BudgetConstructionOrganizationReports.class); killOrgQuery.setCriteria(criteriaID); getPersistenceBrokerTemplate().deleteByQuery(killOrgQuery); getPersistenceBrokerTemplate().clearCache(); // build the organization table buildNewOrganizationReportsTo(); // build the account table buildNewAccountReportsTo(); }
/** * * @see org.kuali.kfs.module.endow.dataaccess.MonthEndDateDao#getAllMonthEndDates() */ public List<MonthEndDate> getAllMonthEndDatesOrderByDescending() { Criteria criteria = new Criteria(); QueryByCriteria qbc = QueryFactory.newQuery(MonthEndDate.class, criteria); qbc.addOrderByDescending(EndowPropertyConstants.MONTH_END_DATE); return (List<MonthEndDate>) getPersistenceBrokerTemplate().getCollectionByQuery(qbc); } }
ojbQuery.setStartAtIndex(startAtIndex); ojbQuery.setEndAtIndex(criteria.getMaxResults() + startAtIndex); for (OrderByField orderByField : criteria.getOrderByFields()) { if (OrderDirection.ASCENDING.equals(orderByField.getOrderDirection())) { ojbQuery.addOrderBy(orderByField.getFieldName(), true); } else if (OrderDirection.DESCENDING.equals(orderByField.getOrderDirection())) { ojbQuery.addOrderBy(orderByField.getFieldName(), false);
/** * Overrides the inactive customizeQuery in the parent class (but makes use * of its code for setting / retrieving parameter values from the XML file). * * @see org.apache.ojb.broker.accesslayer.QueryCustomizer#customizeQuery */ public Query customizeQuery(Object anObject, PersistenceBroker aBroker, CollectionDescriptor aCod, QueryByCriteria aQuery) { // Using reflection, get the long value of the static variable in the DbXrefBean class // that indicates which kind of Param object this is. String paramTypeVariableName = this.getAttribute(ATTRIBUTE_NAME); if (paramTypeVariableName != null && NAME_TO_NUMBER_MAP.get(paramTypeVariableName) != null) { Long paramTypeLongValue = NAME_TO_NUMBER_MAP.get(paramTypeVariableName); // Create the where clause to ensure only the required Param objects are returned. Criteria whereClause = aQuery.getCriteria(); whereClause.addEqualTo("queryXrefType", paramTypeLongValue); aQuery.setCriteria(whereClause); return aQuery; } else { throw new IllegalStateException("The repository.xml file should provide exactly one attribute with an attribute-name of 'param_type_value' and an attribute-value being the name of the field in the DbXrefBean class that describes the required parameter."); } } }
/** * @see org.apache.ojb.broker.accesslayer.QueryCustomizer#customizeQuery(java.lang.Object, * org.apache.ojb.broker.PersistenceBroker, org.apache.ojb.broker.metadata.CollectionDescriptor, * org.apache.ojb.broker.query.QueryByCriteria) */ public Query customizeQuery(Object arg0, PersistenceBroker arg1, CollectionDescriptor arg2, QueryByCriteria arg3) { if ("TRUE".equals(getAttribute(prepaidAttributeName))) { arg3.getCriteria().addEqualTo(prepaidIndicatorField, KFSConstants.ACTIVE_INDICATOR); } else { arg3.getCriteria().addEqualTo(prepaidIndicatorField, KFSConstants.NON_ACTIVE_INDICATOR); } return arg3; }
/** * This method should only be used in unit tests. It loads all the gl_sf_balances_t rows in memory into a collection. This won't * sace for production. * * @return a Collection of all sufficient funds records in the database */ public Collection testingGetAllEntries() { LOG.debug("testingGetAllEntries() started"); Criteria criteria = new Criteria(); QueryByCriteria qbc = QueryFactory.newQuery(SufficientFundBalances.class, criteria); qbc.addOrderBy(KFSPropertyConstants.UNIVERSITY_FISCAL_YEAR, true); qbc.addOrderBy(KFSPropertyConstants.CHART_OF_ACCOUNTS_CODE, true); qbc.addOrderBy(KFSPropertyConstants.ACCOUNT_NUMBER, true); qbc.addOrderBy(KFSPropertyConstants.FINANCIAL_OBJECT_CODE, true); return getPersistenceBrokerTemplate().getCollectionByQuery(qbc); } }
public List<TimesheetDocumentHeader> getDocumentHeadersForPrincipalId(String principalId) { Criteria crit = new Criteria(); List<TimesheetDocumentHeader> lstDocumentHeaders = new ArrayList<TimesheetDocumentHeader>(); crit.addEqualTo("principalId", principalId); QueryByCriteria query = new QueryByCriteria(TimesheetDocumentHeader.class, crit); Collection c = this.getPersistenceBrokerTemplate().getCollectionByQuery(query); if (c != null) { lstDocumentHeaders.addAll(c); } return lstDocumentHeaders; }
/** * @see org.kuali.kfs.module.endow.dataaccess.PooledFundValueDao#getPooledFundValueWhereSTProcessOnDateIsCurrentDate() */ public List<PooledFundValue> getPooledFundValueWhereSTProcessOnDateIsCurrentDate() { Criteria criteria = new Criteria(); criteria.addEqualTo(EndowPropertyConstants.DISTRIBUTE_SHORT_TERM_GAIN_LOSS_ON_DATE, kemService.getCurrentDate()); criteria.addEqualTo(EndowPropertyConstants.ST_GAIN_LOSS_DISTR_COMPL, false); QueryByCriteria qbc = QueryFactory.newQuery(PooledFundValue.class, criteria); qbc.addOrderByAscending(EndowPropertyConstants.POOL_SECURITY_ID); qbc.addOrderByDescending(EndowPropertyConstants.VALUE_EFFECTIVE_DATE); return (List<PooledFundValue>) getPersistenceBrokerTemplate().getCollectionByQuery(qbc); }
/** * Document header IDs are ordered, so an ID less than the current will * always be previous to current. */ public LeaveCalendarDocumentHeader getPreviousDocumentHeader(String principalId, DateTime beginDate) { Criteria crit = new Criteria(); crit.addEqualTo("principalId", principalId); // the pay begin date is the end date of the previous pay period crit.addEqualTo("endDate", beginDate.toDate()); QueryByCriteria query = new QueryByCriteria(LeaveCalendarDocumentHeader.class, crit); query.addOrderByDescending("documentId"); query.setStartAtIndex(0); query.setEndAtIndex(1); return (LeaveCalendarDocumentHeader) this.getPersistenceBrokerTemplate().getObjectByQuery(query); }
@Override public LeaveCalendarDocumentHeader getNextDocumentHeader(String principalId, DateTime endDate) { Criteria crit = new Criteria(); crit.addEqualTo("principalId", principalId); // the pay end date is the begin date of the next pay period crit.addEqualTo("beginDate", endDate.toDate()); QueryByCriteria query = new QueryByCriteria(LeaveCalendarDocumentHeader.class, crit); query.setStartAtIndex(0); query.setEndAtIndex(1); return (LeaveCalendarDocumentHeader) this.getPersistenceBrokerTemplate().getObjectByQuery(query); }
/** * @see org.kuali.kfs.pdp.dataaccess.PaymentDetailDao#getDisbursementNumberRanges(java.lang.String) */ public List<DisbursementNumberRange> getDisbursementNumberRanges(String campus) { LOG.debug("getDisbursementNumberRanges() started"); Date now = new Date(); Timestamp nowTs = new Timestamp(now.getTime()); Criteria criteria = new Criteria(); criteria.addLessOrEqualThan(PdpPropertyConstants.DISBURSEMENT_NUMBER_RANGE_START_DATE, nowTs); criteria.addEqualTo(PdpPropertyConstants.PHYS_CAMPUS_PROC_CODE, campus); criteria.addEqualTo(KFSPropertyConstants.ACTIVE, true); QueryByCriteria qbc = new QueryByCriteria(DisbursementNumberRange.class, criteria); qbc.addOrderBy(KFSPropertyConstants.BANK_CODE, true); return (List<DisbursementNumberRange>) getPersistenceBrokerTemplate().getCollectionByQuery(qbc); }