Imported from dev1.link2tek.net CommEngine.git
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

86 рядки
1.8 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. *
  11. */
  12. static public enum JobStatus
  13. {
  14. READY(false),
  15. TRYING(false),
  16. GO_NEXT_PHONE(false),
  17. TRUNK_ERROR(false),
  18. LONG_DURATION(true),
  19. SUCCESS(true),
  20. NO_MORE_RETRY(true),
  21. RECIPIENT_ADDR_ERROR(true),
  22. SERVICE_PROVIDER_PROTOCOL_ERROR(true),
  23. SERVICE_PROVIDER_GENERATED_ERROR(true),
  24. SERVICE_PROVIDER_HTTP_ERROR(true),
  25. SERVICE_PROVIDER_CONNECT_ERROR(true),
  26. SERVICE_PROVIDER_OTHER_ERROR(true),
  27. CANCELED(true),
  28. EXPIRED(true),
  29. MESSAGE_ERROR(true),
  30. SERVICE_ACCESS_BLOCKED(true),
  31. PLATFORM_ERROR(true),
  32. FAILED(true), // for
  33. UNKNOWN_ERROR(true),
  34. ABORT(true);
  35. private boolean isTerminal;
  36. private JobStatus(boolean isTerminal)
  37. {
  38. this.isTerminal = isTerminal;
  39. }
  40. public boolean isTerminal()
  41. {
  42. return isTerminal;
  43. }
  44. }
  45. public Recipient recipient;
  46. public long startTime;
  47. public JobStatus jobStatus;
  48. public String errorText;
  49. public Job(Recipient recipient)
  50. {
  51. this.recipient = recipient;
  52. jobStatus = JobStatus.READY;
  53. }
  54. public void setStatus(JobStatus jobStatus)
  55. {
  56. this.jobStatus = jobStatus;
  57. }
  58. public void setStatus(JobStatus jobStatus, String errorText)
  59. {
  60. this.jobStatus = jobStatus;
  61. this.errorText = errorText;
  62. }
  63. /**
  64. *
  65. * @return error in text form.
  66. */
  67. public String getErrorText()
  68. {
  69. return errorText;
  70. }
  71. }