{"action":"created","comment":{"url":"https://api.github.com/repos/SonarSource/sonarqube/pulls/comments/32396322","id":32396322,"diff_hunk":"@@ -36,40 +42,100 @@\n   private final Level dataLevel;\n   @Nullable\n   private QualityGateStatus qualityGateStatus;\n+  @Nullable\n+  private MeasureVariations variations;\n+  @Nullable\n+  private String description;\n \n-  protected MeasureImpl(ValueType valueType, @Nullable Double value, @Nullable String data, @Nullable Level dataLevel) {\n+  private MeasureImpl(ValueType valueType, @Nullable Integer ruleId, @Nullable Integer characteristicId, @Nullable Double value, @Nullable String data, @Nullable Level dataLevel) {\n     this.valueType = valueType;\n+    this.ruleId = ruleId;\n+    this.characteristicId = characteristicId;\n     this.value = value;\n     this.data = data;\n     this.dataLevel = dataLevel;\n   }\n \n-  public static MeasureImpl create(boolean value, @Nullable String data) {\n-    return new MeasureImpl(ValueType.BOOLEAN, value ? 1.0d : 0.0d, data, null);\n+  public static Builder builder() {\n+    return new Builder();\n   }\n \n-  public static MeasureImpl create(int value, @Nullable String data) {\n-    return new MeasureImpl(ValueType.INT, (double) value, data, null);\n-  }\n+  public static final class Builder {\n+    public static final String RULE_AND_CHARACTERISTIC_ERROR_MSG = \"A measure can not be associated to both a Characteristic and a Rule\";\n+    private Integer ruleId;\n+    private Integer characteristicId;\n \n-  public static MeasureImpl create(long value, @Nullable String data) {\n-    return new MeasureImpl(ValueType.LONG, (double) value, data, null);\n-  }\n+    /**\n+     * Sets the rule this measure is associated to.\n+     *\n+     * @throws UnsupportedOperationException if the characteristicId as already been set\n+     *\n+     * @see #forCharacteristic(int)\n+     */\n+    public Builder forRule(int ruleId) {\n+      if (characteristicId != null) {\n+        throw new UnsupportedOperationException(RULE_AND_CHARACTERISTIC_ERROR_MSG);\n+      }\n+      this.ruleId = ruleId;\n+      return this;\n+    }\n \n-  public static MeasureImpl create(double value, @Nullable String data) {\n-    return new MeasureImpl(ValueType.DOUBLE, value, data, null);\n-  }\n \n-  public static MeasureImpl create(String value) {\n-    return new MeasureImpl(ValueType.STRING, null, requireNonNull(value), null);\n+    /**\n+     * Sets the characteristic this measure is associated to.\n+     *\n+     * @throws UnsupportedOperationException if the ruleId as already been set\n+     *\n+     * @see #forCharacteristic(int)\n+     */\n+    public Builder forCharacteristic(int characteristicId) {\n+      if (ruleId != null) {\n+        throw new UnsupportedOperationException(RULE_AND_CHARACTERISTIC_ERROR_MSG);\n+      }\n+      this.characteristicId = characteristicId;\n+      return this;\n+    }\n+\n+    public MeasureImpl create(boolean value, @Nullable String data) {","path":"server/sonar-server/src/main/java/org/sonar/server/computation/measure/MeasureImpl.java","position":null,"original_position":96,"commit_id":"335f570f2dadc0f7d3a9c2a65f17c62ecef9caab","original_commit_id":"2b12a36deb7c7878817f152f69dd69ec1cff9435","user":{"login":"henryju","id":281596,"avatar_url":"https://avatars.githubusercontent.com/u/281596?v=3","gravatar_id":"","url":"https://api.github.com/users/henryju","html_url":"https://github.com/henryju","followers_url":"https://api.github.com/users/henryju/followers","following_url":"https://api.github.com/users/henryju/following{/other_user}","gists_url":"https://api.github.com/users/henryju/gists{/gist_id}","starred_url":"https://api.github.com/users/henryju/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/henryju/subscriptions","organizations_url":"https://api.github.com/users/henryju/orgs","repos_url":"https://api.github.com/users/henryju/repos","events_url":"https://api.github.com/users/henryju/events{/privacy}","received_events_url":"https://api.github.com/users/henryju/received_events","type":"User","site_admin":false},"body":"For example JIRA plugin define a \"issues\" measure with:\r\n* value = number of opened JIRA issues\r\n* data = distribution of opened JIRA issues by JIRA severity\r\n* url = JIRA filter URL","created_at":"2015-06-15T07:24:40Z","updated_at":"2015-06-15T07:24:40Z","html_url":"https://github.com/SonarSource/sonarqube/pull/375#discussion_r32396322","pull_request_url":"https://api.github.com/repos/SonarSource/sonarqube/pulls/375","_links":{"self":{"href":"https://api.github.com/repos/SonarSource/sonarqube/pulls/comments/32396322"},"html":{"href":"https://github.com/SonarSource/sonarqube/pull/375#discussion_r32396322"},"pull_request":{"href":"https://api.github.com/repos/SonarSource/sonarqube/pulls/375"}}},"pull_request":{"url":"https://api.github.com/repos/SonarSource/sonarqube/pulls/375","id":37567708,"html_url":"https://github.com/SonarSource/sonarqube/pull/375","diff_url":"https://github.com/SonarSource/sonarqube/pull/375.diff","patch_url":"https://github.com/SonarSource/sonarqube/pull/375.patch","issue_url":"https://api.github.com/repos/SonarSource/sonarqube/issues/375","number":375,"state":"open","locked":false,"title":"persist measures from repository","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 makes `PersistMeasuresStep` use the `MeasureRepository` and therefor be able to persist measures created by the compute engine","created_at":"2015-06-12T14:10:59Z","updated_at":"2015-06-15T07:24:40Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5725c2fca0abe62203608a6ef1c5d388bb2edb59","assignee":{"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},"milestone":null,"commits_url":"https://api.github.com/repos/SonarSource/sonarqube/pulls/375/commits","review_comments_url":"https://api.github.com/repos/SonarSource/sonarqube/pulls/375/comments","review_comment_url":"https://api.github.com/repos/SonarSource/sonarqube/pulls/comments{/number}","comments_url":"https://api.github.com/repos/SonarSource/sonarqube/issues/375/comments","statuses_url":"https://api.github.com/repos/SonarSource/sonarqube/statuses/335f570f2dadc0f7d3a9c2a65f17c62ecef9caab","head":{"label":"SonarSource:feature/persist_measures_from_repository","ref":"feature/persist_measures_from_repository","sha":"335f570f2dadc0f7d3a9c2a65f17c62ecef9caab","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-15T07:11:37Z","pushed_at":"2015-06-15T07:24:30Z","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":682696,"stargazers_count":639,"watchers_count":639,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":345,"mirror_url":null,"open_issues_count":11,"forks":345,"open_issues":11,"watchers":639,"default_branch":"master"}},"base":{"label":"SonarSource:master","ref":"master","sha":"a58eab01247fc0aa6bd5f4938c0412fc0e110f76","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-15T07:11:37Z","pushed_at":"2015-06-15T07:24:30Z","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":682696,"stargazers_count":639,"watchers_count":639,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":345,"mirror_url":null,"open_issues_count":11,"forks":345,"open_issues":11,"watchers":639,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/SonarSource/sonarqube/pulls/375"},"html":{"href":"https://github.com/SonarSource/sonarqube/pull/375"},"issue":{"href":"https://api.github.com/repos/SonarSource/sonarqube/issues/375"},"comments":{"href":"https://api.github.com/repos/SonarSource/sonarqube/issues/375/comments"},"review_comments":{"href":"https://api.github.com/repos/SonarSource/sonarqube/pulls/375/comments"},"review_comment":{"href":"https://api.github.com/repos/SonarSource/sonarqube/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/SonarSource/sonarqube/pulls/375/commits"},"statuses":{"href":"https://api.github.com/repos/SonarSource/sonarqube/statuses/335f570f2dadc0f7d3a9c2a65f17c62ecef9caab"}}}}