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.enduser.pages;
20  
21  import java.util.Optional;
22  import org.apache.syncope.client.enduser.SyncopeEnduserSession;
23  import org.apache.syncope.client.enduser.SyncopeWebApplication;
24  import org.apache.syncope.client.enduser.layout.UserFormLayoutInfo;
25  import org.apache.syncope.client.enduser.panels.UserFormPanel;
26  import org.apache.syncope.common.lib.to.UserTO;
27  import org.apache.wicket.markup.html.WebMarkupContainer;
28  import org.apache.wicket.request.mapper.parameter.PageParameters;
29  
30  public class EditUser extends BasePage {
31  
32      private static final long serialVersionUID = -1100228004207271270L;
33  
34      private static final String EDIT_USER = "page.edituser";
35  
36      protected WebMarkupContainer content;
37  
38      public EditUser(final PageParameters parameters) {
39          super(parameters, EDIT_USER);
40  
41          content = new WebMarkupContainer("content");
42          content.setOutputMarkupId(true);
43          contentWrapper.add(content);
44  
45          UserTO userTO = SyncopeEnduserSession.get().getSelfTO(true);
46  
47          UserFormPanel editUserPanel = new UserFormPanel(
48                  "editUserPanel",
49                  userTO,
50                  userTO,
51                  SyncopeEnduserSession.get().getAnonymousClient().platform().getUserClasses(),
52                  buildFormLayout(),
53                  getPageReference());
54          editUserPanel.setOutputMarkupId(true);
55          content.add(editUserPanel);
56      }
57  
58      protected UserFormLayoutInfo buildFormLayout() {
59          return Optional.ofNullable(SyncopeWebApplication.get().getCustomFormLayout()).
60                  orElseGet(() -> new UserFormLayoutInfo());
61      }
62  }