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: | holy...@gmail.com (holy...@gmail.com) |
| Date: | 04/10/2007 06:17:27 AM |
| List: | com.googlegroups.google-base-data-api |
Thanks Frank, It works, there other issue is iam using custom attributes to insert the item, how do i update custom attribute?
this is how i added custom attributes
aEntry.GBaseAttributes.AddTextAttribute("Prep Time", objRecpie.PrepTime); aEntry.GBaseAttributes.AddTextAttribute("Cook Time", objRecpie.CookTime);
now how do i access custom attributes while updating?
Here is my code in update
updateentry.Id = new AtomId("http://www.google.com/base/feeds/ items/1064982933877444444"); updateentry.Title.Text = "Test Updated"; updateentry.Content.Content = "Tes"; updateentry.GBaseAttributes.ItemType = "Recpies";
now how do i set the values in update for the above custom attributes
Thanks in advance Waiting for a quick response :) Holy Coding
On Apr 10, 2:12 pm, "Frank Mantek" <fman...@gmail.com> wrote:
You need to go to:
http://code.google.com/p/google-gdata/
follow the instructions on the source page, and use the 1.0.9.5 dlls there. Note that those are test DLLs and have not yet been released.
Frank Mantek Google
On 4/9/07, holy...@gmail.com <holy...@gmail.com> wrote:
iam into same problem updating item, iam storing uri in database and later want to update it, iam getting the read only exception, i have gone thorugh the discussion above, are you guys making change to .cs provided by google and recompiling it, i have recompiled the sample app and used it, but same error, please help me
Here is my code
string Username = "xyz"; string Password = "xyz"; string developerkey = "asdfadsfasdfsfadf";
GBaseService Service = new GBaseService("Myxyz", developerkey); Service.setUserCredentials(Username, Password);
Google.GData.Client.GDataRequestFactory oRF; oRF = (Google.GData.Client.GDataRequestFactory)Service.RequestFactory; oRF.KeepAlive = false;
GBaseEntry updateentry = new GBaseEntry();
updateentry.Id = new AtomId("http://www.google.com/base/feeds/ items/234324234234744444"); updateentry.Title.Text = "Test Update"; updateentry.Content.Content = "asf"; updateentry.GBaseAttributes.ItemType = "79"; updateentry.GBaseAttributes.Location = " Kentucky"; updateentry.EditUri = new AtomUri("http://www.google.com/base/ feeds/items/234324234234744444"); updateentry.SelfUri = new AtomUri("http://www.google.com/base/ feeds/items/234324234234744444"); Service.Update(updateentry);
========================================
On Mar 14, 8:31 pm, "iqzone" <4iqz...@gmail.com> wrote:
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, andcanguarantee 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:
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 theReadOnlyproperty of an AtomEntry ( atomfeedentry.cs in /core):
//////////////////////////////////////////////////////////////////////
/// <summary>returns whether ornottheentryisread-only </summary>
//////////////////////////////////////////////////////////////////////
public boolReadOnly { 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, "entryshouldnotbe null"); if (entry.ReadOnly== true) { throw new GDataRequestException("Cannotupdatea read-onlyentry"); }
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'snotset...
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 doesnotset 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 youcanverify this, i would be grateful. As ican'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, theRead-onlyproperty of the updatedEntry is true, and I suspect this is why the assignments never work. I found no way to change theRead-onlyproperty 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.Canyou send me a sample of code that did try that
and
didnot
work? So that icandebug 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 generatedentry. I attempted to do this by assigning the values directly from a retrievedentry(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 existingentryfrom the feed, generating a freshentry, 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 isnot. 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:
Entrye = newEntry(); e.setSomeProperties() ......
...
read more »




