{"action":"created","comment":{"url":"https://api.github.com/repos/PVN-Linagora/pnv-linagora/pulls/comments/108576682","pull_request_review_id":29616261,"id":108576682,"diff_hunk":"@@ -38,90 +43,70 @@ public JPAPerUserMaxQuotaManager(EntityManagerFactory entityManagerFactory) {\n     }\n \n     @Override\n-    public void setMaxStorage(QuotaRoot quotaRoot, long maxStorageQuota) throws MailboxException {\n-        /*\n-        Question 5\n-\n-        Persist a new MaxUserStorage for this quotaRoot.\n-        Wrap it into a transaction.\n-         */\n-        throw new NotImplementedException();\n-    }\n+    public void setMaxStorage(QuotaRoot quotaRoot, long maxStorageQuota) throws MailboxException {  \t\n+    \tentityManager.getTransaction().begin();\n+    \tentityManager.merge(new MaxUserStorage(quotaRoot.getValue(),maxStorageQuota));\n+    \tentityManager.getTransaction().commit();\n+   }\n \n     @Override\n     public void setMaxMessage(QuotaRoot quotaRoot, long maxMessageCount) throws MailboxException {\n-        /*\n-        Question 6\n-\n-        Persist a new MaxUserMessageCount for this quotaRoot.\n-        Wrap it into a transaction.\n-         */\n-        throw new NotImplementedException();\n+    \tentityManager.getTransaction().begin();\n+    \tentityManager.merge(new MaxUserMessageCount(quotaRoot.getValue(),maxMessageCount));\n+    \tentityManager.getTransaction().commit();\n     }\n \n     @Override\n     public void setDefaultMaxStorage(long defaultMaxStorage) throws MailboxException {\n-        /*\n-        Question 7\n-\n-        Persist a new MaxDefaultStorage.\n-        Wrap it into a transaction.\n-         */\n-        throw new NotImplementedException();\n-    }\n+    \tentityManager.getTransaction().begin();\n+    \tentityManager.merge(new MaxDefaultStorage(defaultMaxStorage));\n+    \tentityManager.getTransaction().commit();\n+     }\n \n     @Override\n     public void setDefaultMaxMessage(long defaultMaxMessageCount) throws MailboxException {\n-        /*\n-        Question 8\n-\n-        Persist a new MaxDefaultMessageCount.\n-        Wrap it into a transaction.\n-         */\n-        throw new NotImplementedException();\n+    \tentityManager.getTransaction().begin();\n+    \tentityManager.merge(new MaxDefaultMessageCount(defaultMaxMessageCount));\n+    \tentityManager.getTransaction().commit();\n     }\n \n     @Override\n     public long getDefaultMaxStorage() throws MailboxException {\n-        /*\n-        Question 1 :\n-\n-         Retrieve the stored MaxDefaultStorage. You can use its DEFAULT_KEY.\n-         Provide a default value if absent.\n-         */\n-        throw new NotImplementedException();\n+    \tMaxDefaultStorage storedValue = entityManager.find(MaxDefaultStorage.class, MaxDefaultStorage.DEFAULT_KEY);\n+    \t\n+    \tif(storedValue == null){\n+    \t\treturn Quota.UNLIMITED;\n+    \t}\n+    \treturn storedValue.getValue();\n     }\n \n     @Override\n     public long getDefaultMaxMessage() throws MailboxException {\n-        /*\n-        Question 2 :\n-\n-         Retrieve the stored MaxDefaultMessageCount. You can use its DEFAULT_KEY.\n-         Provide a default value if absent.\n-         */\n-        throw new NotImplementedException();\n+    \tMaxDefaultMessageCount storedValue = entityManager.find(MaxDefaultMessageCount.class, MaxDefaultMessageCount.DEFAULT_KEY);\n+    \t\n+    \tif(storedValue == null){\n+    \t\treturn Quota.UNLIMITED;\n+    \t}\n+    \treturn storedValue.getValue();\n     }\n \n     @Override\n-    public long getMaxStorage(QuotaRoot quotaRoot) throws MailboxException {\n-        /*\n-        Question 3 :\n-\n-         Retrieve the stored MaxUserStorage for this quotaRoot.\n-         Provide a default value if absent.\n-         */\n-        throw new NotImplementedException();\n+    public long getMaxStorage(QuotaRoot quotaRoot) throws MailboxException {   \t\n+    \tMaxUserStorage storedValue = entityManager.find(MaxUserStorage.class, quotaRoot.getValue());\n+    \t\n+    \tif(storedValue == null){\n+    \t\treturn getDefaultMaxStorage();\n+    \t}\n+    \treturn storedValue.getValue();\n     }\n \n     @Override\n     public long getMaxMessage(QuotaRoot quotaRoot) throws MailboxException {\n-        /*\n-        Question 4 :\n-\n-         Retrieve the stored MaxUserMessageCount for this quotaRoot.\n-         Provide a default value if absent.\n-         */\n-        throw new NotImplementedException();\n+        MaxUserMessageCount storedValue = entityManager.find(MaxUserMessageCount.class,quotaRoot.getValue());","path":"src/main/java/com/linagora/pnv/jpa/quota/JPAPerUserMaxQuotaManager.java","position":136,"original_position":136,"commit_id":"4413e25e90851ca700885813cbfab2248e3e1865","original_commit_id":"4413e25e90851ca700885813cbfab2248e3e1865","user":{"login":"chibenwa","id":6928740,"avatar_url":"https://avatars2.githubusercontent.com/u/6928740?v=3","gravatar_id":"","url":"https://api.github.com/users/chibenwa","html_url":"https://github.com/chibenwa","followers_url":"https://api.github.com/users/chibenwa/followers","following_url":"https://api.github.com/users/chibenwa/following{/other_user}","gists_url":"https://api.github.com/users/chibenwa/gists{/gist_id}","starred_url":"https://api.github.com/users/chibenwa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chibenwa/subscriptions","organizations_url":"https://api.github.com/users/chibenwa/orgs","repos_url":"https://api.github.com/users/chibenwa/repos","events_url":"https://api.github.com/users/chibenwa/events{/privacy}","received_events_url":"https://api.github.com/users/chibenwa/received_events","type":"User","site_admin":false},"body":"Missing space after coma","created_at":"2017-03-29T01:46:17Z","updated_at":"2017-03-29T01:49:16Z","html_url":"https://github.com/PVN-Linagora/pnv-linagora/pull/2#discussion_r108576682","pull_request_url":"https://api.github.com/repos/PVN-Linagora/pnv-linagora/pulls/2","_links":{"self":{"href":"https://api.github.com/repos/PVN-Linagora/pnv-linagora/pulls/comments/108576682"},"html":{"href":"https://github.com/PVN-Linagora/pnv-linagora/pull/2#discussion_r108576682"},"pull_request":{"href":"https://api.github.com/repos/PVN-Linagora/pnv-linagora/pulls/2"}}},"pull_request":{"url":"https://api.github.com/repos/PVN-Linagora/pnv-linagora/pulls/2","id":113101848,"html_url":"https://github.com/PVN-Linagora/pnv-linagora/pull/2","diff_url":"https://github.com/PVN-Linagora/pnv-linagora/pull/2.diff","patch_url":"https://github.com/PVN-Linagora/pnv-linagora/pull/2.patch","issue_url":"https://api.github.com/repos/PVN-Linagora/pnv-linagora/issues/2","number":2,"state":"open","locked":false,"title":"pnv-11","user":{"login":"mainguyendn19960519","id":26568604,"avatar_url":"https://avatars2.githubusercontent.com/u/26568604?v=3","gravatar_id":"","url":"https://api.github.com/users/mainguyendn19960519","html_url":"https://github.com/mainguyendn19960519","followers_url":"https://api.github.com/users/mainguyendn19960519/followers","following_url":"https://api.github.com/users/mainguyendn19960519/following{/other_user}","gists_url":"https://api.github.com/users/mainguyendn19960519/gists{/gist_id}","starred_url":"https://api.github.com/users/mainguyendn19960519/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mainguyendn19960519/subscriptions","organizations_url":"https://api.github.com/users/mainguyendn19960519/orgs","repos_url":"https://api.github.com/users/mainguyendn19960519/repos","events_url":"https://api.github.com/users/mainguyendn19960519/events{/privacy}","received_events_url":"https://api.github.com/users/mainguyendn19960519/received_events","type":"User","site_admin":false},"body":"PNV-11 max quota","created_at":"2017-03-29T01:39:49Z","updated_at":"2017-03-29T01:49:16Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6f015f36f02b77128bc9425b3e2790d5a02f7244","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/PVN-Linagora/pnv-linagora/pulls/2/commits","review_comments_url":"https://api.github.com/repos/PVN-Linagora/pnv-linagora/pulls/2/comments","review_comment_url":"https://api.github.com/repos/PVN-Linagora/pnv-linagora/pulls/comments{/number}","comments_url":"https://api.github.com/repos/PVN-Linagora/pnv-linagora/issues/2/comments","statuses_url":"https://api.github.com/repos/PVN-Linagora/pnv-linagora/statuses/4413e25e90851ca700885813cbfab2248e3e1865","head":{"label":"mainguyendn19960519:PNV-11","ref":"PNV-11","sha":"4413e25e90851ca700885813cbfab2248e3e1865","user":{"login":"mainguyendn19960519","id":26568604,"avatar_url":"https://avatars2.githubusercontent.com/u/26568604?v=3","gravatar_id":"","url":"https://api.github.com/users/mainguyendn19960519","html_url":"https://github.com/mainguyendn19960519","followers_url":"https://api.github.com/users/mainguyendn19960519/followers","following_url":"https://api.github.com/users/mainguyendn19960519/following{/other_user}","gists_url":"https://api.github.com/users/mainguyendn19960519/gists{/gist_id}","starred_url":"https://api.github.com/users/mainguyendn19960519/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mainguyendn19960519/subscriptions","organizations_url":"https://api.github.com/users/mainguyendn19960519/orgs","repos_url":"https://api.github.com/users/mainguyendn19960519/repos","events_url":"https://api.github.com/users/mainguyendn19960519/events{/privacy}","received_events_url":"https://api.github.com/users/mainguyendn19960519/received_events","type":"User","site_admin":false},"repo":{"id":86525260,"name":"pnv-linagora","full_name":"mainguyendn19960519/pnv-linagora","owner":{"login":"mainguyendn19960519","id":26568604,"avatar_url":"https://avatars2.githubusercontent.com/u/26568604?v=3","gravatar_id":"","url":"https://api.github.com/users/mainguyendn19960519","html_url":"https://github.com/mainguyendn19960519","followers_url":"https://api.github.com/users/mainguyendn19960519/followers","following_url":"https://api.github.com/users/mainguyendn19960519/following{/other_user}","gists_url":"https://api.github.com/users/mainguyendn19960519/gists{/gist_id}","starred_url":"https://api.github.com/users/mainguyendn19960519/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mainguyendn19960519/subscriptions","organizations_url":"https://api.github.com/users/mainguyendn19960519/orgs","repos_url":"https://api.github.com/users/mainguyendn19960519/repos","events_url":"https://api.github.com/users/mainguyendn19960519/events{/privacy}","received_events_url":"https://api.github.com/users/mainguyendn19960519/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mainguyendn19960519/pnv-linagora","description":null,"fork":true,"url":"https://api.github.com/repos/mainguyendn19960519/pnv-linagora","forks_url":"https://api.github.com/repos/mainguyendn19960519/pnv-linagora/forks","keys_url":"https://api.github.com/repos/mainguyendn19960519/pnv-linagora/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mainguyendn19960519/pnv-linagora/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mainguyendn19960519/pnv-linagora/teams","hooks_url":"https://api.github.com/repos/mainguyendn19960519/pnv-linagora/hooks","issue_events_url":"https://api.github.com/repos/mainguyendn19960519/pnv-linagora/issues/events{/number}","events_url":"https://api.github.com/repos/mainguyendn19960519/pnv-linagora/events","assignees_url":"https://api.github.com/repos/mainguyendn19960519/pnv-linagora/assignees{/user}","branches_url":"https://api.github.com/repos/mainguyendn19960519/pnv-linagora/branches{/branch}","tags_url":"https://api.github.com/repos/mainguyendn19960519/pnv-linagora/tags","blobs_url":"https://api.github.com/repos/mainguyendn19960519/pnv-linagora/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mainguyendn19960519/pnv-linagora/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mainguyendn19960519/pnv-linagora/git/refs{/sha}","trees_url":"https://api.github.com/repos/mainguyendn19960519/pnv-linagora/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mainguyendn19960519/pnv-linagora/statuses/{sha}","languages_url":"https://api.github.com/repos/mainguyendn19960519/pnv-linagora/languages","stargazers_url":"https://api.github.com/repos/mainguyendn19960519/pnv-linagora/stargazers","contributors_url":"https://api.github.com/repos/mainguyendn19960519/pnv-linagora/contributors","subscribers_url":"https://api.github.com/repos/mainguyendn19960519/pnv-linagora/subscribers","subscription_url":"https://api.github.com/repos/mainguyendn19960519/pnv-linagora/subscription","commits_url":"https://api.github.com/repos/mainguyendn19960519/pnv-linagora/commits{/sha}","git_commits_url":"https://api.github.com/repos/mainguyendn19960519/pnv-linagora/git/commits{/sha}","comments_url":"https://api.github.com/repos/mainguyendn19960519/pnv-linagora/comments{/number}","issue_comment_url":"https://api.github.com/repos/mainguyendn19960519/pnv-linagora/issues/comments{/number}","contents_url":"https://api.github.com/repos/mainguyendn19960519/pnv-linagora/contents/{+path}","compare_url":"https://api.github.com/repos/mainguyendn19960519/pnv-linagora/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mainguyendn19960519/pnv-linagora/merges","archive_url":"https://api.github.com/repos/mainguyendn19960519/pnv-linagora/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mainguyendn19960519/pnv-linagora/downloads","issues_url":"https://api.github.com/repos/mainguyendn19960519/pnv-linagora/issues{/number}","pulls_url":"https://api.github.com/repos/mainguyendn19960519/pnv-linagora/pulls{/number}","milestones_url":"https://api.github.com/repos/mainguyendn19960519/pnv-linagora/milestones{/number}","notifications_url":"https://api.github.com/repos/mainguyendn19960519/pnv-linagora/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mainguyendn19960519/pnv-linagora/labels{/name}","releases_url":"https://api.github.com/repos/mainguyendn19960519/pnv-linagora/releases{/id}","deployments_url":"https://api.github.com/repos/mainguyendn19960519/pnv-linagora/deployments","created_at":"2017-03-29T01:37:57Z","updated_at":"2017-03-29T01:37:59Z","pushed_at":"2017-03-29T01:39:20Z","git_url":"git://github.com/mainguyendn19960519/pnv-linagora.git","ssh_url":"git@github.com:mainguyendn19960519/pnv-linagora.git","clone_url":"https://github.com/mainguyendn19960519/pnv-linagora.git","svn_url":"https://github.com/mainguyendn19960519/pnv-linagora","homepage":null,"size":121,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"PVN-Linagora:PNV-11","ref":"PNV-11","sha":"d77acded8d8b5796f2b5b26d13f45fe86a4944e0","user":{"login":"PVN-Linagora","id":24774886,"avatar_url":"https://avatars2.githubusercontent.com/u/24774886?v=3","gravatar_id":"","url":"https://api.github.com/users/PVN-Linagora","html_url":"https://github.com/PVN-Linagora","followers_url":"https://api.github.com/users/PVN-Linagora/followers","following_url":"https://api.github.com/users/PVN-Linagora/following{/other_user}","gists_url":"https://api.github.com/users/PVN-Linagora/gists{/gist_id}","starred_url":"https://api.github.com/users/PVN-Linagora/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PVN-Linagora/subscriptions","organizations_url":"https://api.github.com/users/PVN-Linagora/orgs","repos_url":"https://api.github.com/users/PVN-Linagora/repos","events_url":"https://api.github.com/users/PVN-Linagora/events{/privacy}","received_events_url":"https://api.github.com/users/PVN-Linagora/received_events","type":"Organization","site_admin":false},"repo":{"id":86327991,"name":"pnv-linagora","full_name":"PVN-Linagora/pnv-linagora","owner":{"login":"PVN-Linagora","id":24774886,"avatar_url":"https://avatars2.githubusercontent.com/u/24774886?v=3","gravatar_id":"","url":"https://api.github.com/users/PVN-Linagora","html_url":"https://github.com/PVN-Linagora","followers_url":"https://api.github.com/users/PVN-Linagora/followers","following_url":"https://api.github.com/users/PVN-Linagora/following{/other_user}","gists_url":"https://api.github.com/users/PVN-Linagora/gists{/gist_id}","starred_url":"https://api.github.com/users/PVN-Linagora/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PVN-Linagora/subscriptions","organizations_url":"https://api.github.com/users/PVN-Linagora/orgs","repos_url":"https://api.github.com/users/PVN-Linagora/repos","events_url":"https://api.github.com/users/PVN-Linagora/events{/privacy}","received_events_url":"https://api.github.com/users/PVN-Linagora/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/PVN-Linagora/pnv-linagora","description":null,"fork":false,"url":"https://api.github.com/repos/PVN-Linagora/pnv-linagora","forks_url":"https://api.github.com/repos/PVN-Linagora/pnv-linagora/forks","keys_url":"https://api.github.com/repos/PVN-Linagora/pnv-linagora/keys{/key_id}","collaborators_url":"https://api.github.com/repos/PVN-Linagora/pnv-linagora/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/PVN-Linagora/pnv-linagora/teams","hooks_url":"https://api.github.com/repos/PVN-Linagora/pnv-linagora/hooks","issue_events_url":"https://api.github.com/repos/PVN-Linagora/pnv-linagora/issues/events{/number}","events_url":"https://api.github.com/repos/PVN-Linagora/pnv-linagora/events","assignees_url":"https://api.github.com/repos/PVN-Linagora/pnv-linagora/assignees{/user}","branches_url":"https://api.github.com/repos/PVN-Linagora/pnv-linagora/branches{/branch}","tags_url":"https://api.github.com/repos/PVN-Linagora/pnv-linagora/tags","blobs_url":"https://api.github.com/repos/PVN-Linagora/pnv-linagora/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/PVN-Linagora/pnv-linagora/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/PVN-Linagora/pnv-linagora/git/refs{/sha}","trees_url":"https://api.github.com/repos/PVN-Linagora/pnv-linagora/git/trees{/sha}","statuses_url":"https://api.github.com/repos/PVN-Linagora/pnv-linagora/statuses/{sha}","languages_url":"https://api.github.com/repos/PVN-Linagora/pnv-linagora/languages","stargazers_url":"https://api.github.com/repos/PVN-Linagora/pnv-linagora/stargazers","contributors_url":"https://api.github.com/repos/PVN-Linagora/pnv-linagora/contributors","subscribers_url":"https://api.github.com/repos/PVN-Linagora/pnv-linagora/subscribers","subscription_url":"https://api.github.com/repos/PVN-Linagora/pnv-linagora/subscription","commits_url":"https://api.github.com/repos/PVN-Linagora/pnv-linagora/commits{/sha}","git_commits_url":"https://api.github.com/repos/PVN-Linagora/pnv-linagora/git/commits{/sha}","comments_url":"https://api.github.com/repos/PVN-Linagora/pnv-linagora/comments{/number}","issue_comment_url":"https://api.github.com/repos/PVN-Linagora/pnv-linagora/issues/comments{/number}","contents_url":"https://api.github.com/repos/PVN-Linagora/pnv-linagora/contents/{+path}","compare_url":"https://api.github.com/repos/PVN-Linagora/pnv-linagora/compare/{base}...{head}","merges_url":"https://api.github.com/repos/PVN-Linagora/pnv-linagora/merges","archive_url":"https://api.github.com/repos/PVN-Linagora/pnv-linagora/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/PVN-Linagora/pnv-linagora/downloads","issues_url":"https://api.github.com/repos/PVN-Linagora/pnv-linagora/issues{/number}","pulls_url":"https://api.github.com/repos/PVN-Linagora/pnv-linagora/pulls{/number}","milestones_url":"https://api.github.com/repos/PVN-Linagora/pnv-linagora/milestones{/number}","notifications_url":"https://api.github.com/repos/PVN-Linagora/pnv-linagora/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/PVN-Linagora/pnv-linagora/labels{/name}","releases_url":"https://api.github.com/repos/PVN-Linagora/pnv-linagora/releases{/id}","deployments_url":"https://api.github.com/repos/PVN-Linagora/pnv-linagora/deployments","created_at":"2017-03-27T11:37:10Z","updated_at":"2017-03-27T11:38:17Z","pushed_at":"2017-03-29T01:39:49Z","git_url":"git://github.com/PVN-Linagora/pnv-linagora.git","ssh_url":"git@github.com:PVN-Linagora/pnv-linagora.git","clone_url":"https://github.com/PVN-Linagora/pnv-linagora.git","svn_url":"https://github.com/PVN-Linagora/pnv-linagora","homepage":null,"size":121,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5,"mirror_url":null,"open_issues_count":2,"forks":5,"open_issues":2,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/PVN-Linagora/pnv-linagora/pulls/2"},"html":{"href":"https://github.com/PVN-Linagora/pnv-linagora/pull/2"},"issue":{"href":"https://api.github.com/repos/PVN-Linagora/pnv-linagora/issues/2"},"comments":{"href":"https://api.github.com/repos/PVN-Linagora/pnv-linagora/issues/2/comments"},"review_comments":{"href":"https://api.github.com/repos/PVN-Linagora/pnv-linagora/pulls/2/comments"},"review_comment":{"href":"https://api.github.com/repos/PVN-Linagora/pnv-linagora/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/PVN-Linagora/pnv-linagora/pulls/2/commits"},"statuses":{"href":"https://api.github.com/repos/PVN-Linagora/pnv-linagora/statuses/4413e25e90851ca700885813cbfab2248e3e1865"}}}}
{"actor":{"display_login":"chibenwa"}}