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.policies;
20  
21  import java.util.List;
22  import org.apache.syncope.client.console.rest.PolicyRestClient;
23  import org.apache.syncope.client.console.wicket.extensions.markup.html.repeater.data.table.BooleanPropertyColumn;
24  import org.apache.syncope.common.lib.policy.PropagationPolicyTO;
25  import org.apache.syncope.common.lib.types.IdRepoEntitlement;
26  import org.apache.syncope.common.lib.types.PolicyType;
27  import org.apache.wicket.PageReference;
28  import org.apache.wicket.authroles.authorization.strategies.role.metadata.MetaDataRoleAuthorizationStrategy;
29  import org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn;
30  import org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn;
31  import org.apache.wicket.model.StringResourceModel;
32  
33  public class PropagationPolicyDirectoryPanel extends PolicyDirectoryPanel<PropagationPolicyTO> {
34  
35      private static final long serialVersionUID = 25188602686577L;
36  
37      public PropagationPolicyDirectoryPanel(
38              final String id,
39              final PolicyRestClient restClient,
40              final PageReference pageRef) {
41  
42          super(id, restClient, PolicyType.PROPAGATION, pageRef);
43  
44          PropagationPolicyTO defaultItem = new PropagationPolicyTO();
45  
46          this.addNewItemPanelBuilder(
47                  new PolicyModalPanelBuilder<>(PolicyType.PROPAGATION, defaultItem, modal, restClient, pageRef), true);
48          MetaDataRoleAuthorizationStrategy.authorize(addAjaxLink, RENDER, IdRepoEntitlement.POLICY_CREATE);
49  
50          initResultTable();
51      }
52  
53      @Override
54      protected void addCustomColumnFields(final List<IColumn<PropagationPolicyTO, String>> columns) {
55          columns.add(new BooleanPropertyColumn<>(new StringResourceModel(
56                  "fetchAroundProvisioning", this), "fetchAroundProvisioning", "fetchAroundProvisioning"));
57          columns.add(new BooleanPropertyColumn<>(
58                  new StringResourceModel("updateDelta", this), "updateDelta", "updateDelta"));
59          columns.add(new PropertyColumn<>(
60                  new StringResourceModel("maxAttempts", this), "maxAttempts", "maxAttempts"));
61      }
62  }