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.

UserFavouriteStopsDbo.java 1.9KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. package com.rthoni.stssaguenay.dbo;
  2. import com.luticate.utils.dbo.LuDbo;
  3. import org.json.JSONArray;
  4. import org.json.JSONException;
  5. import org.json.JSONObject;
  6. import java.util.HashMap;
  7. import java.util.List;
  8. import java.util.Vector;
  9. /**
  10. * Created by robin on 10/1/16.
  11. */
  12. public class UserFavouriteStopsDbo extends LuDbo {
  13. protected StopsDbo _stop;
  14. protected List<RoutesDbo> _routes;
  15. protected String _name;
  16. // @Override
  17. // public void fromJson(JSONObject json) throws JSONException {
  18. // _stop = new StopsDbo();
  19. // _stop.fromJson(json.getJSONObject("stop"));
  20. // _routes = new Vector<>();
  21. // JSONArray routes = json.getJSONArray("routes");
  22. // for (int i = 0; i < routes.length(); ++i) {
  23. // RoutesDbo route = new RoutesDbo();
  24. // route.fromJson(routes.getJSONObject(i));
  25. // _routes.add(route);
  26. // }
  27. // _name = json.getString("name");
  28. // }
  29. //
  30. // @Override
  31. // public HashMap<String, Object> toArray() {
  32. // HashMap<String, Object> map = new HashMap<>();
  33. // map.put("stop", _stop.toArray());
  34. // List<Object> routes = new Vector<>();
  35. // for (RoutesDbo route : _routes) {
  36. // routes.add(route.toArray());
  37. // }
  38. // map.put("routes", routes);
  39. // map.put("name", _name);
  40. // return map;
  41. // }
  42. public StopsDbo getStop() {
  43. return _stop;
  44. }
  45. public void setStop(StopsDbo stop) {
  46. _stop = stop;
  47. }
  48. public List<RoutesDbo> getRoutes() {
  49. return _routes;
  50. }
  51. public void setRoutes(List<RoutesDbo> routes) {
  52. _routes = routes;
  53. }
  54. public String getName() {
  55. return _name;
  56. }
  57. public void setName(String name) {
  58. _name = name;
  59. }
  60. public String getCustomName()
  61. {
  62. if (_name != null && !_name.isEmpty()) {
  63. return _name;
  64. }
  65. return _stop.getName();
  66. }
  67. }