16 messages in com.googlegroups.google-base-data-apiRe: Problem with Read-only property o...| From | Sent On | Attachments |
|---|---|---|
| iqzone | 10 Mar 2007 01:11 | |
| Frank Mantek | 12 Mar 2007 04:45 | |
| iqzone | 12 Mar 2007 13:47 | |
| iqzone | 12 Mar 2007 23:45 | |
| Frank Mantek | 13 Mar 2007 01:00 | |
| mont...@gmail.com | 13 Mar 2007 22:27 | |
| mont...@gmail.com | 13 Mar 2007 22:34 | |
| iqzone | 14 Mar 2007 00:30 | |
| Frank Mantek | 14 Mar 2007 02:13 | |
| Frank Mantek | 14 Mar 2007 02:19 | |
| iqzone | 14 Mar 2007 08:31 | |
| Frank Mantek | 14 Mar 2007 08:56 | |
| mont...@gmail.com | 14 Mar 2007 20:02 | |
| holy...@gmail.com | 09 Apr 2007 06:41 | |
| Frank Mantek | 10 Apr 2007 02:12 | |
| holy...@gmail.com | 10 Apr 2007 06:17 |
| Subject: | Re: Problem with Read-only property of GBaseEntry![]() |
|---|---|
| From: | iqzone (4iqz...@gmail.com) |
| Date: | 03/14/2007 08:31:05 AM |
| List: | com.googlegroups.google-base-data-api |
I've been using the precompiled assemblies, but may be able/have the time to do a recompile later today. If you would post the DLLs, I'd greatly appreciate it, and can guarantee that I'll test today.
Either way, I'll post results here once I have them.
Thank you very much for attending to this.
Matthew A. Feadler Datafeeds Director iqzone.com
On Mar 14, 5:19 am, "Frank Mantek" <fman...@gmail.com> wrote:
The code is checked in. Sync the code according to:
http://code.google.com/p/google-gdata/source
Or just use the browser and get "atomfeedentry.cs" in the src/core directory.
If you are unable to build DLLs yourself, let me know and i submit some.
And thanks again for helping to find and fix this issue
Frank Mantek Google
On 3/14/07, Frank Mantek <fman...@gmail.com> wrote:
Ok.. it's time to really understand this...
when you look at the code for the ReadOnly property of an AtomEntry ( atomfeedentry.cs in /core):
////////////////////////////////////////////////////////////////////// /// <summary>returns whether or not the entry is read-only </summary>
////////////////////////////////////////////////////////////////////// public bool ReadOnly { get { return this.EditUri == null ? true : false; } }
/////////////////////////////////////////////////////////////////////////////
so, all this is checking is: is an EditUri set.
In service.Update (service.cs, same directory):
Tracing.Assert(entry != null, "entry should not be null"); if (entry.ReadOnly == true) { throw new GDataRequestException("Can not update a read-only entry"); }
which seems to be the exception that you are both observing. So, the problem seems to be that although you are setting the EditUri, you are later be told it's not set...
So i am looking at the code in more detail, and i think i found the issue...
When you look at the EditUri property...
////////////////////////////////////////////////////////////////////// /// <summary>accessor method public Uri EditUri</summary> /// <returns> </returns>
////////////////////////////////////////////////////////////////////// public AtomUri EditUri { get { AtomLink link = this.Links.FindService ( BaseNameTable.ServiceEdit, AtomLink.ATOM_TYPE); // scan the link collection return link == null ? null : link.HRef; } set { AtomLink link = this.Links.FindService( BaseNameTable.ServiceEdit, AtomLink.ATOM_TYPE); if (link == null) { link = new AtomLink(); link.Rel = BaseNameTable.ServiceEdit ; this.Links.Add(link); } link.HRef = value; } }
/////////////////////////////////////////////////////////////////////////////
When this property is set, what happens is that we create a new AtomLink object, set it's HRef value and add it to the collection of links.. But, the curious observer wonders.. what is that AtomLink.ATOM_TYPE doing? It tells the link collection, when called in FindService, to find links of a special type, the default atom links. Now a new AtomLink(), like we create in the set method, has the following constructor:
////////////////////////////////////////////////////////////////////// /// <summary>default empty constructor</summary>
////////////////////////////////////////////////////////////////////// public AtomLink() { }
/////////////////////////////////////////////////////////////////////////////
which does not set a type. Hence, this will never be found by the getter..
Are you both able to build the GData libraries? I am going to check a fix for this in (in the next 10minutes), and if you can verify this, i would be grateful. As i can't change the default (the empty constructor), i am going to change the code in editUri/selfuri.
Tx
Frank Mantek Google On 3/14/07, iqzone <4iqz...@gmail.com> wrote:
Unfortunately, I consigned that code to the bit-bucket when it proved unworkable.
Essentially, it was:
/* create GBaseService as service */
GBaseEntry retrievedEntry = service.GetEntry(uri);
/* Custom GenerateEntry method which gives me a GBaseEntry as updatedEntry -- n.b., this code works fine for Inserts*/
updatedEntry.EditUri = retrievedEntry.EditUri; updatedEntry.SelfUri = retrievedEntry.EditUri ;
/* etc, etc */
service.Update(updatedEntry);
Again, I attempted regenerating the URIs in various ways, in addition to doing direct assignments like the above. Throughout, from the moment of generation, the Read-only property of the updatedEntry is true, and I suspect this is why the assignments never work. I found no way to change the Read-only property to false. Debugging showed all the members of the retrievedEntry populated correctly at each stage.
Matthew A. Feadler Datafeeds Director iqzone.com
On Mar 13, 1:00 am, "Frank Mantek" <fman...@gmail.com> wrote:
that's weird. Can you send me a sample of code that did try that and did not work? So that i can debug the scenario and fix whatever issues might exist on the .NET side..
Frank Mantek Google
On 3/13/07, iqzone <4iqz...@gmail.com> wrote:
Unfortunately, I had no luck going that route.
I was unable to populate any of the Base, Edit, or Self URIs on a freshly generated entry. I attempted to do this by assigning the values directly from a retrieved entry (i.e., freshEntry.base = retrievedEntry.Base, etc.), and I also tried generating the URIs manually in various ways and assigning the generated values. The assignment code threw no errors, but the freshEntry values did change from null.
I've resorted to simply deleting the existing entry from the feed, generating a fresh entry, and inserting it. Doesn't seem like the most elegant solution, but it works for now.
Matthew A. Feadler Datafeeds Director iqzone.com
On Mar 12, 1:48 pm, "iqzone" <4iqz...@gmail.com> wrote:
Hmm...you may be on to something here. The self.URI is populated by the generator, but I expect the EditUri is not. I'll modify my code and report back.
Matthew A. Feadler Datafeeds Director iqzone.com
On Mar 12, 4:46 am, "Frank Mantek" <fman...@gmail.com> wrote:
If i understand this correctly, your code roughly looks like
this:
Entry e = new Entry(); e.setSomeProperties() ...... e.update() or service.update(e) ?
If so, that can only work if you are setting the edit URI atom.linkproperty on the entry as well. That would be the e.EditUri property, and it needs to get set to
the
EditUri
of the original entry, otherwise this won't work at all. I guess you probably have to set the self.URI as well...
Frank Mantek Google- Hide quoted text -
- Show quoted text -




