Search in sources :

Example 1 with CommentLinkInput

use of com.google.gerrit.extensions.api.projects.CommentLinkInput in project gerrit by GerritCodeReview.

the class PutConfig method updateCommentLinks.

private void updateCommentLinks(ProjectConfig projectConfig, Map<String, CommentLinkInput> input) {
    for (Map.Entry<String, CommentLinkInput> e : input.entrySet()) {
        String name = e.getKey();
        CommentLinkInput value = e.getValue();
        if (value != null) {
            // Add or update the commentlink section
            Config cfg = new Config();
            cfg.setString(COMMENTLINK, name, KEY_MATCH, value.match);
            cfg.setString(COMMENTLINK, name, KEY_LINK, value.link);
            cfg.setBoolean(COMMENTLINK, name, KEY_ENABLED, value.enabled == null || value.enabled);
            projectConfig.addCommentLinkSection(ProjectConfig.buildCommentLink(cfg, name, false));
        } else {
            // Delete the commentlink section
            projectConfig.removeCommentLinkSection(name);
        }
    }
}
Also used : CommentLinkInput(com.google.gerrit.extensions.api.projects.CommentLinkInput) ProjectConfig(com.google.gerrit.server.project.ProjectConfig) Config(org.eclipse.jgit.lib.Config) BooleanProjectConfig(com.google.gerrit.entities.BooleanProjectConfig) Map(java.util.Map) DynamicMap(com.google.gerrit.extensions.registration.DynamicMap)

Example 2 with CommentLinkInput

use of com.google.gerrit.extensions.api.projects.CommentLinkInput in project gerrit by GerritCodeReview.

the class ProjectIT method addCommentLink.

private void addCommentLink(ConfigInput configInput, String name, String match, String link) {
    CommentLinkInput commentLinkInput = new CommentLinkInput();
    commentLinkInput.match = match;
    commentLinkInput.link = link;
    addCommentLink(configInput, name, commentLinkInput);
}
Also used : CommentLinkInput(com.google.gerrit.extensions.api.projects.CommentLinkInput)

Aggregations

CommentLinkInput (com.google.gerrit.extensions.api.projects.CommentLinkInput)2 BooleanProjectConfig (com.google.gerrit.entities.BooleanProjectConfig)1 DynamicMap (com.google.gerrit.extensions.registration.DynamicMap)1 ProjectConfig (com.google.gerrit.server.project.ProjectConfig)1 Map (java.util.Map)1 Config (org.eclipse.jgit.lib.Config)1