Reputation: 2883
I have a value proxy object in my client side which I have created using a Request Context. I use the same request context to save that object. Till here its fine.
Now there is a new requirement where I need to send the same object to the server (for different purpose) to the server before the actual save in the flow. How can I do that?
I tried to create a new request context and then send object with that, but I got an error saying thats not allowed.
Thanks.
Upvotes: 0
Views: 78
Reputation: 64541
You have to duplicate/clone it. As it's a ValueProxy
it shouldn't be a problem. The issue is that there's no easy and clean way to clone a proxy.
The cleanest solution is to use AutoBeanUtils.getAutoBean
and then an AutoBeanVisitor
to visit each property and set it on another proxy.
An easier way is to serialize the proxy into a ProxyStore
and deserialize it, which will create a distinct proxy.
Upvotes: 1