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.java.propagation;
20  
21  import java.util.List;
22  import java.util.Optional;
23  import java.util.Set;
24  import org.apache.commons.lang3.builder.EqualsBuilder;
25  import org.apache.commons.lang3.builder.HashCodeBuilder;
26  import org.apache.syncope.common.lib.types.CipherAlgorithm;
27  import org.apache.syncope.core.persistence.api.entity.ExternalResource;
28  import org.apache.syncope.core.persistence.api.entity.Privilege;
29  import org.apache.syncope.core.persistence.api.entity.user.LAPlainAttr;
30  import org.apache.syncope.core.persistence.api.entity.user.LinkedAccount;
31  import org.apache.syncope.core.persistence.api.entity.user.User;
32  
33  public class DeletingLinkedAccount implements LinkedAccount {
34  
35      private static final long serialVersionUID = -6828106363047119713L;
36  
37      private final User user;
38  
39      private final ExternalResource resource;
40  
41      private final String connObjectKeyValue;
42  
43      public DeletingLinkedAccount(final User user, final ExternalResource resource, final String connObjectKeyValue) {
44          this.user = user;
45          this.resource = resource;
46          this.connObjectKeyValue = connObjectKeyValue;
47      }
48  
49      @Override
50      public String getKey() {
51          return null;
52      }
53  
54      @Override
55      public String getConnObjectKeyValue() {
56          return connObjectKeyValue;
57      }
58  
59      @Override
60      public void setConnObjectKeyValue(final String connObjectKeyValue) {
61          // unsupported
62      }
63  
64      @Override
65      public User getOwner() {
66          return user;
67      }
68  
69      @Override
70      public void setOwner(final User owner) {
71          // unsupported
72      }
73  
74      @Override
75      public ExternalResource getResource() {
76          return resource;
77      }
78  
79      @Override
80      public void setResource(final ExternalResource resource) {
81          // unsupported
82      }
83  
84      @Override
85      public boolean add(final Privilege privilege) {
86          return false;
87      }
88  
89      @Override
90      public Set<? extends Privilege> getPrivileges() {
91          return Set.of();
92      }
93  
94      @Override
95      public String getUsername() {
96          return null;
97      }
98  
99      @Override
100     public void setUsername(final String username) {
101         // unsupported
102     }
103 
104     @Override
105     public CipherAlgorithm getCipherAlgorithm() {
106         return null;
107     }
108 
109     @Override
110     public void setCipherAlgorithm(final CipherAlgorithm cipherAlgorithm) {
111         // unsupported
112     }
113     
114     @Override
115     public boolean canDecodeSecrets() {
116         return false;
117     }
118 
119     @Override
120     public String getPassword() {
121         return null;
122     }
123 
124     @Override
125     public void setEncodedPassword(final String password, final CipherAlgorithm cipherAlgoritm) {
126         // unsupported
127     }
128 
129     @Override
130     public void setPassword(final String password) {
131         // unsupported
132     }
133 
134     @Override
135     public Boolean isSuspended() {
136         return null;
137     }
138 
139     @Override
140     public void setSuspended(final Boolean suspended) {
141         //
142     }
143 
144     @Override
145     public boolean add(final LAPlainAttr attr) {
146         return false;
147     }
148 
149     @Override
150     public boolean remove(final LAPlainAttr attr) {
151         return false;
152     }
153 
154     @Override
155     public Optional<? extends LAPlainAttr> getPlainAttr(final String plainSchema) {
156         return Optional.empty();
157     }
158 
159     @Override
160     public List<? extends LAPlainAttr> getPlainAttrs() {
161         return List.of();
162     }
163 
164     @Override
165     public int hashCode() {
166         return new HashCodeBuilder().
167                 append(user.getKey()).
168                 append(resource).
169                 append(connObjectKeyValue).
170                 build();
171     }
172 
173     @Override
174     public boolean equals(final Object obj) {
175         if (this == obj) {
176             return true;
177         }
178         if (obj == null) {
179             return false;
180         }
181         if (getClass() != obj.getClass()) {
182             return false;
183         }
184         final DeletingLinkedAccount other = (DeletingLinkedAccount) obj;
185         return new EqualsBuilder().
186                 append(user.getKey(), other.user.getKey()).
187                 append(resource, other.resource).
188                 append(connObjectKeyValue, other.connObjectKeyValue).
189                 build();
190     }
191 }