If you dont want to use an original object why not just clone/create a
copy of the original end use that and then copy the values over again?
(i think beanutils or something van do that for you)

On 11/18/08, Nino Saturnino Martinez Vazquez Wael
<[EMAIL PROTECTED]> wrote:
> Hi
>
> Im trying todo a compoundpropertymodel which does not change original
> values in the "original" model. I need this since I am updating some
> stuff in a wizard but I first want to commit when the user confirms in
> the end of the wizard, and if the model are changed directly the
> transaction are automatically committed to the database....
>
> So my idea were to todo a shadowCompoundPropertyModel something like this:
>
> class EditorModel extends CompoundPropertyModel {
>
>
>     private Map newValues=new HashMap<String, Object>();
>
>     public EditorModel(CompoundPropertyModel underlyingModel,
>             String propertyName) {
>         super(underlyingModel);
>     }
>
> public getObject (String property){
> check if there are something in the map if so return it, otherwise fall
> back to the underlying model
>
> }
> public setObject (String prop, Value){
>     put changes in the map...
> }
>
> public UpdateOriginal(){
>  iterate over the map and use reflection to set values on the original
> model..
>
> }
>
> }
>
> Does anybody have something similar floating around, in a more complete
> state..? Or could it be done in a easier way?
>
> --
> -Wicket for love
>
> Nino Martinez Wael
> Java Specialist @ Jayway DK
> http://www.jayway.dk
> +45 2936 7684
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to