Beispiel #1
0
 @GET
 @Path("/vinesDescribed")
 @Produces(MediaType.APPLICATION_JSON)
 public List<Vine> getAllVineDescribed() {
   logger.info("ServiceVineDescribed contains " + serviceVineDescribed.getSize() + " units.");
   List<VineDescribed> vinesDescribed = serviceVineDescribed.getVineDescribeds();
   List<Vine> vines = new ArrayList<Vine>();
   if (vinesDescribed == null) {
     return null;
   }
   for (int i = 0; i < vinesDescribed.size(); i++) {
     vines.add(vinesDescribed.get(i).getVine());
   }
   return vines;
 }
Beispiel #2
0
 @GET
 @Path("/process")
 @Produces(MediaType.APPLICATION_JSON)
 public List<Descriptor> processAllVines() {
   List<Vine> vines = vineRepository.findAllNotDescribedOrderedById();
   for (int i = 0; i < vines.size(); i++) {
     try {
       Descriptor descriptor = new Descriptor(vines.get(i));
       serviceDescriptor.save(descriptor);
       serviceVineDescribed.addVineDescribed(new VineDescribed(descriptor));
       logger.info("ServiceVineDescribed contains " + serviceVineDescribed.getSize() + " units.");
     } catch (Exception e) {
       e.printStackTrace();
     }
   }
   return descriptorRepository.findAllOrderedByVineID();
 }