Example #1
0
 @GET
 @Path("/actors/delete")
 @Produces(MediaType.TEXT_PLAIN)
 public String getActorsToDelete() throws UnknownHostException {
   ArrayList<BasicDBObject> albdbo = ActorsDAO.findActors(100);
   return albdbo.toString();
 }
Example #2
0
  @GET
  @Path("/actors/sort")
  @Produces(MediaType.TEXT_PLAIN)
  public String sortActorsByDate() throws UnknownHostException {
    ArrayList<DBObject> albdbo = ActorsDAO.sortByYear(100);

    return albdbo.toString();
  }
Example #3
0
  @GET
  @Path("/actors")
  @Produces(MediaType.TEXT_PLAIN)
  public String getAllActors() {

    ArrayList<BasicDBObject> albdbo = ActorsDAO.findActors(100);
    return albdbo.toString();
  }
Example #4
0
 @DELETE
 @Path("/actors/delete/{_id}")
 public int deleteActor(@PathParam("_id") int id) {
   try {
     ActorsDAO.deleteActor(id);
   } catch (UnknownHostException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   }
   return id;
 }
Example #5
0
 @POST
 @Path("/actors/edit/updateActor")
 @Produces(MediaType.TEXT_PLAIN)
 public String updateActor(String msg) {
   ArrayList<BasicDBObject> albdbo;
   String[] parts = msg.split("&");
   String[] part1 = parts[0].split("=");
   String[] part2 = parts[1].split("=");
   String[] part3 = parts[2].split("=");
   String id = part1[1].replaceAll("\\+", " ");
   String name = part2[1].replaceAll("\\+", " ");
   String description = part3[1].replaceAll("\\+", ".");
   int id1 = Integer.parseInt(id);
   try {
     ActorsDAO.updateActor(id1, name, description);
   } catch (UnknownHostException e) {
     e.printStackTrace();
   } catch (ParseException e) {
     e.printStackTrace();
   }
   albdbo = ActorsDAO.findActors(100);
   return albdbo.toString();
 }
Example #6
0
 @POST
 @Path("/actors/addActor")
 @Consumes(MediaType.APPLICATION_XML)
 // @Produces(MediaType.TEXT_PLAIN)
 public Response postStrMsg(String msg) throws UnknownHostException {
   System.out.println(msg);
   String[] parts = msg.split("&");
   String[] part1 = parts[0].split("=");
   String[] part2 = parts[1].split("=");
   String[] part3 = parts[2].split("=");
   String name = part1[1].replaceAll("\\+", " ");
   String description = part2[1].replaceAll("\\+", " ");
   String birthDate = part3[1].replaceAll("\\+", ".");
   try {
     ActorsDAO.addActor(name, description, birthDate);
   } catch (ParseException e) {
     // TODO Auto-generated catch block
     System.out.println("Something went terribly wrong!");
     e.printStackTrace();
   }
   return Response.status(201).build();
 }