{"action":"created","comment":{"url":"https://api.github.com/repos/emmanuel099/edulium/pulls/comments/30461083","id":30461083,"diff_hunk":"@@ -0,0 +1,101 @@\n+package com.at.ac.tuwien.sepm.ss15.edulium.domain.validation.impl;\n+\n+import com.at.ac.tuwien.sepm.ss15.edulium.domain.Invoice;\n+import com.at.ac.tuwien.sepm.ss15.edulium.domain.validation.ValidationException;\n+import com.at.ac.tuwien.sepm.ss15.edulium.domain.validation.Validator;\n+\n+import java.math.BigDecimal;\n+\n+class InvoiceValidatorImpl implements Validator<Invoice> {\n+\n+    /**\n+     * Validates the invoice object for the create action\n+     * @param invoice Object to be validated\n+     * @throws ValidationException Thrown if the validation fails\n+     */\n+    @Override\n+    public void validateForCreate(Invoice invoice) throws ValidationException {\n+        if (invoice == null) {\n+            throw new ValidationException(\"Object must not be null\");\n+        }\n+\n+        if (invoice.getTime() == null || invoice.getGross() == null) {\n+            throw  new ValidationException(\"Time and gross must not be null\");\n+        }\n+\n+        if (invoice.getGross().compareTo(BigDecimal.ZERO) < 0) {\n+            throw new ValidationException(\"The total gross amount cannot be negative\");\n+        }\n+\n+        if (invoice.getPaid() != null && invoice.getPaid().equals(Boolean.TRUE)) {\n+            throw new ValidationException(\"The invoice cannot be paid upon creation\");\n+        }\n+\n+        if (invoice.getCreator() == null ||\n+                invoice.getCreator().getIdentity() == null ||\n+                invoice.getCreator().getIdentity().equals(\"\")) {\n+            throw new ValidationException(\"Upon creation, the creator of the invoice \" +\n+                    \"must be provided\");\n+        }\n+    }\n+\n+    /**\n+     * Validates the invoice object for the update action\n+     * @param invoice Object to be validated\n+     * @throws ValidationException Thrown if the validation fails\n+     */\n+    @Override\n+    public void validateForUpdate(Invoice invoice) throws ValidationException {\n+        if (invoice == null) {\n+            throw new ValidationException(\"Object must not be null\");\n+        }\n+\n+        if (invoice.getTime() == null || invoice.getGross() == null) {","path":"src/main/java/com/at/ac/tuwien/sepm/ss15/edulium/domain/validation/impl/InvoiceValidatorImpl.java","position":53,"original_position":53,"commit_id":"5e875a6208e8ee05b81d7de97678c03d3c38b5e5","original_commit_id":"5e875a6208e8ee05b81d7de97678c03d3c38b5e5","user":{"login":"emmanuel099","id":6727923,"avatar_url":"https://avatars.githubusercontent.com/u/6727923?v=3","gravatar_id":"","url":"https://api.github.com/users/emmanuel099","html_url":"https://github.com/emmanuel099","followers_url":"https://api.github.com/users/emmanuel099/followers","following_url":"https://api.github.com/users/emmanuel099/following{/other_user}","gists_url":"https://api.github.com/users/emmanuel099/gists{/gist_id}","starred_url":"https://api.github.com/users/emmanuel099/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/emmanuel099/subscriptions","organizations_url":"https://api.github.com/users/emmanuel099/orgs","repos_url":"https://api.github.com/users/emmanuel099/repos","events_url":"https://api.github.com/users/emmanuel099/events{/privacy}","received_events_url":"https://api.github.com/users/emmanuel099/received_events","type":"User","site_admin":false},"body":"split it up","created_at":"2015-05-16T13:19:37Z","updated_at":"2015-05-16T13:19:37Z","html_url":"https://github.com/emmanuel099/edulium/pull/23#discussion_r30461083","pull_request_url":"https://api.github.com/repos/emmanuel099/edulium/pulls/23","_links":{"self":{"href":"https://api.github.com/repos/emmanuel099/edulium/pulls/comments/30461083"},"html":{"href":"https://github.com/emmanuel099/edulium/pull/23#discussion_r30461083"},"pull_request":{"href":"https://api.github.com/repos/emmanuel099/edulium/pulls/23"}}},"pull_request":{"url":"https://api.github.com/repos/emmanuel099/edulium/pulls/23","id":35558129,"html_url":"https://github.com/emmanuel099/edulium/pull/23","diff_url":"https://github.com/emmanuel099/edulium/pull/23.diff","patch_url":"https://github.com/emmanuel099/edulium/pull/23.patch","issue_url":"https://api.github.com/repos/emmanuel099/edulium/issues/23","number":23,"state":"open","locked":false,"title":"Gorgoris/dao/invoice interface test","user":{"login":"metagon","id":4966265,"avatar_url":"https://avatars.githubusercontent.com/u/4966265?v=3","gravatar_id":"","url":"https://api.github.com/users/metagon","html_url":"https://github.com/metagon","followers_url":"https://api.github.com/users/metagon/followers","following_url":"https://api.github.com/users/metagon/following{/other_user}","gists_url":"https://api.github.com/users/metagon/gists{/gist_id}","starred_url":"https://api.github.com/users/metagon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/metagon/subscriptions","organizations_url":"https://api.github.com/users/metagon/orgs","repos_url":"https://api.github.com/users/metagon/repos","events_url":"https://api.github.com/users/metagon/events{/privacy}","received_events_url":"https://api.github.com/users/metagon/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-05-15T23:00:30Z","updated_at":"2015-05-16T13:19:37Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e86d3aeb32438350d7d028da4ecb00904669071d","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/emmanuel099/edulium/pulls/23/commits","review_comments_url":"https://api.github.com/repos/emmanuel099/edulium/pulls/23/comments","review_comment_url":"https://api.github.com/repos/emmanuel099/edulium/pulls/comments{/number}","comments_url":"https://api.github.com/repos/emmanuel099/edulium/issues/23/comments","statuses_url":"https://api.github.com/repos/emmanuel099/edulium/statuses/5e875a6208e8ee05b81d7de97678c03d3c38b5e5","head":{"label":"emmanuel099:gorgoris/dao/invoice_interface_test","ref":"gorgoris/dao/invoice_interface_test","sha":"5e875a6208e8ee05b81d7de97678c03d3c38b5e5","user":{"login":"emmanuel099","id":6727923,"avatar_url":"https://avatars.githubusercontent.com/u/6727923?v=3","gravatar_id":"","url":"https://api.github.com/users/emmanuel099","html_url":"https://github.com/emmanuel099","followers_url":"https://api.github.com/users/emmanuel099/followers","following_url":"https://api.github.com/users/emmanuel099/following{/other_user}","gists_url":"https://api.github.com/users/emmanuel099/gists{/gist_id}","starred_url":"https://api.github.com/users/emmanuel099/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/emmanuel099/subscriptions","organizations_url":"https://api.github.com/users/emmanuel099/orgs","repos_url":"https://api.github.com/users/emmanuel099/repos","events_url":"https://api.github.com/users/emmanuel099/events{/privacy}","received_events_url":"https://api.github.com/users/emmanuel099/received_events","type":"User","site_admin":false},"repo":{"id":34752652,"name":"edulium","full_name":"emmanuel099/edulium","owner":{"login":"emmanuel099","id":6727923,"avatar_url":"https://avatars.githubusercontent.com/u/6727923?v=3","gravatar_id":"","url":"https://api.github.com/users/emmanuel099","html_url":"https://github.com/emmanuel099","followers_url":"https://api.github.com/users/emmanuel099/followers","following_url":"https://api.github.com/users/emmanuel099/following{/other_user}","gists_url":"https://api.github.com/users/emmanuel099/gists{/gist_id}","starred_url":"https://api.github.com/users/emmanuel099/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/emmanuel099/subscriptions","organizations_url":"https://api.github.com/users/emmanuel099/orgs","repos_url":"https://api.github.com/users/emmanuel099/repos","events_url":"https://api.github.com/users/emmanuel099/events{/privacy}","received_events_url":"https://api.github.com/users/emmanuel099/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/emmanuel099/edulium","description":"","fork":false,"url":"https://api.github.com/repos/emmanuel099/edulium","forks_url":"https://api.github.com/repos/emmanuel099/edulium/forks","keys_url":"https://api.github.com/repos/emmanuel099/edulium/keys{/key_id}","collaborators_url":"https://api.github.com/repos/emmanuel099/edulium/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/emmanuel099/edulium/teams","hooks_url":"https://api.github.com/repos/emmanuel099/edulium/hooks","issue_events_url":"https://api.github.com/repos/emmanuel099/edulium/issues/events{/number}","events_url":"https://api.github.com/repos/emmanuel099/edulium/events","assignees_url":"https://api.github.com/repos/emmanuel099/edulium/assignees{/user}","branches_url":"https://api.github.com/repos/emmanuel099/edulium/branches{/branch}","tags_url":"https://api.github.com/repos/emmanuel099/edulium/tags","blobs_url":"https://api.github.com/repos/emmanuel099/edulium/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/emmanuel099/edulium/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/emmanuel099/edulium/git/refs{/sha}","trees_url":"https://api.github.com/repos/emmanuel099/edulium/git/trees{/sha}","statuses_url":"https://api.github.com/repos/emmanuel099/edulium/statuses/{sha}","languages_url":"https://api.github.com/repos/emmanuel099/edulium/languages","stargazers_url":"https://api.github.com/repos/emmanuel099/edulium/stargazers","contributors_url":"https://api.github.com/repos/emmanuel099/edulium/contributors","subscribers_url":"https://api.github.com/repos/emmanuel099/edulium/subscribers","subscription_url":"https://api.github.com/repos/emmanuel099/edulium/subscription","commits_url":"https://api.github.com/repos/emmanuel099/edulium/commits{/sha}","git_commits_url":"https://api.github.com/repos/emmanuel099/edulium/git/commits{/sha}","comments_url":"https://api.github.com/repos/emmanuel099/edulium/comments{/number}","issue_comment_url":"https://api.github.com/repos/emmanuel099/edulium/issues/comments{/number}","contents_url":"https://api.github.com/repos/emmanuel099/edulium/contents/{+path}","compare_url":"https://api.github.com/repos/emmanuel099/edulium/compare/{base}...{head}","merges_url":"https://api.github.com/repos/emmanuel099/edulium/merges","archive_url":"https://api.github.com/repos/emmanuel099/edulium/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/emmanuel099/edulium/downloads","issues_url":"https://api.github.com/repos/emmanuel099/edulium/issues{/number}","pulls_url":"https://api.github.com/repos/emmanuel099/edulium/pulls{/number}","milestones_url":"https://api.github.com/repos/emmanuel099/edulium/milestones{/number}","notifications_url":"https://api.github.com/repos/emmanuel099/edulium/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/emmanuel099/edulium/labels{/name}","releases_url":"https://api.github.com/repos/emmanuel099/edulium/releases{/id}","created_at":"2015-04-28T19:56:39Z","updated_at":"2015-05-15T22:14:40Z","pushed_at":"2015-05-16T13:12:10Z","git_url":"git://github.com/emmanuel099/edulium.git","ssh_url":"git@github.com:emmanuel099/edulium.git","clone_url":"https://github.com/emmanuel099/edulium.git","svn_url":"https://github.com/emmanuel099/edulium","homepage":null,"size":1272,"stargazers_count":1,"watchers_count":1,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":1,"default_branch":"master"}},"base":{"label":"emmanuel099:gorgoris/dao/invoice","ref":"gorgoris/dao/invoice","sha":"4c2fdac55e6b6001fabaf02ad2eb8a33e6482321","user":{"login":"emmanuel099","id":6727923,"avatar_url":"https://avatars.githubusercontent.com/u/6727923?v=3","gravatar_id":"","url":"https://api.github.com/users/emmanuel099","html_url":"https://github.com/emmanuel099","followers_url":"https://api.github.com/users/emmanuel099/followers","following_url":"https://api.github.com/users/emmanuel099/following{/other_user}","gists_url":"https://api.github.com/users/emmanuel099/gists{/gist_id}","starred_url":"https://api.github.com/users/emmanuel099/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/emmanuel099/subscriptions","organizations_url":"https://api.github.com/users/emmanuel099/orgs","repos_url":"https://api.github.com/users/emmanuel099/repos","events_url":"https://api.github.com/users/emmanuel099/events{/privacy}","received_events_url":"https://api.github.com/users/emmanuel099/received_events","type":"User","site_admin":false},"repo":{"id":34752652,"name":"edulium","full_name":"emmanuel099/edulium","owner":{"login":"emmanuel099","id":6727923,"avatar_url":"https://avatars.githubusercontent.com/u/6727923?v=3","gravatar_id":"","url":"https://api.github.com/users/emmanuel099","html_url":"https://github.com/emmanuel099","followers_url":"https://api.github.com/users/emmanuel099/followers","following_url":"https://api.github.com/users/emmanuel099/following{/other_user}","gists_url":"https://api.github.com/users/emmanuel099/gists{/gist_id}","starred_url":"https://api.github.com/users/emmanuel099/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/emmanuel099/subscriptions","organizations_url":"https://api.github.com/users/emmanuel099/orgs","repos_url":"https://api.github.com/users/emmanuel099/repos","events_url":"https://api.github.com/users/emmanuel099/events{/privacy}","received_events_url":"https://api.github.com/users/emmanuel099/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/emmanuel099/edulium","description":"","fork":false,"url":"https://api.github.com/repos/emmanuel099/edulium","forks_url":"https://api.github.com/repos/emmanuel099/edulium/forks","keys_url":"https://api.github.com/repos/emmanuel099/edulium/keys{/key_id}","collaborators_url":"https://api.github.com/repos/emmanuel099/edulium/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/emmanuel099/edulium/teams","hooks_url":"https://api.github.com/repos/emmanuel099/edulium/hooks","issue_events_url":"https://api.github.com/repos/emmanuel099/edulium/issues/events{/number}","events_url":"https://api.github.com/repos/emmanuel099/edulium/events","assignees_url":"https://api.github.com/repos/emmanuel099/edulium/assignees{/user}","branches_url":"https://api.github.com/repos/emmanuel099/edulium/branches{/branch}","tags_url":"https://api.github.com/repos/emmanuel099/edulium/tags","blobs_url":"https://api.github.com/repos/emmanuel099/edulium/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/emmanuel099/edulium/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/emmanuel099/edulium/git/refs{/sha}","trees_url":"https://api.github.com/repos/emmanuel099/edulium/git/trees{/sha}","statuses_url":"https://api.github.com/repos/emmanuel099/edulium/statuses/{sha}","languages_url":"https://api.github.com/repos/emmanuel099/edulium/languages","stargazers_url":"https://api.github.com/repos/emmanuel099/edulium/stargazers","contributors_url":"https://api.github.com/repos/emmanuel099/edulium/contributors","subscribers_url":"https://api.github.com/repos/emmanuel099/edulium/subscribers","subscription_url":"https://api.github.com/repos/emmanuel099/edulium/subscription","commits_url":"https://api.github.com/repos/emmanuel099/edulium/commits{/sha}","git_commits_url":"https://api.github.com/repos/emmanuel099/edulium/git/commits{/sha}","comments_url":"https://api.github.com/repos/emmanuel099/edulium/comments{/number}","issue_comment_url":"https://api.github.com/repos/emmanuel099/edulium/issues/comments{/number}","contents_url":"https://api.github.com/repos/emmanuel099/edulium/contents/{+path}","compare_url":"https://api.github.com/repos/emmanuel099/edulium/compare/{base}...{head}","merges_url":"https://api.github.com/repos/emmanuel099/edulium/merges","archive_url":"https://api.github.com/repos/emmanuel099/edulium/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/emmanuel099/edulium/downloads","issues_url":"https://api.github.com/repos/emmanuel099/edulium/issues{/number}","pulls_url":"https://api.github.com/repos/emmanuel099/edulium/pulls{/number}","milestones_url":"https://api.github.com/repos/emmanuel099/edulium/milestones{/number}","notifications_url":"https://api.github.com/repos/emmanuel099/edulium/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/emmanuel099/edulium/labels{/name}","releases_url":"https://api.github.com/repos/emmanuel099/edulium/releases{/id}","created_at":"2015-04-28T19:56:39Z","updated_at":"2015-05-15T22:14:40Z","pushed_at":"2015-05-16T13:12:10Z","git_url":"git://github.com/emmanuel099/edulium.git","ssh_url":"git@github.com:emmanuel099/edulium.git","clone_url":"https://github.com/emmanuel099/edulium.git","svn_url":"https://github.com/emmanuel099/edulium","homepage":null,"size":1272,"stargazers_count":1,"watchers_count":1,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/emmanuel099/edulium/pulls/23"},"html":{"href":"https://github.com/emmanuel099/edulium/pull/23"},"issue":{"href":"https://api.github.com/repos/emmanuel099/edulium/issues/23"},"comments":{"href":"https://api.github.com/repos/emmanuel099/edulium/issues/23/comments"},"review_comments":{"href":"https://api.github.com/repos/emmanuel099/edulium/pulls/23/comments"},"review_comment":{"href":"https://api.github.com/repos/emmanuel099/edulium/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/emmanuel099/edulium/pulls/23/commits"},"statuses":{"href":"https://api.github.com/repos/emmanuel099/edulium/statuses/5e875a6208e8ee05b81d7de97678c03d3c38b5e5"}}}}