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.scim;
20  
21  import com.fasterxml.jackson.annotation.JsonIgnore;
22  import java.io.Serializable;
23  import java.util.ArrayList;
24  import java.util.Collections;
25  import java.util.HashMap;
26  import java.util.List;
27  import java.util.Map;
28  import org.apache.syncope.common.lib.scim.types.EmailCanonicalType;
29  import org.apache.syncope.common.lib.scim.types.IMCanonicalType;
30  import org.apache.syncope.common.lib.scim.types.PhoneNumberCanonicalType;
31  import org.apache.syncope.common.lib.scim.types.PhotoCanonicalType;
32  
33  public class SCIMUserConf implements Serializable {
34  
35      private static final long serialVersionUID = -2700011089067219156L;
36  
37      private String externalId;
38  
39      private SCIMUserNameConf name;
40  
41      private String displayName;
42  
43      private String nickName;
44  
45      private String profileUrl;
46  
47      private String title;
48  
49      private String userType;
50  
51      private String preferredLanguage;
52  
53      private String locale;
54  
55      private String timezone;
56  
57      private final List<SCIMComplexConf<EmailCanonicalType>> emails = new ArrayList<>();
58  
59      private final List<SCIMComplexConf<PhoneNumberCanonicalType>> phoneNumbers = new ArrayList<>();
60  
61      private final List<SCIMComplexConf<IMCanonicalType>> ims = new ArrayList<>();
62  
63      private final List<SCIMComplexConf<PhotoCanonicalType>> photos = new ArrayList<>();
64  
65      private final List<SCIMUserAddressConf> addresses = new ArrayList<>();
66  
67      private final List<String> x509Certificates = new ArrayList<>();
68  
69      @JsonIgnore
70      public Map<String, String> asMap() {
71          Map<String, String> map = new HashMap<>();
72  
73          if (externalId != null) {
74              map.put("externalId", externalId);
75          }
76  
77          if (displayName != null) {
78              map.put("displayName", displayName);
79          }
80          if (nickName != null) {
81              map.put("nickName", nickName);
82          }
83          if (profileUrl != null) {
84              map.put("profileUrl", profileUrl);
85          }
86          if (title != null) {
87              map.put("title", title);
88          }
89          if (userType != null) {
90              map.put("userType", userType);
91          }
92          if (preferredLanguage != null) {
93              map.put("preferredLanguage", preferredLanguage);
94          }
95          if (locale != null) {
96              map.put("locale", locale);
97          }
98          if (timezone != null) {
99              map.put("timezone", timezone);
100         }
101 
102         return Collections.unmodifiableMap(map);
103     }
104 
105     public String getExternalId() {
106         return externalId;
107     }
108 
109     public void setExternalId(final String externalId) {
110         this.externalId = externalId;
111     }
112 
113     public SCIMUserNameConf getName() {
114         return name;
115     }
116 
117     public void setName(final SCIMUserNameConf name) {
118         this.name = name;
119     }
120 
121     public String getDisplayName() {
122         return displayName;
123     }
124 
125     public void setDisplayName(final String displayName) {
126         this.displayName = displayName;
127     }
128 
129     public String getNickName() {
130         return nickName;
131     }
132 
133     public void setNickName(final String nickName) {
134         this.nickName = nickName;
135     }
136 
137     public String getProfileUrl() {
138         return profileUrl;
139     }
140 
141     public void setProfileUrl(final String profileUrl) {
142         this.profileUrl = profileUrl;
143     }
144 
145     public String getTitle() {
146         return title;
147     }
148 
149     public void setTitle(final String title) {
150         this.title = title;
151     }
152 
153     public String getUserType() {
154         return userType;
155     }
156 
157     public void setUserType(final String userType) {
158         this.userType = userType;
159     }
160 
161     public String getPreferredLanguage() {
162         return preferredLanguage;
163     }
164 
165     public void setPreferredLanguage(final String preferredLanguage) {
166         this.preferredLanguage = preferredLanguage;
167     }
168 
169     public String getLocale() {
170         return locale;
171     }
172 
173     public void setLocale(final String locale) {
174         this.locale = locale;
175     }
176 
177     public String getTimezone() {
178         return timezone;
179     }
180 
181     public void setTimezone(final String timezone) {
182         this.timezone = timezone;
183     }
184 
185     public List<SCIMComplexConf<EmailCanonicalType>> getEmails() {
186         return emails;
187     }
188 
189     public List<SCIMComplexConf<PhoneNumberCanonicalType>> getPhoneNumbers() {
190         return phoneNumbers;
191     }
192 
193     public List<SCIMComplexConf<IMCanonicalType>> getIms() {
194         return ims;
195     }
196 
197     public List<SCIMComplexConf<PhotoCanonicalType>> getPhotos() {
198         return photos;
199     }
200 
201     public List<SCIMUserAddressConf> getAddresses() {
202         return addresses;
203     }
204 
205     public List<String> getX509Certificates() {
206         return x509Certificates;
207     }
208 }