Esempio n. 1
0
 @Override
 public List<EprSpectrModel> getAllEprSpectrs() {
   ArrayList<EprSpectrModel> listRet = new ArrayList<EprSpectrModel>();
   DatastoreService datastoreService = DatastoreServiceFactory.getDatastoreService();
   Query query = new Query(locMain + EprSpectrModel.class.getSimpleName());
   for (Entity esrSpecEntity : datastoreService.prepare(query).asIterable()) {
     EprSpectr anek = new EprSpectr(esrSpecEntity);
     EprSpectrModel anekModel = anek.getEprSpectrModel();
     listRet.add(anekModel);
   }
   return listRet;
 }
Esempio n. 2
0
 @Override
 public List<EprSpectrModel> getEprSpectrs(QueryEsrSpectrModel q) {
   ArrayList<EprSpectrModel> vRet = new ArrayList<EprSpectrModel>();
   DatastoreService datastoreService = DatastoreServiceFactory.getDatastoreService();
   Query query = new Query(q.loc + EprSpectrModel.class.getSimpleName());
   // if (q.bDate) {
   if (q.bAsc) {
     query = query.addSort(EprSpectr.DATE, Query.SortDirection.ASCENDING);
   } else {
     query = query.addSort(EprSpectr.DATE, Query.SortDirection.DESCENDING);
   }
   int count = q.skip + 1;
   for (Entity esrSpecEntity :
       datastoreService
           .prepare(query)
           .asIterable(FetchOptions.Builder.withLimit(q.limit).offset(q.skip))) {
     EprSpectr anek = new EprSpectr(esrSpecEntity);
     EprSpectrModel anekModel = anek.getEprSpectrModel();
     // anekModel.num = count++;
     vRet.add(anekModel);
   }
   // }
   return vRet;
 }