You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ServerSettings.java 1.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /*
  2. * Copyright 2011 gitblit.com.
  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 com.gitblit.models;
  17. import java.io.Serializable;
  18. import java.util.ArrayList;
  19. import java.util.List;
  20. import java.util.Map;
  21. import java.util.TreeMap;
  22. /**
  23. * Server settings represents the settings of the Gitblit server including all
  24. * setting metadata such as name, current value, default value, description, and
  25. * directives. It is a model class for serialization and presentation, but not
  26. * for persistence.
  27. *
  28. * @author James Moger
  29. */
  30. public class ServerSettings implements Serializable {
  31. private final Map<String, SettingModel> settings;
  32. private static final long serialVersionUID = 1L;
  33. public List<String> pushScripts;
  34. public boolean supportsCredentialChanges;
  35. public boolean supportsDisplayNameChanges;
  36. public boolean supportsEmailAddressChanges;
  37. public boolean supportsTeamMembershipChanges;
  38. public ServerSettings() {
  39. settings = new TreeMap<String, SettingModel>();
  40. }
  41. public List<String> getKeys() {
  42. return new ArrayList<String>(settings.keySet());
  43. }
  44. public void add(SettingModel setting) {
  45. if (setting != null) {
  46. settings.put(setting.name, setting);
  47. }
  48. }
  49. public SettingModel get(String key) {
  50. return settings.get(key);
  51. }
  52. public boolean hasKey(String key) {
  53. return settings.containsKey(key);
  54. }
  55. }