I tried a thousand things. At the moment, the only way for me to ask for something is to get the whole list and view it this way! which takes a lot of time. How can I request something in the Google engine, for example, to pull out only objects that have> 100 votes, for example.
Tried a custom cursor but not sure how it works. I know that he can use the cursor, but how to configure it using the Google App Engine, since my database is not in my application for the message?
Ive tried ... but this dose does not work at all.
Cursor cursor = ("select * from Votes WHERE Votes >" + 250 , null); quotes endpoint.listquotes().setCursor(cursor).execute();
and
String query = ("select * from Votes WHERE Votes >= 40"); quotes endpoint.listquotes().setCursor(query).execute();
Im following the tic-tac-toe example https://github.com/GoogleCloudPlatform/appengine-endpoints-tictactoe-java and https://developers.google.com/eclipse/docs/endpoints-addentities In this example, I just switched quotation marks.
Here is my current code, for example, on how im gets objects.
protected CollectionResponseQuotes doInBackground(Context... contexts) { Quotesendpoint.Builder endpointBuilder = new Quotesendpoint.Builder( AndroidHttp.newCompatibleTransport(), new JacksonFactory(), new HttpRequestInitializer() { public void initialize(HttpRequest httpRequest) { } }); Quotesendpoint endpoint = CloudEndpointUtils.updateBuilder( endpointBuilder).build(); try { quotes = endpoint.listquotes().execute(); for (Quotes quote : quotes.getItems()) { if (quote.getVotes() > 3) { quoteList.add(quote); } }
Here is the code that Google created in the app for me when I created the endpoint. He seems to be asking, but I can't figure it out. These are two different projects.
@Api(name = "quotesendpoint", namespace = @ApiNamespace(ownerDomain = "projectquotes.com" ownerName = "projectquotes.com", packagePath = "")) public class quotesEndpoint { @SuppressWarnings({ "unchecked", "unused" }) @ApiMethod(name = "listquotes") public CollectionResponse<quotes> listquotes( @Nullable @Named("cursor") String cursorString, @Nullable @Named("limit") Integer limit) { EntityManager mgr = null; Cursor cursor = null; List<quotes> execute = null; try { mgr = getEntityManager(); Query query = mgr.createQuery("select from quotes as quotes"); if (cursorString != null && cursorString != "") { cursor = Cursor.fromWebSafeString(cursorString); query.setHint(JPACursorHelper.CURSOR_HINT, cursor); } if (limit != null) { query.setFirstResult(0); query.setMaxResults(limit); } execute = (List<quotes>) query.getResultList(); cursor = JPACursorHelper.getCursor(execute); if (cursor != null) cursorString = cursor.toWebSafeString();