JAL-1432 updated copyright notices
[jalview.git] / src / jalview / ws / jws1 / WSJob.java
1 /*
2  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.0b1)
3  * Copyright (C) 2014 The Jalview Authors
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  * The Jalview Authors are detailed in the 'AUTHORS' file.
18  */
19 package jalview.ws.jws1;
20
21 import jalview.ws.AWsJob;
22
23 abstract class WSJob extends AWsJob
24 {
25   /*
26    * (non-Javadoc)
27    * 
28    * @see jalview.ws.AWsJob#clearResponse()
29    */
30   @Override
31   public void clearResponse()
32   {
33     result = null;
34   }
35
36   /*
37    * (non-Javadoc)
38    * 
39    * @see jalview.ws.AWsJob#hasResponse()
40    */
41   @Override
42   public boolean hasResponse()
43   {
44     return result != null;
45   }
46
47   /*
48    * (non-Javadoc)
49    * 
50    * @see jalview.ws.AWsJob#hasStatus()
51    */
52   @Override
53   public boolean hasStatus()
54   {
55     return result != null && result.getStatus() != null;
56   }
57
58   /**
59    * The last result object returned by the service.
60    */
61   vamsas.objects.simple.Result result;
62
63   /**
64    * @return
65    * @see vamsas.objects.simple.Result#getStatus()
66    */
67   public String getStatus()
68   {
69     return result == null ? null : result.getStatus();
70   }
71
72   public String getState()
73   {
74     return result == null ? "NULL result" : "" + result.getState();
75   }
76
77   /**
78    * @return
79    * @see vamsas.objects.simple.Result#isBroken()
80    */
81   public boolean isBroken()
82   {
83     return result != null && result.isBroken();
84   }
85
86   /**
87    * @return
88    * @see vamsas.objects.simple.Result#isFailed()
89    */
90   public boolean isFailed()
91   {
92     return result != null && result.isFailed();
93   }
94
95   /**
96    * @return
97    * @see vamsas.objects.simple.Result#isFinished()
98    */
99   public boolean isFinished()
100   {
101     return result != null && result.isFinished();
102   }
103
104   /**
105    * @return
106    * @see vamsas.objects.simple.Result#isInvalid()
107    */
108   public boolean isInvalid()
109   {
110     return result != null && result.isInvalid();
111   }
112
113   /**
114    * @return
115    * @see vamsas.objects.simple.Result#isJobFailed()
116    */
117   public boolean isJobFailed()
118   {
119     return result != null && result.isJobFailed();
120   }
121
122   /**
123    * @return
124    * @see vamsas.objects.simple.Result#isQueued()
125    */
126   public boolean isQueued()
127   {
128     return result != null && result.isQueued();
129   }
130
131   /**
132    * @return
133    * @see vamsas.objects.simple.Result#isRunning()
134    */
135   public boolean isRunning()
136   {
137     return result != null && result.isRunning();
138   }
139
140   /**
141    * @return
142    * @see vamsas.objects.simple.Result#isServerError()
143    */
144   public boolean isServerError()
145   {
146     return result != null && result.isServerError();
147   }
148 }