Search in sources :

Example 26 with Criteria

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

the class AwardAccountDaoOjb method isAccountUsedOnAnotherAward.

/**
 * @see edu.cornell.kfs.module.cg.dataaccess.AwardAccountDao#isAccountUsedOnAnotherAward(java.lang.String,
 *      java.lang.String, java.lang.Long)
 */
@Override
public boolean isAccountUsedOnAnotherAward(String chart, String account, String proposalNumber) {
    Criteria criteria = new Criteria();
    criteria.addNotEqualTo(KFSPropertyConstants.PROPOSAL_NUMBER, proposalNumber);
    criteria.addEqualTo(KFSPropertyConstants.CHART_OF_ACCOUNTS_CODE, chart);
    criteria.addEqualTo(KFSPropertyConstants.ACCOUNT_NUMBER, account);
    criteria.addEqualTo(KFSPropertyConstants.ACTIVE, Boolean.TRUE);
    QueryByCriteria query = QueryFactory.newQuery(AwardAccount.class, criteria);
    int numOfRows = getPersistenceBrokerTemplate().getCount(query);
    return numOfRows > 0;
}
Also used : QueryByCriteria(org.apache.ojb.broker.query.QueryByCriteria) QueryByCriteria(org.apache.ojb.broker.query.QueryByCriteria) Criteria(org.apache.ojb.broker.query.Criteria)

Example 27 with Criteria

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

the class CuAttachmentDaoOjb method getAttachmentByAttachmentId.

@Override
public Attachment getAttachmentByAttachmentId(String attachmentIdentifier) {
    Criteria crit = new Criteria();
    crit.addEqualTo(CUKRADPropertyConstants.ATTACHMENT_IDENTIFIER, attachmentIdentifier);
    return (Attachment) this.getPersistenceBrokerTemplate().getObjectByQuery(new QueryByCriteria(Attachment.class, crit));
}
Also used : QueryByCriteria(org.apache.ojb.broker.query.QueryByCriteria) Attachment(org.kuali.kfs.krad.bo.Attachment) QueryByCriteria(org.apache.ojb.broker.query.QueryByCriteria) Criteria(org.apache.ojb.broker.query.Criteria)

Example 28 with Criteria

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

the class CuCreditMemoDaoOjb method getCreditMemosToExtractByVendor.

@Override
public Collection<VendorCreditMemoDocument> getCreditMemosToExtractByVendor(String chartCode, VendorGroupingHelper vendor) {
    LOG.debug("getCreditMemosToExtractByVendor() started");
    Criteria criteria = new Criteria();
    criteria.addEqualTo("processingCampusCode", chartCode);
    criteria.addIsNull("extractedTimestamp");
    criteria.addEqualTo("holdIndicator", Boolean.FALSE);
    criteria.addEqualTo("paymentMethodCode", "P");
    criteria.addEqualTo("vendorHeaderGeneratedIdentifier", vendor.getVendorHeaderGeneratedIdentifier());
    criteria.addEqualTo("vendorDetailAssignedIdentifier", vendor.getVendorDetailAssignedIdentifier());
    criteria.addEqualTo("vendorCountryCode", vendor.getVendorCountry());
    criteria.addLike("vendorPostalCode", vendor.getVendorPostalCode() + "%");
    return (List<VendorCreditMemoDocument>) getPersistenceBrokerTemplate().getCollectionByQuery(new QueryByCriteria(CuVendorCreditMemoDocument.class, criteria));
}
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 29 with Criteria

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

the class CuPaymentRequestDaoOjb method getObjectIdByPaymentRequestDocumentNumber.

@Override
public String getObjectIdByPaymentRequestDocumentNumber(String documentNumber) {
    // Build PREQ query that matches only on document number.
    Criteria crit = new Criteria();
    crit.addEqualTo("documentNumber", documentNumber);
    // Prepare report query that only retrieves object ID.
    ReportQueryByCriteria reportQuery = QueryFactory.newReportQuery(PaymentRequestDocument.class, crit);
    reportQuery.setAttributes(new String[] { "objectId" });
    reportQuery.setJdbcTypes(new int[] { java.sql.Types.VARCHAR });
    // Run query and return results.
    Iterator<Object[]> results = getPersistenceBrokerTemplate().getReportQueryIteratorByQuery(reportQuery);
    if (results.hasNext()) {
        return (String) results.next()[0];
    }
    return null;
}
Also used : ReportQueryByCriteria(org.apache.ojb.broker.query.ReportQueryByCriteria) QueryByCriteria(org.apache.ojb.broker.query.QueryByCriteria) ReportQueryByCriteria(org.apache.ojb.broker.query.ReportQueryByCriteria) Criteria(org.apache.ojb.broker.query.Criteria)

Example 30 with Criteria

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

the class CuPaymentRequestDaoOjb method countDocumentsByPurchaseOrderId.

@Override
public int countDocumentsByPurchaseOrderId(Integer poPurApId, String applicationDocumentStatus) {
    Criteria criteria = new Criteria();
    criteria.addEqualTo(PurapPropertyConstants.PURCHASE_ORDER_IDENTIFIER, poPurApId);
    if (StringUtils.isNotBlank(applicationDocumentStatus)) {
        criteria.addEqualTo(KFSPropertyConstants.DOCUMENT_HEADER + "." + KFSPropertyConstants.APPLICATION_DOCUMENT_STATUS, applicationDocumentStatus);
    }
    QueryByCriteria query = QueryFactory.newQuery(PaymentRequestDocument.class, criteria);
    final int numOfPreqs = getPersistenceBrokerTemplate().getCount(query);
    return numOfPreqs;
}
Also used : QueryByCriteria(org.apache.ojb.broker.query.QueryByCriteria) ReportQueryByCriteria(org.apache.ojb.broker.query.ReportQueryByCriteria) QueryByCriteria(org.apache.ojb.broker.query.QueryByCriteria) ReportQueryByCriteria(org.apache.ojb.broker.query.ReportQueryByCriteria) Criteria(org.apache.ojb.broker.query.Criteria)

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