"key", profile.getQpKey(),
"from", UtcDateUtils.formatDateTime(fixDate(from)),
"to", UtcDateUtils.formatDateTime(fixDate(profile.getRulesUpdatedAt()))));
- eventRepository.add(component, createQProfileEvent(component, profile, "Changes in %s", data));
+ eventRepository.add(component, createQProfileEvent(profile, "Changes in %s", data));
}
private void markAsRemoved(Component component, QualityProfile profile) {
- eventRepository.add(component, createQProfileEvent(component, profile, "Stop using %s"));
+ eventRepository.add(component, createQProfileEvent(profile, "Stop using %s"));
}
private void markAsAdded(Component component, QualityProfile profile) {
- eventRepository.add(component, createQProfileEvent(component, profile, "Use %s"));
+ eventRepository.add(component, createQProfileEvent(profile, "Use %s"));
}
- private Event createQProfileEvent(Component component, QualityProfile profile, String namePattern) {
- return createQProfileEvent(component, profile, namePattern, null);
+ private Event createQProfileEvent(QualityProfile profile, String namePattern) {
+ return createQProfileEvent(profile, namePattern, null);
}
- private Event createQProfileEvent(Component component, QualityProfile profile, String namePattern, @Nullable String data) {
- return Event.createProfile(String.format(namePattern, profileLabel(component, profile)), data, null);
+ private Event createQProfileEvent(QualityProfile profile, String namePattern, @Nullable String data) {
+ return Event.createProfile(String.format(namePattern, profileLabel(profile)), data, null);
}
- private String profileLabel(Component component, QualityProfile profile) {
+ private String profileLabel(QualityProfile profile) {
Optional<Language> language = languageRepository.find(profile.getLanguageKey());
String languageName = language.isPresent() ? language.get().getName() : profile.getLanguageKey();
return String.format("'%s' (%s)", profile.getQpName(), languageName);
/**
* This hack must be done because date precision is millisecond in db/es and date format is select only
*/
- private Date fixDate(Date date) {
+ private static Date fixDate(Date date) {
return DateUtils.addSeconds(date, 1);
}
private final DatabaseMigration databaseMigration;
private final Database database;
- public MigrateDbSystemAction(DatabaseVersion databaseVersion,
- Database database,
- DatabaseMigration databaseMigration) {
+ public MigrateDbSystemAction(DatabaseVersion databaseVersion, Database database, DatabaseMigration databaseMigration) {
this.databaseVersion = databaseVersion;
this.database = database;
this.databaseMigration = databaseMigration;
}
}
- private void writeNotSupportedResponse(Response response) {
+ private static void writeNotSupportedResponse(Response response) {
JsonWriter jsonWriter = response.newJsonWriter();
jsonWriter.beginObject()
.prop(PROPERTY_STATE, STATUS_NOT_SUPPORTED)
private void writeNoneResponse(Response response, DatabaseMigration databaseMigration) {
JsonWriter jsonWriter = response.newJsonWriter();
jsonWriter.beginObject()
- .prop(PROPERTY_STATE, statusToJson(RUNNING))
- .prop(PROPERTY_MESSAGE, MESSAGE_STATUS_RUNNING)
- .propDateTime(PROPERTY_STARTED_AT, databaseMigration.startedAt())
- .endObject();
+ .prop(PROPERTY_STATE, statusToJson(RUNNING))
+ .prop(PROPERTY_MESSAGE, MESSAGE_STATUS_RUNNING)
+ .propDateTime(PROPERTY_STARTED_AT, databaseMigration.startedAt())
+ .endObject();
jsonWriter.close();
}
package org.sonar.server.platform.ws;
import com.google.common.io.Resources;
+import java.util.List;
import org.sonar.api.server.ws.Request;
import org.sonar.api.server.ws.Response;
import org.sonar.api.server.ws.WebService;
import org.sonar.updatecenter.common.SonarUpdate;
import org.sonar.updatecenter.common.UpdateCenter;
-import java.util.List;
-
/**
* Implementation of the {@code upgrades} action for the System WebService.
*/
jsonWriter.endObject();
}
- private void writeMetadata(JsonWriter jsonWriter, Release release) {
+ private static void writeMetadata(JsonWriter jsonWriter, Release release) {
jsonWriter.prop(PROPERTY_VERSION, release.getVersion().getName());
jsonWriter.prop(PROPERTY_DESCRIPTION, release.getDescription());
jsonWriter.propDate(PROPERTY_RELEASE_DATE, release.getDate());
import com.google.common.collect.ImmutableSortedSet;
import com.google.common.io.Resources;
+import java.util.Collection;
import org.sonar.api.server.ws.Request;
import org.sonar.api.server.ws.Response;
import org.sonar.api.server.ws.WebService;
import org.sonar.updatecenter.common.PluginUpdate;
import org.sonar.updatecenter.common.UpdateCenter;
-import java.util.Collection;
-
import static org.sonar.server.plugins.ws.PluginWSCommons.NAME_KEY_PLUGIN_UPDATE_ORDERING;
public class AvailableAction implements PluginsWsAction {
"Plugin information is retrieved from Update Center. Date and time at which Update Center was last refreshed is provided in the response." +
"<br/>" +
"Update status values are: " +
- "<ul>" +
- "<li>COMPATIBLE: plugin is compatible with current SonarQube instance.</li>" +
- "<li>INCOMPATIBLE: plugin is not compatible with current SonarQube instance.</li>" +
- "<li>REQUIRES_SYSTEM_UPGRADE: plugin requires SonarQube to be upgraded before being installed.</li>" +
- "<li>DEPS_REQUIRE_SYSTEM_UPGRADE: at least one plugin on which the plugin is dependent requires SonarQube to be upgraded.</li>" +
- "</ul>")
+ "<ul>" +
+ "<li>COMPATIBLE: plugin is compatible with current SonarQube instance.</li>" +
+ "<li>INCOMPATIBLE: plugin is not compatible with current SonarQube instance.</li>" +
+ "<li>REQUIRES_SYSTEM_UPGRADE: plugin requires SonarQube to be upgraded before being installed.</li>" +
+ "<li>DEPS_REQUIRE_SYSTEM_UPGRADE: at least one plugin on which the plugin is dependent requires SonarQube to be upgraded.</li>" +
+ "</ul>")
.setSince("5.2")
.setHandler(this)
.setResponseExample(Resources.getResource(this.getClass(), "example-available_plugins.json"));
jsonWriter.endArray();
}
- private Collection<PluginUpdate> retrieveAvailablePlugins(UpdateCenter updateCenter) {
+ private static Collection<PluginUpdate> retrieveAvailablePlugins(UpdateCenter updateCenter) {
return ImmutableSortedSet.copyOf(
NAME_KEY_PLUGIN_UPDATE_ORDERING,
updateCenter.findAvailablePlugins()