Re: D2W, EditingContext, WORequest
Re: D2W, EditingContext, WORequest
- Subject: Re: D2W, EditingContext, WORequest
- From: David LeBer <email@hidden>
- Date: Mon, 30 Jan 2012 11:13:50 -0500
Just thinking off the top of my head:
Maybe post an NSNotification in the EO's willUpdate (assuming you are using subclasses of ERXGenericRecord) method if the textblock is changing. The notification should contain the EOGlobalID of the changed object.
Register to receive that kind of notification in your Session object, or somewhere else that it is appropriate to handle it.
If the pdf generation takes time, consider trying something like ERXAsyncQueue to handle in the background.
D
--
David LeBer
Codeferous Software
On 2012-01-30, at 9:59 AM, Markus Ruggiero wrote:
> Yes, Paul, I know this - and I do not want to mix. BUT: the required functionality is so, that when a "textblock" is edited and then stored to the database, all "electronic documents" that include this particular textblock must be recreated automatically. To be able to do this I must be able to find the updated textblock. This is something that the editing context can tell me. To generate the electronic document (resulting PDF) I use a standard WOComponent to generate the XML as input to Apache FOP. And here is my problem: When the user presses "Save" in the D2W page this can result in some modifications to textblocks. Textblock is not necessarily the top entity in the D2W edit page. First I had my code in the nextPageDelegate for the editing page. But this is only called after the save has taken place and I the editing context cannot tell me what has been saved and needs regeneration of the relevant PDF. Can I trap saveChanges() in a D2WEditPage without having to freeze the component? Or is there a way for the editing context to access the request/context (which should probably not be)? Or am I completely off track?
>
> I hope I could make clear where my problem is. Thanks for input/help/whatever
> ---markus---
>
> On 30.01.2012, at 14:06, Paul D Yu wrote:
>
>> Component generation, XML generation are "UI" view things, they should NOT be down in your EOs!!! Have you looked at the PDF generation example in Wonder?
>>
>> Basically, you should create a component like any other, except the wrapper is what FOP wants.
>>
>> Paul
>>
>> Sent from my iPad
>>
>> On Jan 30, 2012, at 4:58 AM, Markus Ruggiero <email@hidden> wrote:
>>
>>> Help, this is urgent, please could someone have a look. I am at a loss here. Probably my concept is wrong but I do not see how to fix it. A nudge into the right direction (or a kick into the bu**) might be all I need.
>>>
>>> Thank you very much
>>> ---markus---
>>>
>>> On 27.01.2012, at 15:35, mailinglists wrote:
>>>
>>>> Help!
>>>>
>>>> My ERD2W application needs to generate PDF-files for EOs. The EO has a method that calls a XML-Generator that generates the XML-input for Apache-FOP. For this I use the following code in the Document-EO (just a fragment)
>>>>
>>>> I_XMLGeneratorInterface xmlGenerator = (I_XMLGeneratorInterface)WOApplication.application().pageWithName(generatorName, new WOContext(session.context().request()));
>>>>
>>>> The problem is that pageWithName needs a WOContext and this needs a WORequest. The WORequest comes from the session. BUT EOs are not supposed to know about sessions. So I pass the session into that method when I call the document to generate the PDF data. Fine, works. But now I want to automate the generation of PDFs when any relevant object is saved. I have thus created my own EOEditingContext descendant where I override saveChanges(). Whenever I save a relevant object I check after success if that object has related documents and then call those to generate the PDF, passing in the session. My EditingContext has a session variable and in the session-constructor I manually create my editing context, stuff the session into it and install it as defaultEditingContext. But D2W creates editingContexts and knows nothing about feeding with session information. When my code runs session variable is null and no PDFs are created.
>>>>
>>>> Any idea how to tackle this problem? HELP! Is my strategy ok? Can I fix the missing session somehow? Or would you recommend a different way to go?
>>>>
>>>> Thanks a lot, this is an urgent one
>>>> ---markus---
>>>> _______________________________________________
>>>> 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
>>>
>>> _______________________________________________
>>> 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
>
> _______________________________________________
> 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
_______________________________________________
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