Java Code Examples for com.atlassian.sal.api.pluginsettings.PluginSettings#get()

The following examples show how to use com.atlassian.sal.api.pluginsettings.PluginSettings#get() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: OnlyOfficeConfServlet.java    From onlyoffice-confluence with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    String username = userManager.getRemoteUsername(request);
    if (username == null || !userManager.isSystemAdmin(username)) {
        SettingsManager settingsManager = (SettingsManager) ContainerManager.getComponent("settingsManager");
        String baseUrl = settingsManager.getGlobalSettings().getBaseUrl();
        response.sendRedirect(baseUrl);
        return;
    }

    PluginSettings pluginSettings = pluginSettingsFactory.createGlobalSettings();
    String apiUrl = (String) pluginSettings.get("onlyoffice.apiUrl");
    String jwtSecret = (String) pluginSettings.get("onlyoffice.jwtSecret");
    if (apiUrl == null || apiUrl.isEmpty()) {
        apiUrl = "";
    }
    if (jwtSecret == null || jwtSecret.isEmpty()) {
        jwtSecret = "";
    }

    response.setContentType("text/html;charset=UTF-8");
    PrintWriter writer = response.getWriter();

    Map<String, Object> contextMap = MacroUtils.defaultVelocityContext();

    contextMap.put("docserviceApiUrl", apiUrl);
    contextMap.put("docserviceJwtSecret", jwtSecret);

    writer.write(getTemplate(contextMap));
}
 
Example 2
Source File: UserConfigDao.java    From stash-token-auth with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Returns the list of users with config data in the system
 *
 * @return
 */
@SuppressWarnings("unchecked")
private List<String> getUserList() {
  PluginSettings settings = pluginSettingsFactory.createGlobalSettings();
  List<String> list = (List<String>) settings.get(USER_LIST);
  return list == null ? Lists.<String>newArrayList() : list;
}
 
Example 3
Source File: ConfigDao.java    From pr-harmony with GNU General Public License v3.0 4 votes vote down vote up
String get(PluginSettings settings, String key, String defaultValue) {
  String val = (String) settings.get(key);
  return val == null ? defaultValue : val;
}