View Javadoc

1   /**
2    * Copyright (C) 2012 White Source Ltd.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.whitesource.teamcity.server;
17  
18  import jetbrains.buildServer.web.openapi.PlaceId;
19  import jetbrains.buildServer.web.openapi.PositionConstraint;
20  import jetbrains.buildServer.web.openapi.SimpleCustomTab;
21  import jetbrains.buildServer.web.openapi.WebControllerManager;
22  import org.jetbrains.annotations.NotNull;
23  import org.whitesource.teamcity.common.Constants;
24  
25  import javax.servlet.http.HttpServletRequest;
26  import java.util.Map;
27  
28  /**
29   * @author Edo.Shor
30   */
31  public class GlobalSettingsTab extends SimpleCustomTab {
32  
33      /* --- Members --- */
34  
35      private GlobalSettingsManager settingsManager;
36  
37      /* --- Constructors --- */
38  
39      /**
40       * Constructor
41       *
42       * @param webControllerManager
43       * @param settingsManager
44       */
45      public GlobalSettingsTab(@NotNull WebControllerManager webControllerManager, @NotNull GlobalSettingsManager settingsManager) {
46          super(webControllerManager,
47                  PlaceId.ADMIN_SERVER_CONFIGURATION_TAB,
48                  Constants.PLUGIN_NAME,
49                  "whitesourceGlobalSettingsTab.jsp",
50                  "White Source");
51  
52          this.settingsManager = settingsManager;
53  
54          setPosition(PositionConstraint.after("serverConfigGeneral"));
55          register();
56  
57          webControllerManager.registerController("/admin/whitesource/globalSettingsTab.html", new GlobalSettingsController(settingsManager));
58      }
59  
60      /* --- Overridden methods --- */
61  
62      @Override
63      public void fillModel(@NotNull Map<String, Object> model, @NotNull HttpServletRequest request) {
64          super.fillModel(model, request);
65          model.put("settingsManager", settingsManager);
66      }
67  }