How about passing in an array of EOs as EOGlobalIDs and a dictionary of 
EOGlobalIDs to whatever prepared data (user info) you need?

Chuck

On 13-09-25 7:41 PM, "Paul Hoadley" wrote:

On 25/09/2013, at 2:32 PM, Paul Hoadley 
<pa...@logicsquad.net<mailto:pa...@logicsquad.net>> wrote:

To be more specific, then, I'm implementing a new background task for the 
ERJasperReports.framework which I'm calling ERJRDataSourceReportTask.  It's 
analogous to the existing ERJRFetchSpecificationReportTask, but takes an 
ERJRFoundationDataSource instead of a fetch specification.  For our purposes 
here, we probably only need to know that the latter just takes an NSArray<? 
extends NSKeyValueCodingAdditions>.  So here's part of the new class:

publicclass ERJRDataSourceReportTask implements Callable<File>, 
IERXPercentComplete {
public ERJRDataSourceReportTask(ERJRFoundationDataSource dataSource,
String reportName) {
// ...
}

Ideally I'd like to keep it general like this (that is, accepting 
ERJRFoundationDataSource in the constructor), but what happens in the specific 
case where the NSArray<? extends NSKeyValueCodingAdditions> backing that is 
actually an NSArray<EOEnterpriseObject>?  Should I look for that specific case 
(in the task's constructor above), then pull out all the EOGlobalIDs, and then 
re-create all the EOs via those EOGlobalIDs right there on the spot?  I mean, 
presumably this is equivalent to having the caller supply an array of 
EOGlobalIDs (because the _constructor_ is running in the same original thread), 
but what I've just described sounds ridiculous, doesn't it?

What I would like to avoid is a special-case constructor accepting 
NSArray<EOGlobalID>, but I could do that if I had to.  Any thoughts?

Actually, there's another complication for my use case.  In preparation for the 
reporting task, I'm actually modifying all the EOs in the array slightly in 
preparation for the report—they have a non-persistent "user info" 
NSMutableDictionary which I'm using to do a bit of the heavy lifting for the 
report.  So I'm stashing, say, a running balance for a list of 
transactions—whatever it is, assume it can't be done by the reporting engine.

This might help to make my query a bit more general, at least: is there any way 
I can safely get these "prepared" EOs from the main thread into the background 
thread?  (Given that passing them as EOGlobalIDs is going to get me fresh 
copies without the preparation.)

If the answer is no, I guess I'll have to do something less general than what I 
started above—pass the array of EOs in as EOGlobalIDs, and do the preparatory 
steps in the background as well.


--
Paul Hoadley
http://logicsquad.net/





--
Chuck Hill
Executive Managing Partner, VP Development and Technical Services

Practical WebObjects - for developers who want to increase their overall 
knowledge of WebObjects or who are trying to solve specific problems.
http://www.global-village.net/gvc/practical_webobjects

Global Village Consulting ranks 13th in 2012 in BIV's Top 100 Fastest Growing 
Companies in B.C!

Global Village Consulting ranks 44th in 25th annual PROFIT 500 ranking of 
Canada’s Fastest-Growing Companies by PROFIT Magazine!
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to