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.commons;
20  
21  import org.apache.syncope.client.enduser.SyncopeWebApplication;
22  import org.apache.syncope.client.enduser.pages.Dashboard;
23  import org.apache.syncope.client.ui.commons.Constants;
24  import org.apache.wicket.Component;
25  import org.apache.wicket.request.mapper.parameter.PageParameters;
26  
27  public final class ProvisioningUtils {
28  
29      public static PageParameters managePageParams(
30              final Component component,
31              final String section,
32              final boolean isSuccess) {
33  
34          PageParameters parameters = new PageParameters();
35          parameters.add(EnduserConstants.STATUS,
36                  isSuccess
37                          ? Constants.OPERATION_SUCCEEDED
38                          : Constants.OPERATION_ERROR);
39          parameters.add(Constants.NOTIFICATION_TITLE_PARAM,
40                  isSuccess
41                          ? component.getString("self." + section + ".success.msg")
42                          : component.getString("self." + section + ".error.msg"));
43          parameters.add(Constants.NOTIFICATION_MSG_PARAM,
44                  isSuccess
45                          ? component.getString("self." + section + ".success")
46                          : component.getString("self." + section + ".error"));
47          parameters.add(EnduserConstants.LANDING_PAGE,
48                  SyncopeWebApplication.get().getPageClass("profile", Dashboard.class).getName());
49          return parameters;
50      }
51  
52      private ProvisioningUtils() {
53          // private constructor for static utility class
54      }
55  }