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));
}
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;
}
Aggregations