use of org.apache.ojb.broker.query.Criteria 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.Criteria 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.Criteria 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.Criteria in project cu-kfs by CU-CommunityApps.
the class CuPaymentRequestDaoOjb method getObjectIdByPaymentRequestDocumentNumber.
@Override
public String getObjectIdByPaymentRequestDocumentNumber(String documentNumber) {
// Build PREQ query that matches only on document number.
Criteria crit = new Criteria();
crit.addEqualTo("documentNumber", documentNumber);
// Prepare report query that only retrieves object ID.
ReportQueryByCriteria reportQuery = QueryFactory.newReportQuery(PaymentRequestDocument.class, crit);
reportQuery.setAttributes(new String[] { "objectId" });
reportQuery.setJdbcTypes(new int[] { java.sql.Types.VARCHAR });
// Run query and return results.
Iterator<Object[]> results = getPersistenceBrokerTemplate().getReportQueryIteratorByQuery(reportQuery);
if (results.hasNext()) {
return (String) results.next()[0];
}
return null;
}
use of org.apache.ojb.broker.query.Criteria 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;
}
Aggregations