update author list in license for (JAL-826)
[jalview.git] / src / jalview / ws / jws1 / WSJob.java
1 /*
2  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
3  * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
4  * 
5  * This file is part of Jalview.
6  * 
7  * Jalview is free software: you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License 
9  * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
10  * 
11  * Jalview is distributed in the hope that it will be useful, but 
12  * WITHOUT ANY WARRANTY; without even the implied warranty 
13  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
14  * PURPOSE.  See the GNU General Public License for more details.
15  * 
16  * You should have received a copy of the GNU General Public License along with Jalview.  If not, see <http://www.gnu.org/licenses/>.
17  */
18 package jalview.ws.jws1;
19
20 import jalview.ws.AWsJob;
21
22 abstract class WSJob extends AWsJob
23 {
24   /*
25    * (non-Javadoc)
26    * 
27    * @see jalview.ws.AWsJob#clearResponse()
28    */
29   @Override
30   public void clearResponse()
31   {
32     result = null;
33   }
34
35   /*
36    * (non-Javadoc)
37    * 
38    * @see jalview.ws.AWsJob#hasResponse()
39    */
40   @Override
41   public boolean hasResponse()
42   {
43     return result != null;
44   }
45
46   /*
47    * (non-Javadoc)
48    * 
49    * @see jalview.ws.AWsJob#hasStatus()
50    */
51   @Override
52   public boolean hasStatus()
53   {
54     return result != null && result.getStatus() != null;
55   }
56
57   /**
58    * The last result object returned by the service.
59    */
60   vamsas.objects.simple.Result result;
61
62   /**
63    * @return
64    * @see vamsas.objects.simple.Result#getStatus()
65    */
66   public String getStatus()
67   {
68     return result == null ? null : result.getStatus();
69   }
70
71   public String getState()
72   {
73     return result == null ? "NULL result" : "" + result.getState();
74   }
75
76   /**
77    * @return
78    * @see vamsas.objects.simple.Result#isBroken()
79    */
80   public boolean isBroken()
81   {
82     return result != null && result.isBroken();
83   }
84
85   /**
86    * @return
87    * @see vamsas.objects.simple.Result#isFailed()
88    */
89   public boolean isFailed()
90   {
91     return result != null && result.isFailed();
92   }
93
94   /**
95    * @return
96    * @see vamsas.objects.simple.Result#isFinished()
97    */
98   public boolean isFinished()
99   {
100     return result != null && result.isFinished();
101   }
102
103   /**
104    * @return
105    * @see vamsas.objects.simple.Result#isInvalid()
106    */
107   public boolean isInvalid()
108   {
109     return result != null && result.isInvalid();
110   }
111
112   /**
113    * @return
114    * @see vamsas.objects.simple.Result#isJobFailed()
115    */
116   public boolean isJobFailed()
117   {
118     return result != null && result.isJobFailed();
119   }
120
121   /**
122    * @return
123    * @see vamsas.objects.simple.Result#isQueued()
124    */
125   public boolean isQueued()
126   {
127     return result != null && result.isQueued();
128   }
129
130   /**
131    * @return
132    * @see vamsas.objects.simple.Result#isRunning()
133    */
134   public boolean isRunning()
135   {
136     return result != null && result.isRunning();
137   }
138
139   /**
140    * @return
141    * @see vamsas.objects.simple.Result#isServerError()
142    */
143   public boolean isServerError()
144   {
145     return result != null && result.isServerError();
146   }
147 }