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