java - No output from Google Endpoints API -
i trying retrieve entities called 'blayer' stored in datastore. running ok without error, not returning anything. @ end of road here. since part of backend, can't stepwise debug either. here endpoints code:
@apimethod(name = "getblayers") public arraylist<arraylist<blayer>> getblayers(@named ("bnames") arraylist<string> bnames) { asyncdatastoreservice datastoreservice = datastoreservicefactory.getasyncdatastoreservice(); key blayerparentkey = keyfactory.createkey("tour",tour_name); arraylist<blayer> blayers = new arraylist<blayer>(); arraylist<arraylist<blayer>> blayersgamelist = new arraylist<arraylist<blayer>>(); arraylist<list<entity>> resultsall=new arraylist<>(); arraylist<string> realnames = new arraylist<string>(arrays.aslist(bnames.get(0).split(","))); if(bnames.size()==1){ bnames=realnames; } future<transaction> transactionfuture=datastoreservice.begintransaction(); int i=0; (string bname :bnames) { query query = new query("blayer", blayerparentkey); query.filter propertyfilter = new query.filterpredicate("bname", query.filteroperator.equal, bname.touppercase()); query.setfilter(propertyfilter); //query.addsort("matchtime", query.sortdirection.descending); resultsall.add(i, datastoreservice.prepare(query).aslist(fetchoptions.builder.withdefaults())); i++; } try{ transactionfuture.get().commit(); }catch (interruptedexception|executionexception e){ blayer blayer = new blayer(); blayer.setbname(bnames.get(0)); blayer.setgameid(0); blayer.setblayerscore(0); blayer.sethisteam(""); blayer.setagainstteam(e.getmessage()); blayers.add(blayer); return blayersgamelist; } i=0; (string bname : bnames){ list<entity> results=resultsall.get(i); if (!resultsall.get(i).isempty()) { (entity result : results) { blayer blayer = new blayer(); blayer.setbname(result.getproperty("bname").tostring()); blayer.setgameid((long) result.getproperty("gameid")); blayer.setblayerscore((long) result.getproperty("blayerscore")); blayer.sethisteam((string) result.getproperty("histeam")); blayer.setagainstteam((string) result.getproperty("againstteam")); blayer.setmatchtime((date) result.getproperty("matchtime")); blayers.add(blayer); } } else { blayer blayer = new blayer(); blayer.setbname(bname); blayer.setgameid(realnames.size()); blayer.setblayerscore(bnames.size()); blayer.sethisteam(bnames.get(0)+";;; "+blayersgamelist.size()+",,,"+blayers.size()); blayer.setagainstteam("no match played"); blayers.add(blayer); } blayersgamelist.add(i,blayers); blayers.clear(); i++; } return blayersgamelist; }
Comments
Post a Comment