
com.qualinsight.plugins.sonarqube.badges.ws.gate.QualityGateBadgeAction Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of qualinsight-plugins-sonarqube-badges Show documentation
Show all versions of qualinsight-plugins-sonarqube-badges Show documentation
This plugin adds a webservice to SonarQube that allows the retrieval of different types of badges that display as a SVG image the quality of a project or a view.
/*
* qualinsight-plugins-sonarqube-badges
* Copyright (c) 2015-2016, QualInsight
* http://www.qualinsight.com/
*
* This program is free software: you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation, either
* version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program. If not, you can retrieve a copy
* from .
*/
package com.qualinsight.plugins.sonarqube.badges.ws.gate;
import org.sonar.api.server.ServerSide;
import org.sonar.api.server.ws.WebService;
import org.sonar.api.server.ws.WebService.Action;
import org.sonar.api.server.ws.WebService.Controller;
import org.sonar.api.server.ws.WebService.NewController;
/**
* Creates {@link Action} for quality gate badge {@link WebService} {@link Controller}.
*
* @author Michel Pawlak
*/
@ServerSide
public class QualityGateBadgeAction {
private static final String RESPONSE_EXAMPLE_FILE = "/com/qualinsight/plugins/sonarqube/badges/ws/gate/example.svg";
private static final String SINCE_VERSION = "1.2.0";
private QualityGateBadgeRequestHandler qualityGateBadgeRequestHandler;
/**
* {@link QualityGateBadgeAction} IoC constructor
*
* @param qualityGateBadgeRequestHandler request handler to be bound to the action
*/
public QualityGateBadgeAction(final QualityGateBadgeRequestHandler qualityGateBadgeRequestHandler) {
this.qualityGateBadgeRequestHandler = qualityGateBadgeRequestHandler;
}
/**
* Adds the action to a provided controller
*
* @param controller the action needs to be added to
*/
public void createOn(final NewController controller) {
controller.createAction("gate")
.setDescription("Retrieves the quality gate status of a project as a SVG image.")
.setHandler(this.qualityGateBadgeRequestHandler)
.setSince(SINCE_VERSION)
.setResponseExample(getClass().getResource(RESPONSE_EXAMPLE_FILE))
.createParam("key")
.setDescription("Key of the project")
.setExampleValue("org.codehaus.sonar:sonar")
.setRequired(true);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy