use of org.apache.ojb.broker.query.QueryByCriteria 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;
}
use of org.apache.ojb.broker.query.QueryByCriteria in project cu-kfs by CU-CommunityApps.
the class CuFiscalYearMakerDaoOjb method deleteNewYearRows.
/**
* Deletes the new year records for the given fiscal year maker. If the object has an extension it first deletes the data
* in the extension table.
*
* @see org.kuali.kfs.sys.batch.dataaccess.impl.FiscalYearMakersDaoOjb#deleteNewYearRows(java.lang.Integer,
* org.kuali.kfs.sys.batch.dataaccess.FiscalYearMaker)
*/
@Override
public void deleteNewYearRows(Integer baseYear, FiscalYearMaker objectFiscalYearMaker) {
// Check if an extension exists and delete extension records first
if (persistenceStructureService.hasReference(objectFiscalYearMaker.getBusinessObjectClass(), KFSPropertyConstants.EXTENSION)) {
Map<String, DataObjectRelationship> relationships = persistenceStructureService.getRelationshipMetadata(objectFiscalYearMaker.getBusinessObjectClass(), KFSPropertyConstants.EXTENSION);
Class extensionClass = relationships.get(KFSPropertyConstants.EXTENSION).getRelatedClass();
LOG.info(String.format("\ndeleting %s for %d", extensionClass.getName(), baseYear + 1));
QueryByCriteria queryExtension = new QueryByCriteria(extensionClass, objectFiscalYearMaker.createDeleteCriteria(baseYear));
getPersistenceBrokerTemplate().deleteByQuery(queryExtension);
getPersistenceBrokerTemplate().clearCache();
}
// Delete the main objects now
if (LOG.isInfoEnabled()) {
LOG.info(String.format("\ndeleting %s for target year(s)", objectFiscalYearMaker.getBusinessObjectClass().getName()));
}
QueryByCriteria queryID = new QueryByCriteria(objectFiscalYearMaker.getBusinessObjectClass(), objectFiscalYearMaker.createDeleteCriteria(baseYear));
getPersistenceBrokerTemplate().deleteByQuery(queryID);
getPersistenceBrokerTemplate().clearCache();
}
Aggregations