EventsController.java 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. package controllers;
  2. import play.mvc.*;
  3. import play.libs.Json;
  4. import views.html.*;
  5. import java.util.List;
  6. import java.util.LinkedList;
  7. import java.util.Date;
  8. import models.Event;
  9. /**
  10. * This controller contains an action to handle HTTP requests
  11. * to the application's home page.
  12. */
  13. public class EventsController extends Controller {
  14. public Result get()
  15. {
  16. List<Event> res = new LinkedList<>();
  17. Event tmp = new Event();
  18. tmp.eventId = 1;
  19. tmp.userId = 1;
  20. tmp.name = "Hello World!";
  21. tmp.time = new Date();
  22. tmp.foodType = "BBQ";
  23. tmp.description = "Free BBQ here!";
  24. tmp.lat = 0;
  25. tmp.lng = 0;
  26. res.add(tmp);
  27. tmp = new Event();
  28. tmp.eventId = 2;
  29. tmp.userId = 1;
  30. tmp.name = "Free Pizza Knight";
  31. tmp.time = new Date();
  32. tmp.foodType = "Pizza";
  33. tmp.description = "Board games and Pizza!";
  34. tmp.lat = 0;
  35. tmp.lng = 0;
  36. res.add(tmp);
  37. tmp = new Event();
  38. tmp.eventId = 3;
  39. tmp.userId = 2;
  40. tmp.name = "Some other Event";
  41. tmp.time = new Date();
  42. tmp.foodType = "Other";
  43. tmp.description = "Really long\nDescription\nWith\nLots\nof\nnew\nlines. " +
  44. "ThisIsAReallyUnrrealisticallyLongWordThatIAmUsingAsATestCase.";
  45. tmp.lat = 0;
  46. tmp.lng = 0;
  47. res.add(tmp);
  48. return ok(Json.toJson(res));
  49. }
  50. public Result create()
  51. {
  52. return notFound();
  53. }
  54. public Result update(long id)
  55. {
  56. return notFound();
  57. }
  58. public Result delete(long id)
  59. {
  60. return notFound();
  61. }
  62. }