I have a PasStep that I would like to deep copy and in order to use these copy methods, they need to be OTObjects, correct? In the Authoring Tool, we are working with the real objects so do I have to go from PasStep to OTPasStep, then copy OTPasStep, then getRealObject, which is a copy of the original PasStep? If this is what we need to do, how would we go from a PasStep to an OTPasStep? or is there a quicker way to perform this?
Thanks, Geoff On Tue, Apr 22, 2008 at 12:10 PM, Scott Cytacki <[EMAIL PROTECTED]> wrote: > > OTrunk has a service method for deep cloning. And it can take a depth > so you can use it to only copy down a few levels. In the future the > concept of containment will be exposed so you can limit the clone to > only objects "contained" by the top level object. > > We also have a cloneable interface that is used for some non OTrunk > objects. Because OTrunk objects can be serialized and their properties > can be introspected so there isn't really a need for a special interface. > > If you want to look at some example code you can look at, > OTObjectService.copyObject methods and their implementations: > OTObjectServiceImpl.copyObject > Because OTrunk objects are backed by a persistence data layer whose main > interface is OTDatabase, this layer is where the cloning actually > happens. So the cloning code works without directly accessing the > OTObjects objects being cloned. This would be similar to cloning a > J2EE domain object by just copying its representation in the sql database. > > For what you are trying to do I would recommend trying to use the > OTObjectService.copyObject methods, if you run into problems with this, > report them and I'll see if we can get them fixed. > > The concept of containment will probably become important, because when > you are copying a step that is referencing some shared object perhaps it > has a reference to a note. You have to decide if you shouldu copy that > note step, or just use a reference to it. Containment provides way to > indicate what should and shouldn't be copied. We haven't used it yet, > so I don't know if it is flexible enough for all cases. I would guess > that in some cases it won't be good enough. > > Scott > > Anthony Perritano wrote: > > Hey Scott, quick question. Geoff and I are working on step and > > activity duplication. we have been doing alot of research on cloning, > > deep copying. there are a number of methods: > > constructor based, factory method, implementing cloneable interface > > etc.... > > > > some say one method is better. some say the contrary. > > > > what method do u perfer? and are there any helpers in the Otrunk code > > base for this? > > > > thx > > -Tony > > > > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "SAIL-Dev" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/SAIL-Dev?hl=en -~----------~----~----~----~------~----~------~--~---
