{"action":"created","comment":{"url":"https://api.github.com/repos/Lony13/thesis-browser-server/pulls/comments/224959620","pull_request_review_id":164462005,"id":224959620,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyNDk1OTYyMA==","diff_hunk":"@@ -0,0 +1,138 @@\n+package com.koczy.kurek.mizera.thesisbrowser.service;\n+\n+import com.koczy.kurek.mizera.thesisbrowser.downloader.Parser.PdfParser;\n+import com.koczy.kurek.mizera.thesisbrowser.downloader.PdfDownloader;\n+import com.koczy.kurek.mizera.thesisbrowser.downloader.Scraper.AGHLibraryScraper;\n+import com.koczy.kurek.mizera.thesisbrowser.downloader.Scraper.DblpScraper;\n+import com.koczy.kurek.mizera.thesisbrowser.downloader.Scraper.GoogleScraper;\n+import com.koczy.kurek.mizera.thesisbrowser.entity.Thesis;\n+import com.koczy.kurek.mizera.thesisbrowser.model.ThesisFilters;\n+import org.springframework.beans.factory.annotation.Autowired;\n+import org.springframework.http.HttpStatus;\n+import org.springframework.http.ResponseEntity;\n+import org.springframework.stereotype.Service;\n+import org.springframework.util.StringUtils;\n+\n+import java.io.BufferedReader;\n+import java.io.IOException;\n+import java.io.InputStream;\n+import java.io.InputStreamReader;\n+import java.util.HashSet;\n+import java.util.Set;\n+import java.util.logging.Level;\n+import java.util.logging.Logger;\n+\n+@Service\n+public class DownloadService implements IDownloadService {\n+\n+    private static final Logger logger = Logger.getLogger(DownloadService.class.getName());\n+\n+    private static final String REGEX = \"[ :/*?|\\\"<>.]\";\n+    private static final String REPLACEMENT = \"_\";\n+    private static final String TXT = \".txt\";\n+    private static final String PDF = \".pdf\";\n+\n+    private AGHLibraryScraper aghLibraryScraper;\n+    private DblpScraper dblpScraper;\n+    private GoogleScraper googleScraper;\n+    private PdfDownloader pdfDownloader;\n+    private PdfParser pdfParser;\n+\n+    @Autowired\n+    public DownloadService(AGHLibraryScraper aghLibraryScraper,\n+                           DblpScraper dblpScraper,\n+                           GoogleScraper googleScraper,\n+                           PdfDownloader pdfDownloader,\n+                           PdfParser pdfParser) {\n+        this.aghLibraryScraper = aghLibraryScraper;\n+        this.dblpScraper = dblpScraper;\n+        this.googleScraper = googleScraper;\n+        this.pdfDownloader = pdfDownloader;\n+        this.pdfParser = pdfParser;\n+    }\n+\n+    @Override\n+    public ResponseEntity downloadTheses(ThesisFilters thesisFilters) {\n+        String firstName = thesisFilters.getAuthor().split(\" \")[0];\n+        String lastName = thesisFilters.getAuthor().split(\" \")[1];\n+        Set<Thesis> theses = new HashSet<>();\n+        try{\n+            if(StringUtils.isEmpty(thesisFilters.getTitle())){\n+                theses.addAll(findAllThesesFromAuthor(firstName, lastName));\n+            }else{\n+                theses.add(findThesisByAuthorNameAndTitle(firstName, lastName, thesisFilters.getTitle()));\n+            }\n+        } catch (IOException e) {\n+            logger.log(Level.WARNING, e.toString());\n+            return new ResponseEntity(HttpStatus.INTERNAL_SERVER_ERROR);","path":"src/main/java/com/koczy/kurek/mizera/thesisbrowser/service/DownloadService.java","position":67,"original_position":67,"commit_id":"46bcf0394023f98211dcad8e35e680873d1e6c15","original_commit_id":"46bcf0394023f98211dcad8e35e680873d1e6c15","user":{"login":"Lony13","id":26119083,"node_id":"MDQ6VXNlcjI2MTE5MDgz","avatar_url":"https://avatars3.githubusercontent.com/u/26119083?v=4","gravatar_id":"","url":"https://api.github.com/users/Lony13","html_url":"https://github.com/Lony13","followers_url":"https://api.github.com/users/Lony13/followers","following_url":"https://api.github.com/users/Lony13/following{/other_user}","gists_url":"https://api.github.com/users/Lony13/gists{/gist_id}","starred_url":"https://api.github.com/users/Lony13/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Lony13/subscriptions","organizations_url":"https://api.github.com/users/Lony13/orgs","repos_url":"https://api.github.com/users/Lony13/repos","events_url":"https://api.github.com/users/Lony13/events{/privacy}","received_events_url":"https://api.github.com/users/Lony13/received_events","type":"User","site_admin":false},"body":"Wiem, że to ja dodałem, ale można by się zastanowić czy zwracamy taki status czy nie jakiś inny, plus można dopisać treść błędu jakąś od nas, new ResponseEntity(\"Jakis blad\", HttpStatus.COS);","created_at":"2018-10-13T13:04:20Z","updated_at":"2018-10-13T13:08:24Z","html_url":"https://github.com/Lony13/thesis-browser-server/pull/2#discussion_r224959620","pull_request_url":"https://api.github.com/repos/Lony13/thesis-browser-server/pulls/2","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/Lony13/thesis-browser-server/pulls/comments/224959620"},"html":{"href":"https://github.com/Lony13/thesis-browser-server/pull/2#discussion_r224959620"},"pull_request":{"href":"https://api.github.com/repos/Lony13/thesis-browser-server/pulls/2"}}},"pull_request":{"url":"https://api.github.com/repos/Lony13/thesis-browser-server/pulls/2","id":222647245,"node_id":"MDExOlB1bGxSZXF1ZXN0MjIyNjQ3MjQ1","html_url":"https://github.com/Lony13/thesis-browser-server/pull/2","diff_url":"https://github.com/Lony13/thesis-browser-server/pull/2.diff","patch_url":"https://github.com/Lony13/thesis-browser-server/pull/2.patch","issue_url":"https://api.github.com/repos/Lony13/thesis-browser-server/issues/2","number":2,"state":"open","locked":false,"title":"Dev kurek pdf downloader","user":{"login":"Thomasz111","id":26261719,"node_id":"MDQ6VXNlcjI2MjYxNzE5","avatar_url":"https://avatars3.githubusercontent.com/u/26261719?v=4","gravatar_id":"","url":"https://api.github.com/users/Thomasz111","html_url":"https://github.com/Thomasz111","followers_url":"https://api.github.com/users/Thomasz111/followers","following_url":"https://api.github.com/users/Thomasz111/following{/other_user}","gists_url":"https://api.github.com/users/Thomasz111/gists{/gist_id}","starred_url":"https://api.github.com/users/Thomasz111/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Thomasz111/subscriptions","organizations_url":"https://api.github.com/users/Thomasz111/orgs","repos_url":"https://api.github.com/users/Thomasz111/repos","events_url":"https://api.github.com/users/Thomasz111/events{/privacy}","received_events_url":"https://api.github.com/users/Thomasz111/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-10-13T12:27:22Z","updated_at":"2018-10-13T13:08:24Z","closed_at":null,"merged_at":null,"merge_commit_sha":"591b00bbb1b514b06fb7c0ddf3ed3c244addb3c6","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/Lony13/thesis-browser-server/pulls/2/commits","review_comments_url":"https://api.github.com/repos/Lony13/thesis-browser-server/pulls/2/comments","review_comment_url":"https://api.github.com/repos/Lony13/thesis-browser-server/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Lony13/thesis-browser-server/issues/2/comments","statuses_url":"https://api.github.com/repos/Lony13/thesis-browser-server/statuses/46bcf0394023f98211dcad8e35e680873d1e6c15","head":{"label":"Lony13:dev-kurek-pdf-downloader","ref":"dev-kurek-pdf-downloader","sha":"46bcf0394023f98211dcad8e35e680873d1e6c15","user":{"login":"Lony13","id":26119083,"node_id":"MDQ6VXNlcjI2MTE5MDgz","avatar_url":"https://avatars3.githubusercontent.com/u/26119083?v=4","gravatar_id":"","url":"https://api.github.com/users/Lony13","html_url":"https://github.com/Lony13","followers_url":"https://api.github.com/users/Lony13/followers","following_url":"https://api.github.com/users/Lony13/following{/other_user}","gists_url":"https://api.github.com/users/Lony13/gists{/gist_id}","starred_url":"https://api.github.com/users/Lony13/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Lony13/subscriptions","organizations_url":"https://api.github.com/users/Lony13/orgs","repos_url":"https://api.github.com/users/Lony13/repos","events_url":"https://api.github.com/users/Lony13/events{/privacy}","received_events_url":"https://api.github.com/users/Lony13/received_events","type":"User","site_admin":false},"repo":{"id":136705861,"node_id":"MDEwOlJlcG9zaXRvcnkxMzY3MDU4NjE=","name":"thesis-browser-server","full_name":"Lony13/thesis-browser-server","private":false,"owner":{"login":"Lony13","id":26119083,"node_id":"MDQ6VXNlcjI2MTE5MDgz","avatar_url":"https://avatars3.githubusercontent.com/u/26119083?v=4","gravatar_id":"","url":"https://api.github.com/users/Lony13","html_url":"https://github.com/Lony13","followers_url":"https://api.github.com/users/Lony13/followers","following_url":"https://api.github.com/users/Lony13/following{/other_user}","gists_url":"https://api.github.com/users/Lony13/gists{/gist_id}","starred_url":"https://api.github.com/users/Lony13/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Lony13/subscriptions","organizations_url":"https://api.github.com/users/Lony13/orgs","repos_url":"https://api.github.com/users/Lony13/repos","events_url":"https://api.github.com/users/Lony13/events{/privacy}","received_events_url":"https://api.github.com/users/Lony13/received_events","type":"User","site_admin":false},"html_url":"https://github.com/Lony13/thesis-browser-server","description":null,"fork":false,"url":"https://api.github.com/repos/Lony13/thesis-browser-server","forks_url":"https://api.github.com/repos/Lony13/thesis-browser-server/forks","keys_url":"https://api.github.com/repos/Lony13/thesis-browser-server/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Lony13/thesis-browser-server/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Lony13/thesis-browser-server/teams","hooks_url":"https://api.github.com/repos/Lony13/thesis-browser-server/hooks","issue_events_url":"https://api.github.com/repos/Lony13/thesis-browser-server/issues/events{/number}","events_url":"https://api.github.com/repos/Lony13/thesis-browser-server/events","assignees_url":"https://api.github.com/repos/Lony13/thesis-browser-server/assignees{/user}","branches_url":"https://api.github.com/repos/Lony13/thesis-browser-server/branches{/branch}","tags_url":"https://api.github.com/repos/Lony13/thesis-browser-server/tags","blobs_url":"https://api.github.com/repos/Lony13/thesis-browser-server/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Lony13/thesis-browser-server/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Lony13/thesis-browser-server/git/refs{/sha}","trees_url":"https://api.github.com/repos/Lony13/thesis-browser-server/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Lony13/thesis-browser-server/statuses/{sha}","languages_url":"https://api.github.com/repos/Lony13/thesis-browser-server/languages","stargazers_url":"https://api.github.com/repos/Lony13/thesis-browser-server/stargazers","contributors_url":"https://api.github.com/repos/Lony13/thesis-browser-server/contributors","subscribers_url":"https://api.github.com/repos/Lony13/thesis-browser-server/subscribers","subscription_url":"https://api.github.com/repos/Lony13/thesis-browser-server/subscription","commits_url":"https://api.github.com/repos/Lony13/thesis-browser-server/commits{/sha}","git_commits_url":"https://api.github.com/repos/Lony13/thesis-browser-server/git/commits{/sha}","comments_url":"https://api.github.com/repos/Lony13/thesis-browser-server/comments{/number}","issue_comment_url":"https://api.github.com/repos/Lony13/thesis-browser-server/issues/comments{/number}","contents_url":"https://api.github.com/repos/Lony13/thesis-browser-server/contents/{+path}","compare_url":"https://api.github.com/repos/Lony13/thesis-browser-server/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Lony13/thesis-browser-server/merges","archive_url":"https://api.github.com/repos/Lony13/thesis-browser-server/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Lony13/thesis-browser-server/downloads","issues_url":"https://api.github.com/repos/Lony13/thesis-browser-server/issues{/number}","pulls_url":"https://api.github.com/repos/Lony13/thesis-browser-server/pulls{/number}","milestones_url":"https://api.github.com/repos/Lony13/thesis-browser-server/milestones{/number}","notifications_url":"https://api.github.com/repos/Lony13/thesis-browser-server/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Lony13/thesis-browser-server/labels{/name}","releases_url":"https://api.github.com/repos/Lony13/thesis-browser-server/releases{/id}","deployments_url":"https://api.github.com/repos/Lony13/thesis-browser-server/deployments","created_at":"2018-06-09T08:38:56Z","updated_at":"2018-10-10T10:01:56Z","pushed_at":"2018-10-13T12:27:23Z","git_url":"git://github.com/Lony13/thesis-browser-server.git","ssh_url":"git@github.com:Lony13/thesis-browser-server.git","clone_url":"https://github.com/Lony13/thesis-browser-server.git","svn_url":"https://github.com/Lony13/thesis-browser-server","homepage":null,"size":33,"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":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":null,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"Lony13:master","ref":"master","sha":"2893e8d72dea7137b6cd7e85a075df8aea629580","user":{"login":"Lony13","id":26119083,"node_id":"MDQ6VXNlcjI2MTE5MDgz","avatar_url":"https://avatars3.githubusercontent.com/u/26119083?v=4","gravatar_id":"","url":"https://api.github.com/users/Lony13","html_url":"https://github.com/Lony13","followers_url":"https://api.github.com/users/Lony13/followers","following_url":"https://api.github.com/users/Lony13/following{/other_user}","gists_url":"https://api.github.com/users/Lony13/gists{/gist_id}","starred_url":"https://api.github.com/users/Lony13/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Lony13/subscriptions","organizations_url":"https://api.github.com/users/Lony13/orgs","repos_url":"https://api.github.com/users/Lony13/repos","events_url":"https://api.github.com/users/Lony13/events{/privacy}","received_events_url":"https://api.github.com/users/Lony13/received_events","type":"User","site_admin":false},"repo":{"id":136705861,"node_id":"MDEwOlJlcG9zaXRvcnkxMzY3MDU4NjE=","name":"thesis-browser-server","full_name":"Lony13/thesis-browser-server","private":false,"owner":{"login":"Lony13","id":26119083,"node_id":"MDQ6VXNlcjI2MTE5MDgz","avatar_url":"https://avatars3.githubusercontent.com/u/26119083?v=4","gravatar_id":"","url":"https://api.github.com/users/Lony13","html_url":"https://github.com/Lony13","followers_url":"https://api.github.com/users/Lony13/followers","following_url":"https://api.github.com/users/Lony13/following{/other_user}","gists_url":"https://api.github.com/users/Lony13/gists{/gist_id}","starred_url":"https://api.github.com/users/Lony13/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Lony13/subscriptions","organizations_url":"https://api.github.com/users/Lony13/orgs","repos_url":"https://api.github.com/users/Lony13/repos","events_url":"https://api.github.com/users/Lony13/events{/privacy}","received_events_url":"https://api.github.com/users/Lony13/received_events","type":"User","site_admin":false},"html_url":"https://github.com/Lony13/thesis-browser-server","description":null,"fork":false,"url":"https://api.github.com/repos/Lony13/thesis-browser-server","forks_url":"https://api.github.com/repos/Lony13/thesis-browser-server/forks","keys_url":"https://api.github.com/repos/Lony13/thesis-browser-server/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Lony13/thesis-browser-server/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Lony13/thesis-browser-server/teams","hooks_url":"https://api.github.com/repos/Lony13/thesis-browser-server/hooks","issue_events_url":"https://api.github.com/repos/Lony13/thesis-browser-server/issues/events{/number}","events_url":"https://api.github.com/repos/Lony13/thesis-browser-server/events","assignees_url":"https://api.github.com/repos/Lony13/thesis-browser-server/assignees{/user}","branches_url":"https://api.github.com/repos/Lony13/thesis-browser-server/branches{/branch}","tags_url":"https://api.github.com/repos/Lony13/thesis-browser-server/tags","blobs_url":"https://api.github.com/repos/Lony13/thesis-browser-server/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Lony13/thesis-browser-server/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Lony13/thesis-browser-server/git/refs{/sha}","trees_url":"https://api.github.com/repos/Lony13/thesis-browser-server/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Lony13/thesis-browser-server/statuses/{sha}","languages_url":"https://api.github.com/repos/Lony13/thesis-browser-server/languages","stargazers_url":"https://api.github.com/repos/Lony13/thesis-browser-server/stargazers","contributors_url":"https://api.github.com/repos/Lony13/thesis-browser-server/contributors","subscribers_url":"https://api.github.com/repos/Lony13/thesis-browser-server/subscribers","subscription_url":"https://api.github.com/repos/Lony13/thesis-browser-server/subscription","commits_url":"https://api.github.com/repos/Lony13/thesis-browser-server/commits{/sha}","git_commits_url":"https://api.github.com/repos/Lony13/thesis-browser-server/git/commits{/sha}","comments_url":"https://api.github.com/repos/Lony13/thesis-browser-server/comments{/number}","issue_comment_url":"https://api.github.com/repos/Lony13/thesis-browser-server/issues/comments{/number}","contents_url":"https://api.github.com/repos/Lony13/thesis-browser-server/contents/{+path}","compare_url":"https://api.github.com/repos/Lony13/thesis-browser-server/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Lony13/thesis-browser-server/merges","archive_url":"https://api.github.com/repos/Lony13/thesis-browser-server/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Lony13/thesis-browser-server/downloads","issues_url":"https://api.github.com/repos/Lony13/thesis-browser-server/issues{/number}","pulls_url":"https://api.github.com/repos/Lony13/thesis-browser-server/pulls{/number}","milestones_url":"https://api.github.com/repos/Lony13/thesis-browser-server/milestones{/number}","notifications_url":"https://api.github.com/repos/Lony13/thesis-browser-server/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Lony13/thesis-browser-server/labels{/name}","releases_url":"https://api.github.com/repos/Lony13/thesis-browser-server/releases{/id}","deployments_url":"https://api.github.com/repos/Lony13/thesis-browser-server/deployments","created_at":"2018-06-09T08:38:56Z","updated_at":"2018-10-10T10:01:56Z","pushed_at":"2018-10-13T12:27:23Z","git_url":"git://github.com/Lony13/thesis-browser-server.git","ssh_url":"git@github.com:Lony13/thesis-browser-server.git","clone_url":"https://github.com/Lony13/thesis-browser-server.git","svn_url":"https://github.com/Lony13/thesis-browser-server","homepage":null,"size":33,"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":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":null,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Lony13/thesis-browser-server/pulls/2"},"html":{"href":"https://github.com/Lony13/thesis-browser-server/pull/2"},"issue":{"href":"https://api.github.com/repos/Lony13/thesis-browser-server/issues/2"},"comments":{"href":"https://api.github.com/repos/Lony13/thesis-browser-server/issues/2/comments"},"review_comments":{"href":"https://api.github.com/repos/Lony13/thesis-browser-server/pulls/2/comments"},"review_comment":{"href":"https://api.github.com/repos/Lony13/thesis-browser-server/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Lony13/thesis-browser-server/pulls/2/commits"},"statuses":{"href":"https://api.github.com/repos/Lony13/thesis-browser-server/statuses/46bcf0394023f98211dcad8e35e680873d1e6c15"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"Lony13"}}