Search in sources :

Example 21 with QueryByCriteria

use of org.apache.ojb.broker.query.QueryByCriteria 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 22 with QueryByCriteria

use of org.apache.ojb.broker.query.QueryByCriteria 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 23 with QueryByCriteria

use of org.apache.ojb.broker.query.QueryByCriteria 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 24 with QueryByCriteria

use of org.apache.ojb.broker.query.QueryByCriteria 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)

Example 25 with QueryByCriteria

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

the class CuPaymentRequestDaoOjb method getPaymentRequestsToExtract.

@Override
public List<PaymentRequestDocument> getPaymentRequestsToExtract(boolean onlySpecialPayments, String chartCode, Date onOrBeforePaymentRequestPayDate) {
    LOG.debug("getPaymentRequestsToExtract() started");
    Criteria criteria = new Criteria();
    if (chartCode != null) {
        criteria.addEqualTo("processingCampusCode", chartCode);
    }
    // criteria.addIn(PurapPropertyConstants.STATUS_CODE, Arrays.asList(PaymentRequestStatuses.STATUSES_ALLOWED_FOR_EXTRACTION));
    criteria.addIsNull("extractedTimestamp");
    criteria.addEqualTo("holdIndicator", Boolean.FALSE);
    criteria.addEqualTo("paymentMethodCode", "P");
    if (onlySpecialPayments) {
        Criteria a = new Criteria();
        Criteria c1 = new Criteria();
        c1.addNotNull("specialHandlingInstructionLine1Text");
        Criteria c2 = new Criteria();
        c2.addNotNull("specialHandlingInstructionLine2Text");
        Criteria c3 = new Criteria();
        c3.addNotNull("specialHandlingInstructionLine3Text");
        Criteria c4 = new Criteria();
        c4.addEqualTo("paymentAttachmentIndicator", Boolean.TRUE);
        c1.addOrCriteria(c2);
        c1.addOrCriteria(c3);
        c1.addOrCriteria(c4);
        a.addAndCriteria(c1);
        a.addLessOrEqualThan("paymentRequestPayDate", onOrBeforePaymentRequestPayDate);
        Criteria c5 = new Criteria();
        c5.addEqualTo("immediatePaymentIndicator", Boolean.TRUE);
        c5.addOrCriteria(a);
        criteria.addAndCriteria(a);
    } else {
        Criteria c1 = new Criteria();
        c1.addLessOrEqualThan("paymentRequestPayDate", onOrBeforePaymentRequestPayDate);
        Criteria c2 = new Criteria();
        c2.addEqualTo("immediatePaymentIndicator", Boolean.TRUE);
        c1.addOrCriteria(c2);
        criteria.addAndCriteria(c1);
    }
    return (List<PaymentRequestDocument>) getPersistenceBrokerTemplate().getCollectionByQuery(new QueryByCriteria(CuPaymentRequestDocument.class, criteria));
}
Also used : QueryByCriteria(org.apache.ojb.broker.query.QueryByCriteria) ReportQueryByCriteria(org.apache.ojb.broker.query.ReportQueryByCriteria) List(java.util.List) QueryByCriteria(org.apache.ojb.broker.query.QueryByCriteria) ReportQueryByCriteria(org.apache.ojb.broker.query.ReportQueryByCriteria) Criteria(org.apache.ojb.broker.query.Criteria)

Aggregations

QueryByCriteria (org.apache.ojb.broker.query.QueryByCriteria)27 Criteria (org.apache.ojb.broker.query.Criteria)25 List (java.util.List)17 ArrayList (java.util.ArrayList)5 Timestamp (java.sql.Timestamp)3 GregorianCalendar (java.util.GregorianCalendar)3 Iterator (java.util.Iterator)3 ReportQueryByCriteria (org.apache.ojb.broker.query.ReportQueryByCriteria)3 PaymentGroup (org.kuali.kfs.pdp.businessobject.PaymentGroup)2 Transactional (org.springframework.transaction.annotation.Transactional)2 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 DisbursementVoucherDocument (org.kuali.kfs.fp.document.DisbursementVoucherDocument)1 Attachment (org.kuali.kfs.krad.bo.Attachment)1 DataObjectRelationship (org.kuali.kfs.krad.bo.DataObjectRelationship)1