Advertisement
leticiaf

searchService

Aug 31st, 2015
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.26 KB | None | 0 0
  1. import IBusiness = require("../business/iBusiness");
  2. import IService = require("./iService");
  3. import $inject = require("../core/inject");
  4.  
  5. /**
  6. * Responsible for integrating the outside's requests for Buses with the business logics
  7. * @class SearchService
  8. */
  9. class SearchService implements IService {
  10.  
  11. public constructor(private context: IBusiness = $inject("business/searchBusiness")) {}
  12.  
  13. /**
  14. * Gets the Buses given a line or a list of, a bus order or a list of. If the search
  15. * params are not given, gets all buses latest data.
  16. *
  17. * @param {string} lines/orders
  18. * @return {Bus[]}
  19. */
  20. public retrieve(userAgent: string, line?: string): any {
  21. return (line!==undefined)? this.context.retrieve(userAgent, line.split(",")) : this.context.retrieve(userAgent);
  22. }
  23.  
  24. public processData(data: string): any{
  25. data.toLowerCase;
  26. switch(data){
  27. case "transcarioca":
  28. return ["301", "302"];
  29. break;
  30. default:
  31. return data.split(",");
  32. break;
  33. }
  34. }
  35.  
  36.  
  37. /**
  38. * Not implemented.
  39. * @return {void}
  40. */
  41. public delete(): any {}
  42.  
  43. /**
  44. * Not implemented.
  45. * @return {void}
  46. */
  47. public create(): any {}
  48.  
  49. /**
  50. * Not implemented.
  51. * @return {void}
  52. */
  53. public update(): any {}
  54. }
  55. export = SearchService;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement