{"action":"created","comment":{"url":"https://api.github.com/repos/ITB5-TeamC/nefarious-octo-kidney/pulls/comments/45864083","id":45864083,"diff_hunk":"@@ -353,4 +401,84 @@ public MatchDTO saveMatch(String sessionId, MatchDTO matchDTO, DepartmentDTO dep\n \t\t}\n \t\treturn null;\n \t}\n+\n+\tpublic Boolean rsvp(String sessionId, TeamDTO team, TeamInvitationStatus answer) {\n+\t\tif (team == null || answer == null) {\n+\t\t\treturn null;\n+\t\t}\n+\t\tif (!answer.equals(TeamInvitationStatus.Accepted) && !answer.equals(TeamInvitationStatus.Declined)) {\n+\t\t\tlog.warn(\"rsvp: TeamInvitationStatus must be set to Accepted or Declined!\");\n+\t\t\treturn null;\n+\t\t}\n+\t\ttry {\n+\t\t\tUserDTO player = getCurrentUser(sessionId);\n+\t\t\tTeam teamEntity = ConverterTeamDTO.toEntity(team);\n+\t\t\tteamEntity.setMemberStatus(player.getId(), answer);\n+\t\t\treturn PersistenceFacade.getInstance().saveOrUpdate(teamEntity) != null;\n+\t\t} catch (Exception e) {\n+\t\t\tlog.error(e.getMessage());\n+\t\t\treturn false;\n+\t\t}\n+\t}\n+\n+\tpublic MessageDTO getMessage(String sessionId) {\n+\t\tQueueManager qm = new QueueManager(SessionManager.getInstance().getUserId(sessionId).toString());\n+\t\treturn ConverterMessageDTO.toDTO(qm.consume());\n+\t}\n+\n+\t/**\n+\t * adds a player to a team from the specified tournament and creates a\n+\t * notification for the player\n+\t * \n+\t * @param sessionId\n+\t *            session id\n+\t * @param player\n+\t *            player to be added\n+\t * @param team\n+\t *            team of the player\n+\t * @param tournament\n+\t *            tournament\n+\t */\n+\tpublic void invitePlayer(String sessionId, UserDTO player, TeamDTO team, TournamentDTO tournament) {\n+\t\tDepartmentDTO dept = ConverterDepartmentDTO\n+\t\t\t\t.toDTO(PersistenceFacade.getInstance().getById(Department.class, tournament.getDepartmentId()));\n+\n+\t\tif (hasRole(sessionId, UserRole.Admin) || isDepartmentHead(sessionId, dept)) {\n+\t\t\tif (tournament.getHomeTeamsIds().contains(team.getId())) {\n+\t\t\t\t// add player to team if not exists\n+\t\t\t\tif (team.getMemberIds().contains(player.getId())) {\n+\t\t\t\t\t// add message to players queue\n+\t\t\t\t\tenqueueTournamentInvitation(SessionManager.getInstance().getUserId(sessionId), tournament.getId(),\n+\t\t\t\t\t\t\tteam.getId());\n+\t\t\t\t}\n+\t\t\t}\n+\t\t}\n+\t}\n+\n+\tpublic boolean isCoach(String sessionId, DepartmentDTO dept) {\n+\t\tList<Team> res = PersistenceFacade.getInstance().findTeams(null, null, dept.getId(), null,\n+\t\t\t\tSessionManager.getInstance().getUserId(sessionId));\n+\n+\t\treturn !res.isEmpty();\n+\t}\n+\n+\tprivate void enqueueTournamentInvitation(Long playerId, Long tournamentId, Long teamId) {","path":"root/application/src/main/java/at/fhv/itb5c/application/ApplicationFacade.java","position":218,"original_position":218,"commit_id":"a4e8984197bfc9937f3e5f65967ab919ba19688a","original_commit_id":"a4e8984197bfc9937f3e5f65967ab919ba19688a","user":{"login":"Norskan","id":5956494,"avatar_url":"https://avatars.githubusercontent.com/u/5956494?v=3","gravatar_id":"","url":"https://api.github.com/users/Norskan","html_url":"https://github.com/Norskan","followers_url":"https://api.github.com/users/Norskan/followers","following_url":"https://api.github.com/users/Norskan/following{/other_user}","gists_url":"https://api.github.com/users/Norskan/gists{/gist_id}","starred_url":"https://api.github.com/users/Norskan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Norskan/subscriptions","organizations_url":"https://api.github.com/users/Norskan/orgs","repos_url":"https://api.github.com/users/Norskan/repos","events_url":"https://api.github.com/users/Norskan/events{/privacy}","received_events_url":"https://api.github.com/users/Norskan/received_events","type":"User","site_admin":false},"body":"couldn't this be extracted in its won classe? same for line 475\r\n","created_at":"2015-11-25T13:07:31Z","updated_at":"2015-11-25T13:07:31Z","html_url":"https://github.com/ITB5-TeamC/nefarious-octo-kidney/pull/25#discussion_r45864083","pull_request_url":"https://api.github.com/repos/ITB5-TeamC/nefarious-octo-kidney/pulls/25","_links":{"self":{"href":"https://api.github.com/repos/ITB5-TeamC/nefarious-octo-kidney/pulls/comments/45864083"},"html":{"href":"https://github.com/ITB5-TeamC/nefarious-octo-kidney/pull/25#discussion_r45864083"},"pull_request":{"href":"https://api.github.com/repos/ITB5-TeamC/nefarious-octo-kidney/pulls/25"}}},"pull_request":{"url":"https://api.github.com/repos/ITB5-TeamC/nefarious-octo-kidney/pulls/25","id":51449654,"html_url":"https://github.com/ITB5-TeamC/nefarious-octo-kidney/pull/25","diff_url":"https://github.com/ITB5-TeamC/nefarious-octo-kidney/pull/25.diff","patch_url":"https://github.com/ITB5-TeamC/nefarious-octo-kidney/pull/25.patch","issue_url":"https://api.github.com/repos/ITB5-TeamC/nefarious-octo-kidney/issues/25","number":25,"state":"open","locked":false,"title":"Research/jms","user":{"login":"Cometlight","id":11016034,"avatar_url":"https://avatars.githubusercontent.com/u/11016034?v=3","gravatar_id":"","url":"https://api.github.com/users/Cometlight","html_url":"https://github.com/Cometlight","followers_url":"https://api.github.com/users/Cometlight/followers","following_url":"https://api.github.com/users/Cometlight/following{/other_user}","gists_url":"https://api.github.com/users/Cometlight/gists{/gist_id}","starred_url":"https://api.github.com/users/Cometlight/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Cometlight/subscriptions","organizations_url":"https://api.github.com/users/Cometlight/orgs","repos_url":"https://api.github.com/users/Cometlight/repos","events_url":"https://api.github.com/users/Cometlight/events{/privacy}","received_events_url":"https://api.github.com/users/Cometlight/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-11-21T20:35:04Z","updated_at":"2015-11-25T13:07:31Z","closed_at":null,"merged_at":null,"merge_commit_sha":"971149899c1bbdf2078d8aa43acd5ea5e74b3612","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ITB5-TeamC/nefarious-octo-kidney/pulls/25/commits","review_comments_url":"https://api.github.com/repos/ITB5-TeamC/nefarious-octo-kidney/pulls/25/comments","review_comment_url":"https://api.github.com/repos/ITB5-TeamC/nefarious-octo-kidney/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ITB5-TeamC/nefarious-octo-kidney/issues/25/comments","statuses_url":"https://api.github.com/repos/ITB5-TeamC/nefarious-octo-kidney/statuses/a4e8984197bfc9937f3e5f65967ab919ba19688a","head":{"label":"ITB5-TeamC:research/jms","ref":"research/jms","sha":"a4e8984197bfc9937f3e5f65967ab919ba19688a","user":{"login":"ITB5-TeamC","id":15198285,"avatar_url":"https://avatars.githubusercontent.com/u/15198285?v=3","gravatar_id":"","url":"https://api.github.com/users/ITB5-TeamC","html_url":"https://github.com/ITB5-TeamC","followers_url":"https://api.github.com/users/ITB5-TeamC/followers","following_url":"https://api.github.com/users/ITB5-TeamC/following{/other_user}","gists_url":"https://api.github.com/users/ITB5-TeamC/gists{/gist_id}","starred_url":"https://api.github.com/users/ITB5-TeamC/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ITB5-TeamC/subscriptions","organizations_url":"https://api.github.com/users/ITB5-TeamC/orgs","repos_url":"https://api.github.com/users/ITB5-TeamC/repos","events_url":"https://api.github.com/users/ITB5-TeamC/events{/privacy}","received_events_url":"https://api.github.com/users/ITB5-TeamC/received_events","type":"Organization","site_admin":false},"repo":{"id":44534289,"name":"nefarious-octo-kidney","full_name":"ITB5-TeamC/nefarious-octo-kidney","owner":{"login":"ITB5-TeamC","id":15198285,"avatar_url":"https://avatars.githubusercontent.com/u/15198285?v=3","gravatar_id":"","url":"https://api.github.com/users/ITB5-TeamC","html_url":"https://github.com/ITB5-TeamC","followers_url":"https://api.github.com/users/ITB5-TeamC/followers","following_url":"https://api.github.com/users/ITB5-TeamC/following{/other_user}","gists_url":"https://api.github.com/users/ITB5-TeamC/gists{/gist_id}","starred_url":"https://api.github.com/users/ITB5-TeamC/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ITB5-TeamC/subscriptions","organizations_url":"https://api.github.com/users/ITB5-TeamC/orgs","repos_url":"https://api.github.com/users/ITB5-TeamC/repos","events_url":"https://api.github.com/users/ITB5-TeamC/events{/privacy}","received_events_url":"https://api.github.com/users/ITB5-TeamC/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ITB5-TeamC/nefarious-octo-kidney","description":"","fork":false,"url":"https://api.github.com/repos/ITB5-TeamC/nefarious-octo-kidney","forks_url":"https://api.github.com/repos/ITB5-TeamC/nefarious-octo-kidney/forks","keys_url":"https://api.github.com/repos/ITB5-TeamC/nefarious-octo-kidney/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ITB5-TeamC/nefarious-octo-kidney/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ITB5-TeamC/nefarious-octo-kidney/teams","hooks_url":"https://api.github.com/repos/ITB5-TeamC/nefarious-octo-kidney/hooks","issue_events_url":"https://api.github.com/repos/ITB5-TeamC/nefarious-octo-kidney/issues/events{/number}","events_url":"https://api.github.com/repos/ITB5-TeamC/nefarious-octo-kidney/events","assignees_url":"https://api.github.com/repos/ITB5-TeamC/nefarious-octo-kidney/assignees{/user}","branches_url":"https://api.github.com/repos/ITB5-TeamC/nefarious-octo-kidney/branches{/branch}","tags_url":"https://api.github.com/repos/ITB5-TeamC/nefarious-octo-kidney/tags","blobs_url":"https://api.github.com/repos/ITB5-TeamC/nefarious-octo-kidney/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ITB5-TeamC/nefarious-octo-kidney/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ITB5-TeamC/nefarious-octo-kidney/git/refs{/sha}","trees_url":"https://api.github.com/repos/ITB5-TeamC/nefarious-octo-kidney/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ITB5-TeamC/nefarious-octo-kidney/statuses/{sha}","languages_url":"https://api.github.com/repos/ITB5-TeamC/nefarious-octo-kidney/languages","stargazers_url":"https://api.github.com/repos/ITB5-TeamC/nefarious-octo-kidney/stargazers","contributors_url":"https://api.github.com/repos/ITB5-TeamC/nefarious-octo-kidney/contributors","subscribers_url":"https://api.github.com/repos/ITB5-TeamC/nefarious-octo-kidney/subscribers","subscription_url":"https://api.github.com/repos/ITB5-TeamC/nefarious-octo-kidney/subscription","commits_url":"https://api.github.com/repos/ITB5-TeamC/nefarious-octo-kidney/commits{/sha}","git_commits_url":"https://api.github.com/repos/ITB5-TeamC/nefarious-octo-kidney/git/commits{/sha}","comments_url":"https://api.github.com/repos/ITB5-TeamC/nefarious-octo-kidney/comments{/number}","issue_comment_url":"https://api.github.com/repos/ITB5-TeamC/nefarious-octo-kidney/issues/comments{/number}","contents_url":"https://api.github.com/repos/ITB5-TeamC/nefarious-octo-kidney/contents/{+path}","compare_url":"https://api.github.com/repos/ITB5-TeamC/nefarious-octo-kidney/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ITB5-TeamC/nefarious-octo-kidney/merges","archive_url":"https://api.github.com/repos/ITB5-TeamC/nefarious-octo-kidney/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ITB5-TeamC/nefarious-octo-kidney/downloads","issues_url":"https://api.github.com/repos/ITB5-TeamC/nefarious-octo-kidney/issues{/number}","pulls_url":"https://api.github.com/repos/ITB5-TeamC/nefarious-octo-kidney/pulls{/number}","milestones_url":"https://api.github.com/repos/ITB5-TeamC/nefarious-octo-kidney/milestones{/number}","notifications_url":"https://api.github.com/repos/ITB5-TeamC/nefarious-octo-kidney/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ITB5-TeamC/nefarious-octo-kidney/labels{/name}","releases_url":"https://api.github.com/repos/ITB5-TeamC/nefarious-octo-kidney/releases{/id}","created_at":"2015-10-19T12:51:47Z","updated_at":"2015-10-29T10:15:36Z","pushed_at":"2015-11-25T12:56:19Z","git_url":"git://github.com/ITB5-TeamC/nefarious-octo-kidney.git","ssh_url":"git@github.com:ITB5-TeamC/nefarious-octo-kidney.git","clone_url":"https://github.com/ITB5-TeamC/nefarious-octo-kidney.git","svn_url":"https://github.com/ITB5-TeamC/nefarious-octo-kidney","homepage":"https://homepages.fhv.at/tf/EC/projekt.html","size":961,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"dev"}},"base":{"label":"ITB5-TeamC:dev","ref":"dev","sha":"8ad789c6388c61f5144fccfbfac0ef2366cfda13","user":{"login":"ITB5-TeamC","id":15198285,"avatar_url":"https://avatars.githubusercontent.com/u/15198285?v=3","gravatar_id":"","url":"https://api.github.com/users/ITB5-TeamC","html_url":"https://github.com/ITB5-TeamC","followers_url":"https://api.github.com/users/ITB5-TeamC/followers","following_url":"https://api.github.com/users/ITB5-TeamC/following{/other_user}","gists_url":"https://api.github.com/users/ITB5-TeamC/gists{/gist_id}","starred_url":"https://api.github.com/users/ITB5-TeamC/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ITB5-TeamC/subscriptions","organizations_url":"https://api.github.com/users/ITB5-TeamC/orgs","repos_url":"https://api.github.com/users/ITB5-TeamC/repos","events_url":"https://api.github.com/users/ITB5-TeamC/events{/privacy}","received_events_url":"https://api.github.com/users/ITB5-TeamC/received_events","type":"Organization","site_admin":false},"repo":{"id":44534289,"name":"nefarious-octo-kidney","full_name":"ITB5-TeamC/nefarious-octo-kidney","owner":{"login":"ITB5-TeamC","id":15198285,"avatar_url":"https://avatars.githubusercontent.com/u/15198285?v=3","gravatar_id":"","url":"https://api.github.com/users/ITB5-TeamC","html_url":"https://github.com/ITB5-TeamC","followers_url":"https://api.github.com/users/ITB5-TeamC/followers","following_url":"https://api.github.com/users/ITB5-TeamC/following{/other_user}","gists_url":"https://api.github.com/users/ITB5-TeamC/gists{/gist_id}","starred_url":"https://api.github.com/users/ITB5-TeamC/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ITB5-TeamC/subscriptions","organizations_url":"https://api.github.com/users/ITB5-TeamC/orgs","repos_url":"https://api.github.com/users/ITB5-TeamC/repos","events_url":"https://api.github.com/users/ITB5-TeamC/events{/privacy}","received_events_url":"https://api.github.com/users/ITB5-TeamC/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ITB5-TeamC/nefarious-octo-kidney","description":"","fork":false,"url":"https://api.github.com/repos/ITB5-TeamC/nefarious-octo-kidney","forks_url":"https://api.github.com/repos/ITB5-TeamC/nefarious-octo-kidney/forks","keys_url":"https://api.github.com/repos/ITB5-TeamC/nefarious-octo-kidney/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ITB5-TeamC/nefarious-octo-kidney/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ITB5-TeamC/nefarious-octo-kidney/teams","hooks_url":"https://api.github.com/repos/ITB5-TeamC/nefarious-octo-kidney/hooks","issue_events_url":"https://api.github.com/repos/ITB5-TeamC/nefarious-octo-kidney/issues/events{/number}","events_url":"https://api.github.com/repos/ITB5-TeamC/nefarious-octo-kidney/events","assignees_url":"https://api.github.com/repos/ITB5-TeamC/nefarious-octo-kidney/assignees{/user}","branches_url":"https://api.github.com/repos/ITB5-TeamC/nefarious-octo-kidney/branches{/branch}","tags_url":"https://api.github.com/repos/ITB5-TeamC/nefarious-octo-kidney/tags","blobs_url":"https://api.github.com/repos/ITB5-TeamC/nefarious-octo-kidney/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ITB5-TeamC/nefarious-octo-kidney/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ITB5-TeamC/nefarious-octo-kidney/git/refs{/sha}","trees_url":"https://api.github.com/repos/ITB5-TeamC/nefarious-octo-kidney/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ITB5-TeamC/nefarious-octo-kidney/statuses/{sha}","languages_url":"https://api.github.com/repos/ITB5-TeamC/nefarious-octo-kidney/languages","stargazers_url":"https://api.github.com/repos/ITB5-TeamC/nefarious-octo-kidney/stargazers","contributors_url":"https://api.github.com/repos/ITB5-TeamC/nefarious-octo-kidney/contributors","subscribers_url":"https://api.github.com/repos/ITB5-TeamC/nefarious-octo-kidney/subscribers","subscription_url":"https://api.github.com/repos/ITB5-TeamC/nefarious-octo-kidney/subscription","commits_url":"https://api.github.com/repos/ITB5-TeamC/nefarious-octo-kidney/commits{/sha}","git_commits_url":"https://api.github.com/repos/ITB5-TeamC/nefarious-octo-kidney/git/commits{/sha}","comments_url":"https://api.github.com/repos/ITB5-TeamC/nefarious-octo-kidney/comments{/number}","issue_comment_url":"https://api.github.com/repos/ITB5-TeamC/nefarious-octo-kidney/issues/comments{/number}","contents_url":"https://api.github.com/repos/ITB5-TeamC/nefarious-octo-kidney/contents/{+path}","compare_url":"https://api.github.com/repos/ITB5-TeamC/nefarious-octo-kidney/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ITB5-TeamC/nefarious-octo-kidney/merges","archive_url":"https://api.github.com/repos/ITB5-TeamC/nefarious-octo-kidney/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ITB5-TeamC/nefarious-octo-kidney/downloads","issues_url":"https://api.github.com/repos/ITB5-TeamC/nefarious-octo-kidney/issues{/number}","pulls_url":"https://api.github.com/repos/ITB5-TeamC/nefarious-octo-kidney/pulls{/number}","milestones_url":"https://api.github.com/repos/ITB5-TeamC/nefarious-octo-kidney/milestones{/number}","notifications_url":"https://api.github.com/repos/ITB5-TeamC/nefarious-octo-kidney/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ITB5-TeamC/nefarious-octo-kidney/labels{/name}","releases_url":"https://api.github.com/repos/ITB5-TeamC/nefarious-octo-kidney/releases{/id}","created_at":"2015-10-19T12:51:47Z","updated_at":"2015-10-29T10:15:36Z","pushed_at":"2015-11-25T12:56:19Z","git_url":"git://github.com/ITB5-TeamC/nefarious-octo-kidney.git","ssh_url":"git@github.com:ITB5-TeamC/nefarious-octo-kidney.git","clone_url":"https://github.com/ITB5-TeamC/nefarious-octo-kidney.git","svn_url":"https://github.com/ITB5-TeamC/nefarious-octo-kidney","homepage":"https://homepages.fhv.at/tf/EC/projekt.html","size":961,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"dev"}},"_links":{"self":{"href":"https://api.github.com/repos/ITB5-TeamC/nefarious-octo-kidney/pulls/25"},"html":{"href":"https://github.com/ITB5-TeamC/nefarious-octo-kidney/pull/25"},"issue":{"href":"https://api.github.com/repos/ITB5-TeamC/nefarious-octo-kidney/issues/25"},"comments":{"href":"https://api.github.com/repos/ITB5-TeamC/nefarious-octo-kidney/issues/25/comments"},"review_comments":{"href":"https://api.github.com/repos/ITB5-TeamC/nefarious-octo-kidney/pulls/25/comments"},"review_comment":{"href":"https://api.github.com/repos/ITB5-TeamC/nefarious-octo-kidney/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ITB5-TeamC/nefarious-octo-kidney/pulls/25/commits"},"statuses":{"href":"https://api.github.com/repos/ITB5-TeamC/nefarious-octo-kidney/statuses/a4e8984197bfc9937f3e5f65967ab919ba19688a"}}}}