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.info;
20  
21  import com.fasterxml.jackson.annotation.JsonIgnore;
22  import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
23  import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
24  import java.util.ArrayList;
25  import java.util.HashSet;
26  import java.util.List;
27  import java.util.Optional;
28  import java.util.Set;
29  import org.apache.syncope.common.lib.BaseBean;
30  
31  public class PlatformInfo implements BaseBean {
32  
33      private static final long serialVersionUID = -7941853999417673827L;
34  
35      private boolean selfRegAllowed;
36  
37      private boolean pwdResetAllowed;
38  
39      private boolean pwdResetRequiringSecurityQuestions;
40  
41      private final Set<String> connIdLocations = new HashSet<>();
42  
43      private final List<String> anyTypes = new ArrayList<>();
44  
45      private final List<String> userClasses = new ArrayList<>();
46  
47      private final List<String> anyTypeClasses = new ArrayList<>();
48  
49      private final List<String> resources = new ArrayList<>();
50  
51      private final Set<String> entitlements = new HashSet<>();
52  
53      private final Set<String> implementationTypes = new HashSet<>();
54  
55      private final Set<JavaImplInfo> javaImplInfos = new HashSet<>();
56  
57      public boolean isSelfRegAllowed() {
58          return selfRegAllowed;
59      }
60  
61      public boolean isPwdResetAllowed() {
62          return pwdResetAllowed;
63      }
64  
65      public boolean isPwdResetRequiringSecurityQuestions() {
66          return pwdResetRequiringSecurityQuestions;
67      }
68  
69      @JacksonXmlElementWrapper(localName = "connIdLocations")
70      @JacksonXmlProperty(localName = "connIdLocation")
71      public Set<String> getConnIdLocations() {
72          return connIdLocations;
73      }
74  
75      @JacksonXmlElementWrapper(localName = "anyTypes")
76      @JacksonXmlProperty(localName = "anyType")
77      public List<String> getAnyTypes() {
78          return anyTypes;
79      }
80  
81      @JacksonXmlElementWrapper(localName = "userClasses")
82      @JacksonXmlProperty(localName = "userClass")
83      public List<String> getUserClasses() {
84          return userClasses;
85      }
86  
87      @JacksonXmlElementWrapper(localName = "anyTypeClasses")
88      @JacksonXmlProperty(localName = "anyTypeClass")
89      public List<String> getAnyTypeClasses() {
90          return anyTypeClasses;
91      }
92  
93      @JacksonXmlElementWrapper(localName = "resources")
94      @JacksonXmlProperty(localName = "resource")
95      public List<String> getResources() {
96          return resources;
97      }
98  
99      @JacksonXmlElementWrapper(localName = "entitlements")
100     @JacksonXmlProperty(localName = "entitlement")
101     public Set<String> getEntitlements() {
102         return entitlements;
103     }
104 
105     @JacksonXmlElementWrapper(localName = "implementationTypes")
106     @JacksonXmlProperty(localName = "implementationType")
107     public Set<String> getImplementationTypes() {
108         return implementationTypes;
109     }
110 
111     @JsonIgnore
112     public Optional<JavaImplInfo> getJavaImplInfo(final String type) {
113         return javaImplInfos.stream().filter(javaImplInfo -> javaImplInfo.getType().equals(type)).findFirst();
114     }
115 
116     @JacksonXmlElementWrapper(localName = "javaImplInfos")
117     @JacksonXmlProperty(localName = "javaImplInfo")
118     public Set<JavaImplInfo> getJavaImplInfos() {
119         return javaImplInfos;
120     }
121 
122     public void setSelfRegAllowed(final boolean selfRegAllowed) {
123         this.selfRegAllowed = selfRegAllowed;
124     }
125 
126     public void setPwdResetAllowed(final boolean pwdResetAllowed) {
127         this.pwdResetAllowed = pwdResetAllowed;
128     }
129 
130     public void setPwdResetRequiringSecurityQuestions(final boolean pwdResetRequiringSecurityQuestions) {
131         this.pwdResetRequiringSecurityQuestions = pwdResetRequiringSecurityQuestions;
132     }
133 }