aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-plugin-api/src/main/java/org/sonar/api/config
diff options
context:
space:
mode:
authorJulien HENRY <julien.henry@sonarsource.com>2013-05-20 13:49:13 +0200
committerJulien HENRY <julien.henry@sonarsource.com>2013-05-20 14:47:40 +0200
commit2870e3114a698d24f17a554281b8696f52da5978 (patch)
treeb877a9c6ad5f00bbebde51d89f93f5afd9dba969 /sonar-plugin-api/src/main/java/org/sonar/api/config
parentae188fbbf4d9871adff1815fa4d69c7c0fc62104 (diff)
downloadsonarqube-2870e3114a698d24f17a554281b8696f52da5978.tar.gz
sonarqube-2870e3114a698d24f17a554281b8696f52da5978.zip
SONAR-4340 Display additional properties on licenses
Diffstat (limited to 'sonar-plugin-api/src/main/java/org/sonar/api/config')
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/config/License.java28
1 files changed, 23 insertions, 5 deletions
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/config/License.java b/sonar-plugin-api/src/main/java/org/sonar/api/config/License.java
index 8c23b1a641e..12d22ab6af1 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/config/License.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/config/License.java
@@ -27,6 +27,7 @@ import org.apache.commons.lang.StringUtils;
import org.sonar.api.utils.DateUtils;
import javax.annotation.Nullable;
+
import java.io.IOException;
import java.io.StringReader;
import java.util.Calendar;
@@ -46,13 +47,30 @@ public final class License {
private String expirationDate;
private String type;
private String server;
+ private Map<String, String> additionalProperties;
private License(Map<String, String> properties) {
- product = StringUtils.defaultString(properties.get("Product"), properties.get("Plugin"));
- organization = StringUtils.defaultString(properties.get("Organisation"), properties.get("Name"));
- expirationDate = StringUtils.defaultString(properties.get("Expiration"), properties.get("Expires"));
- type = properties.get("Type");
- server = properties.get("Server");
+ this.additionalProperties = Maps.newHashMap(properties);
+ product = StringUtils.defaultString(get("Product", properties), get("Plugin", properties));
+ organization = StringUtils.defaultString(get("Organisation", properties), get("Name", properties));
+ expirationDate = StringUtils.defaultString(get("Expiration", properties), get("Expires", properties));
+ type = get("Type", properties);
+ server = get("Server", properties);
+ // SONAR-4340 Don't expose Digest property
+ additionalProperties.remove("Digest");
+ }
+
+ private String get(String key, Map<String, String> properties) {
+ additionalProperties.remove(key);
+ return properties.get(key);
+ }
+
+ /**
+ * Get additional properties available on this license (like threshold conditions)
+ * @since 3.6
+ */
+ public Map<String, String> additionalProperties() {
+ return additionalProperties;
}
@Nullable