View Javadoc

1   /*
2    * Copyright 2011 Vincent Behar
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.rundeck.api.domain;
17  
18  import java.io.Serializable;
19  
20  /**
21   * Represents an abort of a {@link RundeckExecution}
22   * 
23   * @author Vincent Behar
24   */
25  public class RundeckAbort implements Serializable {
26  
27      private static final long serialVersionUID = 1L;
28  
29      private AbortStatus status;
30  
31      private RundeckExecution execution;
32  
33      public AbortStatus getStatus() {
34          return status;
35      }
36  
37      public void setStatus(AbortStatus status) {
38          this.status = status;
39      }
40  
41      public RundeckExecution getExecution() {
42          return execution;
43      }
44  
45      public void setExecution(RundeckExecution execution) {
46          this.execution = execution;
47      }
48  
49      @Override
50      public String toString() {
51          return "RundeckAbort [status=" + status + ", execution=" + execution + "]";
52      }
53  
54      @Override
55      public int hashCode() {
56          final int prime = 31;
57          int result = 1;
58          result = prime * result + ((execution == null) ? 0 : execution.hashCode());
59          result = prime * result + ((status == null) ? 0 : status.hashCode());
60          return result;
61      }
62  
63      @Override
64      public boolean equals(Object obj) {
65          if (this == obj)
66              return true;
67          if (obj == null)
68              return false;
69          if (getClass() != obj.getClass())
70              return false;
71          RundeckAbort other = (RundeckAbort) obj;
72          if (execution == null) {
73              if (other.execution != null)
74                  return false;
75          } else if (!execution.equals(other.execution))
76              return false;
77          if (status == null) {
78              if (other.status != null)
79                  return false;
80          } else if (!status.equals(other.status))
81              return false;
82          return true;
83      }
84  
85      /**
86       * The status of an abort
87       */
88      public static enum AbortStatus {
89          PENDING, FAILED, ABORTED;
90      }
91  
92  }