View Javadoc

1   package org.rundeck.api.domain;
2   
3   import java.util.List;
4   import java.util.ArrayList;
5   
6   import java.io.Serializable;
7   
8   
9   /**
10   * Represents a Rundeck output
11   * 
12   */
13  public class RundeckOutput implements Serializable {
14  
15  	private static final long serialVersionUID = 1L;
16  
17  	private Long executionId;
18  	
19  	//private String message = null;
20  
21  	//private String error = null;
22  	
23  	private Boolean unmodified = false;
24  	
25  	private Boolean empty = false;
26  	
27  	private int offset;
28  	
29  	private Boolean completed = false;
30  	
31  	private Boolean execCompleted = false;
32  	
33  	private Boolean hasFailedNodes = false;
34  	
35  	private RundeckExecution.ExecutionStatus status = null;
36  	
37  	private Long lastModified;
38  	
39  	private Long execDuration;
40  	
41  	private Float percentLoaded;
42  	
43  	private int totalSize;
44  	
45  	List<RundeckOutputEntry> logEntries = null;
46  
47      private String filterNode;
48      private String filterStep;
49  
50  	public Long getExecutionId() {
51  		return executionId;
52  	}
53  
54  	public void setExecutionId(Long executionId) {
55  		this.executionId = executionId;
56  	}
57  
58  	/*public String getMessage() {
59  		return message;
60  	}
61  
62  	public void setMessage(String message) {
63  		this.message = message;
64  	}
65  
66  	public String getError() {
67  		return error;
68  	}
69  
70  	public void setError(String error) {
71  		this.error = error;
72  	}*/
73  
74  	public Boolean isUnmodified() {
75  		return unmodified;
76  	}
77  
78  	public void setUnmodified(Boolean unmodified) {
79  		this.unmodified = unmodified;
80  	}
81  
82  	public Boolean isEmpty() {
83  		return empty;
84  	}
85  
86  	public void setEmpty(Boolean empty) {
87  		this.empty = empty;
88  	}
89  
90  	public int getOffset() {
91  		return offset;
92  	}
93  
94  	public void setOffset(int offset) {
95  		this.offset = offset;
96  	}
97  
98  	public Boolean isCompleted() {
99  		return completed;
100 	}
101 
102 	public void setCompleted(Boolean completed) {
103 		this.completed = completed;
104 	}
105 
106 	public Boolean isExecCompleted() {
107 		return execCompleted;
108 	}
109 
110 	public void setExecCompleted(Boolean execCompleted) {
111 		this.execCompleted = execCompleted;
112 	}
113 
114 	public Boolean isHasFailedNodes() {
115 		return hasFailedNodes;
116 	}
117 
118 	public void setHasFailedNodes(Boolean hasFailedNodes) {
119 		this.hasFailedNodes = hasFailedNodes;
120 	}
121 
122 	public RundeckExecution.ExecutionStatus getStatus() {
123 		return status;
124 	}
125 
126 	public void setStatus(RundeckExecution.ExecutionStatus status) {
127 		this.status = status;
128 	}
129 
130 	public Long getLastModified() {
131 		return lastModified;
132 	}
133 
134 	public void setLastModified(Long lastModified) {
135 		this.lastModified = lastModified;
136 	}
137 
138 	public Long getExecDuration() {
139 		return execDuration;
140 	}
141 
142 	public void setExecDuration(Long execDuration) {
143 		this.execDuration = execDuration;
144 	}
145 
146 	public Float getPercentLoaded() {
147 		return percentLoaded;
148 	}
149 
150 	public void setPercentLoaded(Float percentLoaded) {
151 		this.percentLoaded = percentLoaded;
152 	}
153 
154 	public int getTotalSize() {
155 		return totalSize;
156 	}
157 
158 	public void setTotalSize(int totalSize) {
159 		this.totalSize = totalSize;
160 	}
161 
162 	public List<RundeckOutputEntry> getLogEntries() {
163 		return logEntries;
164 	}
165 
166 	public void setLogEntries(List<RundeckOutputEntry> logEntries) {
167 		this.logEntries = logEntries;
168 	}
169 	
170 	public void addLogEntry(RundeckOutputEntry entry){
171 		if(logEntries == null){
172 			logEntries = new ArrayList<RundeckOutputEntry>();
173 		}
174 		logEntries.add(entry);
175 	}
176 
177     @Override
178     public String toString() {
179         return "RundeckOutput [executionId=" + executionId + /*", message=" + message + 
180         	", error=" + error +*/ ", unmodified=" + unmodified + ", empty=" + empty + 
181         	", offset=" + offset + ", completed=" + completed +
182         	", execCompleted=" + execCompleted + ", hasFailedNodes=" + hasFailedNodes +
183         	", status=" + status + ", lastModified=" + lastModified +
184         	", execDuration=" + execDuration + ", percentLoaded=" + percentLoaded +
185         	", filterNode=" + filterNode + ", filterStep=" + filterStep +
186         	", totalSize=" + totalSize + "]";
187     }
188 
189     @Override
190     public int hashCode() {
191         final int prime = 31;
192         int result = 1;
193         result = prime * result + ((executionId == null) ? 0 : executionId.hashCode());
194        // result = prime * result + ((message == null) ? 0 : message.hashCode());
195        // result = prime * result + ((error == null) ? 0 : error.hashCode());
196         result = prime * result + ((unmodified == null) ? 0 : unmodified.hashCode());
197         result = prime * result + ((empty == null) ? 0 : empty.hashCode());
198         result = prime * result + offset;
199         result = prime * result + ((completed == null) ? 0 : completed.hashCode());
200         result = prime * result + ((execCompleted == null) ? 0 : execCompleted.hashCode());
201         result = prime * result + ((hasFailedNodes == null) ? 0 : hasFailedNodes.hashCode());
202         result = prime * result + ((status == null) ? 0 : status.hashCode());
203         result = prime * result + ((lastModified == null) ? 0 : lastModified.hashCode());
204         result = prime * result + ((execDuration == null) ? 0 : execDuration.hashCode());
205         result = prime * result + ((percentLoaded == null) ? 0 : percentLoaded.hashCode());
206         result = prime * result + totalSize;
207         result = prime * result + ((logEntries == null) ? 0 : logEntries.hashCode());
208         result = prime * result + ((filterNode == null) ? 0 : filterNode.hashCode());
209         result = prime * result + ((filterStep == null) ? 0 : filterStep.hashCode());
210         return result;
211     }
212 
213 
214     @Override
215     public boolean equals(Object obj) {
216         if (this == obj)
217             return true;
218         if (obj == null)
219             return false;
220         if (getClass() != obj.getClass())
221             return false;
222         RundeckOutput other = (RundeckOutput) obj;
223         if (executionId == null) {
224             if (other.executionId != null)
225                 return false;
226         } else if (!executionId.equals(other.executionId))
227             return false;
228 /*        if (message == null) {
229             if (other.message != null)
230                 return false;
231         } else if (!message.equals(other.message))
232             return false;
233         if (error == null) {
234             if (other.error != null)
235                 return false;
236         } else if (!error.equals(other.error))
237             return false;
238 */
239         if (unmodified == null) {
240             if (other.unmodified != null)
241                 return false;
242         } else if (!unmodified.equals(other.unmodified))
243             return false;
244         if (empty == null) {
245             if (other.empty != null)
246                 return false;
247         } else if (!empty.equals(other.empty))
248             return false;
249         if (offset != other.offset)
250             return false;
251         if (completed == null) {
252             if (other.completed != null)
253                 return false;
254         } else if (!completed.equals(other.completed))
255             return false;
256         if (execCompleted == null) {
257             if (other.execCompleted != null)
258                 return false;
259         } else if (!execCompleted.equals(other.execCompleted))
260             return false;
261         if (hasFailedNodes == null) {
262             if (other.hasFailedNodes != null)
263                 return false;
264         } else if (!hasFailedNodes.equals(other.hasFailedNodes))
265             return false;
266         if (status == null) {
267             if (other.status != null)
268                 return false;
269         } else if (!status.equals(other.status))
270             return false;
271         if (lastModified == null) {
272             if (other.lastModified != null)
273                 return false;
274         } else if (!lastModified.equals(other.lastModified))
275             return false;
276         if (execDuration == null) {
277             if (other.execDuration != null)
278                 return false;
279         } else if (!execDuration.equals(other.execDuration))
280             return false;
281         if (percentLoaded == null) {
282             if (other.percentLoaded != null)
283                 return false;
284         } else if (!percentLoaded.equals(other.percentLoaded))
285             return false;
286         if (totalSize != other.totalSize)
287             return false;
288         if (logEntries == null) {
289             if (other.logEntries != null)
290                 return false;
291         } else if (!logEntries.equals(other.logEntries))
292             return false;
293         if (filterNode == null) {
294             if (other.filterNode != null)
295                 return false;
296         } else if (!filterNode.equals(other.filterNode))
297             return false;
298         if (filterStep == null) {
299             if (other.filterStep != null)
300                 return false;
301         } else if (!filterStep.equals(other.filterStep))
302             return false;
303         return true;
304     }
305 
306     public String getFilterNode() {
307         return filterNode;
308     }
309 
310     /**
311      * return the node name used to filter this output
312      * @param filterNode
313      */
314     public void setFilterNode(String filterNode) {
315         this.filterNode = filterNode;
316     }
317 
318     /**
319      * Return the step context used to filter this output
320      * @return
321      */
322     public String getFilterStep() {
323         return filterStep;
324     }
325 
326     public void setFilterStep(String filterStep) {
327         this.filterStep = filterStep;
328     }
329 }