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