You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

SchedulesDbo.java 1.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. package com.rthoni.stssaguenay.dbo;
  2. import com.luticate.utils.dbo.LuDbo;
  3. import com.luticate.utils.dbo.LuPaginatedDbo;
  4. import org.joda.time.LocalDateTime;
  5. import org.joda.time.LocalTime;
  6. import org.joda.time.format.DateTimeFormat;
  7. import org.joda.time.format.DateTimeFormatter;
  8. import org.json.JSONArray;
  9. import org.json.JSONException;
  10. import org.json.JSONObject;
  11. import java.util.HashMap;
  12. import java.util.List;
  13. import java.util.Vector;
  14. /**
  15. * Created by robin on 10/1/16.
  16. */
  17. public class SchedulesDbo extends LuDbo {
  18. public static class SchedulesDboArray extends LuPaginatedDbo<SchedulesDbo>
  19. {
  20. }
  21. protected String _stopId;
  22. protected String _routeId;
  23. protected List<LocalDateTime> _schedules;
  24. @Override
  25. public void fromJson(JSONObject json) throws JSONException {
  26. _stopId = json.getString("stopId");
  27. _routeId = json.getString("routeId");
  28. _schedules = new Vector<>();
  29. JSONArray schedules = json.getJSONArray("schedules");
  30. for (int i = 0; i < schedules.length(); ++i) {
  31. _schedules.add(LocalDateTime.parse(schedules.getString(i), DateTimeFormat.forPattern("y-M-d H:m:s")));
  32. }
  33. }
  34. @Override
  35. public HashMap<String, Object> toArray() {
  36. return null;
  37. }
  38. public String getStopId() {
  39. return _stopId;
  40. }
  41. public void setStopId(String stopId) {
  42. _stopId = stopId;
  43. }
  44. public String getRouteId() {
  45. return _routeId;
  46. }
  47. public void setRouteId(String routeId) {
  48. _routeId = routeId;
  49. }
  50. public List<LocalDateTime> getSchedules() {
  51. return _schedules;
  52. }
  53. public void setSchedules(List<LocalDateTime> schedules) {
  54. _schedules = schedules;
  55. }
  56. }