|
- 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
- {
- /**
- *
- */
- static public enum JobStatus
- {
- READY(false),
- TRYING(false),
- GO_NEXT_PHONE(false),
- TRUNK_ERROR(false),
- LONG_DURATION(true),
- SUCCESS(true),
- NO_MORE_RETRY(true),
- RECIPIENT_ADDR_ERROR(true),
- SERVICE_PROVIDER_PROTOCOL_ERROR(true),
- SERVICE_PROVIDER_GENERATED_ERROR(true),
- SERVICE_PROVIDER_HTTP_ERROR(true),
- SERVICE_PROVIDER_CONNECT_ERROR(true),
- SERVICE_PROVIDER_OTHER_ERROR(true),
- CANCELED(true),
- EXPIRED(true),
- MESSAGE_ERROR(true),
- SERVICE_ACCESS_BLOCKED(true),
- PLATFORM_ERROR(true),
- FAILED(true), // for
- UNKNOWN_ERROR(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 = JobStatus.READY;
- }
-
- 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;
- }
-
- }
|