My favorites | Sign in
Google
                
New issue | Search
for
| Advanced search | Search tips
Issue 282: AtomCategoryCollection Remove method is not working properly
1 person starred this issue and may be notified of changes. Back to list
Status:  Fixed
Owner:  fmantek
Closed:  Nov 23


Sign in to add a comment
 
Reported by ATGard...@gmail.com, Nov 12, 2009
I am using the Google Documents List Data API 3.0 for .net (documents3 
project)

What steps will reproduce the problem?
1. Create a new document with the web browser.
2. Star the document.
3. Read the document using a DocumentsListQuery on the title (For example)
4. Check the document.DocumentEntry.IsStarred - it should be "true"
5. Put "false" to try to remove the star
6. The star category is not removed from the DocumentEntry.

Please provide any additional information below.
The problem is that the "IsStarred" property is using the "public static 
AtomCategory STARRED_CATEGORY" object created earlier, which is not 
necessarily equal the category inside the collection. In the "Contains" and 
"Find" methods you managed to get over this problem by comparing the 
"scheme" and "term" of the AtomCategory, not using reference "Equals". The 
"Remove" method is not overloaded.
I think an overall better approach would be to override the "Equals" method 
of the AtomCategory class, so it will only check for the "scheme" and 
"term" in the first place. This way the "Contains" and "Find" method need 
not to be overridden, and the "Remove" will just work.
I can easily send in a patch for this, if you'd like.
Comment 1 by fmantek, Nov 16, 2009
I love user contributions. Please do :)

Frank
Status: Reviewed
Comment 2 by ATGard...@gmail.com, Nov 16, 2009
With pleasure. I'll get to it later today or tomorrow.
Comment 3 by ATGard...@gmail.com, Nov 16, 2009
I just made AtomCategory into an IEquatable<AtomCategory>
The Equals method checks that both categories have the same term, and the same scheme 
(unless either one has null, in which case the scheme is ignored).

I also changed the documententry file, so that the public static categories will 
include the labels as well. I noticed that when adding such a category without the 
label, after update to GD, the category is missing.
Please make sure the labels I've added there are all correct.
GD patch.patch
6.6 KB   Download
Comment 4 by fmantek, Nov 23, 2009
Thanks for the patch, checked in today.

Frank
Status: Fixed
Owner: fmantek
Sign in to add a comment