Search in sources :

Example 31 with Criteria

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

Example 32 with Criteria

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

the class CuFormatPaymentDaoOjb method markPaymentsForFormat.

public Iterator markPaymentsForFormat(List customerIds, Timestamp paydateTs, String paymentTypes, String paymentDistribution) {
    LOG.debug("markPaymentsForFormat() started");
    Criteria criteria = new Criteria();
    if (customerIds.size() > 0) {
        criteria.addIn(PdpPropertyConstants.PaymentGroup.PAYMENT_GROUP_BATCH + "." + PdpPropertyConstants.BatchConstants.CUSTOMER_ID, customerIds);
    }
    criteria.addEqualTo(PdpPropertyConstants.PaymentGroup.PAYMENT_GROUP_PAYMENT_STATUS_CODE, PdpConstants.PaymentStatusCodes.OPEN);
    if (PdpConstants.PaymentTypes.DISBURSEMENTS_WITH_SPECIAL_HANDLING.equals(paymentTypes)) {
        // special handling only
        criteria.addEqualTo(PdpPropertyConstants.PaymentGroup.PAYMENT_SPECIAL_HANDLING, Boolean.TRUE);
    } else if (PdpConstants.PaymentTypes.DISBURSEMENTS_NO_SPECIAL_HANDLING.equals(paymentTypes)) {
        // no special handling only
        criteria.addEqualTo(PdpPropertyConstants.PaymentGroup.PAYMENT_SPECIAL_HANDLING, Boolean.FALSE);
    } else if (PdpConstants.PaymentTypes.DISBURSEMENTS_WITH_ATTACHMENTS.equals(paymentTypes)) {
        // attachments only
        criteria.addEqualTo(PdpPropertyConstants.PaymentGroup.PAYMENT_ATTACHMENT, Boolean.TRUE);
    } else if (PdpConstants.PaymentTypes.DISBURSEMENTS_NO_ATTACHMENTS.equals(paymentTypes)) {
        // no attachments only
        criteria.addEqualTo(PdpPropertyConstants.PaymentGroup.PAYMENT_ATTACHMENT, Boolean.FALSE);
    }
    if (PdpConstants.PaymentTypes.PROCESS_IMMEDIATE.equals(paymentTypes)) {
        criteria.addEqualTo(PdpPropertyConstants.PaymentGroup.PROCESS_IMMEDIATE, Boolean.TRUE);
    } else {
        // (Payment date <= usePaydate OR immediate = TRUE)
        Criteria criteria1 = new Criteria();
        criteria1.addEqualTo(PdpPropertyConstants.PaymentGroup.PROCESS_IMMEDIATE, Boolean.TRUE);
        Criteria criteria2 = new Criteria();
        criteria2.addLessOrEqualThan(PdpPropertyConstants.PaymentGroup.PAYMENT_DATE, paydateTs);
        criteria1.addOrCriteria(criteria2);
        criteria.addAndCriteria(criteria1);
    }
    if (CUPdpConstants.PaymentDistributions.PROCESS_ACH_ONLY.equals(paymentDistribution)) {
        criteria.addEqualTo(PdpPropertyConstants.PaymentGroup.PAYMENT_GROUP_DISBURSEMENT_TYPE_CODE, PdpConstants.DisbursementTypeCodes.ACH);
    } else if (CUPdpConstants.PaymentDistributions.PROCESS_CHECK_ONLY.equals(paymentDistribution)) {
        Criteria criteria3 = new Criteria();
        criteria3.addEqualTo(PdpPropertyConstants.PaymentGroup.PAYMENT_GROUP_DISBURSEMENT_TYPE_CODE, PdpConstants.DisbursementTypeCodes.CHECK);
        Criteria criteria4 = new Criteria();
        criteria4.addIsNull(PdpPropertyConstants.PaymentGroup.PAYMENT_GROUP_DISBURSEMENT_TYPE_CODE);
        criteria3.addOrCriteria(criteria4);
        criteria.addAndCriteria(criteria3);
    }
    Iterator groupIterator = getPersistenceBrokerTemplate().getIteratorByQuery(new QueryByCriteria(PaymentGroup.class, criteria));
    return groupIterator;
}
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)

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