1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.rundeck.api.domain;
17
18 import java.io.Serializable;
19 import java.util.ArrayList;
20 import java.util.HashMap;
21 import java.util.List;
22 import java.util.Map;
23
24
25
26
27
28
29 public class RundeckJobsImportResult implements Serializable {
30
31 private static final long serialVersionUID = 1L;
32
33 private final List<RundeckJob> succeededJobs = new ArrayList<RundeckJob>();
34
35 private final List<RundeckJob> skippedJobs = new ArrayList<RundeckJob>();
36
37 private final Map<RundeckJob, String> failedJobs = new HashMap<RundeckJob, String>();
38
39 public void addSucceededJob(RundeckJob job) {
40 succeededJobs.add(job);
41 }
42
43 public void addSkippedJob(RundeckJob job) {
44 skippedJobs.add(job);
45 }
46
47 public void addFailedJob(RundeckJob job, String errorMessage) {
48 failedJobs.put(job, errorMessage);
49 }
50
51 public List<RundeckJob> getSucceededJobs() {
52 return succeededJobs;
53 }
54
55 public List<RundeckJob> getSkippedJobs() {
56 return skippedJobs;
57 }
58
59 public Map<RundeckJob, String> getFailedJobs() {
60 return failedJobs;
61 }
62
63 @Override
64 public String toString() {
65 return "RundeckJobsImportResult [succeededJobs=" + succeededJobs + ", skippedJobs=" + skippedJobs
66 + ", failedJobs=" + failedJobs + "]";
67 }
68
69 @Override
70 public int hashCode() {
71 final int prime = 31;
72 int result = 1;
73 result = prime * result + ((failedJobs == null) ? 0 : failedJobs.hashCode());
74 result = prime * result + ((skippedJobs == null) ? 0 : skippedJobs.hashCode());
75 result = prime * result + ((succeededJobs == null) ? 0 : succeededJobs.hashCode());
76 return result;
77 }
78
79 @Override
80 public boolean equals(Object obj) {
81 if (this == obj)
82 return true;
83 if (obj == null)
84 return false;
85 if (getClass() != obj.getClass())
86 return false;
87 RundeckJobsImportResult other = (RundeckJobsImportResult) obj;
88 if (failedJobs == null) {
89 if (other.failedJobs != null)
90 return false;
91 } else if (!failedJobs.equals(other.failedJobs))
92 return false;
93 if (skippedJobs == null) {
94 if (other.skippedJobs != null)
95 return false;
96 } else if (!skippedJobs.equals(other.skippedJobs))
97 return false;
98 if (succeededJobs == null) {
99 if (other.succeededJobs != null)
100 return false;
101 } else if (!succeededJobs.equals(other.succeededJobs))
102 return false;
103 return true;
104 }
105
106 }