{"action":"created","comment":{"url":"https://api.github.com/repos/Sage-Bionetworks/SynapseWebClient/pulls/comments/60454662","id":60454662,"diff_hunk":"@@ -50,51 +55,95 @@ public void clearState() {\n \t}\n \n \tpublic void configure(boolean showVersions, SelectedHandler<Reference> handler) {\n+\t\tconfigure(EntityFilter.ALL, showVersions, handler);\n+\t}\n+\t\n+\n+\tpublic void configure(EntityFilter filter, boolean showVersions, SelectedHandler<Reference> handler) {\n+\t\tthis.filter = filter;\n \t\tthis.showVersions = showVersions;\n \t\tthis.selectedHandler = handler;\n \t}\n \t\n \t@Override\n \tpublic void setSelectedEntity(Reference selected) {\n+\t\tsynAlert.clear();\n \t\tselectedEntity = selected;\n \t}\n \t\n \t@Override\n \tpublic void okClicked() {\n+\t\tsynAlert.clear();\n \t\t//check for valid selection\n \t\tif (selectedEntity == null || selectedEntity.getTargetId() == null) {\n-\t\t\tview.showErrorMessage(DisplayConstants.PLEASE_MAKE_SELECTION);\n-\t\t} else if (selectedHandler != null) {\n-\t\t\tselectedHandler.onSelected(selectedEntity);\n+\t\t\tsynAlert.showError(DisplayConstants.PLEASE_MAKE_SELECTION);\n+\t\t} else {\n+\t\t\t// fetch the entity for a type check\n+\t\t\tlookupEntity(selectedEntity.getTargetId(), new AsyncCallback<Entity>() {\n+\t\t\t\t@Override\n+\t\t\t\tpublic void onFailure(Throwable caught) {\n+\t\t\t\t\tsynAlert.handleException(caught);\n+\t\t\t\t}\n+\t\t\t\tpublic void onSuccess(Entity result) {\n+\t\t\t\t\tif (validateEntityTypeAgainstFilter(result)) {\n+\t\t\t\t\t\tif (selectedHandler != null) {\n+\t\t\t\t\t\t\tselectedHandler.onSelected(selectedEntity);\n+\t\t\t\t\t\t}\n+\t\t\t\t\t}\n+\t\t\t\t};\n+\t\t\t});\n \t\t}\n \t}\n+\t\n+\tpublic boolean validateEntityTypeAgainstFilter(Entity entity) {\n+\t\tboolean isCorrectType = true;\n+\t\tsynAlert.clear();\n+\t\tswitch (filter) {\n+\t\t\tcase CONTAINER:","path":"src/main/java/org/sagebionetworks/web/client/widget/entity/browse/EntityFinder.java","position":109,"original_position":109,"commit_id":"56c838c56c164fe3f8d7b9d9cdb539d906b69c20","original_commit_id":"56c838c56c164fe3f8d7b9d9cdb539d906b69c20","user":{"login":"jay-hodgson","id":1864447,"avatar_url":"https://avatars.githubusercontent.com/u/1864447?v=3","gravatar_id":"","url":"https://api.github.com/users/jay-hodgson","html_url":"https://github.com/jay-hodgson","followers_url":"https://api.github.com/users/jay-hodgson/followers","following_url":"https://api.github.com/users/jay-hodgson/following{/other_user}","gists_url":"https://api.github.com/users/jay-hodgson/gists{/gist_id}","starred_url":"https://api.github.com/users/jay-hodgson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jay-hodgson/subscriptions","organizations_url":"https://api.github.com/users/jay-hodgson/orgs","repos_url":"https://api.github.com/users/jay-hodgson/repos","events_url":"https://api.github.com/users/jay-hodgson/events{/privacy}","received_events_url":"https://api.github.com/users/jay-hodgson/received_events","type":"User","site_admin":false},"body":"Move entity type check logic to Filter.","created_at":"2016-04-20T17:44:32Z","updated_at":"2016-04-20T17:44:32Z","html_url":"https://github.com/Sage-Bionetworks/SynapseWebClient/pull/2230#discussion_r60454662","pull_request_url":"https://api.github.com/repos/Sage-Bionetworks/SynapseWebClient/pulls/2230","_links":{"self":{"href":"https://api.github.com/repos/Sage-Bionetworks/SynapseWebClient/pulls/comments/60454662"},"html":{"href":"https://github.com/Sage-Bionetworks/SynapseWebClient/pull/2230#discussion_r60454662"},"pull_request":{"href":"https://api.github.com/repos/Sage-Bionetworks/SynapseWebClient/pulls/2230"}}},"pull_request":{"url":"https://api.github.com/repos/Sage-Bionetworks/SynapseWebClient/pulls/2230","id":67081132,"html_url":"https://github.com/Sage-Bionetworks/SynapseWebClient/pull/2230","diff_url":"https://github.com/Sage-Bionetworks/SynapseWebClient/pull/2230.diff","patch_url":"https://github.com/Sage-Bionetworks/SynapseWebClient/pull/2230.patch","issue_url":"https://api.github.com/repos/Sage-Bionetworks/SynapseWebClient/issues/2230","number":2230,"state":"open","locked":false,"title":"SWC-3018: ability to specify a filter to the entity finder","user":{"login":"jay-hodgson","id":1864447,"avatar_url":"https://avatars.githubusercontent.com/u/1864447?v=3","gravatar_id":"","url":"https://api.github.com/users/jay-hodgson","html_url":"https://github.com/jay-hodgson","followers_url":"https://api.github.com/users/jay-hodgson/followers","following_url":"https://api.github.com/users/jay-hodgson/following{/other_user}","gists_url":"https://api.github.com/users/jay-hodgson/gists{/gist_id}","starred_url":"https://api.github.com/users/jay-hodgson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jay-hodgson/subscriptions","organizations_url":"https://api.github.com/users/jay-hodgson/orgs","repos_url":"https://api.github.com/users/jay-hodgson/repos","events_url":"https://api.github.com/users/jay-hodgson/events{/privacy}","received_events_url":"https://api.github.com/users/jay-hodgson/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-04-19T20:08:42Z","updated_at":"2016-04-20T17:44:32Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b67e924568a742aa7568584aad5d937b4dd7f9e2","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Sage-Bionetworks/SynapseWebClient/pulls/2230/commits","review_comments_url":"https://api.github.com/repos/Sage-Bionetworks/SynapseWebClient/pulls/2230/comments","review_comment_url":"https://api.github.com/repos/Sage-Bionetworks/SynapseWebClient/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Sage-Bionetworks/SynapseWebClient/issues/2230/comments","statuses_url":"https://api.github.com/repos/Sage-Bionetworks/SynapseWebClient/statuses/56c838c56c164fe3f8d7b9d9cdb539d906b69c20","head":{"label":"jay-hodgson:SWC-3018","ref":"SWC-3018","sha":"56c838c56c164fe3f8d7b9d9cdb539d906b69c20","user":{"login":"jay-hodgson","id":1864447,"avatar_url":"https://avatars.githubusercontent.com/u/1864447?v=3","gravatar_id":"","url":"https://api.github.com/users/jay-hodgson","html_url":"https://github.com/jay-hodgson","followers_url":"https://api.github.com/users/jay-hodgson/followers","following_url":"https://api.github.com/users/jay-hodgson/following{/other_user}","gists_url":"https://api.github.com/users/jay-hodgson/gists{/gist_id}","starred_url":"https://api.github.com/users/jay-hodgson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jay-hodgson/subscriptions","organizations_url":"https://api.github.com/users/jay-hodgson/orgs","repos_url":"https://api.github.com/users/jay-hodgson/repos","events_url":"https://api.github.com/users/jay-hodgson/events{/privacy}","received_events_url":"https://api.github.com/users/jay-hodgson/received_events","type":"User","site_admin":false},"repo":{"id":4719704,"name":"SynapseWebClient","full_name":"jay-hodgson/SynapseWebClient","owner":{"login":"jay-hodgson","id":1864447,"avatar_url":"https://avatars.githubusercontent.com/u/1864447?v=3","gravatar_id":"","url":"https://api.github.com/users/jay-hodgson","html_url":"https://github.com/jay-hodgson","followers_url":"https://api.github.com/users/jay-hodgson/followers","following_url":"https://api.github.com/users/jay-hodgson/following{/other_user}","gists_url":"https://api.github.com/users/jay-hodgson/gists{/gist_id}","starred_url":"https://api.github.com/users/jay-hodgson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jay-hodgson/subscriptions","organizations_url":"https://api.github.com/users/jay-hodgson/orgs","repos_url":"https://api.github.com/users/jay-hodgson/repos","events_url":"https://api.github.com/users/jay-hodgson/events{/privacy}","received_events_url":"https://api.github.com/users/jay-hodgson/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jay-hodgson/SynapseWebClient","description":"The web client of the Synapse REST service core","fork":true,"url":"https://api.github.com/repos/jay-hodgson/SynapseWebClient","forks_url":"https://api.github.com/repos/jay-hodgson/SynapseWebClient/forks","keys_url":"https://api.github.com/repos/jay-hodgson/SynapseWebClient/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jay-hodgson/SynapseWebClient/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jay-hodgson/SynapseWebClient/teams","hooks_url":"https://api.github.com/repos/jay-hodgson/SynapseWebClient/hooks","issue_events_url":"https://api.github.com/repos/jay-hodgson/SynapseWebClient/issues/events{/number}","events_url":"https://api.github.com/repos/jay-hodgson/SynapseWebClient/events","assignees_url":"https://api.github.com/repos/jay-hodgson/SynapseWebClient/assignees{/user}","branches_url":"https://api.github.com/repos/jay-hodgson/SynapseWebClient/branches{/branch}","tags_url":"https://api.github.com/repos/jay-hodgson/SynapseWebClient/tags","blobs_url":"https://api.github.com/repos/jay-hodgson/SynapseWebClient/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jay-hodgson/SynapseWebClient/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jay-hodgson/SynapseWebClient/git/refs{/sha}","trees_url":"https://api.github.com/repos/jay-hodgson/SynapseWebClient/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jay-hodgson/SynapseWebClient/statuses/{sha}","languages_url":"https://api.github.com/repos/jay-hodgson/SynapseWebClient/languages","stargazers_url":"https://api.github.com/repos/jay-hodgson/SynapseWebClient/stargazers","contributors_url":"https://api.github.com/repos/jay-hodgson/SynapseWebClient/contributors","subscribers_url":"https://api.github.com/repos/jay-hodgson/SynapseWebClient/subscribers","subscription_url":"https://api.github.com/repos/jay-hodgson/SynapseWebClient/subscription","commits_url":"https://api.github.com/repos/jay-hodgson/SynapseWebClient/commits{/sha}","git_commits_url":"https://api.github.com/repos/jay-hodgson/SynapseWebClient/git/commits{/sha}","comments_url":"https://api.github.com/repos/jay-hodgson/SynapseWebClient/comments{/number}","issue_comment_url":"https://api.github.com/repos/jay-hodgson/SynapseWebClient/issues/comments{/number}","contents_url":"https://api.github.com/repos/jay-hodgson/SynapseWebClient/contents/{+path}","compare_url":"https://api.github.com/repos/jay-hodgson/SynapseWebClient/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jay-hodgson/SynapseWebClient/merges","archive_url":"https://api.github.com/repos/jay-hodgson/SynapseWebClient/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jay-hodgson/SynapseWebClient/downloads","issues_url":"https://api.github.com/repos/jay-hodgson/SynapseWebClient/issues{/number}","pulls_url":"https://api.github.com/repos/jay-hodgson/SynapseWebClient/pulls{/number}","milestones_url":"https://api.github.com/repos/jay-hodgson/SynapseWebClient/milestones{/number}","notifications_url":"https://api.github.com/repos/jay-hodgson/SynapseWebClient/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jay-hodgson/SynapseWebClient/labels{/name}","releases_url":"https://api.github.com/repos/jay-hodgson/SynapseWebClient/releases{/id}","deployments_url":"https://api.github.com/repos/jay-hodgson/SynapseWebClient/deployments","created_at":"2012-06-19T21:57:07Z","updated_at":"2015-05-07T19:59:26Z","pushed_at":"2016-04-19T23:10:26Z","git_url":"git://github.com/jay-hodgson/SynapseWebClient.git","ssh_url":"git@github.com:jay-hodgson/SynapseWebClient.git","clone_url":"https://github.com/jay-hodgson/SynapseWebClient.git","svn_url":"https://github.com/jay-hodgson/SynapseWebClient","homepage":null,"size":60000,"stargazers_count":1,"watchers_count":1,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":1,"default_branch":"develop"}},"base":{"label":"Sage-Bionetworks:develop","ref":"develop","sha":"2aff36e2b7cdb3d84ed60628318f2b8392f76e2a","user":{"login":"Sage-Bionetworks","id":1250897,"avatar_url":"https://avatars.githubusercontent.com/u/1250897?v=3","gravatar_id":"","url":"https://api.github.com/users/Sage-Bionetworks","html_url":"https://github.com/Sage-Bionetworks","followers_url":"https://api.github.com/users/Sage-Bionetworks/followers","following_url":"https://api.github.com/users/Sage-Bionetworks/following{/other_user}","gists_url":"https://api.github.com/users/Sage-Bionetworks/gists{/gist_id}","starred_url":"https://api.github.com/users/Sage-Bionetworks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Sage-Bionetworks/subscriptions","organizations_url":"https://api.github.com/users/Sage-Bionetworks/orgs","repos_url":"https://api.github.com/users/Sage-Bionetworks/repos","events_url":"https://api.github.com/users/Sage-Bionetworks/events{/privacy}","received_events_url":"https://api.github.com/users/Sage-Bionetworks/received_events","type":"Organization","site_admin":false},"repo":{"id":4302671,"name":"SynapseWebClient","full_name":"Sage-Bionetworks/SynapseWebClient","owner":{"login":"Sage-Bionetworks","id":1250897,"avatar_url":"https://avatars.githubusercontent.com/u/1250897?v=3","gravatar_id":"","url":"https://api.github.com/users/Sage-Bionetworks","html_url":"https://github.com/Sage-Bionetworks","followers_url":"https://api.github.com/users/Sage-Bionetworks/followers","following_url":"https://api.github.com/users/Sage-Bionetworks/following{/other_user}","gists_url":"https://api.github.com/users/Sage-Bionetworks/gists{/gist_id}","starred_url":"https://api.github.com/users/Sage-Bionetworks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Sage-Bionetworks/subscriptions","organizations_url":"https://api.github.com/users/Sage-Bionetworks/orgs","repos_url":"https://api.github.com/users/Sage-Bionetworks/repos","events_url":"https://api.github.com/users/Sage-Bionetworks/events{/privacy}","received_events_url":"https://api.github.com/users/Sage-Bionetworks/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Sage-Bionetworks/SynapseWebClient","description":"The web client of the Synapse REST service core","fork":false,"url":"https://api.github.com/repos/Sage-Bionetworks/SynapseWebClient","forks_url":"https://api.github.com/repos/Sage-Bionetworks/SynapseWebClient/forks","keys_url":"https://api.github.com/repos/Sage-Bionetworks/SynapseWebClient/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Sage-Bionetworks/SynapseWebClient/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Sage-Bionetworks/SynapseWebClient/teams","hooks_url":"https://api.github.com/repos/Sage-Bionetworks/SynapseWebClient/hooks","issue_events_url":"https://api.github.com/repos/Sage-Bionetworks/SynapseWebClient/issues/events{/number}","events_url":"https://api.github.com/repos/Sage-Bionetworks/SynapseWebClient/events","assignees_url":"https://api.github.com/repos/Sage-Bionetworks/SynapseWebClient/assignees{/user}","branches_url":"https://api.github.com/repos/Sage-Bionetworks/SynapseWebClient/branches{/branch}","tags_url":"https://api.github.com/repos/Sage-Bionetworks/SynapseWebClient/tags","blobs_url":"https://api.github.com/repos/Sage-Bionetworks/SynapseWebClient/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Sage-Bionetworks/SynapseWebClient/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Sage-Bionetworks/SynapseWebClient/git/refs{/sha}","trees_url":"https://api.github.com/repos/Sage-Bionetworks/SynapseWebClient/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Sage-Bionetworks/SynapseWebClient/statuses/{sha}","languages_url":"https://api.github.com/repos/Sage-Bionetworks/SynapseWebClient/languages","stargazers_url":"https://api.github.com/repos/Sage-Bionetworks/SynapseWebClient/stargazers","contributors_url":"https://api.github.com/repos/Sage-Bionetworks/SynapseWebClient/contributors","subscribers_url":"https://api.github.com/repos/Sage-Bionetworks/SynapseWebClient/subscribers","subscription_url":"https://api.github.com/repos/Sage-Bionetworks/SynapseWebClient/subscription","commits_url":"https://api.github.com/repos/Sage-Bionetworks/SynapseWebClient/commits{/sha}","git_commits_url":"https://api.github.com/repos/Sage-Bionetworks/SynapseWebClient/git/commits{/sha}","comments_url":"https://api.github.com/repos/Sage-Bionetworks/SynapseWebClient/comments{/number}","issue_comment_url":"https://api.github.com/repos/Sage-Bionetworks/SynapseWebClient/issues/comments{/number}","contents_url":"https://api.github.com/repos/Sage-Bionetworks/SynapseWebClient/contents/{+path}","compare_url":"https://api.github.com/repos/Sage-Bionetworks/SynapseWebClient/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Sage-Bionetworks/SynapseWebClient/merges","archive_url":"https://api.github.com/repos/Sage-Bionetworks/SynapseWebClient/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Sage-Bionetworks/SynapseWebClient/downloads","issues_url":"https://api.github.com/repos/Sage-Bionetworks/SynapseWebClient/issues{/number}","pulls_url":"https://api.github.com/repos/Sage-Bionetworks/SynapseWebClient/pulls{/number}","milestones_url":"https://api.github.com/repos/Sage-Bionetworks/SynapseWebClient/milestones{/number}","notifications_url":"https://api.github.com/repos/Sage-Bionetworks/SynapseWebClient/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Sage-Bionetworks/SynapseWebClient/labels{/name}","releases_url":"https://api.github.com/repos/Sage-Bionetworks/SynapseWebClient/releases{/id}","deployments_url":"https://api.github.com/repos/Sage-Bionetworks/SynapseWebClient/deployments","created_at":"2012-05-11T23:11:54Z","updated_at":"2016-02-06T14:16:25Z","pushed_at":"2016-04-20T00:36:16Z","git_url":"git://github.com/Sage-Bionetworks/SynapseWebClient.git","ssh_url":"git@github.com:Sage-Bionetworks/SynapseWebClient.git","clone_url":"https://github.com/Sage-Bionetworks/SynapseWebClient.git","svn_url":"https://github.com/Sage-Bionetworks/SynapseWebClient","homepage":null,"size":56876,"stargazers_count":18,"watchers_count":18,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":23,"mirror_url":null,"open_issues_count":4,"forks":23,"open_issues":4,"watchers":18,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/Sage-Bionetworks/SynapseWebClient/pulls/2230"},"html":{"href":"https://github.com/Sage-Bionetworks/SynapseWebClient/pull/2230"},"issue":{"href":"https://api.github.com/repos/Sage-Bionetworks/SynapseWebClient/issues/2230"},"comments":{"href":"https://api.github.com/repos/Sage-Bionetworks/SynapseWebClient/issues/2230/comments"},"review_comments":{"href":"https://api.github.com/repos/Sage-Bionetworks/SynapseWebClient/pulls/2230/comments"},"review_comment":{"href":"https://api.github.com/repos/Sage-Bionetworks/SynapseWebClient/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Sage-Bionetworks/SynapseWebClient/pulls/2230/commits"},"statuses":{"href":"https://api.github.com/repos/Sage-Bionetworks/SynapseWebClient/statuses/56c838c56c164fe3f8d7b9d9cdb539d906b69c20"}}}}