{"action":"created","comment":{"url":"https://api.github.com/repos/windup/windup/pulls/comments/139020831","pull_request_review_id":62898218,"id":139020831,"diff_hunk":"@@ -113,27 +110,20 @@ public int getCount()\n     public void perform(GraphRewrite event, EvaluationContext context, WindupVertexFrame payload)\n     {\n         Set<ProjectModel> projects = new HashSet<>();\n-        if (payload instanceof ProjectModel)\n-        {\n-            projects.add((ProjectModel) payload);\n-        }\n-        else if (payload instanceof FileModel)\n-        {\n-            projects.add(((FileModel) payload).getProjectModel());\n-        } else if (payload instanceof FileLocationModel)\n-        {\n-            projects.add(((FileLocationModel)payload).getFile().getProjectModel());\n-        } else if (payload instanceof JNDIResourceModel)\n-        {\n-            JNDIResourceModel jndiResourceModel = (JNDIResourceModel)payload;\n-            jndiResourceModel.getApplications().forEach(projects::add);\n-        } else if (payload instanceof EjbBeanBaseModel)\n+\n+        if (payload instanceof BelongsToProject)\n         {\n-            EjbBeanBaseModel ejbBeanBaseModel = (EjbBeanBaseModel) payload;\n-            ejbBeanBaseModel.getApplications().forEach(projects::add);\n+            Iterable<ProjectModel> rootProjectModels = ((BelongsToProject) payload).getRootProjectModels();\n+\n+            for (ProjectModel projectModel : rootProjectModels)\n+            {\n+                projects.add(projectModel);\n+            }","path":"rules-java-ee/addon/src/main/java/org/jboss/windup/rules/apps/javaee/TechnologyIdentified.java","position":45,"original_position":45,"commit_id":"6c2033ba0b1244fe9d9bcd3079305458521a1d3f","original_commit_id":"6c2033ba0b1244fe9d9bcd3079305458521a1d3f","user":{"login":"jsight","id":1181549,"avatar_url":"https://avatars3.githubusercontent.com/u/1181549?v=4","gravatar_id":"","url":"https://api.github.com/users/jsight","html_url":"https://github.com/jsight","followers_url":"https://api.github.com/users/jsight/followers","following_url":"https://api.github.com/users/jsight/following{/other_user}","gists_url":"https://api.github.com/users/jsight/gists{/gist_id}","starred_url":"https://api.github.com/users/jsight/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jsight/subscriptions","organizations_url":"https://api.github.com/users/jsight/orgs","repos_url":"https://api.github.com/users/jsight/repos","events_url":"https://api.github.com/users/jsight/events{/privacy}","received_events_url":"https://api.github.com/users/jsight/received_events","type":"User","site_admin":false},"body":"I wrote a unit test and confirmed that it returns only the shared-libs project in the case of a library in shared libs.\r\n\r\nUpdated PR here: https://github.com/windup/windup/pull/1178\r\n","created_at":"2017-09-14T21:54:40Z","updated_at":"2017-09-14T21:54:40Z","html_url":"https://github.com/windup/windup/pull/1174#discussion_r139020831","pull_request_url":"https://api.github.com/repos/windup/windup/pulls/1174","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/windup/windup/pulls/comments/139020831"},"html":{"href":"https://github.com/windup/windup/pull/1174#discussion_r139020831"},"pull_request":{"href":"https://api.github.com/repos/windup/windup/pulls/1174"}},"in_reply_to_id":138620578},"pull_request":{"url":"https://api.github.com/repos/windup/windup/pulls/1174","id":140815408,"html_url":"https://github.com/windup/windup/pull/1174","diff_url":"https://github.com/windup/windup/pull/1174.diff","patch_url":"https://github.com/windup/windup/pull/1174.patch","issue_url":"https://api.github.com/repos/windup/windup/issues/1174","number":1174,"state":"open","locked":false,"title":"TechnologyIdentified - use BelongsToProject instead of if-else chain","user":{"login":"klinki","id":1476175,"avatar_url":"https://avatars3.githubusercontent.com/u/1476175?v=4","gravatar_id":"","url":"https://api.github.com/users/klinki","html_url":"https://github.com/klinki","followers_url":"https://api.github.com/users/klinki/followers","following_url":"https://api.github.com/users/klinki/following{/other_user}","gists_url":"https://api.github.com/users/klinki/gists{/gist_id}","starred_url":"https://api.github.com/users/klinki/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/klinki/subscriptions","organizations_url":"https://api.github.com/users/klinki/orgs","repos_url":"https://api.github.com/users/klinki/repos","events_url":"https://api.github.com/users/klinki/events{/privacy}","received_events_url":"https://api.github.com/users/klinki/received_events","type":"User","site_admin":false},"body":"Instead of having huge if-else chain, I suggest to use `BelongsToProject` interface.\r\n\r\nI think it will be more maintainable and readable. ","created_at":"2017-09-13T12:49:03Z","updated_at":"2017-09-14T21:54:40Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3877e462149c5a8111e38fd19304fdee3eae0e29","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/windup/windup/pulls/1174/commits","review_comments_url":"https://api.github.com/repos/windup/windup/pulls/1174/comments","review_comment_url":"https://api.github.com/repos/windup/windup/pulls/comments{/number}","comments_url":"https://api.github.com/repos/windup/windup/issues/1174/comments","statuses_url":"https://api.github.com/repos/windup/windup/statuses/6c2033ba0b1244fe9d9bcd3079305458521a1d3f","head":{"label":"klinki:use-belongs-to-project","ref":"use-belongs-to-project","sha":"6c2033ba0b1244fe9d9bcd3079305458521a1d3f","user":{"login":"klinki","id":1476175,"avatar_url":"https://avatars3.githubusercontent.com/u/1476175?v=4","gravatar_id":"","url":"https://api.github.com/users/klinki","html_url":"https://github.com/klinki","followers_url":"https://api.github.com/users/klinki/followers","following_url":"https://api.github.com/users/klinki/following{/other_user}","gists_url":"https://api.github.com/users/klinki/gists{/gist_id}","starred_url":"https://api.github.com/users/klinki/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/klinki/subscriptions","organizations_url":"https://api.github.com/users/klinki/orgs","repos_url":"https://api.github.com/users/klinki/repos","events_url":"https://api.github.com/users/klinki/events{/privacy}","received_events_url":"https://api.github.com/users/klinki/received_events","type":"User","site_admin":false},"repo":{"id":71461720,"name":"windup","full_name":"klinki/windup","owner":{"login":"klinki","id":1476175,"avatar_url":"https://avatars3.githubusercontent.com/u/1476175?v=4","gravatar_id":"","url":"https://api.github.com/users/klinki","html_url":"https://github.com/klinki","followers_url":"https://api.github.com/users/klinki/followers","following_url":"https://api.github.com/users/klinki/following{/other_user}","gists_url":"https://api.github.com/users/klinki/gists{/gist_id}","starred_url":"https://api.github.com/users/klinki/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/klinki/subscriptions","organizations_url":"https://api.github.com/users/klinki/orgs","repos_url":"https://api.github.com/users/klinki/repos","events_url":"https://api.github.com/users/klinki/events{/privacy}","received_events_url":"https://api.github.com/users/klinki/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/klinki/windup","description":"Windup - JBoss Automated Migration Tool","fork":true,"url":"https://api.github.com/repos/klinki/windup","forks_url":"https://api.github.com/repos/klinki/windup/forks","keys_url":"https://api.github.com/repos/klinki/windup/keys{/key_id}","collaborators_url":"https://api.github.com/repos/klinki/windup/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/klinki/windup/teams","hooks_url":"https://api.github.com/repos/klinki/windup/hooks","issue_events_url":"https://api.github.com/repos/klinki/windup/issues/events{/number}","events_url":"https://api.github.com/repos/klinki/windup/events","assignees_url":"https://api.github.com/repos/klinki/windup/assignees{/user}","branches_url":"https://api.github.com/repos/klinki/windup/branches{/branch}","tags_url":"https://api.github.com/repos/klinki/windup/tags","blobs_url":"https://api.github.com/repos/klinki/windup/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/klinki/windup/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/klinki/windup/git/refs{/sha}","trees_url":"https://api.github.com/repos/klinki/windup/git/trees{/sha}","statuses_url":"https://api.github.com/repos/klinki/windup/statuses/{sha}","languages_url":"https://api.github.com/repos/klinki/windup/languages","stargazers_url":"https://api.github.com/repos/klinki/windup/stargazers","contributors_url":"https://api.github.com/repos/klinki/windup/contributors","subscribers_url":"https://api.github.com/repos/klinki/windup/subscribers","subscription_url":"https://api.github.com/repos/klinki/windup/subscription","commits_url":"https://api.github.com/repos/klinki/windup/commits{/sha}","git_commits_url":"https://api.github.com/repos/klinki/windup/git/commits{/sha}","comments_url":"https://api.github.com/repos/klinki/windup/comments{/number}","issue_comment_url":"https://api.github.com/repos/klinki/windup/issues/comments{/number}","contents_url":"https://api.github.com/repos/klinki/windup/contents/{+path}","compare_url":"https://api.github.com/repos/klinki/windup/compare/{base}...{head}","merges_url":"https://api.github.com/repos/klinki/windup/merges","archive_url":"https://api.github.com/repos/klinki/windup/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/klinki/windup/downloads","issues_url":"https://api.github.com/repos/klinki/windup/issues{/number}","pulls_url":"https://api.github.com/repos/klinki/windup/pulls{/number}","milestones_url":"https://api.github.com/repos/klinki/windup/milestones{/number}","notifications_url":"https://api.github.com/repos/klinki/windup/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/klinki/windup/labels{/name}","releases_url":"https://api.github.com/repos/klinki/windup/releases{/id}","deployments_url":"https://api.github.com/repos/klinki/windup/deployments","created_at":"2016-10-20T12:38:52Z","updated_at":"2016-10-20T12:38:57Z","pushed_at":"2017-09-13T12:48:29Z","git_url":"git://github.com/klinki/windup.git","ssh_url":"git@github.com:klinki/windup.git","clone_url":"https://github.com/klinki/windup.git","svn_url":"https://github.com/klinki/windup","homepage":"","size":114073,"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":"windup:master","ref":"master","sha":"68731f12992bd041c0f9ad24dfe4a0ae885242a8","user":{"login":"windup","id":4266383,"avatar_url":"https://avatars1.githubusercontent.com/u/4266383?v=4","gravatar_id":"","url":"https://api.github.com/users/windup","html_url":"https://github.com/windup","followers_url":"https://api.github.com/users/windup/followers","following_url":"https://api.github.com/users/windup/following{/other_user}","gists_url":"https://api.github.com/users/windup/gists{/gist_id}","starred_url":"https://api.github.com/users/windup/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/windup/subscriptions","organizations_url":"https://api.github.com/users/windup/orgs","repos_url":"https://api.github.com/users/windup/repos","events_url":"https://api.github.com/users/windup/events{/privacy}","received_events_url":"https://api.github.com/users/windup/received_events","type":"Organization","site_admin":false},"repo":{"id":9702026,"name":"windup","full_name":"windup/windup","owner":{"login":"windup","id":4266383,"avatar_url":"https://avatars1.githubusercontent.com/u/4266383?v=4","gravatar_id":"","url":"https://api.github.com/users/windup","html_url":"https://github.com/windup","followers_url":"https://api.github.com/users/windup/followers","following_url":"https://api.github.com/users/windup/following{/other_user}","gists_url":"https://api.github.com/users/windup/gists{/gist_id}","starred_url":"https://api.github.com/users/windup/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/windup/subscriptions","organizations_url":"https://api.github.com/users/windup/orgs","repos_url":"https://api.github.com/users/windup/repos","events_url":"https://api.github.com/users/windup/events{/privacy}","received_events_url":"https://api.github.com/users/windup/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/windup/windup","description":"Windup - JBoss Automated Migration Tool","fork":false,"url":"https://api.github.com/repos/windup/windup","forks_url":"https://api.github.com/repos/windup/windup/forks","keys_url":"https://api.github.com/repos/windup/windup/keys{/key_id}","collaborators_url":"https://api.github.com/repos/windup/windup/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/windup/windup/teams","hooks_url":"https://api.github.com/repos/windup/windup/hooks","issue_events_url":"https://api.github.com/repos/windup/windup/issues/events{/number}","events_url":"https://api.github.com/repos/windup/windup/events","assignees_url":"https://api.github.com/repos/windup/windup/assignees{/user}","branches_url":"https://api.github.com/repos/windup/windup/branches{/branch}","tags_url":"https://api.github.com/repos/windup/windup/tags","blobs_url":"https://api.github.com/repos/windup/windup/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/windup/windup/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/windup/windup/git/refs{/sha}","trees_url":"https://api.github.com/repos/windup/windup/git/trees{/sha}","statuses_url":"https://api.github.com/repos/windup/windup/statuses/{sha}","languages_url":"https://api.github.com/repos/windup/windup/languages","stargazers_url":"https://api.github.com/repos/windup/windup/stargazers","contributors_url":"https://api.github.com/repos/windup/windup/contributors","subscribers_url":"https://api.github.com/repos/windup/windup/subscribers","subscription_url":"https://api.github.com/repos/windup/windup/subscription","commits_url":"https://api.github.com/repos/windup/windup/commits{/sha}","git_commits_url":"https://api.github.com/repos/windup/windup/git/commits{/sha}","comments_url":"https://api.github.com/repos/windup/windup/comments{/number}","issue_comment_url":"https://api.github.com/repos/windup/windup/issues/comments{/number}","contents_url":"https://api.github.com/repos/windup/windup/contents/{+path}","compare_url":"https://api.github.com/repos/windup/windup/compare/{base}...{head}","merges_url":"https://api.github.com/repos/windup/windup/merges","archive_url":"https://api.github.com/repos/windup/windup/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/windup/windup/downloads","issues_url":"https://api.github.com/repos/windup/windup/issues{/number}","pulls_url":"https://api.github.com/repos/windup/windup/pulls{/number}","milestones_url":"https://api.github.com/repos/windup/windup/milestones{/number}","notifications_url":"https://api.github.com/repos/windup/windup/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/windup/windup/labels{/name}","releases_url":"https://api.github.com/repos/windup/windup/releases{/id}","deployments_url":"https://api.github.com/repos/windup/windup/deployments","created_at":"2013-04-26T18:52:08Z","updated_at":"2017-08-29T14:26:17Z","pushed_at":"2017-09-14T21:43:29Z","git_url":"git://github.com/windup/windup.git","ssh_url":"git@github.com:windup/windup.git","clone_url":"https://github.com/windup/windup.git","svn_url":"https://github.com/windup/windup","homepage":"","size":122269,"stargazers_count":72,"watchers_count":72,"language":"Java","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":86,"mirror_url":null,"open_issues_count":51,"forks":86,"open_issues":51,"watchers":72,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/windup/windup/pulls/1174"},"html":{"href":"https://github.com/windup/windup/pull/1174"},"issue":{"href":"https://api.github.com/repos/windup/windup/issues/1174"},"comments":{"href":"https://api.github.com/repos/windup/windup/issues/1174/comments"},"review_comments":{"href":"https://api.github.com/repos/windup/windup/pulls/1174/comments"},"review_comment":{"href":"https://api.github.com/repos/windup/windup/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/windup/windup/pulls/1174/commits"},"statuses":{"href":"https://api.github.com/repos/windup/windup/statuses/6c2033ba0b1244fe9d9bcd3079305458521a1d3f"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"jsight"}}