@Override
public void define(WebService.NewController context) {
WebService.NewAction action = context.createAction("list_definitions")
- .setDescription(String.format("Returns definitions of properties.<br>" +
- "Either '%s' or '%s' could be provided, not both.<br> " +
+ .setDescription(String.format("List settings definitions.<br>" +
+ "Either '%s' or '%s' can be provided, not both.<br> " +
"Requires one of the following permissions: " +
"<ul>" +
"<li>'Administer System'</li>" +
package org.sonar.server.settings.ws;
import com.google.common.base.Splitter;
+import com.google.common.collect.ImmutableTable;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import org.sonarqube.ws.Settings.ValuesWsResponse;
import static org.elasticsearch.common.Strings.isNullOrEmpty;
+import static org.sonar.api.PropertyType.PROPERTY_SET;
import static org.sonar.server.settings.ws.SettingsWsComponentParameters.PARAM_COMPONENT_ID;
import static org.sonar.server.settings.ws.SettingsWsComponentParameters.PARAM_COMPONENT_KEY;
import static org.sonar.server.settings.ws.SettingsWsComponentParameters.addComponentParameters;
public class ValuesAction implements SettingsWsAction {
- private static final Splitter MULTI_VALUE_SPLITTER = Splitter.on(",");
+ private static final Splitter COMMA_SPLITTER = Splitter.on(",");
static final String PARAM_KEYS = "keys";
@Override
public void define(WebService.NewController context) {
WebService.NewAction action = context.createAction("values")
- .setDescription(String.format("Returns values of given properties.<br>" +
- "If no value have been set for a property, then the default value is returned.<br>" +
- "Either '%s' or '%s' could be provided, not both.<br> " +
+ .setDescription("List settings values.<br>" +
+ "If no value has been set for a setting, then the default value is returned.<br>" +
+ "Either '%s' or '%s' can be provided, not both.<br> " +
"Requires one of the following permissions: " +
"<ul>" +
"<li>'Administer System'</li>" +
"<li>'Administer' rights on the specified component</li>" +
- "</ul>", PARAM_COMPONENT_ID, PARAM_COMPONENT_KEY))
+ "</ul>", PARAM_COMPONENT_ID, PARAM_COMPONENT_KEY)
.setResponseExample(getClass().getResource("values-example.json"))
.setSince("6.1")
.setHandler(this);
settingsWsComponentParameters.checkAdminPermission(component);
Set<String> keys = new HashSet<>(request.mandatoryParamAsStrings(PARAM_KEYS));
- List<PropertyDefinition> definitions = getDefinitions(keys);
- Map<String, PropertyDefinition> definitionsByKey = definitions.stream()
- .collect(Collectors.toMap(PropertyDefinition::key, Function.identity()));
-
ValuesWsResponse.Builder valuesBuilder = ValuesWsResponse.newBuilder();
- new ValuesBuilder(dbSession, valuesBuilder, definitionsByKey, keys, component).build();
- return valuesBuilder.build();
+ new SettingsBuilder(dbSession, valuesBuilder, getDefinitions(keys), keys, component).build();
+ ValuesWsResponse response = valuesBuilder.build();
+ return response;
} finally {
dbClient.closeSession(dbSession);
}
}
- private class ValuesBuilder {
+ private class SettingsBuilder {
private final DbSession dbSession;
+ private final ComponentDto component;
+
private final ValuesWsResponse.Builder valuesWsBuilder;
private final Map<String, PropertyDefinition> definitionsByKey;
private final Set<String> keys;
- private final ComponentDto component;
+ private final Set<String> propertySetKeys;
- private final Map<String, Settings.Value.Builder> valueBuilderByKey = new HashMap<>();
+ private final Map<String, Settings.Setting.Builder> settingsBuilderByKey = new HashMap<>();
- ValuesBuilder(DbSession dbSession, ValuesWsResponse.Builder valuesWsBuilder, Map<String, PropertyDefinition> definitionsByKey,
+ SettingsBuilder(DbSession dbSession, ValuesWsResponse.Builder valuesWsBuilder, List<PropertyDefinition> definitions,
Set<String> keys, @Nullable ComponentDto component) {
this.dbSession = dbSession;
this.valuesWsBuilder = valuesWsBuilder;
- this.definitionsByKey = definitionsByKey;
+ this.definitionsByKey = definitions.stream()
+ .collect(Collectors.toMap(PropertyDefinition::key, Function.identity()));
this.keys = keys;
this.component = component;
+
+ this.propertySetKeys = definitions.stream()
+ .filter(definition -> definition.type().equals(PROPERTY_SET))
+ .map(PropertyDefinition::key)
+ .collect(Collectors.toSet());
}
void build() {
processDefinitions();
- processPropertyDtos(dbClient.propertiesDao().selectGlobalPropertiesByKeys(dbSession, keys));
+ processPropertyDtos(true);
if (component != null) {
- processPropertyDtos(dbClient.propertiesDao().selectComponentPropertiesByKeys(dbSession, keys, component.getId()));
+ processPropertyDtos(false);
}
- valueBuilderByKey.values().forEach(Settings.Value.Builder::build);
+ settingsBuilderByKey.values().forEach(Settings.Setting.Builder::build);
}
private void processDefinitions() {
}
private void processDefaultValue(PropertyDefinition definition) {
- Settings.Value.Builder valueBuilder = valuesWsBuilder.addValuesBuilder()
+ Settings.Setting.Builder settingBuilder = valuesWsBuilder.addSettingsBuilder()
.setKey(definition.key())
- .setIsDefault(true);
- setValue(valueBuilder, definition.defaultValue());
- valueBuilderByKey.put(definition.key(), valueBuilder);
+ .setInherited(false)
+ .setDefault(true);
+ setValue(settingBuilder, definition.defaultValue());
+ settingsBuilderByKey.put(definition.key(), settingBuilder);
}
- private void processPropertyDtos(List<PropertyDto> properties) {
- properties.stream()
- .filter(propertyDto -> !isNullOrEmpty(propertyDto.getValue()))
- .forEach(this::processDtoValue);
+ private void processPropertyDtos(boolean loadGlobal) {
+ List<PropertyDto> properties = loadProperties(dbSession, loadGlobal, keys);
+ PropertySetValues propertySetValues = new PropertySetValues(properties, loadGlobal);
+
+ properties.forEach(property -> {
+ String key = property.getKey();
+ Settings.Setting.Builder valueBuilder = getOrCreateValueBuilder(key);
+ valueBuilder.setInherited(component != null && property.getResourceId() == null);
+ valueBuilder.setDefault(false);
+
+ PropertyDefinition definition = definitionsByKey.get(key);
+ if (definition != null && definition.type().equals(PROPERTY_SET)) {
+ Settings.FieldsValues.Builder builder = Settings.FieldsValues.newBuilder();
+ for (Map<String, String> propertySetMap : propertySetValues.get(key)) {
+ builder.addFieldsValuesBuilder().putAllValue(propertySetMap);
+ }
+ valueBuilder.setFieldsValues(builder);
+ } else {
+ setValue(valueBuilder, property.getValue());
+ }
+ });
}
- private void processDtoValue(PropertyDto property) {
- Settings.Value.Builder valueBuilder = valueBuilderByKey.get(property.getKey());
+ private Settings.Setting.Builder getOrCreateValueBuilder(String propertyKey) {
+ Settings.Setting.Builder valueBuilder = settingsBuilderByKey.get(propertyKey);
if (valueBuilder == null) {
- valueBuilder = valuesWsBuilder.addValuesBuilder().setKey(property.getKey());
- valueBuilderByKey.put(property.getKey(), valueBuilder);
+ valueBuilder = valuesWsBuilder.addSettingsBuilder().setKey(propertyKey);
+ settingsBuilderByKey.put(propertyKey, valueBuilder);
}
- valueBuilder.setIsInherited(component != null && property.getResourceId() == null);
- valueBuilder.setIsDefault(false);
- setValue(valueBuilder, property.getValue());
+ return valueBuilder;
}
- private void setValue(Settings.Value.Builder valueBuilder, String value) {
+ private void setValue(Settings.Setting.Builder valueBuilder, String value) {
PropertyDefinition definition = definitionsByKey.get(valueBuilder.getKey());
if (definition != null && definition.multiValues()) {
- valueBuilder.addAllValues(MULTI_VALUE_SPLITTER.split(value));
+ valueBuilder.setValues(Settings.Values.newBuilder().addAllValues(COMMA_SPLITTER.split(value)));
} else {
valueBuilder.setValue(value);
}
}
+
+ private List<PropertyDto> loadProperties(DbSession dbSession, boolean loadGlobal, Set<String> keys) {
+ if (loadGlobal) {
+ return dbClient.propertiesDao().selectGlobalPropertiesByKeys(dbSession, keys);
+ }
+ return dbClient.propertiesDao().selectComponentPropertiesByKeys(dbSession, keys, component.getId());
+ }
+
+ private class PropertySetValues {
+ private final Map<String, PropertyKeyWithFieldAndSetId> propertyKeyWithFieldAndSetIds = new HashMap<>();
+ private final Map<String, PropertySetValue> propertySetValuesByPropertyKey = new HashMap<>();
+
+ PropertySetValues(List<PropertyDto> properties, boolean loadGlobal) {
+ properties.stream()
+ .filter(propertyDto -> propertySetKeys.contains(propertyDto.getKey()))
+ .forEach(propertyDto -> definitionsByKey.get(propertyDto.getKey()).fields()
+ .forEach(field -> COMMA_SPLITTER.splitToList(propertyDto.getValue())
+ .forEach(value -> add(propertyDto.getKey(), field.key(), value))));
+
+ loadProperties(dbSession, loadGlobal, propertyKeyWithFieldAndSetIds.keySet())
+ .forEach(propertySetDto -> {
+ PropertyKeyWithFieldAndSetId propertyKeyWithFieldAndSetIdKey = propertyKeyWithFieldAndSetIds.get(propertySetDto.getKey());
+ PropertySetValue propertySetValue = getOrCreatePropertySetValue(propertyKeyWithFieldAndSetIdKey.getPropertyKey());
+ propertySetValue.add(propertyKeyWithFieldAndSetIdKey.getSetId(), propertyKeyWithFieldAndSetIdKey.getFieldKey(), propertySetDto.getValue());
+ });
+ }
+
+ private void add(String propertyKey, String fieldKey, String value) {
+ String propertySetKey = generatePropertySetKey(propertyKey, value, fieldKey);
+ propertyKeyWithFieldAndSetIds.put(propertySetKey, new PropertyKeyWithFieldAndSetId(propertyKey, fieldKey, value));
+ }
+
+ private PropertySetValue getOrCreatePropertySetValue(String propertyKey) {
+ PropertySetValue propertySetValue = propertySetValuesByPropertyKey.get(propertyKey);
+ if (propertySetValue == null) {
+ propertySetValue = new PropertySetValue();
+ propertySetValuesByPropertyKey.put(propertyKey, propertySetValue);
+ }
+ return propertySetValue;
+ }
+
+ List<Map<String, String>> get(String propertyKey) {
+ return propertySetValuesByPropertyKey.get(propertyKey).get();
+ }
+
+ private String generatePropertySetKey(String propertyKey, String id, String fieldKey) {
+ return propertyKey + "." + id + "." + fieldKey;
+ }
+ }
}
private List<PropertyDefinition> getDefinitions(Set<String> keys) {
.collect(Collectors.toList());
}
+ private static class PropertyKeyWithFieldAndSetId {
+ private final String propertyKey;
+ private final String fieldKey;
+ private final String setId;
+
+ PropertyKeyWithFieldAndSetId(String propertyKey, String fieldKey, String setId) {
+ this.propertyKey = propertyKey;
+ this.fieldKey = fieldKey;
+ this.setId = setId;
+ }
+
+ public String getPropertyKey() {
+ return propertyKey;
+ }
+
+ public String getFieldKey() {
+ return fieldKey;
+ }
+
+ public String getSetId() {
+ return setId;
+ }
+ }
+
+ private static class PropertySetValue {
+ ImmutableTable.Builder<String, String, String> tableBuilder = new ImmutableTable.Builder<>();
+
+ public void add(String setId, String fieldKey, String value) {
+ tableBuilder.put(setId, fieldKey, value);
+ }
+
+ public List<Map<String, String>> get() {
+ ImmutableTable<String, String, String> table = tableBuilder.build();
+ return table.rowKeySet().stream()
+ .map(table::row)
+ .collect(Collectors.toList());
+ }
+ }
+
}
{
- "values": [
+ "settings": [
{
"key": "sonar.test.jira",
"value": "abc",
- "isDefault": true
+ "default": true,
+ "inherited": false
},
{
"key": "sonar.autogenerated",
"val2",
"val3"
],
- "isDefault": false
+ "default": false,
+ "inherited": false
},
{
"key": "sonar.demo",
- "setValues": {
- "text": {
- "values": [
- "foo",
- "bar"
- ]
+ "fieldsValues": [
+ {
+ "boolean": "true",
+ "text": "foo"
},
- "boolean": {
- "values": [
- "true",
- "false"
- ]
+ {
+ "boolean": "false",
+ "text": "bar"
}
- },
- "isDefault": false
+ ],
+ "default": false,
+ "inherited": false
}
]
}
import java.io.IOException;
import javax.annotation.Nullable;
import org.junit.Before;
-import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
+import org.sonar.api.PropertyType;
import org.sonar.api.config.PropertyDefinition;
import org.sonar.api.config.PropertyDefinitions;
+import org.sonar.api.config.PropertyFieldDefinition;
import org.sonar.api.server.ws.WebService;
import org.sonar.api.utils.System2;
import org.sonar.db.DbClient;
import org.sonarqube.ws.Settings;
import org.sonarqube.ws.Settings.ValuesWsResponse;
+import static java.util.Arrays.asList;
import static org.assertj.core.api.Java6Assertions.assertThat;
+import static org.assertj.core.api.Java6Assertions.entry;
import static org.sonar.api.web.UserRole.ADMIN;
import static org.sonar.api.web.UserRole.USER;
import static org.sonar.core.permission.GlobalPermissions.DASHBOARD_SHARING;
insertProperties(newGlobalPropertyDto().setKey("foo").setValue("one"));
ValuesWsResponse result = newRequestForGlobalProperties("foo");
- assertThat(result.getValuesList()).hasSize(1);
+ assertThat(result.getSettingsList()).hasSize(1);
- Settings.Value value = result.getValues(0);
+ Settings.Setting value = result.getSettings(0);
assertThat(value.getKey()).isEqualTo("foo");
assertThat(value.getValue()).isEqualTo("one");
- assertThat(value.getValuesCount()).isZero();
- assertThat(value.getSetValues()).isEmpty();
- assertThat(value.getIsDefault()).isFalse();
+ assertThat(value.hasValues()).isFalse();
+ assertThat(value.hasFieldsValues()).isFalse();
+ assertThat(value.getDefault()).isFalse();
}
@Test
insertProperties(newGlobalPropertyDto().setKey("global").setValue("three,four"));
ValuesWsResponse result = newRequestForGlobalProperties("default", "global");
- assertThat(result.getValuesList()).hasSize(2);
+ assertThat(result.getSettingsList()).hasSize(2);
- Settings.Value foo = result.getValues(0);
+ Settings.Setting foo = result.getSettings(0);
assertThat(foo.getKey()).isEqualTo("default");
assertThat(foo.hasValue()).isFalse();
- assertThat(foo.getValuesList()).containsOnly("one", "two");
- assertThat(foo.getSetValues()).isEmpty();
+ assertThat(foo.getValues().getValuesList()).containsOnly("one", "two");
+ assertThat(foo.hasFieldsValues()).isFalse();
- Settings.Value bar = result.getValues(1);
+ Settings.Setting bar = result.getSettings(1);
assertThat(bar.getKey()).isEqualTo("global");
assertThat(bar.hasValue()).isFalse();
- assertThat(bar.getValuesList()).containsOnly("three", "four");
- assertThat(bar.getSetValues()).isEmpty();
+ assertThat(bar.getValues().getValuesList()).containsOnly("three", "four");
+ assertThat(bar.hasFieldsValues()).isFalse();
+ }
+
+ @Test
+ public void return_property_set() throws Exception {
+ setUserAsSystemAdmin();
+ propertyDefinitions.addComponent(PropertyDefinition
+ .builder("foo")
+ .type(PropertyType.PROPERTY_SET)
+ .fields(asList(
+ PropertyFieldDefinition.build("key").name("Key").build(),
+ PropertyFieldDefinition.build("size").name("Size").build()))
+ .build());
+ insertProperties(
+ newGlobalPropertyDto().setKey("foo").setValue("1,2"),
+ newGlobalPropertyDto().setKey("foo.1.key").setValue("key1"),
+ newGlobalPropertyDto().setKey("foo.1.size").setValue("size1"),
+ newGlobalPropertyDto().setKey("foo.2.key").setValue("key2"));
+
+ ValuesWsResponse result = newRequestForGlobalProperties("foo");
+ assertThat(result.getSettingsList()).hasSize(1);
+
+ Settings.Setting value = result.getSettings(0);
+ assertThat(value.getKey()).isEqualTo("foo");
+ assertThat(value.hasValue()).isFalse();
+ assertThat(value.hasValues()).isFalse();
+
+ assertThat(value.getFieldsValues().getFieldsValuesList()).hasSize(2);
+ assertThat(value.getFieldsValues().getFieldsValuesList().get(0).getValue()).containsOnly(entry("key", "key1"), entry("size", "size1"));
+ assertThat(value.getFieldsValues().getFieldsValuesList().get(1).getValue()).containsOnly(entry("key", "key2"));
+ }
+
+ @Test
+ public void return_property_set_for_component() throws Exception {
+ setUserAsSystemAdmin();
+ propertyDefinitions.addComponent(PropertyDefinition
+ .builder("foo")
+ .type(PropertyType.PROPERTY_SET)
+ .fields(asList(
+ PropertyFieldDefinition.build("key").name("Key").build(),
+ PropertyFieldDefinition.build("size").name("Size").build()))
+ .build());
+ insertProperties(
+ newComponentPropertyDto(project).setKey("foo").setValue("1,2"),
+ newComponentPropertyDto(project).setKey("foo.1.key").setValue("key1"),
+ newComponentPropertyDto(project).setKey("foo.1.size").setValue("size1"),
+ newComponentPropertyDto(project).setKey("foo.2.key").setValue("key2"));
+
+ ValuesWsResponse result = newRequestForProjectProperties("foo");
+ assertThat(result.getSettingsList()).hasSize(1);
+
+ Settings.Setting value = result.getSettings(0);
+ assertThat(value.getKey()).isEqualTo("foo");
+ assertThat(value.hasValue()).isFalse();
+ assertThat(value.hasValues()).isFalse();
+
+ assertThat(value.getFieldsValues().getFieldsValuesList()).hasSize(2);
+ assertThat(value.getFieldsValues().getFieldsValuesList().get(0).getValue()).containsOnly(entry("key", "key1"), entry("size", "size1"));
+ assertThat(value.getFieldsValues().getFieldsValuesList().get(1).getValue()).containsOnly(entry("key", "key2"));
}
@Test
.build());
ValuesWsResponse result = newRequestForGlobalProperties("foo");
- assertThat(result.getValuesList()).hasSize(1);
+ assertThat(result.getSettingsList()).hasSize(1);
- Settings.Value value = result.getValues(0);
+ Settings.Setting value = result.getSettings(0);
assertThat(value.getKey()).isEqualTo("foo");
assertThat(value.getValue()).isEqualTo("default");
- assertThat(value.getIsDefault()).isTrue();
- assertThat(value.getIsInherited()).isFalse();
+ assertThat(value.getDefault()).isTrue();
+ assertThat(value.getInherited()).isFalse();
}
@Test
newGlobalPropertyDto().setKey("property").setValue("one"));
ValuesWsResponse result = newRequestForGlobalProperties("property");
- assertThat(result.getValuesList()).hasSize(1);
+ assertThat(result.getSettingsList()).hasSize(1);
- Settings.Value globalPropertyValue = result.getValues(0);
+ Settings.Setting globalPropertyValue = result.getSettings(0);
assertThat(globalPropertyValue.getKey()).isEqualTo("property");
assertThat(globalPropertyValue.getValue()).isEqualTo("one");
- assertThat(globalPropertyValue.getIsDefault()).isFalse();
- assertThat(globalPropertyValue.getIsInherited()).isFalse();
+ assertThat(globalPropertyValue.getDefault()).isFalse();
+ assertThat(globalPropertyValue.getInherited()).isFalse();
}
@Test
- public void return_component_values() throws Exception {
+ public void return_project_values() throws Exception {
setUserAsSystemAdmin();
propertyDefinitions.addComponent(PropertyDefinition.builder("property").defaultValue("default").build());
insertProperties(
newComponentPropertyDto(project).setKey("property").setValue("two"));
ValuesWsResponse result = newRequestForProjectProperties("property");
- assertThat(result.getValuesList()).hasSize(1);
+ assertThat(result.getSettingsList()).hasSize(1);
- Settings.Value globalPropertyValue = result.getValues(0);
+ Settings.Setting globalPropertyValue = result.getSettings(0);
assertThat(globalPropertyValue.getKey()).isEqualTo("property");
assertThat(globalPropertyValue.getValue()).isEqualTo("two");
- assertThat(globalPropertyValue.getIsDefault()).isFalse();
- assertThat(globalPropertyValue.getIsInherited()).isFalse();
+ assertThat(globalPropertyValue.getDefault()).isFalse();
+ assertThat(globalPropertyValue.getInherited()).isFalse();
}
@Test
insertProperties(newGlobalPropertyDto().setKey("property").setValue("one"));
ValuesWsResponse result = newRequestForProjectProperties("property");
- assertThat(result.getValuesList()).hasSize(1);
+ assertThat(result.getSettingsList()).hasSize(1);
- Settings.Value globalPropertyValue = result.getValues(0);
+ Settings.Setting globalPropertyValue = result.getSettings(0);
assertThat(globalPropertyValue.getKey()).isEqualTo("property");
assertThat(globalPropertyValue.getValue()).isEqualTo("one");
- assertThat(globalPropertyValue.getIsDefault()).isFalse();
- assertThat(globalPropertyValue.getIsInherited()).isTrue();
+ assertThat(globalPropertyValue.getDefault()).isFalse();
+ assertThat(globalPropertyValue.getInherited()).isTrue();
}
@Test
insertProperties(newGlobalPropertyDto().setKey("globalPropertyWithoutDefinition").setValue("value"));
ValuesWsResponse result = newRequestForGlobalProperties("globalPropertyWithoutDefinition");
- Settings.Value globalPropertyWithoutDefinitionValue = result.getValues(0);
+ Settings.Setting globalPropertyWithoutDefinitionValue = result.getSettings(0);
assertThat(globalPropertyWithoutDefinitionValue.getKey()).isEqualTo("globalPropertyWithoutDefinition");
assertThat(globalPropertyWithoutDefinitionValue.getValue()).isEqualTo("value");
- assertThat(globalPropertyWithoutDefinitionValue.getIsDefault()).isFalse();
+ assertThat(globalPropertyWithoutDefinitionValue.getDefault()).isFalse();
}
@Test
propertyDefinitions.addComponent(PropertyDefinition
.builder("foo")
.build());
- insertProperties(newGlobalPropertyDto().setKey("bar").setValue(""));
- ValuesWsResponse result = newRequestForGlobalProperties("foo", "bar");
- assertThat(result.getValuesList()).isEmpty();
+ ValuesWsResponse result = newRequestForGlobalProperties("foo");
+ assertThat(result.getSettingsList()).isEmpty();
}
@Test
insertProperties(newGlobalPropertyDto().setKey("bar").setValue(""));
ValuesWsResponse result = newRequestForGlobalProperties("unknown");
- assertThat(result.getValuesList()).isEmpty();
+ assertThat(result.getSettingsList()).isEmpty();
}
@Test
- @Ignore
public void test_example_json_response() {
setUserAsSystemAdmin();
propertyDefinitions.addComponent(PropertyDefinition
.builder("sonar.test.jira")
.defaultValue("abc")
.build());
+ propertyDefinitions.addComponent(PropertyDefinition
+ .builder("sonar.autogenerated")
+ .multiValues(true)
+ .build());
+ insertProperties(newGlobalPropertyDto().setKey("sonar.autogenerated").setValue("val1,val2,val3"));
+
+ propertyDefinitions.addComponent(PropertyDefinition
+ .builder("sonar.demo")
+ .type(PropertyType.PROPERTY_SET)
+ .fields(PropertyFieldDefinition.build("text").name("Text").build(),
+ PropertyFieldDefinition.build("boolean").name("Boolean").build())
+ .build());
+ insertProperties(
+ newGlobalPropertyDto().setKey("sonar.demo").setValue("1,2"),
+ newGlobalPropertyDto().setKey("sonar.demo.1.text").setValue("foo"),
+ newGlobalPropertyDto().setKey("sonar.demo.1.boolean").setValue("true"),
+ newGlobalPropertyDto().setKey("sonar.demo.2.text").setValue("bar"),
+ newGlobalPropertyDto().setKey("sonar.demo.2.boolean").setValue("false"));
String result = ws.newRequest()
.setParam("keys", "sonar.test.jira,sonar.autogenerated,sonar.demo")
// Response of GET api/settings/values
message ValuesWsResponse {
- repeated Value values = 1;
+ repeated Setting settings = 1;
}
-message Value {
+message Setting {
optional string key = 1;
optional string value = 2;
- repeated string values = 3;
- map<string, SetValue> setValues = 4;
- optional bool isDefault = 5;
- optional bool isInherited = 6;
+ optional Values values = 3;
+ optional FieldsValues fieldsValues = 4;
+ optional bool default = 5;
+ optional bool inherited = 6;
}
-message SetValue {
+message Values {
repeated string values = 1;
}
+message FieldsValues {
+ repeated Value fieldsValues = 1;
+
+ message Value {
+ map<string, string> value = 1;
+ }
+}
+
+
+