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.commons;
20  
21  import java.util.ArrayList;
22  import java.util.List;
23  import org.apache.syncope.client.console.policies.AccessPolicyDirectoryPanel;
24  import org.apache.syncope.client.console.policies.AttrReleasePolicyDirectoryPanel;
25  import org.apache.syncope.client.console.policies.AuthPolicyDirectoryPanel;
26  import org.apache.syncope.client.console.policies.TicketExpirationPolicyDirectoryPanel;
27  import org.apache.syncope.client.console.rest.PolicyRestClient;
28  import org.apache.wicket.PageReference;
29  import org.apache.wicket.extensions.markup.html.tabs.AbstractTab;
30  import org.apache.wicket.extensions.markup.html.tabs.ITab;
31  import org.apache.wicket.markup.html.panel.Panel;
32  import org.apache.wicket.model.ResourceModel;
33  
34  public class AMPolicyTabProvider implements PolicyTabProvider {
35  
36      private static final long serialVersionUID = 2822554006571803418L;
37  
38      protected final PolicyRestClient policyRestClient;
39  
40      public AMPolicyTabProvider(final PolicyRestClient policyRestClient) {
41          this.policyRestClient = policyRestClient;
42      }
43  
44      @Override
45      public List<ITab> buildTabList(final PageReference pageRef) {
46          List<ITab> tabs = new ArrayList<>();
47  
48          tabs.add(new AbstractTab(new ResourceModel("policy.access")) {
49  
50              private static final long serialVersionUID = -6815067322125799251L;
51  
52              @Override
53              public Panel getPanel(final String panelId) {
54                  return new AccessPolicyDirectoryPanel(panelId, policyRestClient, pageRef);
55              }
56          });
57  
58          tabs.add(new AbstractTab(new ResourceModel("policy.attrRelease")) {
59  
60              private static final long serialVersionUID = -6815067322125799251L;
61  
62              @Override
63              public Panel getPanel(final String panelId) {
64                  return new AttrReleasePolicyDirectoryPanel(panelId, policyRestClient, pageRef);
65              }
66          });
67  
68          tabs.add(new AbstractTab(new ResourceModel("policy.auth")) {
69  
70              private static final long serialVersionUID = -6815067322125799251L;
71  
72              @Override
73              public Panel getPanel(final String panelId) {
74                  return new AuthPolicyDirectoryPanel(panelId, policyRestClient, pageRef);
75              }
76          });
77  
78          tabs.add(new AbstractTab(new ResourceModel("policy.ticketExpiration")) {
79  
80              private static final long serialVersionUID = -6815067322125799251L;
81  
82              @Override
83              public Panel getPanel(final String panelId) {
84                  return new TicketExpirationPolicyDirectoryPanel(panelId, policyRestClient, pageRef);
85              }
86          });
87  
88          return tabs;
89      }
90  }