First patch for * JAL-493
[jalview.git] / src / jalview / ws / WSJob.java
1 /**
2  * 
3  */
4 package jalview.ws;
5
6 abstract class WSJob extends AWsJob
7 {
8   /* (non-Javadoc)
9    * @see jalview.ws.AWsJob#clearResponse()
10    */
11   @Override
12   public void clearResponse()
13   {
14     result = null;
15   }
16
17   /* (non-Javadoc)
18    * @see jalview.ws.AWsJob#hasResponse()
19    */
20   @Override
21   public boolean hasResponse()
22   {
23     return result!=null;
24   }
25
26   /* (non-Javadoc)
27    * @see jalview.ws.AWsJob#hasStatus()
28    */
29   @Override
30   public boolean hasStatus()
31   {
32     return result!=null && result.getStatus()!=null;
33   }
34
35   /**
36    * The last result object returned by the service.
37    */
38   vamsas.objects.simple.Result result;
39
40   /**
41    * @return
42    * @see vamsas.objects.simple.Result#getStatus()
43    */
44   public String getStatus()
45   {
46     return result==null ? null : result.getStatus();
47   }
48
49   public String getState() {
50     return result==null ? "NULL result" : ""+result.getState(); 
51   }
52   /**
53    * @return
54    * @see vamsas.objects.simple.Result#isBroken()
55    */
56   public boolean isBroken()
57   {
58     return result!=null && result.isBroken();
59   }
60
61   /**
62    * @return
63    * @see vamsas.objects.simple.Result#isFailed()
64    */
65   public boolean isFailed()
66   {
67     return result!=null && result.isFailed();
68   }
69
70   /**
71    * @return
72    * @see vamsas.objects.simple.Result#isFinished()
73    */
74   public boolean isFinished()
75   {
76     return result!=null && result.isFinished();
77   }
78
79   /**
80    * @return
81    * @see vamsas.objects.simple.Result#isInvalid()
82    */
83   public boolean isInvalid()
84   {
85     return result!=null && result.isInvalid();
86   }
87
88   /**
89    * @return
90    * @see vamsas.objects.simple.Result#isJobFailed()
91    */
92   public boolean isJobFailed()
93   {
94     return result!=null && result.isJobFailed();
95   }
96
97   /**
98    * @return
99    * @see vamsas.objects.simple.Result#isQueued()
100    */
101   public boolean isQueued()
102   {
103     return result!=null && result.isQueued();
104   }
105
106   /**
107    * @return
108    * @see vamsas.objects.simple.Result#isRunning()
109    */
110   public boolean isRunning()
111   {
112     return result!=null && result.isRunning();
113   }
114
115   /**
116    * @return
117    * @see vamsas.objects.simple.Result#isServerError()
118    */
119   public boolean isServerError()
120   {
121     return result!=null && result.isServerError();
122   }
123 }