{"action":"created","comment":{"url":"https://api.github.com/repos/midasplatform/Midas/pulls/comments/59574399","id":59574399,"diff_hunk":"@@ -0,0 +1,232 @@\n+<?php\n+/*=========================================================================\n+ Midas Server\n+ Copyright Kitware SAS, 26 rue Louis Guérin, 69100 Villeurbanne, France.\n+ All rights reserved.\n+ For more information visit http://www.kitware.com/.\n+\n+ Licensed under the Apache License, Version 2.0 (the \"License\");\n+ you may not use this file except in compliance with the License.\n+ You may obtain a copy of the License at\n+\n+         http://www.apache.org/licenses/LICENSE-2.0.txt\n+\n+ Unless required by applicable law or agreed to in writing, software\n+ distributed under the License is distributed on an \"AS IS\" BASIS,\n+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ See the License for the specific language governing permissions and\n+ limitations under the License.\n+=========================================================================*/\n+\n+/** API aggregatemetricnotification component for the tracker module. */\n+class Tracker_ApiaggregatemetricnotificationComponent extends AppComponent\n+{\n+    /** @var string */\n+    public $moduleName = 'tracker';\n+\n+    /**\n+     * Delete the given aggregateMetricNotification.\n+     *\n+     * @path /tracker/aggregatemetricnotification/{id}\n+     * @http DELETE\n+     * @param id\n+     * @return void\n+     *\n+     * @param array $args parameters\n+     * @throws Exception\n+     */\n+    public function delete($args)\n+    {\n+        /** @var ApihelperComponent $apihelperComponent */\n+        $apihelperComponent = MidasLoader::loadComponent('Apihelper');\n+        $apihelperComponent->validateParams($args, array('id'));\n+        $apihelperComponent->requirePolicyScopes(array(MIDAS_API_PERMISSION_SCOPE_ADMIN_DATA));\n+\n+        /** @var int $aggregateMetricNotificationId */\n+        $aggregateMetricNotificationId = $args['id'];\n+\n+        /** @var Tracker_AggregateMetricNotificationModel $aggregateMetricNotificationModel */\n+        $aggregateMetricNotificationModel = MidasLoader::loadModel('AggregateMetricNotification', $this->moduleName);\n+        /** @var Tracker_AggregateMetricSpecModel $aggregateMetricSpecModel */\n+        $aggregateMetricSpecModel = MidasLoader::loadModel('AggregateMetricSpec', $this->moduleName);\n+\n+        /** @var Tracker_AggregateMetricNotificationDao $aggregateMetricNotificationDao */\n+        $aggregateMetricNotificationDao = $aggregateMetricNotificationModel->load($aggregateMetricNotificationId);\n+        $userDao = $apihelperComponent->getUser($args);\n+        if ($aggregateMetricSpecModel->policyCheck($aggregateMetricNotificationDao->getAggregateMetricSpec(), $userDao, MIDAS_POLICY_WRITE) === false) {\n+            throw new Exception('The aggregateMetricNotification does not exist or you do not have the necessary permission', MIDAS_INVALID_POLICY);\n+        }\n+\n+        $aggregateMetricNotificationModel->delete($aggregateMetricNotificationDao);\n+    }\n+\n+    /**\n+     * Retrieve the given aggregateMetricNotification.\n+     *\n+     * @path /tracker/aggregatemetricnotification/{id}\n+     * @http GET\n+     * @param id\n+     * @return array\n+     *\n+     * @param array $args parameters\n+     * @throws Exception\n+     */\n+    public function get($args)\n+    {\n+        /** @var ApihelperComponent $apihelperComponent */\n+        $apihelperComponent = MidasLoader::loadComponent('Apihelper');\n+        $apihelperComponent->validateParams($args, array('id'));\n+        $apihelperComponent->requirePolicyScopes(array(MIDAS_API_PERMISSION_SCOPE_READ_DATA));\n+\n+        /** @var int $aggregateMetricNotificationId */\n+        $aggregateMetricNotificationId = $args['id'];\n+\n+        /** @var Tracker_AggregateMetricNotificationModel $aggregateMetricNotificationModel */\n+        $aggregateMetricNotificationModel = MidasLoader::loadModel('AggregateMetricNotification', $this->moduleName);\n+        /** @var Tracker_AggregateMetricSpecModel $aggregateMetricSpecModel */\n+        $aggregateMetricSpecModel = MidasLoader::loadModel('AggregateMetricSpec', $this->moduleName);\n+\n+        /** @var Tracker_AggregateMetricNotificationDao $aggregateMetricNotificationDao */\n+        $aggregateMetricNotificationDao = $aggregateMetricNotificationModel->load($aggregateMetricNotificationId);\n+        $userDao = $apihelperComponent->getUser($args);\n+        if ($aggregateMetricSpecModel->policyCheck($aggregateMetricNotificationDao->getAggregateMetricSpec(), $userDao, MIDAS_POLICY_WRITE) === false) {","path":"modules/tracker/controllers/components/ApiaggregatemetricnotificationComponent.php","position":56,"original_position":92,"commit_id":"341402ecc0125d8db3fb3c518beaa9c07b0ec9fc","original_commit_id":"ce1627045f233074b19ba5aef71341eaaa7334dc","user":{"login":"cpatrick","id":115384,"avatar_url":"https://avatars.githubusercontent.com/u/115384?v=3","gravatar_id":"","url":"https://api.github.com/users/cpatrick","html_url":"https://github.com/cpatrick","followers_url":"https://api.github.com/users/cpatrick/followers","following_url":"https://api.github.com/users/cpatrick/following{/other_user}","gists_url":"https://api.github.com/users/cpatrick/gists{/gist_id}","starred_url":"https://api.github.com/users/cpatrick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cpatrick/subscriptions","organizations_url":"https://api.github.com/users/cpatrick/orgs","repos_url":"https://api.github.com/users/cpatrick/repos","events_url":"https://api.github.com/users/cpatrick/events{/privacy}","received_events_url":"https://api.github.com/users/cpatrick/received_events","type":"User","site_admin":false},"body":"MIDAS_POLICY_READ","created_at":"2016-04-13T15:55:24Z","updated_at":"2016-04-13T15:55:24Z","html_url":"https://github.com/midasplatform/Midas/pull/228#discussion_r59574399","pull_request_url":"https://api.github.com/repos/midasplatform/Midas/pulls/228","_links":{"self":{"href":"https://api.github.com/repos/midasplatform/Midas/pulls/comments/59574399"},"html":{"href":"https://github.com/midasplatform/Midas/pull/228#discussion_r59574399"},"pull_request":{"href":"https://api.github.com/repos/midasplatform/Midas/pulls/228"}}},"pull_request":{"url":"https://api.github.com/repos/midasplatform/Midas/pulls/228","id":66257141,"html_url":"https://github.com/midasplatform/Midas/pull/228","diff_url":"https://github.com/midasplatform/Midas/pull/228.diff","patch_url":"https://github.com/midasplatform/Midas/pull/228.patch","issue_url":"https://api.github.com/repos/midasplatform/Midas/issues/228","number":228,"state":"open","locked":false,"title":"Aggregregate metrics on all branches","user":{"login":"mgrauer","id":595023,"avatar_url":"https://avatars.githubusercontent.com/u/595023?v=3","gravatar_id":"","url":"https://api.github.com/users/mgrauer","html_url":"https://github.com/mgrauer","followers_url":"https://api.github.com/users/mgrauer/followers","following_url":"https://api.github.com/users/mgrauer/following{/other_user}","gists_url":"https://api.github.com/users/mgrauer/gists{/gist_id}","starred_url":"https://api.github.com/users/mgrauer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mgrauer/subscriptions","organizations_url":"https://api.github.com/users/mgrauer/orgs","repos_url":"https://api.github.com/users/mgrauer/repos","events_url":"https://api.github.com/users/mgrauer/events{/privacy}","received_events_url":"https://api.github.com/users/mgrauer/received_events","type":"User","site_admin":false},"body":"@cpatrick PTAL\r\n\r\nThis includes all the commits of #202.  I can give you a demo tomorrow.\r\n\r\nThe behavior change is to split the aggregate metrics from notifications.  Metrics defined by an aggregate metric spec will be calculated on all submissions.  Notifications will only be set by an aggregate metric notification, which defines a threshold and a branch, and can have users linked to it who will be notified when a metric is over threshold.","created_at":"2016-04-13T02:25:58Z","updated_at":"2016-04-13T15:55:24Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ed59da7228ddff654cfdfe58747834a779f2a4c5","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/midasplatform/Midas/pulls/228/commits","review_comments_url":"https://api.github.com/repos/midasplatform/Midas/pulls/228/comments","review_comment_url":"https://api.github.com/repos/midasplatform/Midas/pulls/comments{/number}","comments_url":"https://api.github.com/repos/midasplatform/Midas/issues/228/comments","statuses_url":"https://api.github.com/repos/midasplatform/Midas/statuses/341402ecc0125d8db3fb3c518beaa9c07b0ec9fc","head":{"label":"midasplatform:aggregregate_metrics_on_all_branches","ref":"aggregregate_metrics_on_all_branches","sha":"341402ecc0125d8db3fb3c518beaa9c07b0ec9fc","user":{"login":"midasplatform","id":1188892,"avatar_url":"https://avatars.githubusercontent.com/u/1188892?v=3","gravatar_id":"","url":"https://api.github.com/users/midasplatform","html_url":"https://github.com/midasplatform","followers_url":"https://api.github.com/users/midasplatform/followers","following_url":"https://api.github.com/users/midasplatform/following{/other_user}","gists_url":"https://api.github.com/users/midasplatform/gists{/gist_id}","starred_url":"https://api.github.com/users/midasplatform/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/midasplatform/subscriptions","organizations_url":"https://api.github.com/users/midasplatform/orgs","repos_url":"https://api.github.com/users/midasplatform/repos","events_url":"https://api.github.com/users/midasplatform/events{/privacy}","received_events_url":"https://api.github.com/users/midasplatform/received_events","type":"Organization","site_admin":false},"repo":{"id":18849230,"name":"Midas","full_name":"midasplatform/Midas","owner":{"login":"midasplatform","id":1188892,"avatar_url":"https://avatars.githubusercontent.com/u/1188892?v=3","gravatar_id":"","url":"https://api.github.com/users/midasplatform","html_url":"https://github.com/midasplatform","followers_url":"https://api.github.com/users/midasplatform/followers","following_url":"https://api.github.com/users/midasplatform/following{/other_user}","gists_url":"https://api.github.com/users/midasplatform/gists{/gist_id}","starred_url":"https://api.github.com/users/midasplatform/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/midasplatform/subscriptions","organizations_url":"https://api.github.com/users/midasplatform/orgs","repos_url":"https://api.github.com/users/midasplatform/repos","events_url":"https://api.github.com/users/midasplatform/events{/privacy}","received_events_url":"https://api.github.com/users/midasplatform/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/midasplatform/Midas","description":"An open-source application that enables the rapid creation of tailored, web-enabled data storage","fork":false,"url":"https://api.github.com/repos/midasplatform/Midas","forks_url":"https://api.github.com/repos/midasplatform/Midas/forks","keys_url":"https://api.github.com/repos/midasplatform/Midas/keys{/key_id}","collaborators_url":"https://api.github.com/repos/midasplatform/Midas/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/midasplatform/Midas/teams","hooks_url":"https://api.github.com/repos/midasplatform/Midas/hooks","issue_events_url":"https://api.github.com/repos/midasplatform/Midas/issues/events{/number}","events_url":"https://api.github.com/repos/midasplatform/Midas/events","assignees_url":"https://api.github.com/repos/midasplatform/Midas/assignees{/user}","branches_url":"https://api.github.com/repos/midasplatform/Midas/branches{/branch}","tags_url":"https://api.github.com/repos/midasplatform/Midas/tags","blobs_url":"https://api.github.com/repos/midasplatform/Midas/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/midasplatform/Midas/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/midasplatform/Midas/git/refs{/sha}","trees_url":"https://api.github.com/repos/midasplatform/Midas/git/trees{/sha}","statuses_url":"https://api.github.com/repos/midasplatform/Midas/statuses/{sha}","languages_url":"https://api.github.com/repos/midasplatform/Midas/languages","stargazers_url":"https://api.github.com/repos/midasplatform/Midas/stargazers","contributors_url":"https://api.github.com/repos/midasplatform/Midas/contributors","subscribers_url":"https://api.github.com/repos/midasplatform/Midas/subscribers","subscription_url":"https://api.github.com/repos/midasplatform/Midas/subscription","commits_url":"https://api.github.com/repos/midasplatform/Midas/commits{/sha}","git_commits_url":"https://api.github.com/repos/midasplatform/Midas/git/commits{/sha}","comments_url":"https://api.github.com/repos/midasplatform/Midas/comments{/number}","issue_comment_url":"https://api.github.com/repos/midasplatform/Midas/issues/comments{/number}","contents_url":"https://api.github.com/repos/midasplatform/Midas/contents/{+path}","compare_url":"https://api.github.com/repos/midasplatform/Midas/compare/{base}...{head}","merges_url":"https://api.github.com/repos/midasplatform/Midas/merges","archive_url":"https://api.github.com/repos/midasplatform/Midas/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/midasplatform/Midas/downloads","issues_url":"https://api.github.com/repos/midasplatform/Midas/issues{/number}","pulls_url":"https://api.github.com/repos/midasplatform/Midas/pulls{/number}","milestones_url":"https://api.github.com/repos/midasplatform/Midas/milestones{/number}","notifications_url":"https://api.github.com/repos/midasplatform/Midas/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/midasplatform/Midas/labels{/name}","releases_url":"https://api.github.com/repos/midasplatform/Midas/releases{/id}","deployments_url":"https://api.github.com/repos/midasplatform/Midas/deployments","created_at":"2014-04-16T17:36:18Z","updated_at":"2016-03-06T12:48:28Z","pushed_at":"2016-04-13T15:13:21Z","git_url":"git://github.com/midasplatform/Midas.git","ssh_url":"git@github.com:midasplatform/Midas.git","clone_url":"https://github.com/midasplatform/Midas.git","svn_url":"https://github.com/midasplatform/Midas","homepage":"http://www.midasplatform.org/","size":71670,"stargazers_count":9,"watchers_count":9,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":7,"mirror_url":null,"open_issues_count":39,"forks":7,"open_issues":39,"watchers":9,"default_branch":"master"}},"base":{"label":"midasplatform:master","ref":"master","sha":"47289cf1dc4f53e5e628ddd17dfb9165c0d31bfb","user":{"login":"midasplatform","id":1188892,"avatar_url":"https://avatars.githubusercontent.com/u/1188892?v=3","gravatar_id":"","url":"https://api.github.com/users/midasplatform","html_url":"https://github.com/midasplatform","followers_url":"https://api.github.com/users/midasplatform/followers","following_url":"https://api.github.com/users/midasplatform/following{/other_user}","gists_url":"https://api.github.com/users/midasplatform/gists{/gist_id}","starred_url":"https://api.github.com/users/midasplatform/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/midasplatform/subscriptions","organizations_url":"https://api.github.com/users/midasplatform/orgs","repos_url":"https://api.github.com/users/midasplatform/repos","events_url":"https://api.github.com/users/midasplatform/events{/privacy}","received_events_url":"https://api.github.com/users/midasplatform/received_events","type":"Organization","site_admin":false},"repo":{"id":18849230,"name":"Midas","full_name":"midasplatform/Midas","owner":{"login":"midasplatform","id":1188892,"avatar_url":"https://avatars.githubusercontent.com/u/1188892?v=3","gravatar_id":"","url":"https://api.github.com/users/midasplatform","html_url":"https://github.com/midasplatform","followers_url":"https://api.github.com/users/midasplatform/followers","following_url":"https://api.github.com/users/midasplatform/following{/other_user}","gists_url":"https://api.github.com/users/midasplatform/gists{/gist_id}","starred_url":"https://api.github.com/users/midasplatform/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/midasplatform/subscriptions","organizations_url":"https://api.github.com/users/midasplatform/orgs","repos_url":"https://api.github.com/users/midasplatform/repos","events_url":"https://api.github.com/users/midasplatform/events{/privacy}","received_events_url":"https://api.github.com/users/midasplatform/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/midasplatform/Midas","description":"An open-source application that enables the rapid creation of tailored, web-enabled data storage","fork":false,"url":"https://api.github.com/repos/midasplatform/Midas","forks_url":"https://api.github.com/repos/midasplatform/Midas/forks","keys_url":"https://api.github.com/repos/midasplatform/Midas/keys{/key_id}","collaborators_url":"https://api.github.com/repos/midasplatform/Midas/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/midasplatform/Midas/teams","hooks_url":"https://api.github.com/repos/midasplatform/Midas/hooks","issue_events_url":"https://api.github.com/repos/midasplatform/Midas/issues/events{/number}","events_url":"https://api.github.com/repos/midasplatform/Midas/events","assignees_url":"https://api.github.com/repos/midasplatform/Midas/assignees{/user}","branches_url":"https://api.github.com/repos/midasplatform/Midas/branches{/branch}","tags_url":"https://api.github.com/repos/midasplatform/Midas/tags","blobs_url":"https://api.github.com/repos/midasplatform/Midas/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/midasplatform/Midas/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/midasplatform/Midas/git/refs{/sha}","trees_url":"https://api.github.com/repos/midasplatform/Midas/git/trees{/sha}","statuses_url":"https://api.github.com/repos/midasplatform/Midas/statuses/{sha}","languages_url":"https://api.github.com/repos/midasplatform/Midas/languages","stargazers_url":"https://api.github.com/repos/midasplatform/Midas/stargazers","contributors_url":"https://api.github.com/repos/midasplatform/Midas/contributors","subscribers_url":"https://api.github.com/repos/midasplatform/Midas/subscribers","subscription_url":"https://api.github.com/repos/midasplatform/Midas/subscription","commits_url":"https://api.github.com/repos/midasplatform/Midas/commits{/sha}","git_commits_url":"https://api.github.com/repos/midasplatform/Midas/git/commits{/sha}","comments_url":"https://api.github.com/repos/midasplatform/Midas/comments{/number}","issue_comment_url":"https://api.github.com/repos/midasplatform/Midas/issues/comments{/number}","contents_url":"https://api.github.com/repos/midasplatform/Midas/contents/{+path}","compare_url":"https://api.github.com/repos/midasplatform/Midas/compare/{base}...{head}","merges_url":"https://api.github.com/repos/midasplatform/Midas/merges","archive_url":"https://api.github.com/repos/midasplatform/Midas/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/midasplatform/Midas/downloads","issues_url":"https://api.github.com/repos/midasplatform/Midas/issues{/number}","pulls_url":"https://api.github.com/repos/midasplatform/Midas/pulls{/number}","milestones_url":"https://api.github.com/repos/midasplatform/Midas/milestones{/number}","notifications_url":"https://api.github.com/repos/midasplatform/Midas/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/midasplatform/Midas/labels{/name}","releases_url":"https://api.github.com/repos/midasplatform/Midas/releases{/id}","deployments_url":"https://api.github.com/repos/midasplatform/Midas/deployments","created_at":"2014-04-16T17:36:18Z","updated_at":"2016-03-06T12:48:28Z","pushed_at":"2016-04-13T15:13:21Z","git_url":"git://github.com/midasplatform/Midas.git","ssh_url":"git@github.com:midasplatform/Midas.git","clone_url":"https://github.com/midasplatform/Midas.git","svn_url":"https://github.com/midasplatform/Midas","homepage":"http://www.midasplatform.org/","size":71670,"stargazers_count":9,"watchers_count":9,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":7,"mirror_url":null,"open_issues_count":39,"forks":7,"open_issues":39,"watchers":9,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/midasplatform/Midas/pulls/228"},"html":{"href":"https://github.com/midasplatform/Midas/pull/228"},"issue":{"href":"https://api.github.com/repos/midasplatform/Midas/issues/228"},"comments":{"href":"https://api.github.com/repos/midasplatform/Midas/issues/228/comments"},"review_comments":{"href":"https://api.github.com/repos/midasplatform/Midas/pulls/228/comments"},"review_comment":{"href":"https://api.github.com/repos/midasplatform/Midas/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/midasplatform/Midas/pulls/228/commits"},"statuses":{"href":"https://api.github.com/repos/midasplatform/Midas/statuses/341402ecc0125d8db3fb3c518beaa9c07b0ec9fc"}}}}