|
- package altk.comm.engine;
-
- /**
- * Derived classes may add more class attributes, e.g. list of phone numbers, call status.
- * @author Yuk-Ming
- *
- */
- public class Job
- {
- /**
- * Because enum has no inheritance, JobStatus is the union of
- * all possible job status from all backend engines built on CommEngine.
- */
- static public enum JobStatus
- {
- // TODO: Some of them, like CANCELED and EXPIRED, should not be used, and should be cleaned out.
- TRYING(false), // VoiceEngine
- GO_NEXT_PHONE(false), // VoiceEngine
- //TRUNK_ERROR(false),
- LONG_DURATION(true), // VoiceEngine
- SUCCESS(true),
- NO_MORE_RETRY(true), // VoiceEngine
- ADDRESS_ERROR(true), // All
- SERVICE_PROVIDER_PROTOCOL_ERROR(true), // SMS
- SERVICE_PROVIDER_GENERATED_ERROR(true), // SMS
- SERVICE_PROVIDER_HTTP_ERROR(true), // SMS
- SERVICE_PROVIDER_CONNECT_ERROR(true), // SMS
- FORBIDDEN(true), // SMS - HTTP 403
- SPAM(true), // SMS
- SERVICE_PROVIDER_OTHER_ERROR(true), // Email
- CANCELED(true), // Voice - is it really?
- EXPIRED(true), // Voice - is it really?
- MESSAGE_ERROR(true), // Email, SMS
- NOT_FOUND(true), // SMS
- INVALID_MEDIA_TYPE(true), // MMS
- SERVICE_ACCESS_BLOCKED(true), // SMS
- PLATFORM_ERROR(true), // SMS
- FAILED(true), // SMS
- UNKNOWN_ERROR(true), // SMS
- NOT_AUTHORIZED(true), // SMS
- BAD_REQUEST(true), // SMS
- THROTTLE_LIMIT_REACHED(true), // SMS
- UNPROCESSABLE_ENTITY(true), // SMS
- PAYMENT_REQUIRED(true) ,
- ABORT(true),
- ;
-
- private boolean isTerminal;
-
- private JobStatus(boolean isTerminal)
- {
- this.isTerminal = isTerminal;
- }
-
- public boolean isTerminal()
- {
- return isTerminal;
- }
-
- }
-
- public Recipient recipient;
-
- public long startTime;
-
- public JobStatus jobStatus;
-
- public String errorText;
-
- public Job(Recipient recipient)
- {
- this.recipient = recipient;
- jobStatus = null;
- }
-
- public void setStatus(JobStatus jobStatus)
- {
- this.jobStatus = jobStatus;
- }
-
- public void setStatus(JobStatus jobStatus, String errorText)
- {
- this.jobStatus = jobStatus;
- this.errorText = errorText;
- }
-
- /**
- *
- * @return error in text form.
- */
- public String getErrorText()
- {
- return errorText;
- }
-
- }
|