SilverHoodCorp / gdata-java-client

Automatically exported from code.google.com/p/gdata-java-client
Apache License 2.0
0 stars 0 forks source link

Get the base ID for entries? #209

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I've discovered that most operations require an ID to reference other
entries. For instance when referencing a calendar event to cancel a
particular entry of a recurring event one needs the ID of the original
event to put into the OriginalEvent object. However the return value of
CalendarEventEntry.getId() is not the correct value to use. What I must do
is to search for the last occurrence of '/' and take everything after that
and use that string as the ID. Am I missing some method here that should be
used to get the base ID of an entry to be used for this?

Original issue reported on code.google.com by jpsch...@gmail.com on 17 Nov 2009 at 2:53

GoogleCodeExporter commented 9 years ago
Most of the API code is auto-generated from the schema.  So its possible that 
some of 
the navigations are little harder to do., and requires extra massaging at 
user's end.  If 
there is a specific convenience method you would like to add to a specific 
feed/entry 
class, please send in a patch.  Will include it in next release.

Thanks.

Original comment by vbarat...@gmail.com on 7 Dec 2009 at 5:29

GoogleCodeExporter commented 9 years ago
The method would be to get the ID that is required for the other methods. This 
should
be in all APIs, I work with the python API as well and have the same issue. 
Generally
I treat IDs as opaque objects that should not be taken apart. In this case I 
need to
take it apart and do string manipulation on it. This sounds really dangerous. Is
there better way to do this?

Original comment by jpsch...@gmail.com on 7 Dec 2009 at 3:48

GoogleCodeExporter commented 9 years ago
I understand the frustration.  Unfortunately the ID part is not consistent 
across all 
APIs.  Some APIs need absolute URI, and some just the uuid part.  The correct 
approach would be to add a convenience layer on top of the existing model.  
Unfortunately because of lack of resources, this has not been done.

Having said that, the best solution would be to expose data in a format thats 
natural 
to the target language (jsonc in javascript, java object (JSONObject or java 
bean), 
element tree in python) and make it really easy to access the data.  This is a 
fundamental problem in the current object model used in this java client 
library.  We 
are working on simplifying this.

Short answer: There is no one-line fix for this, as the uri template is not 
constant 
across APIs to generalize this helper to extract ID.  This need to be a design 
change 
on how we address related resources in a simplified way.  This may change in 
future.

Original comment by vbarat...@gmail.com on 7 Dec 2009 at 4:01