Пример #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;
 }
Пример #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();
 }
Пример #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;
   }
 }