Update - we implemented a "diff" algorithm, and only post operations to 
mutate() if we absolutely have to.  This bypasses the problem.  Therefore 
this issue is not of critical importance to us anymore.

For more details...

To recap the problem - if you REMOVE a target and then ADD it again shortly 
afterwards, the ADD is ignored and never appears in the campaign.

The solution is to implement a "diff" algorithm so the mutate() operations 
only reflect true changes.  In other words, don't remove a Language=US if 
you are just going to add it back again.

My first implementation of this tried to rely on the underlying Criterion 
objects themselves, hoping that their equals() and hashCode() 
implementations would find matches for me.  Unfortunately this wasn't the 
case, because those objects are usually not fully defined.  For example 
there are many fields which the documentation says are "read only" and 
ignored for ADD operations.  Therefore we don't bother setting those when 
we create our desired list.  Also, when we request the data from Google, we 
don't necessarily select every single field, so some objects might be 
missing some data.

Instead, I made a little adapter which builds a "key" that uniquely 
identifies the criterion, only paying attention to the fields that matter 
to our application.  Then we perform our diff using those keys.

After that I discovered that a lot of the objects were missing important 
fields, so we had to add some more fields to our Selector.

In the end this fixes it.  The moral is - only mutate() stuff that you 
truly want to change.

Jim

-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
http://adwordsapi.blogspot.com
http://groups.google.com/group/adwords-api
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API Forum" group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en

Reply via email to