NSMutableArray<ReportForPaymentType> reports = new NSMutableArray<ReportForPaymentType>();
EOEntity entity = new EOEnterpriseObjectClazz<EOEnterpriseObject>(MESAbstractPaymentInfo.ENTITY_NAME).entity();
NSArray<EOEntity> subEntities = entity.subEntities();
NSMutableArray<EOQualifier> qualifiers = new NSMutableArray<EOQualifier>();
qualifiers.addObject(MESAbstractPaymentInfo.DISPATCH.dot(MESDispatch.RESERVATION_DATE).greaterThanOrEqualTo(controller().startDate()));
qualifiers.addObject(MESAbstractPaymentInfo.DISPATCH.dot(MESDispatch.RESERVATION_DATE).lessThanOrEqualTo(controller().endDate()));
for(EOEntity subEntity : subEntities) {
NSMutableArray<EOQualifier> subEntityQualifiers = (NSMutableArray<EOQualifier>)qualifiers.clone();
subEntityQualifiers.addObject(subEntity.restrictingQualifier());
NSArray<MESAbstractPaymentInfo> subEntityPayments = MESAbstractPaymentInfo.fetchMESAbstractPaymentInfos(controller().ec(), new EOAndQualifier(subEntityQualifiers), null);
if(subEntityPayments.size() > 0) {
// This is the part I want to change
// I'd like to somehow get the "displayName" without having to get an object.
// So that even if the result is 0 I can still create a report for the sub entity.
MESAbstractPaymentInfo paymentInfo = subEntityPayments.get(0);
ReportForPaymentType report = new ReportForPaymentType();
report.setPaymentType(paymentInfo.displayName());
report.setDispatchCount(subEntityPayments.size());
report.setTotalRevenue((BigDecimal)subEntityPayments.valueForKey("@sum.amount"));
reports.addObject(report);
}
}
I hope that makes some kind of sense...
Johnny
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden