Yes, tricky indeed. Well, I would say that we could specify a list of singles and a list of compositions to ignore at all levels if they are come across. Perhaps we could also add a flag in the transfer config for ignoring a particular composition or object during cascades? I think cascading could be terribly powerful with a few alterations.
Did you get my stack overflow issue? I managed to get a workaround, so I have Transfer running on Railo now flawlessly. On Jun 24, 6:34 pm, Mark Mandel <[email protected]> wrote: > Yeah, this gets a little tricky.. i.e. what do you ignore if you get to > level 2/3 of the graph, how do you specify what gets ignore there...? > > Or should we only be concerned for the top level? > > Mark > > On Sat, Jun 20, 2009 at 11:07 AM, whostheJBoss > <[email protected]>wrote: > > > > > Hmm, would composition still work for a single class? Maybe a flag > > list of both compositions and individual classes to ignore? Thanks > > Mark! > > > On Jun 19, 5:45 pm, Mark Mandel <[email protected]> wrote: > > > Would you want to do it via the name of the class.. or would you prefer > > to > > > ignore by the name of the composition? > > > > Mark > > > > On Sat, Jun 20, 2009 at 3:36 AM, whostheJBoss < > > [email protected]>wrote: > > > > > Well, I had wanted to be able to do this with all my deletes by > > > > default so I would be able to cascade delete and provide a list of > > > > objects to ignore without writing custom methods to loop and drill > > > > through all of the objects. Anyway, I hacked up the change myself if > > > > anyone is interested in actually adding it to Transfer. > > > > > The changes are below (comments are provided where there changes are, > > > > I only provided snippets showing the portion of the code that contains > > > > changes). I'm sure I could have put the skip list in the visitingargs, > > > > but I didn't delve that deeply into it. This works as expected though. > > > > You call cascadeDelete with an additional argument, which is a comma- > > > > delimited list of objects to ignore. > > > > > I call it this way: > > > > > deleteThis = instance.Transfer.get("users.posts", > > > > arguments.postID); > > > > cdArgs = structNew(); > > > > cdArgs.transfer = deleteThis; > > > > cdArgs.skip = "users.user"; > > > instance.Transfer.cascadeDelete(argumentCollection=cdArgs); > > > > > This deletes everything on both sides of the post except the > > > > users.user object. > > > > > Here are the changes: > > > > > Transfer.cfc: > > > > --------------------------------------------- > > > > <cffunction name="cascadeDelete" hint="does a cascade down the object > > > > hierarchy, calling delete() as it goes" access="public" > > > > returntype="void" output="false"> > > > > <cfargument name="transfer" hint="The transferObject to create" > > > > type="TransferObject" required="Yes"> > > > > <cfargument name="depth" hint="the number of levels in which to > > > > cascade, 0 is unlimited" type="numeric" required="No" default="0"> > > > > <cfargument name="useTransaction" hint="deprecated: use > > > > TransferFactory.getTransaction for transaction management. Whether or > > > > not to use an internal transaction block" type="boolean" required="No" > > > > default="true"> > > > > // ******** ADDED SKIP ARGUMENT ******** > > > > <cfargument name="skip" type="string" required="No"> > > > > > <cffunction name="visitObjectGraph" hint="visit each of the objects in > > > > the graph, calling 'visit({transfer:transferObject, visitArgs1...})' > > > > on the visitor for each TransferObject in the graph" access="public" > > > > returntype="void" output="false"> > > > > <cfargument name="transfer" hint="the starting object to visit" > > > > type="transfer.com.TransferObject" required="Yes"> > > > > <cfargument name="visitor" hint="the visitor object" type="any" > > > > required="Yes"> > > > > <cfargument name="visitingMethod" hint="the name of the method > > that > > > > is being visited" type="string" required="Yes"> > > > > <cfargument name="visitArgs" hint="visiting arguments, if there > > are > > > > any" type="struct" required="No" default="#StructNew()#"> > > > > <cfargument name="depth" hint="the max depth to go to" > > > > type="numeric" > > > > required="no" default="0"> > > > > <cfargument name="topDown" hint="travel top down, rather than > > bottom > > > > up" type="boolean" required="No" default="true"> > > > > <cfargument name="forceLoading" hint="if not loaded, force > > loading" > > > > type="boolean" required="No" default="false"> > > > > // ******** ADDED SKIP ARGUMENT ******** > > > > <cfargument name="skip" type="string" required="No"> > > > > --------------------------------------------- > > > > > DynamicManager.cfc: > > > > --------------------------------------------- > > > > <cffunction name="visitObjectGraph" hint="visit each of the objects in > > > > the graph, calling 'visit({transfer:transferObject, visitArgs1...})' > > > > on the visitor for each TransferObject in the graph" access="public" > > > > returntype="void" output="false"> > > > > <cfargument name="transfer" hint="the starting object to visit" > > > > type="transfer.com.TransferObject" required="Yes"> > > > > <cfargument name="visitor" hint="the visitor object" type="any" > > > > required="Yes"> > > > > <cfargument name="visitingMethod" hint="the name of the method > > that > > > > is being visited" type="string" required="Yes"> > > > > <cfargument name="visitArgs" hint="visiting arguments, if there > > are > > > > any" type="struct" required="Yes"> > > > > <cfargument name="depth" hint="the max depth to go to" > > > > type="numeric" > > > > required="no" default="0"> > > > > <cfargument name="topDown" hint="travel top down, rather than > > bottom > > > > up" type="boolean" required="No" default="true"> > > > > <cfargument name="forceLoading" hint="if not loaded, force > > loading" > > > > type="boolean" required="No" default="false"> > > > > // ******** ADDED SKIP ARGUMENT ******** > > > > <cfargument name="skip" type="string" required="No"> > > > > --------------------------------------------- > > > > > ObjectTreeWalker.cfc: > > > > --------------------------------------------- > > > > <cffunction name="visit" hint="visit each of the objects in the graph" > > > > access="public" returntype="void" output="false"> > > > > <cfargument name="transfer" hint="the starting object to visit" > > > > type="transfer.com.TransferObject" required="Yes"> > > > > <cfargument name="visitor" hint="the visitor object" type="any" > > > > required="Yes"> > > > > <cfargument name="visitingMethod" hint="the name of the method > > that > > > > is being visited" type="string" required="Yes"> > > > > <cfargument name="visitArgs" hint="visiting arguments, if there > > are > > > > any" type="struct" required="Yes"> > > > > <cfargument name="depth" hint="the max depth to go to" > > > > type="numeric" > > > > required="no" default="0"> > > > > <cfargument name="topDown" hint="travel top down, rather than > > bottom > > > > up" type="boolean" required="No" default="true"> > > > > <cfargument name="forceLoading" hint="if not loaded, force > > loading" > > > > type="boolean" required="No" default="false"> > > > > // ******** ADDED SKIP ARGUMENT ******** > > > > <cfargument name="skip" type="string" required="No" default=""> > > > > > <cfscript> > > > > // ******** ADDED SKIP ARGUMENT AND 0 and structNew() > > for > > > > currentDepth and visitedHashs to be passed to traverse() ******** > > > > // ******** traverse() is expecting the argument after > > > > forceLoading to be depth, I supplied the default value here ******** > > > > // ******** and did the same with visitedHashs ******** > > > > traverse(arguments.transfer, > > > > arguments.visitor, > > > > arguments.visitingMethod, > > > > arguments.visitArgs, > > > > arguments.depth, > > > > arguments.topDown, > > > > arguments.forceLoading, > > > > 0, > > > > structNew(), > > > > arguments.skip > > > > ); > > > > </cfscript> > > > > > <cffunction name="traverse" hint="traverses the object graph" > > > > access="private" returntype="void" output="false"> > > > > <cfargument name="transfer" hint="the starting object to visit" > > > > type="transfer.com.TransferObject" required="Yes"> > > > > <cfargument name="visitor" hint="the visitor object" type="any" > > > > required="Yes"> > > > > <cfargument name="visitingMethod" hint="the name of the method > > that > > > > is being visited" type="string" required="Yes"> > > > > <cfargument name="visitArgs" hint="visiting arguments, if there > > are > > > > any" type="struct" required="Yes"> > > > > <cfargument name="maxDepth" hint="the max depth to go to" > > > > type="numeric" required="yes"> > > > > <cfargument name="topDown" hint="travel top down, rather than > > bottom > > > > up" type="boolean" required="yes"> > > > > <cfargument name="forceLoading" hint="if not loaded, force > > loading" > > > > type="boolean" required="yes"> > > > > <cfargument name="currentDepth" hint="the max depth to go to" > > > > type="numeric" required="no" default="0"> > > > > <cfargument name="visitedHashs" hint="A struct of the identity > > hash > > > > codes, so we know what has been hit" type="struct" required="No" > > > > default="#StructNew()#"> > > > > // ******** ADDED SKIP ARGUMENT ******** > > > > <cfargument name="skip" type="string" required="No"> > > > > > <cffunction name="visitTransfer" hint="visit a single object with the > > > > method that is provided" access="private" returntype="void" > > > > output="false"> > > > > <cfargument name="transfer" hint="the starting object to visit" > > > > type="transfer.com.TransferObject" required="Yes"> > > > > <cfargument name="visitor" hint="the visitor object" type="any" > > > > required="Yes"> > > > > <cfargument name="visitingMethod" hint="the name of the method > > that > > ... > > read more » --~--~---------~--~----~------------~-------~--~----~ Before posting questions to the group please read: http://groups.google.com/group/transfer-dev/web/how-to-ask-support-questions-on-transfer You received this message because you are subscribed to the Google Groups "transfer-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/transfer-dev?hl=en -~----------~----~----~----~------~----~------~--~---
