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();
 }
Beispiel #3
0
 @POST
 @Path("/findVine")
 @Consumes(MediaType.APPLICATION_JSON)
 @Produces(MediaType.APPLICATION_JSON)
 public Vine findVineFromImage(InputStream uploadedInputStream) {
   try {
     return serviceVineDescribed.findVineFromImage(ImageIO.read(uploadedInputStream));
   } catch (IOException e) {
     e.printStackTrace();
     return null;
   }
 }