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.panels;
20  
21  import java.io.Serializable;
22  import java.util.ArrayList;
23  import org.apache.syncope.client.ui.commons.panels.SimpleListViewPanel;
24  import org.apache.syncope.client.ui.commons.status.StatusBean;
25  import org.apache.syncope.client.ui.commons.status.StatusUtils;
26  import org.apache.syncope.client.ui.commons.wizards.any.AbstractResultPanel;
27  import org.apache.wicket.Component;
28  import org.apache.wicket.PageReference;
29  import org.apache.wicket.markup.html.panel.Panel;
30  import org.slf4j.Logger;
31  import org.slf4j.LoggerFactory;
32  
33  public class ResultPanel extends AbstractResultPanel<String, Serializable> {
34  
35      private static final long serialVersionUID = -8995647450549098844L;
36  
37      protected static final Logger LOG = LoggerFactory.getLogger(ResultPanel.class);
38  
39      private final PageReference pageRef;
40  
41      public ResultPanel(final String item, final Serializable errors, final PageReference pageRef) {
42          super(item, errors);
43          this.pageRef = pageRef;
44      }
45  
46      @SuppressWarnings("unchecked")
47      @Override
48      protected Panel customResultBody(final String panelId, final String item, final Serializable errorBeans) {
49          return new SimpleListViewPanel.Builder<>(StatusBean.class, pageRef) {
50  
51              private static final long serialVersionUID = -6809736686861678498L;
52  
53              @Override
54              protected Component getValueComponent(final String key, final StatusBean bean) {
55                  return "status".equalsIgnoreCase(key)
56                          ? StatusUtils.getWarningStatusPanel("field")
57                          : super.getValueComponent(key, bean);
58              }
59          }.setItems((ArrayList<StatusBean>) errorBeans).includes("resource", "status").build(panelId);
60      }
61  }