View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.syncope.common.lib.to;
20  
21  import org.apache.commons.lang3.builder.EqualsBuilder;
22  import org.apache.commons.lang3.builder.HashCodeBuilder;
23  import org.apache.syncope.common.lib.BaseBean;
24  import org.apache.syncope.common.lib.types.ExecStatus;
25  
26  /**
27   * Single propagation status.
28   */
29  public class PropagationStatus implements BaseBean {
30  
31      private static final long serialVersionUID = 3921498450222857690L;
32  
33      /**
34       * Object before propagation.
35       */
36      private ConnObject beforeObj;
37  
38      /**
39       * Object after propagation.
40       */
41      private ConnObject afterObj;
42  
43      /**
44       * Propagated resource name.
45       */
46      private String resource;
47  
48      /**
49       * Propagation task execution status.
50       */
51      private ExecStatus status;
52  
53      /**
54       * Propagation task execution failure message.
55       */
56      private String failureReason;
57  
58      public ConnObject getAfterObj() {
59          return afterObj;
60      }
61  
62      public void setAfterObj(final ConnObject afterObj) {
63          this.afterObj = afterObj;
64      }
65  
66      public ConnObject getBeforeObj() {
67          return beforeObj;
68      }
69  
70      public void setBeforeObj(final ConnObject beforeObj) {
71          this.beforeObj = beforeObj;
72      }
73  
74      public String getResource() {
75          return resource;
76      }
77  
78      public void setResource(final String resource) {
79          this.resource = resource;
80      }
81  
82      public ExecStatus getStatus() {
83          return status;
84      }
85  
86      public void setStatus(final ExecStatus status) {
87          this.status = status;
88      }
89  
90      public String getFailureReason() {
91          return failureReason;
92      }
93  
94      public void setFailureReason(final String failureReason) {
95          this.failureReason = failureReason;
96      }
97  
98      @Override
99      public int hashCode() {
100         return new HashCodeBuilder().
101                 append(beforeObj).
102                 append(afterObj).
103                 append(resource).
104                 append(status).
105                 append(failureReason).
106                 build();
107     }
108 
109     @Override
110     public boolean equals(final Object obj) {
111         if (this == obj) {
112             return true;
113         }
114         if (obj == null) {
115             return false;
116         }
117         if (getClass() != obj.getClass()) {
118             return false;
119         }
120         final PropagationStatus other = (PropagationStatus) obj;
121         return new EqualsBuilder().
122                 append(beforeObj, other.beforeObj).
123                 append(afterObj, other.afterObj).
124                 append(resource, other.resource).
125                 append(status, other.status).
126                 append(failureReason, other.failureReason).
127                 build();
128     }
129 }