Skip to Content
0
Former Member
Jul 19, 2005 at 07:40 PM

How to serialize/deserialize a Context to/from a file?

38 Views

Hello,

I have a DynPro application which contains an evaluation form for employees. Once pressing "Submit" the whole form is being written to an SQL table.

The evaluation form is very long and it could be that one will want to save the evaluation so far (without submitting it to the DB yet) and continue on another day.

In order to do that, I need to save the temporary context, perhaps serialize it to a file.

My idea was the following:

1. In case a user selects to temporary save the evaluation, I should serialize the whole context to a file, with the employee ID as the filename.

2. When a user selects to evaluate a certain employee, I will go over the folder which contains the temporary files and check if a file for this employee ID exists.

3. In case it exists, I will replace the current instance of the Context with the context which has been saved on a file.

I have two question:

A. Is it possible to serialize the whole context to a file?

B. Is it possible to retreive this context and replace the default instance which Dynpro creates with the serialized contex?

I am already familiar with this post:

converting context-tree to xml?

In this post Valery explained how to transform the Context to an xml file using SAX Parser, but I don't need that, all I need is wrting the whole context as a bulk to a file and then retreive it. And even if I'll use this method, is it possible to replace the default context with the saved one without going over the Context and setting it node by node?

Roy