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.core.provisioning.api;
20  
21  import java.util.Set;
22  import org.apache.commons.lang3.builder.EqualsBuilder;
23  import org.apache.commons.lang3.builder.HashCodeBuilder;
24  import org.apache.commons.lang3.builder.ToStringBuilder;
25  import org.apache.commons.lang3.tuple.Pair;
26  
27  public class UserWorkflowResult<T> extends WorkflowResult<T> {
28  
29      private final PropagationByResource<Pair<String, String>> propByLinkedAccount;
30  
31      public UserWorkflowResult(
32              final T result,
33              final PropagationByResource<String> propByRes,
34              final PropagationByResource<Pair<String, String>> propByLinkedAccount,
35              final String performedTask) {
36  
37          super(result, propByRes, performedTask);
38          this.propByLinkedAccount = propByLinkedAccount;
39      }
40  
41      public UserWorkflowResult(
42              final T result,
43              final PropagationByResource<String> propByRes,
44              final PropagationByResource<Pair<String, String>> propByLinkedAccount,
45              final Set<String> performedTasks) {
46  
47          super(result, propByRes, performedTasks);
48          this.propByLinkedAccount = propByLinkedAccount;
49      }
50  
51      public PropagationByResource<Pair<String, String>> getPropByLinkedAccount() {
52          return propByLinkedAccount;
53      }
54  
55      @Override
56      public int hashCode() {
57          return new HashCodeBuilder().
58                  appendSuper(super.hashCode()).
59                  append(propByLinkedAccount).
60                  build();
61      }
62  
63      @Override
64      public boolean equals(final Object obj) {
65          if (this == obj) {
66              return true;
67          }
68          if (obj == null) {
69              return false;
70          }
71          if (getClass() != obj.getClass()) {
72              return false;
73          }
74          @SuppressWarnings("unchecked")
75          final UserWorkflowResult<T> other = (UserWorkflowResult<T>) obj;
76          return new EqualsBuilder().
77                  appendSuper(true).
78                  append(propByLinkedAccount, other.propByLinkedAccount).
79                  build();
80      }
81  
82      @Override
83      public String toString() {
84          return new ToStringBuilder(this).
85                  appendSuper(super.toString()).
86                  append(propByLinkedAccount).
87                  build();
88      }
89  }