Package com.google.gerrit.server.account
Class StoredPreferences
java.lang.Object
com.google.gerrit.server.account.StoredPreferences
Parses/writes preferences from/to a
Config
file.
This is a low-level API. Read/write of preferences in a user branch should be done through
AccountsUpdate
or AccountConfig
.
The config file has separate sections for general, diff and edit preferences:
[diff] hideTopMenu = true [edit] lineLength = 80
The parameter names match the names that are used in the preferences REST API.
If the preference is omitted in the config file, then the default value for the preference is used.
Defaults for preferences that apply for all accounts can be configured in the
refs/users/default
branch in the All-Users
repository. The config for the default
preferences must be provided to this class so that it can read default values from it.
The preferences are lazily parsed.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoid
parse()
org.eclipse.jgit.lib.Config
saveGeneralPreferences
(Optional<GeneralPreferencesInfo> generalPreferencesInput, Optional<DiffPreferencesInfo> diffPreferencesInput, Optional<EditPreferencesInfo> editPreferencesInput) static DiffPreferencesInfo
static EditPreferencesInfo
static GeneralPreferencesInfo
static void
validateMy
(List<MenuItem> my)
-
Field Details
-
PREFERENCES_CONFIG
- See Also:
-
-
Method Details
-
getGeneralPreferences
-
getDiffPreferences
-
getEditPreferences
-
parse
public void parse() -
saveGeneralPreferences
public org.eclipse.jgit.lib.Config saveGeneralPreferences(Optional<GeneralPreferencesInfo> generalPreferencesInput, Optional<DiffPreferencesInfo> diffPreferencesInput, Optional<EditPreferencesInfo> editPreferencesInput) throws org.eclipse.jgit.errors.ConfigInvalidException - Throws:
org.eclipse.jgit.errors.ConfigInvalidException
-
updateDefaultGeneralPreferences
public static GeneralPreferencesInfo updateDefaultGeneralPreferences(MetaDataUpdate md, GeneralPreferencesInfo input) throws IOException, org.eclipse.jgit.errors.ConfigInvalidException - Throws:
IOException
org.eclipse.jgit.errors.ConfigInvalidException
-
updateDefaultDiffPreferences
public static DiffPreferencesInfo updateDefaultDiffPreferences(MetaDataUpdate md, DiffPreferencesInfo input) throws IOException, org.eclipse.jgit.errors.ConfigInvalidException - Throws:
IOException
org.eclipse.jgit.errors.ConfigInvalidException
-
updateDefaultEditPreferences
public static EditPreferencesInfo updateDefaultEditPreferences(MetaDataUpdate md, EditPreferencesInfo input) throws IOException, org.eclipse.jgit.errors.ConfigInvalidException - Throws:
IOException
org.eclipse.jgit.errors.ConfigInvalidException
-
validateMy
- Throws:
BadRequestException
-