Imported from dev1.link2tek.net CommEngine.git
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.

97 lines
2.7 KiB

  1. package altk.comm.engine;
  2. /**
  3. * Derived classes may add more class attributes, e.g. list of phone numbers, call status.
  4. * @author Yuk-Ming
  5. *
  6. */
  7. public class Job
  8. {
  9. /**
  10. * Because enum has no inheritance, JobStatus is the union of
  11. * all possible job status from all backend engines built on CommEngine.
  12. */
  13. static public enum JobStatus
  14. {
  15. // TODO: Some of them, like CANCELED and EXPIRED, should not be used, and should be cleaned out.
  16. TRYING(false), // VoiceEngine
  17. GO_NEXT_PHONE(false), // VoiceEngine
  18. //TRUNK_ERROR(false),
  19. LONG_DURATION(true), // VoiceEngine
  20. SUCCESS(true),
  21. NO_MORE_RETRY(true), // VoiceEngine
  22. ADDRESS_ERROR(true), // All
  23. SERVICE_PROVIDER_PROTOCOL_ERROR(true), // SMS
  24. SERVICE_PROVIDER_GENERATED_ERROR(true), // SMS
  25. SERVICE_PROVIDER_HTTP_ERROR(true), // SMS
  26. SERVICE_PROVIDER_CONNECT_ERROR(true), // SMS
  27. FORBIDDEN(true), // SMS - HTTP 403
  28. SPAM(true), // SMS
  29. SERVICE_PROVIDER_OTHER_ERROR(true), // Email
  30. CANCELED(true), // Voice - is it really?
  31. EXPIRED(true), // Voice - is it really?
  32. MESSAGE_ERROR(true), // Email, SMS
  33. NOT_FOUND(true), // SMS
  34. INVALID_MEDIA_TYPE(true), // MMS
  35. SERVICE_ACCESS_BLOCKED(true), // SMS
  36. PLATFORM_ERROR(true), // SMS
  37. FAILED(true), // SMS
  38. UNKNOWN_ERROR(true), // SMS
  39. NOT_AUTHORIZED(true), // SMS
  40. BAD_REQUEST(true), // SMS
  41. THROTTLE_LIMIT_REACHED(true), // SMS
  42. UNPROCESSABLE_ENTITY(true), // SMS
  43. PAYMENT_REQUIRED(true) ,
  44. ABORT(true),
  45. ;
  46. private boolean isTerminal;
  47. private JobStatus(boolean isTerminal)
  48. {
  49. this.isTerminal = isTerminal;
  50. }
  51. public boolean isTerminal()
  52. {
  53. return isTerminal;
  54. }
  55. }
  56. public Recipient recipient;
  57. public long startTime;
  58. public JobStatus jobStatus;
  59. public String errorText;
  60. public Job(Recipient recipient)
  61. {
  62. this.recipient = recipient;
  63. jobStatus = null;
  64. }
  65. public void setStatus(JobStatus jobStatus)
  66. {
  67. this.jobStatus = jobStatus;
  68. }
  69. public void setStatus(JobStatus jobStatus, String errorText)
  70. {
  71. this.jobStatus = jobStatus;
  72. this.errorText = errorText;
  73. }
  74. /**
  75. *
  76. * @return error in text form.
  77. */
  78. public String getErrorText()
  79. {
  80. return errorText;
  81. }
  82. }