{"action":"created","comment":{"url":"https://api.github.com/repos/easygo2015/easygoapp/pulls/comments/25962290","id":25962290,"diff_hunk":"@@ -27,4 +40,176 @@ public void setTripRepository(TripRepository tripRepository) {\n         this.tripRepository = tripRepository;\n         super.setRepository(tripRepository);\n     }\n+\n+    @Override\n+    public Trip findOne(Long id){\n+        Trip trip = super.findOne(id);\n+        trip.getCompanions().size();\n+        trip.getPassengerNodePoints().size();\n+        return trip;\n+    }\n+\n+    @Override\n+    @Transactional\n+    public User addPassenger(User user, Trip trip) {\n+        User passenger = userRepository.findOne(user.getId());\n+        Trip current_trip = tripRepository.findOne(trip.getId());\n+        int capacity = current_trip.getCarCapacity();\n+        List<User> companions = current_trip.getCompanions();\n+        if (companions.size()-1 < capacity){\n+            companions.add(passenger);\n+            current_trip.setCompanions(companions);\n+            tripRepository.save(current_trip);\n+            /* here will be driver notification */\n+        }\n+        return passenger;\n+    }\n+\n+    @Override\n+    @Transactional\n+    public boolean removePassenger(User user, Trip trip) {\n+        Trip current_trip = tripRepository.findOne(trip.getId());\n+        User passenger = userRepository.findOne(user.getId());\n+        List<User> companions = current_trip.getCompanions();\n+        if (companions.size()>1 && companions.contains(passenger)){\n+            companions.remove(passenger);\n+            trip.setCompanions(companions);\n+            tripRepository.save(current_trip);\n+            /* here will be driver notification */\n+            return true;\n+        }\n+        return false;\n+    }\n+\n+    @Override\n+    @Transactional\n+    public PassengerNodePoint addPassengerNodePoint(PassengerNodePoint passengerNodePoint, Trip trip) {\n+        PassengerNodePoint curPassengerNodePoint = passengerNodePointRepository.findOne(passengerNodePoint.getId());\n+        Trip currentTrip = tripRepository.findOne(trip.getId());\n+        List<PassengerNodePoint> passengerNodePoints = currentTrip.getPassengerNodePoints();\n+        passengerNodePoints.add(passengerNodePoint);\n+        currentTrip.setPassengerNodePoints(passengerNodePoints);\n+        tripRepository.save(currentTrip);\n+        return passengerNodePoint;\n+    }\n+\n+    @Override\n+    @Transactional\n+    public void removePassengerNodePoint(PassengerNodePoint passengerNodePoint, Trip trip) {","path":"src/main/java/com/easygoapp/service/impl/TripServiceImpl.java","position":95,"original_position":95,"commit_id":"d7de827b5e9e8f6f4e678157f19d93c493a3c9c6","original_commit_id":"d7de827b5e9e8f6f4e678157f19d93c493a3c9c6","user":{"login":"davseitsev","id":1793410,"avatar_url":"https://avatars.githubusercontent.com/u/1793410?v=3","gravatar_id":"","url":"https://api.github.com/users/davseitsev","html_url":"https://github.com/davseitsev","followers_url":"https://api.github.com/users/davseitsev/followers","following_url":"https://api.github.com/users/davseitsev/following{/other_user}","gists_url":"https://api.github.com/users/davseitsev/gists{/gist_id}","starred_url":"https://api.github.com/users/davseitsev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davseitsev/subscriptions","organizations_url":"https://api.github.com/users/davseitsev/orgs","repos_url":"https://api.github.com/users/davseitsev/repos","events_url":"https://api.github.com/users/davseitsev/events{/privacy}","received_events_url":"https://api.github.com/users/davseitsev/received_events","type":"User","site_admin":false},"body":"см. комментарии к методу `addPassenger`","created_at":"2015-03-06T17:47:14Z","updated_at":"2015-03-06T17:47:14Z","html_url":"https://github.com/easygo2015/easygoapp/pull/7#discussion_r25962290","pull_request_url":"https://api.github.com/repos/easygo2015/easygoapp/pulls/7","_links":{"self":{"href":"https://api.github.com/repos/easygo2015/easygoapp/pulls/comments/25962290"},"html":{"href":"https://github.com/easygo2015/easygoapp/pull/7#discussion_r25962290"},"pull_request":{"href":"https://api.github.com/repos/easygo2015/easygoapp/pulls/7"}}},"pull_request":{"url":"https://api.github.com/repos/easygo2015/easygoapp/pulls/7","id":30543818,"html_url":"https://github.com/easygo2015/easygoapp/pull/7","diff_url":"https://github.com/easygo2015/easygoapp/pull/7.diff","patch_url":"https://github.com/easygo2015/easygoapp/pull/7.patch","issue_url":"https://api.github.com/repos/easygo2015/easygoapp/issues/7","number":7,"state":"open","locked":false,"title":"Services","user":{"login":"mavami","id":10735748,"avatar_url":"https://avatars.githubusercontent.com/u/10735748?v=3","gravatar_id":"","url":"https://api.github.com/users/mavami","html_url":"https://github.com/mavami","followers_url":"https://api.github.com/users/mavami/followers","following_url":"https://api.github.com/users/mavami/following{/other_user}","gists_url":"https://api.github.com/users/mavami/gists{/gist_id}","starred_url":"https://api.github.com/users/mavami/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mavami/subscriptions","organizations_url":"https://api.github.com/users/mavami/orgs","repos_url":"https://api.github.com/users/mavami/repos","events_url":"https://api.github.com/users/mavami/events{/privacy}","received_events_url":"https://api.github.com/users/mavami/received_events","type":"User","site_admin":false},"body":"Services and tests for services","created_at":"2015-03-05T10:03:59Z","updated_at":"2015-03-06T17:47:14Z","closed_at":null,"merged_at":null,"merge_commit_sha":"141112c4efee0e0ad9a8f1f11f239927769448e6","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/easygo2015/easygoapp/pulls/7/commits","review_comments_url":"https://api.github.com/repos/easygo2015/easygoapp/pulls/7/comments","review_comment_url":"https://api.github.com/repos/easygo2015/easygoapp/pulls/comments{/number}","comments_url":"https://api.github.com/repos/easygo2015/easygoapp/issues/7/comments","statuses_url":"https://api.github.com/repos/easygo2015/easygoapp/statuses/d7de827b5e9e8f6f4e678157f19d93c493a3c9c6","head":{"label":"easygo2015:services","ref":"services","sha":"d7de827b5e9e8f6f4e678157f19d93c493a3c9c6","user":{"login":"easygo2015","id":11177457,"avatar_url":"https://avatars.githubusercontent.com/u/11177457?v=3","gravatar_id":"","url":"https://api.github.com/users/easygo2015","html_url":"https://github.com/easygo2015","followers_url":"https://api.github.com/users/easygo2015/followers","following_url":"https://api.github.com/users/easygo2015/following{/other_user}","gists_url":"https://api.github.com/users/easygo2015/gists{/gist_id}","starred_url":"https://api.github.com/users/easygo2015/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/easygo2015/subscriptions","organizations_url":"https://api.github.com/users/easygo2015/orgs","repos_url":"https://api.github.com/users/easygo2015/repos","events_url":"https://api.github.com/users/easygo2015/events{/privacy}","received_events_url":"https://api.github.com/users/easygo2015/received_events","type":"User","site_admin":false},"repo":{"id":31263544,"name":"easygoapp","full_name":"easygo2015/easygoapp","owner":{"login":"easygo2015","id":11177457,"avatar_url":"https://avatars.githubusercontent.com/u/11177457?v=3","gravatar_id":"","url":"https://api.github.com/users/easygo2015","html_url":"https://github.com/easygo2015","followers_url":"https://api.github.com/users/easygo2015/followers","following_url":"https://api.github.com/users/easygo2015/following{/other_user}","gists_url":"https://api.github.com/users/easygo2015/gists{/gist_id}","starred_url":"https://api.github.com/users/easygo2015/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/easygo2015/subscriptions","organizations_url":"https://api.github.com/users/easygo2015/orgs","repos_url":"https://api.github.com/users/easygo2015/repos","events_url":"https://api.github.com/users/easygo2015/events{/privacy}","received_events_url":"https://api.github.com/users/easygo2015/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/easygo2015/easygoapp","description":"Web-service to find auto-companion in Dneprodzerzhinsk(Ukraine)","fork":false,"url":"https://api.github.com/repos/easygo2015/easygoapp","forks_url":"https://api.github.com/repos/easygo2015/easygoapp/forks","keys_url":"https://api.github.com/repos/easygo2015/easygoapp/keys{/key_id}","collaborators_url":"https://api.github.com/repos/easygo2015/easygoapp/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/easygo2015/easygoapp/teams","hooks_url":"https://api.github.com/repos/easygo2015/easygoapp/hooks","issue_events_url":"https://api.github.com/repos/easygo2015/easygoapp/issues/events{/number}","events_url":"https://api.github.com/repos/easygo2015/easygoapp/events","assignees_url":"https://api.github.com/repos/easygo2015/easygoapp/assignees{/user}","branches_url":"https://api.github.com/repos/easygo2015/easygoapp/branches{/branch}","tags_url":"https://api.github.com/repos/easygo2015/easygoapp/tags","blobs_url":"https://api.github.com/repos/easygo2015/easygoapp/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/easygo2015/easygoapp/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/easygo2015/easygoapp/git/refs{/sha}","trees_url":"https://api.github.com/repos/easygo2015/easygoapp/git/trees{/sha}","statuses_url":"https://api.github.com/repos/easygo2015/easygoapp/statuses/{sha}","languages_url":"https://api.github.com/repos/easygo2015/easygoapp/languages","stargazers_url":"https://api.github.com/repos/easygo2015/easygoapp/stargazers","contributors_url":"https://api.github.com/repos/easygo2015/easygoapp/contributors","subscribers_url":"https://api.github.com/repos/easygo2015/easygoapp/subscribers","subscription_url":"https://api.github.com/repos/easygo2015/easygoapp/subscription","commits_url":"https://api.github.com/repos/easygo2015/easygoapp/commits{/sha}","git_commits_url":"https://api.github.com/repos/easygo2015/easygoapp/git/commits{/sha}","comments_url":"https://api.github.com/repos/easygo2015/easygoapp/comments{/number}","issue_comment_url":"https://api.github.com/repos/easygo2015/easygoapp/issues/comments{/number}","contents_url":"https://api.github.com/repos/easygo2015/easygoapp/contents/{+path}","compare_url":"https://api.github.com/repos/easygo2015/easygoapp/compare/{base}...{head}","merges_url":"https://api.github.com/repos/easygo2015/easygoapp/merges","archive_url":"https://api.github.com/repos/easygo2015/easygoapp/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/easygo2015/easygoapp/downloads","issues_url":"https://api.github.com/repos/easygo2015/easygoapp/issues{/number}","pulls_url":"https://api.github.com/repos/easygo2015/easygoapp/pulls{/number}","milestones_url":"https://api.github.com/repos/easygo2015/easygoapp/milestones{/number}","notifications_url":"https://api.github.com/repos/easygo2015/easygoapp/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/easygo2015/easygoapp/labels{/name}","releases_url":"https://api.github.com/repos/easygo2015/easygoapp/releases{/id}","created_at":"2015-02-24T14:24:38Z","updated_at":"2015-03-01T14:06:02Z","pushed_at":"2015-03-06T15:54:15Z","git_url":"git://github.com/easygo2015/easygoapp.git","ssh_url":"git@github.com:easygo2015/easygoapp.git","clone_url":"https://github.com/easygo2015/easygoapp.git","svn_url":"https://github.com/easygo2015/easygoapp","homepage":null,"size":846,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"easygo2015:develop","ref":"develop","sha":"d6b6382e4b67dd1d7a1a073cdc91e5bcd4e1c5f3","user":{"login":"easygo2015","id":11177457,"avatar_url":"https://avatars.githubusercontent.com/u/11177457?v=3","gravatar_id":"","url":"https://api.github.com/users/easygo2015","html_url":"https://github.com/easygo2015","followers_url":"https://api.github.com/users/easygo2015/followers","following_url":"https://api.github.com/users/easygo2015/following{/other_user}","gists_url":"https://api.github.com/users/easygo2015/gists{/gist_id}","starred_url":"https://api.github.com/users/easygo2015/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/easygo2015/subscriptions","organizations_url":"https://api.github.com/users/easygo2015/orgs","repos_url":"https://api.github.com/users/easygo2015/repos","events_url":"https://api.github.com/users/easygo2015/events{/privacy}","received_events_url":"https://api.github.com/users/easygo2015/received_events","type":"User","site_admin":false},"repo":{"id":31263544,"name":"easygoapp","full_name":"easygo2015/easygoapp","owner":{"login":"easygo2015","id":11177457,"avatar_url":"https://avatars.githubusercontent.com/u/11177457?v=3","gravatar_id":"","url":"https://api.github.com/users/easygo2015","html_url":"https://github.com/easygo2015","followers_url":"https://api.github.com/users/easygo2015/followers","following_url":"https://api.github.com/users/easygo2015/following{/other_user}","gists_url":"https://api.github.com/users/easygo2015/gists{/gist_id}","starred_url":"https://api.github.com/users/easygo2015/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/easygo2015/subscriptions","organizations_url":"https://api.github.com/users/easygo2015/orgs","repos_url":"https://api.github.com/users/easygo2015/repos","events_url":"https://api.github.com/users/easygo2015/events{/privacy}","received_events_url":"https://api.github.com/users/easygo2015/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/easygo2015/easygoapp","description":"Web-service to find auto-companion in Dneprodzerzhinsk(Ukraine)","fork":false,"url":"https://api.github.com/repos/easygo2015/easygoapp","forks_url":"https://api.github.com/repos/easygo2015/easygoapp/forks","keys_url":"https://api.github.com/repos/easygo2015/easygoapp/keys{/key_id}","collaborators_url":"https://api.github.com/repos/easygo2015/easygoapp/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/easygo2015/easygoapp/teams","hooks_url":"https://api.github.com/repos/easygo2015/easygoapp/hooks","issue_events_url":"https://api.github.com/repos/easygo2015/easygoapp/issues/events{/number}","events_url":"https://api.github.com/repos/easygo2015/easygoapp/events","assignees_url":"https://api.github.com/repos/easygo2015/easygoapp/assignees{/user}","branches_url":"https://api.github.com/repos/easygo2015/easygoapp/branches{/branch}","tags_url":"https://api.github.com/repos/easygo2015/easygoapp/tags","blobs_url":"https://api.github.com/repos/easygo2015/easygoapp/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/easygo2015/easygoapp/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/easygo2015/easygoapp/git/refs{/sha}","trees_url":"https://api.github.com/repos/easygo2015/easygoapp/git/trees{/sha}","statuses_url":"https://api.github.com/repos/easygo2015/easygoapp/statuses/{sha}","languages_url":"https://api.github.com/repos/easygo2015/easygoapp/languages","stargazers_url":"https://api.github.com/repos/easygo2015/easygoapp/stargazers","contributors_url":"https://api.github.com/repos/easygo2015/easygoapp/contributors","subscribers_url":"https://api.github.com/repos/easygo2015/easygoapp/subscribers","subscription_url":"https://api.github.com/repos/easygo2015/easygoapp/subscription","commits_url":"https://api.github.com/repos/easygo2015/easygoapp/commits{/sha}","git_commits_url":"https://api.github.com/repos/easygo2015/easygoapp/git/commits{/sha}","comments_url":"https://api.github.com/repos/easygo2015/easygoapp/comments{/number}","issue_comment_url":"https://api.github.com/repos/easygo2015/easygoapp/issues/comments{/number}","contents_url":"https://api.github.com/repos/easygo2015/easygoapp/contents/{+path}","compare_url":"https://api.github.com/repos/easygo2015/easygoapp/compare/{base}...{head}","merges_url":"https://api.github.com/repos/easygo2015/easygoapp/merges","archive_url":"https://api.github.com/repos/easygo2015/easygoapp/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/easygo2015/easygoapp/downloads","issues_url":"https://api.github.com/repos/easygo2015/easygoapp/issues{/number}","pulls_url":"https://api.github.com/repos/easygo2015/easygoapp/pulls{/number}","milestones_url":"https://api.github.com/repos/easygo2015/easygoapp/milestones{/number}","notifications_url":"https://api.github.com/repos/easygo2015/easygoapp/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/easygo2015/easygoapp/labels{/name}","releases_url":"https://api.github.com/repos/easygo2015/easygoapp/releases{/id}","created_at":"2015-02-24T14:24:38Z","updated_at":"2015-03-01T14:06:02Z","pushed_at":"2015-03-06T15:54:15Z","git_url":"git://github.com/easygo2015/easygoapp.git","ssh_url":"git@github.com:easygo2015/easygoapp.git","clone_url":"https://github.com/easygo2015/easygoapp.git","svn_url":"https://github.com/easygo2015/easygoapp","homepage":null,"size":846,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/easygo2015/easygoapp/pulls/7"},"html":{"href":"https://github.com/easygo2015/easygoapp/pull/7"},"issue":{"href":"https://api.github.com/repos/easygo2015/easygoapp/issues/7"},"comments":{"href":"https://api.github.com/repos/easygo2015/easygoapp/issues/7/comments"},"review_comments":{"href":"https://api.github.com/repos/easygo2015/easygoapp/pulls/7/comments"},"review_comment":{"href":"https://api.github.com/repos/easygo2015/easygoapp/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/easygo2015/easygoapp/pulls/7/commits"},"statuses":{"href":"https://api.github.com/repos/easygo2015/easygoapp/statuses/d7de827b5e9e8f6f4e678157f19d93c493a3c9c6"}}}}