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.client.console.panels;
20  
21  import org.apache.syncope.client.ui.commons.markup.html.form.AjaxTextFieldPanel;
22  import org.apache.syncope.common.lib.scim.SCIMConf;
23  import org.apache.syncope.common.lib.scim.SCIMGroupConf;
24  import org.apache.wicket.extensions.ajax.markup.html.autocomplete.AutoCompleteSettings;
25  import org.apache.wicket.model.PropertyModel;
26  import org.slf4j.Logger;
27  import org.slf4j.LoggerFactory;
28  
29  public class SCIMConfGroupPanel extends SCIMConfTabPanel {
30  
31      protected static final Logger LOG = LoggerFactory.getLogger(SCIMConfGroupPanel.class);
32  
33      private static final long serialVersionUID = 8747864142447220523L;
34  
35      private final SCIMGroupConf scimGroupConf;
36  
37      public SCIMConfGroupPanel(final String id, final SCIMConf scimConf) {
38          super(id);
39  
40          if (scimConf.getGroupConf() == null) {
41              scimConf.setGroupConf(new SCIMGroupConf());
42          }
43          scimGroupConf = scimConf.getGroupConf();
44  
45          final AutoCompleteSettings settings = new AutoCompleteSettings();
46          settings.setShowCompleteListOnFocusGain(true);
47          settings.setShowListOnEmptyInput(true);
48          settings.setCssClassName("custom-autocomplete-box");
49  
50          AjaxTextFieldPanel externalIdPanel = new AjaxTextFieldPanel("externalId", "externalId",
51                  new PropertyModel<>("externalId", "externalId") {
52  
53              private static final long serialVersionUID = -6427731218492117883L;
54  
55              @Override
56              public String getObject() {
57                  return scimGroupConf.getExternalId();
58              }
59  
60              @Override
61              public void setObject(final String object) {
62                  scimGroupConf.setExternalId(object);
63              }
64          });
65          externalIdPanel.setChoices(groupPlainSchemas.getObject());
66  
67          add(externalIdPanel);
68      }
69  }