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.Collections;
24  import java.util.HashMap;
25  import java.util.Map;
26  import org.apache.syncope.common.lib.scim.types.AddressCanonicalType;
27  
28  public class SCIMUserAddressConf implements Serializable {
29  
30      private static final long serialVersionUID = 8093531407836615577L;
31  
32      private String formatted;
33  
34      private String streetAddress;
35  
36      private String locality;
37  
38      private String region;
39  
40      private String postalCode;
41  
42      private String country;
43  
44      private AddressCanonicalType type;
45  
46      private boolean primary;
47  
48      @JsonIgnore
49      public Map<String, String> asMap() {
50          Map<String, String> map = new HashMap<>();
51  
52          if (formatted != null) {
53              map.put("formatted", formatted);
54          }
55          if (streetAddress != null) {
56              map.put("streetAddress", streetAddress);
57          }
58          if (locality != null) {
59              map.put("locality", locality);
60          }
61          if (region != null) {
62              map.put("region", region);
63          }
64          if (postalCode != null) {
65              map.put("postalCode", postalCode);
66          }
67          if (country != null) {
68              map.put("country", country);
69          }
70  
71          return Collections.unmodifiableMap(map);
72      }
73  
74      public String getFormatted() {
75          return formatted;
76      }
77  
78      public void setFormatted(final String formatted) {
79          this.formatted = formatted;
80      }
81  
82      public String getStreetAddress() {
83          return streetAddress;
84      }
85  
86      public void setStreetAddress(final String streetAddress) {
87          this.streetAddress = streetAddress;
88      }
89  
90      public String getLocality() {
91          return locality;
92      }
93  
94      public void setLocality(final String locality) {
95          this.locality = locality;
96      }
97  
98      public String getRegion() {
99          return region;
100     }
101 
102     public void setRegion(final String region) {
103         this.region = region;
104     }
105 
106     public String getPostalCode() {
107         return postalCode;
108     }
109 
110     public void setPostalCode(final String postalCode) {
111         this.postalCode = postalCode;
112     }
113 
114     public String getCountry() {
115         return country;
116     }
117 
118     public void setCountry(final String country) {
119         this.country = country;
120     }
121 
122     public AddressCanonicalType getType() {
123         return type;
124     }
125 
126     public void setType(final AddressCanonicalType type) {
127         this.type = type;
128     }
129 
130     public boolean isPrimary() {
131         return primary;
132     }
133 
134     public void setPrimary(final boolean primary) {
135         this.primary = primary;
136     }
137 }