{"action":"created","comment":{"url":"https://api.github.com/repos/SonarSource/sonarqube/pulls/comments/32033784","id":32033784,"diff_hunk":"@@ -0,0 +1,140 @@\n+/*\n+ * SonarQube, open source software quality management tool.\n+ * Copyright (C) 2008-2014 SonarSource\n+ * mailto:contact AT sonarsource DOT com\n+ *\n+ * SonarQube is free software; you can redistribute it and/or\n+ * modify it under the terms of the GNU Lesser General Public\n+ * License as published by the Free Software Foundation; either\n+ * version 3 of the License, or (at your option) any later version.\n+ *\n+ * SonarQube is distributed in the hope that it will be useful,\n+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\n+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n+ * Lesser General Public License for more details.\n+ *\n+ * You should have received a copy of the GNU Lesser General Public License\n+ * along with this program; if not, write to the Free Software Foundation,\n+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.\n+ */\n+package org.sonar.server.computation.measure;\n+\n+import com.google.common.base.Optional;\n+import javax.annotation.CheckForNull;\n+import javax.annotation.Nullable;\n+\n+public interface Measure {\n+\n+  enum ValueType {\n+    NO_VALUE, BOOLEAN, INT, LONG, DOUBLE, STRING\n+  }\n+\n+  enum AlertStatus {\n+    OK(\"Green\"),\n+    WARN(\"Orange\"),\n+    ERROR(\"Red\");\n+\n+    private final String colorName;\n+\n+    AlertStatus(String colorName) {\n+      this.colorName = colorName;\n+    }\n+\n+    public String getColorName() {\n+      return colorName;\n+    }\n+\n+    public static Optional<Measure.AlertStatus> toAlertStatus(@Nullable String alertStatus) {\n+      if (alertStatus == null) {\n+        return Optional.absent();\n+      }\n+      try {\n+        return Optional.of(Measure.AlertStatus.valueOf(alertStatus));\n+      } catch (IllegalArgumentException e) {\n+        return Optional.absent();\n+      }\n+    }\n+  }\n+\n+  /**\n+   * The type of value stored in the measure.\n+   */\n+  ValueType getValueType();\n+\n+  /**\n+   * The value of this measure as a boolean if the type is {@link Measure.ValueType#BOOLEAN}.\n+   *\n+   * @throws IllegalStateException if the value type of the measure is not {@link Measure.ValueType#BOOLEAN}\n+   */\n+  boolean getBooleanValue();\n+\n+  /**\n+   * The value of this measure as a int if the type is {@link Measure.ValueType#INT}.\n+   *\n+   * @throws IllegalStateException if the value type of the measure is not {@link Measure.ValueType#INT}\n+   */\n+  int getIntValue();\n+\n+  /**\n+   * The value of this measure as a long if the type is {@link Measure.ValueType#LONG}.\n+   *\n+   * @throws IllegalStateException if the value type of the measure is not {@link Measure.ValueType#LONG}\n+   */\n+  long getLongValue();\n+\n+  /**\n+   * The value of this measure as a double if the type is {@link Measure.ValueType#DOUBLE}.\n+   *\n+   * @throws IllegalStateException if the value type of the measure is not {@link Measure.ValueType#DOUBLE}\n+   */\n+  double getDoubleValue();\n+\n+  /**\n+   * The value of this measure as a String if the type is {@link Measure.ValueType#STRING}.\n+   *\n+   * @throws IllegalStateException if the value type of the measure is not {@link Measure.ValueType#STRING}\n+   */\n+  String getStringValue();\n+\n+  /**\n+   * The data of this measure if it exists.\n+   * <p>\n+   * If the measure type is {@link Measure.ValueType#STRING}, the value returned by this function is the same as {@link #getStringValue()}.\n+   * </p>\n+   *\n+   * @throws IllegalStateException if the value type of the measure is not {@link Measure.ValueType#BOOLEAN}\n+   */\n+  @CheckForNull\n+  String getData();\n+\n+  /**\n+   * Any Measure, which ever is its value type, can have an alert status.\n+   */\n+  boolean hasAlertStatus();\n+\n+  /**\n+   * The alert status for this measure.\n+   * <strong>Don't call this method unless you've checked the result of {@link #hasAlertStatus()} first</strong>\n+   *\n+   * @throws IllegalStateException if the measure has no alert status\n+   */\n+  AlertStatus getAlertStatus();\n+\n+  /**\n+   * Any Measure, which ever is its value type, can have an alert status.\n+   * <p>It does not make sense to have an alert text without an alert status but nothing enforces this consistency\n+   * as the measure level</p>\n+   */\n+  boolean hasAlertText();\n+\n+  /**\n+   * The alert text for this measure.\n+   * <strong>Don't call this method unless you've checked the result of {@link #hasAlertText()} first</strong>\n+   *\n+   * @throws IllegalStateException if the measure has no alert text\n+   */\n+  String getAlertText();\n+\n+  Integer getSeverityIndex();","path":"server/sonar-server/src/main/java/org/sonar/server/computation/measure/Measure.java","position":138,"original_position":138,"commit_id":"f10db0dfb550a805bcac9949890e58f04a264d3e","original_commit_id":"f10db0dfb550a805bcac9949890e58f04a264d3e","user":{"login":"simonbrandhof","id":414010,"avatar_url":"https://avatars.githubusercontent.com/u/414010?v=3","gravatar_id":"","url":"https://api.github.com/users/simonbrandhof","html_url":"https://github.com/simonbrandhof","followers_url":"https://api.github.com/users/simonbrandhof/followers","following_url":"https://api.github.com/users/simonbrandhof/following{/other_user}","gists_url":"https://api.github.com/users/simonbrandhof/gists{/gist_id}","starred_url":"https://api.github.com/users/simonbrandhof/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/simonbrandhof/subscriptions","organizations_url":"https://api.github.com/users/simonbrandhof/orgs","repos_url":"https://api.github.com/users/simonbrandhof/repos","events_url":"https://api.github.com/users/simonbrandhof/events{/privacy}","received_events_url":"https://api.github.com/users/simonbrandhof/received_events","type":"User","site_admin":false},"body":"This is a db-specific value isn't it ? In this case it should not be here.","created_at":"2015-06-09T16:35:27Z","updated_at":"2015-06-09T16:35:27Z","html_url":"https://github.com/SonarSource/sonarqube/pull/360#discussion_r32033784","pull_request_url":"https://api.github.com/repos/SonarSource/sonarqube/pulls/360","_links":{"self":{"href":"https://api.github.com/repos/SonarSource/sonarqube/pulls/comments/32033784"},"html":{"href":"https://github.com/SonarSource/sonarqube/pull/360#discussion_r32033784"},"pull_request":{"href":"https://api.github.com/repos/SonarSource/sonarqube/pulls/360"}}},"pull_request":{"url":"https://api.github.com/repos/SonarSource/sonarqube/pulls/360","id":37260216,"html_url":"https://github.com/SonarSource/sonarqube/pull/360","diff_url":"https://github.com/SonarSource/sonarqube/pull/360.diff","patch_url":"https://github.com/SonarSource/sonarqube/pull/360.patch","issue_url":"https://api.github.com/repos/SonarSource/sonarqube/issues/360","number":360,"state":"open","locked":false,"title":"add storage to MeasureRepository, add a MetricRepository and add qualitygate to ce","user":{"login":"sns-seb","id":11717580,"avatar_url":"https://avatars.githubusercontent.com/u/11717580?v=3","gravatar_id":"","url":"https://api.github.com/users/sns-seb","html_url":"https://github.com/sns-seb","followers_url":"https://api.github.com/users/sns-seb/followers","following_url":"https://api.github.com/users/sns-seb/following{/other_user}","gists_url":"https://api.github.com/users/sns-seb/gists{/gist_id}","starred_url":"https://api.github.com/users/sns-seb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sns-seb/subscriptions","organizations_url":"https://api.github.com/users/sns-seb/orgs","repos_url":"https://api.github.com/users/sns-seb/repos","events_url":"https://api.github.com/users/sns-seb/events{/privacy}","received_events_url":"https://api.github.com/users/sns-seb/received_events","type":"User","site_admin":false},"body":"this PR adds the following:\r\n* a CE specific interface Metric and a MetricRepository\r\n* adds the QualityGate to the CE container via the QualityGateHolder\r\n* adds possibility to stored new Measure into MeasureRepository\r\n    * (WARNING) Measure added to MeasureRepository are not yet persisted into DB","created_at":"2015-06-09T14:37:45Z","updated_at":"2015-06-09T16:35:27Z","closed_at":null,"merged_at":null,"merge_commit_sha":"61e23c9282eadd4cf7f078949eabbe963326352a","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/SonarSource/sonarqube/pulls/360/commits","review_comments_url":"https://api.github.com/repos/SonarSource/sonarqube/pulls/360/comments","review_comment_url":"https://api.github.com/repos/SonarSource/sonarqube/pulls/comments{/number}","comments_url":"https://api.github.com/repos/SonarSource/sonarqube/issues/360/comments","statuses_url":"https://api.github.com/repos/SonarSource/sonarqube/statuses/f10db0dfb550a805bcac9949890e58f04a264d3e","head":{"label":"SonarSource:feature/add_qualitygate_to_CE","ref":"feature/add_qualitygate_to_CE","sha":"f10db0dfb550a805bcac9949890e58f04a264d3e","user":{"login":"SonarSource","id":545988,"avatar_url":"https://avatars.githubusercontent.com/u/545988?v=3","gravatar_id":"","url":"https://api.github.com/users/SonarSource","html_url":"https://github.com/SonarSource","followers_url":"https://api.github.com/users/SonarSource/followers","following_url":"https://api.github.com/users/SonarSource/following{/other_user}","gists_url":"https://api.github.com/users/SonarSource/gists{/gist_id}","starred_url":"https://api.github.com/users/SonarSource/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SonarSource/subscriptions","organizations_url":"https://api.github.com/users/SonarSource/orgs","repos_url":"https://api.github.com/users/SonarSource/repos","events_url":"https://api.github.com/users/SonarSource/events{/privacy}","received_events_url":"https://api.github.com/users/SonarSource/received_events","type":"Organization","site_admin":false},"repo":{"id":1222504,"name":"sonarqube","full_name":"SonarSource/sonarqube","owner":{"login":"SonarSource","id":545988,"avatar_url":"https://avatars.githubusercontent.com/u/545988?v=3","gravatar_id":"","url":"https://api.github.com/users/SonarSource","html_url":"https://github.com/SonarSource","followers_url":"https://api.github.com/users/SonarSource/followers","following_url":"https://api.github.com/users/SonarSource/following{/other_user}","gists_url":"https://api.github.com/users/SonarSource/gists{/gist_id}","starred_url":"https://api.github.com/users/SonarSource/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SonarSource/subscriptions","organizations_url":"https://api.github.com/users/SonarSource/orgs","repos_url":"https://api.github.com/users/SonarSource/repos","events_url":"https://api.github.com/users/SonarSource/events{/privacy}","received_events_url":"https://api.github.com/users/SonarSource/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/SonarSource/sonarqube","description":"Put your technical debt under control","fork":false,"url":"https://api.github.com/repos/SonarSource/sonarqube","forks_url":"https://api.github.com/repos/SonarSource/sonarqube/forks","keys_url":"https://api.github.com/repos/SonarSource/sonarqube/keys{/key_id}","collaborators_url":"https://api.github.com/repos/SonarSource/sonarqube/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/SonarSource/sonarqube/teams","hooks_url":"https://api.github.com/repos/SonarSource/sonarqube/hooks","issue_events_url":"https://api.github.com/repos/SonarSource/sonarqube/issues/events{/number}","events_url":"https://api.github.com/repos/SonarSource/sonarqube/events","assignees_url":"https://api.github.com/repos/SonarSource/sonarqube/assignees{/user}","branches_url":"https://api.github.com/repos/SonarSource/sonarqube/branches{/branch}","tags_url":"https://api.github.com/repos/SonarSource/sonarqube/tags","blobs_url":"https://api.github.com/repos/SonarSource/sonarqube/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/SonarSource/sonarqube/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/SonarSource/sonarqube/git/refs{/sha}","trees_url":"https://api.github.com/repos/SonarSource/sonarqube/git/trees{/sha}","statuses_url":"https://api.github.com/repos/SonarSource/sonarqube/statuses/{sha}","languages_url":"https://api.github.com/repos/SonarSource/sonarqube/languages","stargazers_url":"https://api.github.com/repos/SonarSource/sonarqube/stargazers","contributors_url":"https://api.github.com/repos/SonarSource/sonarqube/contributors","subscribers_url":"https://api.github.com/repos/SonarSource/sonarqube/subscribers","subscription_url":"https://api.github.com/repos/SonarSource/sonarqube/subscription","commits_url":"https://api.github.com/repos/SonarSource/sonarqube/commits{/sha}","git_commits_url":"https://api.github.com/repos/SonarSource/sonarqube/git/commits{/sha}","comments_url":"https://api.github.com/repos/SonarSource/sonarqube/comments{/number}","issue_comment_url":"https://api.github.com/repos/SonarSource/sonarqube/issues/comments{/number}","contents_url":"https://api.github.com/repos/SonarSource/sonarqube/contents/{+path}","compare_url":"https://api.github.com/repos/SonarSource/sonarqube/compare/{base}...{head}","merges_url":"https://api.github.com/repos/SonarSource/sonarqube/merges","archive_url":"https://api.github.com/repos/SonarSource/sonarqube/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/SonarSource/sonarqube/downloads","issues_url":"https://api.github.com/repos/SonarSource/sonarqube/issues{/number}","pulls_url":"https://api.github.com/repos/SonarSource/sonarqube/pulls{/number}","milestones_url":"https://api.github.com/repos/SonarSource/sonarqube/milestones{/number}","notifications_url":"https://api.github.com/repos/SonarSource/sonarqube/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/SonarSource/sonarqube/labels{/name}","releases_url":"https://api.github.com/repos/SonarSource/sonarqube/releases{/id}","created_at":"2011-01-05T11:05:17Z","updated_at":"2015-06-09T01:55:21Z","pushed_at":"2015-06-09T16:12:26Z","git_url":"git://github.com/SonarSource/sonarqube.git","ssh_url":"git@github.com:SonarSource/sonarqube.git","clone_url":"https://github.com/SonarSource/sonarqube.git","svn_url":"https://github.com/SonarSource/sonarqube","homepage":"http://www.sonarqube.org","size":681180,"stargazers_count":632,"watchers_count":632,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":343,"mirror_url":null,"open_issues_count":8,"forks":343,"open_issues":8,"watchers":632,"default_branch":"master"}},"base":{"label":"SonarSource:master","ref":"master","sha":"0404abda61c69d4b9f9a7d1c551e9a563d90bbd5","user":{"login":"SonarSource","id":545988,"avatar_url":"https://avatars.githubusercontent.com/u/545988?v=3","gravatar_id":"","url":"https://api.github.com/users/SonarSource","html_url":"https://github.com/SonarSource","followers_url":"https://api.github.com/users/SonarSource/followers","following_url":"https://api.github.com/users/SonarSource/following{/other_user}","gists_url":"https://api.github.com/users/SonarSource/gists{/gist_id}","starred_url":"https://api.github.com/users/SonarSource/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SonarSource/subscriptions","organizations_url":"https://api.github.com/users/SonarSource/orgs","repos_url":"https://api.github.com/users/SonarSource/repos","events_url":"https://api.github.com/users/SonarSource/events{/privacy}","received_events_url":"https://api.github.com/users/SonarSource/received_events","type":"Organization","site_admin":false},"repo":{"id":1222504,"name":"sonarqube","full_name":"SonarSource/sonarqube","owner":{"login":"SonarSource","id":545988,"avatar_url":"https://avatars.githubusercontent.com/u/545988?v=3","gravatar_id":"","url":"https://api.github.com/users/SonarSource","html_url":"https://github.com/SonarSource","followers_url":"https://api.github.com/users/SonarSource/followers","following_url":"https://api.github.com/users/SonarSource/following{/other_user}","gists_url":"https://api.github.com/users/SonarSource/gists{/gist_id}","starred_url":"https://api.github.com/users/SonarSource/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SonarSource/subscriptions","organizations_url":"https://api.github.com/users/SonarSource/orgs","repos_url":"https://api.github.com/users/SonarSource/repos","events_url":"https://api.github.com/users/SonarSource/events{/privacy}","received_events_url":"https://api.github.com/users/SonarSource/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/SonarSource/sonarqube","description":"Put your technical debt under control","fork":false,"url":"https://api.github.com/repos/SonarSource/sonarqube","forks_url":"https://api.github.com/repos/SonarSource/sonarqube/forks","keys_url":"https://api.github.com/repos/SonarSource/sonarqube/keys{/key_id}","collaborators_url":"https://api.github.com/repos/SonarSource/sonarqube/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/SonarSource/sonarqube/teams","hooks_url":"https://api.github.com/repos/SonarSource/sonarqube/hooks","issue_events_url":"https://api.github.com/repos/SonarSource/sonarqube/issues/events{/number}","events_url":"https://api.github.com/repos/SonarSource/sonarqube/events","assignees_url":"https://api.github.com/repos/SonarSource/sonarqube/assignees{/user}","branches_url":"https://api.github.com/repos/SonarSource/sonarqube/branches{/branch}","tags_url":"https://api.github.com/repos/SonarSource/sonarqube/tags","blobs_url":"https://api.github.com/repos/SonarSource/sonarqube/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/SonarSource/sonarqube/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/SonarSource/sonarqube/git/refs{/sha}","trees_url":"https://api.github.com/repos/SonarSource/sonarqube/git/trees{/sha}","statuses_url":"https://api.github.com/repos/SonarSource/sonarqube/statuses/{sha}","languages_url":"https://api.github.com/repos/SonarSource/sonarqube/languages","stargazers_url":"https://api.github.com/repos/SonarSource/sonarqube/stargazers","contributors_url":"https://api.github.com/repos/SonarSource/sonarqube/contributors","subscribers_url":"https://api.github.com/repos/SonarSource/sonarqube/subscribers","subscription_url":"https://api.github.com/repos/SonarSource/sonarqube/subscription","commits_url":"https://api.github.com/repos/SonarSource/sonarqube/commits{/sha}","git_commits_url":"https://api.github.com/repos/SonarSource/sonarqube/git/commits{/sha}","comments_url":"https://api.github.com/repos/SonarSource/sonarqube/comments{/number}","issue_comment_url":"https://api.github.com/repos/SonarSource/sonarqube/issues/comments{/number}","contents_url":"https://api.github.com/repos/SonarSource/sonarqube/contents/{+path}","compare_url":"https://api.github.com/repos/SonarSource/sonarqube/compare/{base}...{head}","merges_url":"https://api.github.com/repos/SonarSource/sonarqube/merges","archive_url":"https://api.github.com/repos/SonarSource/sonarqube/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/SonarSource/sonarqube/downloads","issues_url":"https://api.github.com/repos/SonarSource/sonarqube/issues{/number}","pulls_url":"https://api.github.com/repos/SonarSource/sonarqube/pulls{/number}","milestones_url":"https://api.github.com/repos/SonarSource/sonarqube/milestones{/number}","notifications_url":"https://api.github.com/repos/SonarSource/sonarqube/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/SonarSource/sonarqube/labels{/name}","releases_url":"https://api.github.com/repos/SonarSource/sonarqube/releases{/id}","created_at":"2011-01-05T11:05:17Z","updated_at":"2015-06-09T01:55:21Z","pushed_at":"2015-06-09T16:12:26Z","git_url":"git://github.com/SonarSource/sonarqube.git","ssh_url":"git@github.com:SonarSource/sonarqube.git","clone_url":"https://github.com/SonarSource/sonarqube.git","svn_url":"https://github.com/SonarSource/sonarqube","homepage":"http://www.sonarqube.org","size":681180,"stargazers_count":632,"watchers_count":632,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":343,"mirror_url":null,"open_issues_count":8,"forks":343,"open_issues":8,"watchers":632,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/SonarSource/sonarqube/pulls/360"},"html":{"href":"https://github.com/SonarSource/sonarqube/pull/360"},"issue":{"href":"https://api.github.com/repos/SonarSource/sonarqube/issues/360"},"comments":{"href":"https://api.github.com/repos/SonarSource/sonarqube/issues/360/comments"},"review_comments":{"href":"https://api.github.com/repos/SonarSource/sonarqube/pulls/360/comments"},"review_comment":{"href":"https://api.github.com/repos/SonarSource/sonarqube/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/SonarSource/sonarqube/pulls/360/commits"},"statuses":{"href":"https://api.github.com/repos/SonarSource/sonarqube/statuses/f10db0dfb550a805bcac9949890e58f04a264d3e"}}}}