Reputation: 317
I am building an Android Application using Google App Engine with Cloud Endpoints. I carefully followed this tutorial (https://developers.google.com/eclipse/docs/endpoints-addentities), thus I managed to successfully perform insert operation in the datastore. 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).
Data access layer: This is a class with methods to perform queries on your JPA POJO (using EntityManagerFactory). => I assume it's the automatically generated class after I did Note >> 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?
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.
Upvotes: 1
Views: 3031
Reputation: 4789
@Cropcircles , you can refer the following docs and sample code provided by google :
1, Sample code for design of app engine backend in java using google cloud endpoints
2, Guidelines and sample code for consuming the endpoints, that is accessing data from datastore, in an android client
3, You can find the guidelines also for consuming endpoints in IOS and JavaScript clients. Samplecode for IOS
Upvotes: 3