[英]How to retrieve data from the datastore on Android device, using Google App Engine with Cloud Endpoints?
I am building an Android Application using Google App Engine with Cloud Endpoints. 我正在使用带有云端点的Google App Engine构建Android应用程序。 I carefully followed this tutorial ( https://developers.google.com/eclipse/docs/endpoints-addentities ), thus I managed to successfully perform insert operation in the datastore.
我仔细地遵循了本教程( https://developers.google.com/eclipse/docs/endpoints-addentities ),因此我成功地在数据存储区中执行了插入操作。 Furthermore, because I am facing the fuzziness of the beginner with respect to everything, I received a really good advice(that helped me to organize the information in my head, and then my code) in the following manner(I have inserted also the explanations):
此外,因为我面对初学者关于一切的模糊性,我收到了一个非常好的建议(这帮助我按照以下方式组织了我的头脑中的信息,然后我的代码)(我已经插入了解释):
JPA entity (POJO with getters and setters and JPA annotations only) => I have this, is a class called Note (I have the corresponding setters and getters) (it's stored in the myapp-AppEngine (server side). JPA实体(POJO只有getter和setter以及JPA注释)=>我有这个,是一个名为Note的类(我有相应的setter和getters)(它存储在myapp-AppEngine(服务器端))。
Data access layer: This is a class with methods to perform queries on your JPA POJO (using EntityManagerFactory). 数据访问层:这是一个具有在JPA POJO上执行查询的方法的类(使用EntityManagerFactory)。 => I assume it's the automatically generated class after I did Note >> Google >> Generate Cloud Endpoint Class.
=>我认为这是我做过注释>> Google >> Generate Cloud Endpoint Class后自动生成的类。 The obtained class is one the has Create,Read,Update,Delete operations.
获得的类是具有创建,读取,更新,删除操作的类。 (I assume this one is the data acces layer ? - correct me if I am wrong, please).
(我假设这个是数据访问层? - 请纠正我,如果我错了,请)。
Business layer: This is a class where I should manipulate the data I receive, then pass the result to the data access layer. 业务层:这是一个我应该操纵我收到的数据的类,然后将结果传递给数据访问层。 => This is where it's a little bit unclear, because I am not sure how I should proceed.
=>这是有点不清楚的地方,因为我不确定我该怎么办。 I should consider Business Layer as an intermediate class, where I manipulate the data, so that I do not access the methods from the Data Access layer directly from the Client-side (Android-side) of my application?
我应该将Business Layer视为一个中间类,我操作数据,以便我不直接从我的应用程序的客户端(Android端)访问数据访问层中的方法?
Or, is there any other way I could retrieve data from my datastore? 或者,还有其他方法可以从我的数据存储中检索数据吗? Even if, I consider really useful this way of organizing my code, clear, and somehow natural.
即使,我认为这种组织代码的方式非常有用,清晰,并且有些自然。 If anyone could indicate me how I can do this, I'd really appreciate it.
如果有人能告诉我如何做到这一点,我真的很感激。
Thank you. 谢谢。
@Cropcircles , you can refer the following docs and sample code provided by google : @Cropcircles,您可以参考以下docs和google提供的示例代码:
1, Sample code for design of app engine backend in java using google cloud endpoints 1,使用谷歌云端点设计java引擎后端的示例代码
2, Guidelines and sample code for consuming the endpoints, that is accessing data from datastore, in an android client 2,在Android客户端中使用端点(即从数据存储区访问数据)的准则和示例代码
3, You can find the guidelines also for consuming endpoints in IOS and JavaScript clients. 3,您还可以在IOS和JavaScript客户端中找到用于使用端点的准则。 Samplecode for IOS
IOS的示例代码
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.