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