{"action":"created","comment":{"url":"https://api.github.com/repos/cBioPortal/clinical-data-dictionary/pulls/comments/178370673","pull_request_review_id":108426465,"id":178370673,"diff_hunk":"@@ -0,0 +1,108 @@\n+/*\n+ * Copyright (c) 2018 Memorial Sloan-Kettering Cancer Center.\n+ *\n+ * This library is distributed in the hope that it will be useful, but\n+ * WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF\n+ * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  The software and\n+ * documentation provided hereunder is on an \"as is\" basis, and\n+ * Memorial Sloan-Kettering Cancer Center\n+ * has no obligations to provide maintenance, support,\n+ * updates, enhancements or modifications.  In no event shall\n+ * Memorial Sloan-Kettering Cancer Center\n+ * be liable to any party for direct, indirect, special,\n+ * incidental or consequential damages, including lost profits, arising\n+ * out of the use of this software and its documentation, even if\n+ * Memorial Sloan-Kettering Cancer Center\n+ * has been advised of the possibility of such damage.\n+*/\n+\n+package org.cbioportal.cdd.repository.topbraid;\n+\n+import java.util.Collections;\n+import java.util.List;\n+import java.util.ArrayList;\n+\n+import org.apache.log4j.Logger;\n+\n+import org.springframework.beans.factory.annotation.Autowired;\n+import org.springframework.beans.factory.annotation.Value;\n+import org.springframework.core.ParameterizedTypeReference;\n+import org.springframework.http.HttpEntity;\n+import org.springframework.http.HttpHeaders;\n+import org.springframework.http.HttpMethod;\n+import org.springframework.http.HttpStatus;\n+import org.springframework.http.MediaType;\n+import org.springframework.http.ResponseEntity;\n+import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;\n+import org.springframework.stereotype.Repository;\n+import org.springframework.util.LinkedMultiValueMap;\n+import org.springframework.util.MultiValueMap;\n+import org.springframework.web.client.RestClientException;\n+import org.springframework.web.client.RestTemplate;\n+\n+/**\n+ *\n+ * @author Manda Wilson\n+ **/\n+@Repository\n+public abstract class TopBraidRepository<T> {\n+\n+    private final static Logger logger = Logger.getLogger(TopBraidRepository.class);\n+\n+    @Value(\"${topbraid.url}\")\n+    private String topBraidURL;\n+\n+    @Autowired\n+    private TopBraidSessionConfiguration topBraidSessionConfiguration;\n+\n+    protected List<T> query(String query, ParameterizedTypeReference<List<T>> parameterizedType)\n+            throws TopBraidException {\n+        return query(query, parameterizedType, true);\n+    }\n+\n+    private List<T> query(String query, ParameterizedTypeReference<List<T>> parameterizedType, boolean refreshSessionOnFailure)\n+            throws TopBraidException {\n+        logger.debug(\"query() -- query: '\" + query + \"'\");\n+        String sessionId = topBraidSessionConfiguration.getSessionId();\n+        logger.debug(\"query() -- sessionId: \" + sessionId);\n+        RestTemplate restTemplate = new RestTemplate();\n+\n+        // the default supported types for MappingJackson2HttpMessageConverter are:\n+        //   application/json and application/*+json\n+        // our response content type is application/sparql-results+json-simple\n+        // NOTE: if the response content type was one of the default types we \n+        //   would not have to add the message converter to the rest template\n+        MappingJackson2HttpMessageConverter messageConverter = new MappingJackson2HttpMessageConverter();\n+        messageConverter.setSupportedMediaTypes(Collections.singletonList(\n+            new MediaType(\"application\",\"sparql-results+json-simple\")));\n+        restTemplate.getMessageConverters().add(messageConverter);","path":"src/main/java/org/cbioportal/cdd/repository/topbraid/TopBraidRepository.java","position":78,"original_position":78,"commit_id":"6581c14757c9d8c74c82a03c237d8f7df1fae4fe","original_commit_id":"6581c14757c9d8c74c82a03c237d8f7df1fae4fe","user":{"login":"sheridancbio","id":7747489,"avatar_url":"https://avatars3.githubusercontent.com/u/7747489?v=4","gravatar_id":"","url":"https://api.github.com/users/sheridancbio","html_url":"https://github.com/sheridancbio","followers_url":"https://api.github.com/users/sheridancbio/followers","following_url":"https://api.github.com/users/sheridancbio/following{/other_user}","gists_url":"https://api.github.com/users/sheridancbio/gists{/gist_id}","starred_url":"https://api.github.com/users/sheridancbio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sheridancbio/subscriptions","organizations_url":"https://api.github.com/users/sheridancbio/orgs","repos_url":"https://api.github.com/users/sheridancbio/repos","events_url":"https://api.github.com/users/sheridancbio/events{/privacy}","received_events_url":"https://api.github.com/users/sheridancbio/received_events","type":"User","site_admin":false},"body":"Right .. we have to add it .. I'm just thinking that by having the call inside of the function query() we may be adding additional redundant converters to restTemplate during every future call to this function.","created_at":"2018-03-30T20:24:43Z","updated_at":"2018-03-30T20:24:43Z","html_url":"https://github.com/cBioPortal/clinical-data-dictionary/pull/19#discussion_r178370673","pull_request_url":"https://api.github.com/repos/cBioPortal/clinical-data-dictionary/pulls/19","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/cBioPortal/clinical-data-dictionary/pulls/comments/178370673"},"html":{"href":"https://github.com/cBioPortal/clinical-data-dictionary/pull/19#discussion_r178370673"},"pull_request":{"href":"https://api.github.com/repos/cBioPortal/clinical-data-dictionary/pulls/19"}},"in_reply_to_id":178344442},"pull_request":{"url":"https://api.github.com/repos/cBioPortal/clinical-data-dictionary/pulls/19","id":177988883,"html_url":"https://github.com/cBioPortal/clinical-data-dictionary/pull/19","diff_url":"https://github.com/cBioPortal/clinical-data-dictionary/pull/19.diff","patch_url":"https://github.com/cBioPortal/clinical-data-dictionary/pull/19.patch","issue_url":"https://api.github.com/repos/cBioPortal/clinical-data-dictionary/issues/19","number":19,"state":"open","locked":false,"title":"Queries TobBraid for clinical attributes","user":{"login":"mandawilson","id":1458628,"avatar_url":"https://avatars3.githubusercontent.com/u/1458628?v=4","gravatar_id":"","url":"https://api.github.com/users/mandawilson","html_url":"https://github.com/mandawilson","followers_url":"https://api.github.com/users/mandawilson/followers","following_url":"https://api.github.com/users/mandawilson/following{/other_user}","gists_url":"https://api.github.com/users/mandawilson/gists{/gist_id}","starred_url":"https://api.github.com/users/mandawilson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mandawilson/subscriptions","organizations_url":"https://api.github.com/users/mandawilson/orgs","repos_url":"https://api.github.com/users/mandawilson/repos","events_url":"https://api.github.com/users/mandawilson/events{/privacy}","received_events_url":"https://api.github.com/users/mandawilson/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-03-28T10:06:55Z","updated_at":"2018-03-30T20:24:43Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9366f075083f4db90ed2ed1708ae3bd82e55b31d","assignee":null,"assignees":[],"requested_reviewers":[{"login":"averyniceday","id":18199796,"avatar_url":"https://avatars2.githubusercontent.com/u/18199796?v=4","gravatar_id":"","url":"https://api.github.com/users/averyniceday","html_url":"https://github.com/averyniceday","followers_url":"https://api.github.com/users/averyniceday/followers","following_url":"https://api.github.com/users/averyniceday/following{/other_user}","gists_url":"https://api.github.com/users/averyniceday/gists{/gist_id}","starred_url":"https://api.github.com/users/averyniceday/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/averyniceday/subscriptions","organizations_url":"https://api.github.com/users/averyniceday/orgs","repos_url":"https://api.github.com/users/averyniceday/repos","events_url":"https://api.github.com/users/averyniceday/events{/privacy}","received_events_url":"https://api.github.com/users/averyniceday/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/cBioPortal/clinical-data-dictionary/pulls/19/commits","review_comments_url":"https://api.github.com/repos/cBioPortal/clinical-data-dictionary/pulls/19/comments","review_comment_url":"https://api.github.com/repos/cBioPortal/clinical-data-dictionary/pulls/comments{/number}","comments_url":"https://api.github.com/repos/cBioPortal/clinical-data-dictionary/issues/19/comments","statuses_url":"https://api.github.com/repos/cBioPortal/clinical-data-dictionary/statuses/6581c14757c9d8c74c82a03c237d8f7df1fae4fe","head":{"label":"mandawilson:topbraid-repo","ref":"topbraid-repo","sha":"6581c14757c9d8c74c82a03c237d8f7df1fae4fe","user":{"login":"mandawilson","id":1458628,"avatar_url":"https://avatars3.githubusercontent.com/u/1458628?v=4","gravatar_id":"","url":"https://api.github.com/users/mandawilson","html_url":"https://github.com/mandawilson","followers_url":"https://api.github.com/users/mandawilson/followers","following_url":"https://api.github.com/users/mandawilson/following{/other_user}","gists_url":"https://api.github.com/users/mandawilson/gists{/gist_id}","starred_url":"https://api.github.com/users/mandawilson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mandawilson/subscriptions","organizations_url":"https://api.github.com/users/mandawilson/orgs","repos_url":"https://api.github.com/users/mandawilson/repos","events_url":"https://api.github.com/users/mandawilson/events{/privacy}","received_events_url":"https://api.github.com/users/mandawilson/received_events","type":"User","site_admin":false},"repo":{"id":123326771,"name":"clinical-data-dictionary","full_name":"mandawilson/clinical-data-dictionary","owner":{"login":"mandawilson","id":1458628,"avatar_url":"https://avatars3.githubusercontent.com/u/1458628?v=4","gravatar_id":"","url":"https://api.github.com/users/mandawilson","html_url":"https://github.com/mandawilson","followers_url":"https://api.github.com/users/mandawilson/followers","following_url":"https://api.github.com/users/mandawilson/following{/other_user}","gists_url":"https://api.github.com/users/mandawilson/gists{/gist_id}","starred_url":"https://api.github.com/users/mandawilson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mandawilson/subscriptions","organizations_url":"https://api.github.com/users/mandawilson/orgs","repos_url":"https://api.github.com/users/mandawilson/repos","events_url":"https://api.github.com/users/mandawilson/events{/privacy}","received_events_url":"https://api.github.com/users/mandawilson/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mandawilson/clinical-data-dictionary","description":"Clinical Data Dictionary Web Service","fork":true,"url":"https://api.github.com/repos/mandawilson/clinical-data-dictionary","forks_url":"https://api.github.com/repos/mandawilson/clinical-data-dictionary/forks","keys_url":"https://api.github.com/repos/mandawilson/clinical-data-dictionary/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mandawilson/clinical-data-dictionary/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mandawilson/clinical-data-dictionary/teams","hooks_url":"https://api.github.com/repos/mandawilson/clinical-data-dictionary/hooks","issue_events_url":"https://api.github.com/repos/mandawilson/clinical-data-dictionary/issues/events{/number}","events_url":"https://api.github.com/repos/mandawilson/clinical-data-dictionary/events","assignees_url":"https://api.github.com/repos/mandawilson/clinical-data-dictionary/assignees{/user}","branches_url":"https://api.github.com/repos/mandawilson/clinical-data-dictionary/branches{/branch}","tags_url":"https://api.github.com/repos/mandawilson/clinical-data-dictionary/tags","blobs_url":"https://api.github.com/repos/mandawilson/clinical-data-dictionary/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mandawilson/clinical-data-dictionary/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mandawilson/clinical-data-dictionary/git/refs{/sha}","trees_url":"https://api.github.com/repos/mandawilson/clinical-data-dictionary/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mandawilson/clinical-data-dictionary/statuses/{sha}","languages_url":"https://api.github.com/repos/mandawilson/clinical-data-dictionary/languages","stargazers_url":"https://api.github.com/repos/mandawilson/clinical-data-dictionary/stargazers","contributors_url":"https://api.github.com/repos/mandawilson/clinical-data-dictionary/contributors","subscribers_url":"https://api.github.com/repos/mandawilson/clinical-data-dictionary/subscribers","subscription_url":"https://api.github.com/repos/mandawilson/clinical-data-dictionary/subscription","commits_url":"https://api.github.com/repos/mandawilson/clinical-data-dictionary/commits{/sha}","git_commits_url":"https://api.github.com/repos/mandawilson/clinical-data-dictionary/git/commits{/sha}","comments_url":"https://api.github.com/repos/mandawilson/clinical-data-dictionary/comments{/number}","issue_comment_url":"https://api.github.com/repos/mandawilson/clinical-data-dictionary/issues/comments{/number}","contents_url":"https://api.github.com/repos/mandawilson/clinical-data-dictionary/contents/{+path}","compare_url":"https://api.github.com/repos/mandawilson/clinical-data-dictionary/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mandawilson/clinical-data-dictionary/merges","archive_url":"https://api.github.com/repos/mandawilson/clinical-data-dictionary/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mandawilson/clinical-data-dictionary/downloads","issues_url":"https://api.github.com/repos/mandawilson/clinical-data-dictionary/issues{/number}","pulls_url":"https://api.github.com/repos/mandawilson/clinical-data-dictionary/pulls{/number}","milestones_url":"https://api.github.com/repos/mandawilson/clinical-data-dictionary/milestones{/number}","notifications_url":"https://api.github.com/repos/mandawilson/clinical-data-dictionary/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mandawilson/clinical-data-dictionary/labels{/name}","releases_url":"https://api.github.com/repos/mandawilson/clinical-data-dictionary/releases{/id}","deployments_url":"https://api.github.com/repos/mandawilson/clinical-data-dictionary/deployments","created_at":"2018-02-28T18:42:26Z","updated_at":"2018-03-12T14:45:07Z","pushed_at":"2018-03-28T19:39:48Z","git_url":"git://github.com/mandawilson/clinical-data-dictionary.git","ssh_url":"git@github.com:mandawilson/clinical-data-dictionary.git","clone_url":"https://github.com/mandawilson/clinical-data-dictionary.git","svn_url":"https://github.com/mandawilson/clinical-data-dictionary","homepage":"","size":60,"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,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"cBioPortal:master","ref":"master","sha":"cbbfa57161585abf19449fdc7f9c12403f730035","user":{"login":"cBioPortal","id":9876251,"avatar_url":"https://avatars2.githubusercontent.com/u/9876251?v=4","gravatar_id":"","url":"https://api.github.com/users/cBioPortal","html_url":"https://github.com/cBioPortal","followers_url":"https://api.github.com/users/cBioPortal/followers","following_url":"https://api.github.com/users/cBioPortal/following{/other_user}","gists_url":"https://api.github.com/users/cBioPortal/gists{/gist_id}","starred_url":"https://api.github.com/users/cBioPortal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cBioPortal/subscriptions","organizations_url":"https://api.github.com/users/cBioPortal/orgs","repos_url":"https://api.github.com/users/cBioPortal/repos","events_url":"https://api.github.com/users/cBioPortal/events{/privacy}","received_events_url":"https://api.github.com/users/cBioPortal/received_events","type":"Organization","site_admin":false},"repo":{"id":122997152,"name":"clinical-data-dictionary","full_name":"cBioPortal/clinical-data-dictionary","owner":{"login":"cBioPortal","id":9876251,"avatar_url":"https://avatars2.githubusercontent.com/u/9876251?v=4","gravatar_id":"","url":"https://api.github.com/users/cBioPortal","html_url":"https://github.com/cBioPortal","followers_url":"https://api.github.com/users/cBioPortal/followers","following_url":"https://api.github.com/users/cBioPortal/following{/other_user}","gists_url":"https://api.github.com/users/cBioPortal/gists{/gist_id}","starred_url":"https://api.github.com/users/cBioPortal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cBioPortal/subscriptions","organizations_url":"https://api.github.com/users/cBioPortal/orgs","repos_url":"https://api.github.com/users/cBioPortal/repos","events_url":"https://api.github.com/users/cBioPortal/events{/privacy}","received_events_url":"https://api.github.com/users/cBioPortal/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cBioPortal/clinical-data-dictionary","description":"Clinical Attribute Web Service for retrieving clinical attribute names and metadata.","fork":false,"url":"https://api.github.com/repos/cBioPortal/clinical-data-dictionary","forks_url":"https://api.github.com/repos/cBioPortal/clinical-data-dictionary/forks","keys_url":"https://api.github.com/repos/cBioPortal/clinical-data-dictionary/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cBioPortal/clinical-data-dictionary/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cBioPortal/clinical-data-dictionary/teams","hooks_url":"https://api.github.com/repos/cBioPortal/clinical-data-dictionary/hooks","issue_events_url":"https://api.github.com/repos/cBioPortal/clinical-data-dictionary/issues/events{/number}","events_url":"https://api.github.com/repos/cBioPortal/clinical-data-dictionary/events","assignees_url":"https://api.github.com/repos/cBioPortal/clinical-data-dictionary/assignees{/user}","branches_url":"https://api.github.com/repos/cBioPortal/clinical-data-dictionary/branches{/branch}","tags_url":"https://api.github.com/repos/cBioPortal/clinical-data-dictionary/tags","blobs_url":"https://api.github.com/repos/cBioPortal/clinical-data-dictionary/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cBioPortal/clinical-data-dictionary/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cBioPortal/clinical-data-dictionary/git/refs{/sha}","trees_url":"https://api.github.com/repos/cBioPortal/clinical-data-dictionary/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cBioPortal/clinical-data-dictionary/statuses/{sha}","languages_url":"https://api.github.com/repos/cBioPortal/clinical-data-dictionary/languages","stargazers_url":"https://api.github.com/repos/cBioPortal/clinical-data-dictionary/stargazers","contributors_url":"https://api.github.com/repos/cBioPortal/clinical-data-dictionary/contributors","subscribers_url":"https://api.github.com/repos/cBioPortal/clinical-data-dictionary/subscribers","subscription_url":"https://api.github.com/repos/cBioPortal/clinical-data-dictionary/subscription","commits_url":"https://api.github.com/repos/cBioPortal/clinical-data-dictionary/commits{/sha}","git_commits_url":"https://api.github.com/repos/cBioPortal/clinical-data-dictionary/git/commits{/sha}","comments_url":"https://api.github.com/repos/cBioPortal/clinical-data-dictionary/comments{/number}","issue_comment_url":"https://api.github.com/repos/cBioPortal/clinical-data-dictionary/issues/comments{/number}","contents_url":"https://api.github.com/repos/cBioPortal/clinical-data-dictionary/contents/{+path}","compare_url":"https://api.github.com/repos/cBioPortal/clinical-data-dictionary/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cBioPortal/clinical-data-dictionary/merges","archive_url":"https://api.github.com/repos/cBioPortal/clinical-data-dictionary/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cBioPortal/clinical-data-dictionary/downloads","issues_url":"https://api.github.com/repos/cBioPortal/clinical-data-dictionary/issues{/number}","pulls_url":"https://api.github.com/repos/cBioPortal/clinical-data-dictionary/pulls{/number}","milestones_url":"https://api.github.com/repos/cBioPortal/clinical-data-dictionary/milestones{/number}","notifications_url":"https://api.github.com/repos/cBioPortal/clinical-data-dictionary/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cBioPortal/clinical-data-dictionary/labels{/name}","releases_url":"https://api.github.com/repos/cBioPortal/clinical-data-dictionary/releases{/id}","deployments_url":"https://api.github.com/repos/cBioPortal/clinical-data-dictionary/deployments","created_at":"2018-02-26T16:29:48Z","updated_at":"2018-03-26T18:12:39Z","pushed_at":"2018-03-28T19:39:50Z","git_url":"git://github.com/cBioPortal/clinical-data-dictionary.git","ssh_url":"git@github.com:cBioPortal/clinical-data-dictionary.git","clone_url":"https://github.com/cBioPortal/clinical-data-dictionary.git","svn_url":"https://github.com/cBioPortal/clinical-data-dictionary","homepage":"","size":53,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"archived":false,"open_issues_count":5,"license":null,"forks":4,"open_issues":5,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/cBioPortal/clinical-data-dictionary/pulls/19"},"html":{"href":"https://github.com/cBioPortal/clinical-data-dictionary/pull/19"},"issue":{"href":"https://api.github.com/repos/cBioPortal/clinical-data-dictionary/issues/19"},"comments":{"href":"https://api.github.com/repos/cBioPortal/clinical-data-dictionary/issues/19/comments"},"review_comments":{"href":"https://api.github.com/repos/cBioPortal/clinical-data-dictionary/pulls/19/comments"},"review_comment":{"href":"https://api.github.com/repos/cBioPortal/clinical-data-dictionary/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/cBioPortal/clinical-data-dictionary/pulls/19/commits"},"statuses":{"href":"https://api.github.com/repos/cBioPortal/clinical-data-dictionary/statuses/6581c14757c9d8c74c82a03c237d8f7df1fae4fe"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"sheridancbio"}}