Help

Controls

PermLinkWikiLink

Built with Seam

You can find the full source code for this website in the Seam package in the directory /examples/wiki. It is licensed under the LGPL.

Forum: Seam Users Forum ListTopic List
04. Jun 2008, 20:07 CET | Link

Good Afternoon, All:

How do I access the DocumentStore from within a class?

What notations and imports need to be made?

What code should I use to do this?

Please be as specific and detailed as you can. I hate to ask, but the answer is not as intuitive as I'd hoped, and the only examples of code that I've found haven't worked. I'm hoping that a direct appeal will help me move forward past this roadblock.

With Regards,

Jason Flynn Kemp

4 Replies:
04. Jun 2008, 21:51 CET | Link

Try DocumentStore.instance(), what are you trying to do?

 

If a man speaks in the forest and there is no woman around to hear him, is he still wrong?

04. Jun 2008, 22:37 CET | Link

Man, that was easy. I'm trying to get the contents of the DocumentStore after it generates a PDF, so that I can write it out to a file instead of to the browser.

I was trying to use Ben Catherall's approach as described in this thread: http://www.seamframework.org/Community/PDFdocumentStore

However, conversation doesn't work like he has in his code (there is no get(String) method for Conversation), so I'm now trying to access the DocumentStore directly.

Now I have to figure out how to get the document's id String so that I can get the DocumentData, since the DocumentStore's getDocumentData method requires an id String.

Any clues or suggestions?

With Regards,

Jason Flynn Kemp

04. Jun 2008, 23:05 CET | Link

I'm just brainstorming here but looking at the source code in the UIDocument encodeEnd I see something like


        if (sendRedirect) {
           // The stuff that puts data in DocumentStore and redirects
        } else {
            UIComponent parent = getParent();

            if (parent instanceof ValueHolder) {
                ValueHolder holder = (ValueHolder) parent;
                holder.setValue(documentData);
            }

which could indicate that if you set sendRedirect=false in the UIDocument, the data should end up in the parent, as long as it is a ValueHolder.

I've never used it so just guessing: If you set sendRedirect to false and nest the UIDocument in something with a value-binding, the byte[] data ends up there?

 

If a man speaks in the forest and there is no woman around to hear him, is he still wrong?

05. Jun 2008, 13:12 CET | Link

My bad in the code before its a Context object, not Conversation object

conversation = Contexts.getConversationContext()