{"action":"created","comment":{"url":"https://api.github.com/repos/AmyAssist/Amy/pulls/comments/200612326","pull_request_review_id":134962836,"id":200612326,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwMDYxMjMyNg==","diff_hunk":"@@ -0,0 +1,312 @@\n+/*\n+ * This source file is part of the Amy open source project.\n+ * For more information see github.com/AmyAssist\n+ * \n+ * Copyright (c) 2018 the Amy project authors.\n+ *\n+ * SPDX-License-Identifier: Apache-2.0\n+ * \n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at \n+ * \n+ *   http://www.apache.org/licenses/LICENSE-2.0\n+ * \n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ *\n+ * For more information see notice.md\n+ */\n+\n+package de.unistuttgart.iaas.amyassist.amy.plugin.calendar;\n+\n+import java.io.ByteArrayInputStream;\n+import java.io.IOException;\n+import java.io.InputStream;\n+import java.io.InputStreamReader;\n+import java.security.GeneralSecurityException;\n+import java.time.LocalDateTime;\n+import java.time.ZoneId;\n+import java.util.ArrayList;\n+import java.util.Collections;\n+import java.util.Date;\n+import java.util.List;\n+import java.util.Properties;\n+\n+import org.slf4j.Logger;\n+\n+import com.google.api.client.auth.oauth2.Credential;\n+import com.google.api.client.extensions.java6.auth.oauth2.AuthorizationCodeInstalledApp;\n+import com.google.api.client.extensions.jetty.auth.oauth2.LocalServerReceiver;\n+import com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeFlow;\n+import com.google.api.client.googleapis.auth.oauth2.GoogleClientSecrets;\n+import com.google.api.client.googleapis.javanet.GoogleNetHttpTransport;\n+import com.google.api.client.http.javanet.NetHttpTransport;\n+import com.google.api.client.json.JsonFactory;\n+import com.google.api.client.json.jackson2.JacksonFactory;\n+import com.google.api.client.util.DateTime;\n+import com.google.api.client.util.store.FileDataStoreFactory;\n+import com.google.api.services.calendar.Calendar;\n+import com.google.api.services.calendar.CalendarScopes;\n+import com.google.api.services.calendar.model.Event;\n+import com.google.api.services.calendar.model.Events;\n+\n+import de.unistuttgart.iaas.amyassist.amy.core.di.annotation.PostConstruct;\n+import de.unistuttgart.iaas.amyassist.amy.core.di.annotation.Reference;\n+import de.unistuttgart.iaas.amyassist.amy.core.di.annotation.Service;\n+import de.unistuttgart.iaas.amyassist.amy.core.io.Environment;\n+\n+/**\n+ * This class is for the Calendar Authentication and Logic, parts of the Code are from\n+ * https://developers.google.com/calendar/quickstart/java\n+ * \n+ * @author Patrick Gebhardt, Florian Bauer\n+ */\n+@Service\n+public class CalendarLogic {\n+\tprivate static final String APPLICATION_NAME = \"Google Calendar API Java Quickstart\";\n+\tprivate static final JsonFactory JSON_FACTORY = JacksonFactory.getDefaultInstance();\n+\n+\t/**\n+\t * Global instance of the scopes required by this quickstart. If modifying these scopes, delete your previously\n+\t * saved credentials/ folder.\n+\t */\n+\tprivate static final List<String> SCOPES = Collections.singletonList(CalendarScopes.CALENDAR_READONLY);\n+\n+\t@Reference\n+\tprivate Properties configuration;\n+\t@Reference\n+\tprivate Environment environment;\n+\t@Reference\n+\tprivate Logger logger;\n+\n+\tprivate Calendar service;\n+\n+\tprivate List<String> eventList = new ArrayList<>();\n+\n+\t/**\n+\t * Creates an authorized Credential object.\n+\t * \n+\t * @param xHTTPTRANSPORT\n+\t *            The network HTTP Transport.\n+\t * @return An authorized Credential object.\n+\t * @throws IOException\n+\t *             If there is no client_secret.\n+\t */\n+\tprivate Credential getCredentials(final NetHttpTransport xHTTPTRANSPORT) throws IOException {\n+\t\t// Load client secrets.\n+\t\tInputStream test = new ByteArrayInputStream(this.configuration.getProperty(\"JSON\").getBytes());\n+\t\tGoogleClientSecrets clientSecrets = GoogleClientSecrets.load(JSON_FACTORY, new InputStreamReader(test));","path":"plugins/calendar/src/main/java/de/unistuttgart/iaas/amyassist/amy/plugin/calendar/CalendarLogic.java","position":102,"original_position":102,"commit_id":"3220b389adfbc7caefe08344b33641c60237d180","original_commit_id":"3220b389adfbc7caefe08344b33641c60237d180","user":{"login":"sonarcloud[bot]","id":39514782,"node_id":"MDM6Qm90Mzk1MTQ3ODI=","avatar_url":"https://avatars2.githubusercontent.com/in/12526?v=4","gravatar_id":"","url":"https://api.github.com/users/sonarcloud%5Bbot%5D","html_url":"https://github.com/apps/sonarcloud","followers_url":"https://api.github.com/users/sonarcloud%5Bbot%5D/followers","following_url":"https://api.github.com/users/sonarcloud%5Bbot%5D/following{/other_user}","gists_url":"https://api.github.com/users/sonarcloud%5Bbot%5D/gists{/gist_id}","starred_url":"https://api.github.com/users/sonarcloud%5Bbot%5D/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sonarcloud%5Bbot%5D/subscriptions","organizations_url":"https://api.github.com/users/sonarcloud%5Bbot%5D/orgs","repos_url":"https://api.github.com/users/sonarcloud%5Bbot%5D/repos","events_url":"https://api.github.com/users/sonarcloud%5Bbot%5D/events{/privacy}","received_events_url":"https://api.github.com/users/sonarcloud%5Bbot%5D/received_events","type":"Bot","site_admin":false},"body":"![Code Smell](https://sonarsource.github.io/sonar-github/code_smell.png 'Code Smell') Code Smell: Remove this use of constructor \"InputStreamReader(InputStream)\" ([squid:S1943](https://sonarcloud.io/organizations/amyassist/rules#rule_key=squid%3AS1943))\n\n[See it in SonarCloud](https://sonarcloud.io/project/issues?id=de.unistuttgart.iaas.amyassist%3Aamy&pullRequest=146&issues=AWRkbbi4l6vpliCe5A8M&open=AWRkbbi4l6vpliCe5A8M)\n\n[ISSUE_KEY]: AWRkbbi4l6vpliCe5A8M","created_at":"2018-07-06T10:22:06Z","updated_at":"2018-07-06T10:22:06Z","html_url":"https://github.com/AmyAssist/Amy/pull/146#discussion_r200612326","pull_request_url":"https://api.github.com/repos/AmyAssist/Amy/pulls/146","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/AmyAssist/Amy/pulls/comments/200612326"},"html":{"href":"https://github.com/AmyAssist/Amy/pull/146#discussion_r200612326"},"pull_request":{"href":"https://api.github.com/repos/AmyAssist/Amy/pulls/146"}}},"pull_request":{"url":"https://api.github.com/repos/AmyAssist/Amy/pulls/146","id":199173936,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk5MTczOTM2","html_url":"https://github.com/AmyAssist/Amy/pull/146","diff_url":"https://github.com/AmyAssist/Amy/pull/146.diff","patch_url":"https://github.com/AmyAssist/Amy/pull/146.patch","issue_url":"https://api.github.com/repos/AmyAssist/Amy/issues/146","number":146,"state":"open","locked":false,"title":"WIP: Calendar Feature","user":{"login":"Hobbitsloth","id":17177847,"node_id":"MDQ6VXNlcjE3MTc3ODQ3","avatar_url":"https://avatars3.githubusercontent.com/u/17177847?v=4","gravatar_id":"","url":"https://api.github.com/users/Hobbitsloth","html_url":"https://github.com/Hobbitsloth","followers_url":"https://api.github.com/users/Hobbitsloth/followers","following_url":"https://api.github.com/users/Hobbitsloth/following{/other_user}","gists_url":"https://api.github.com/users/Hobbitsloth/gists{/gist_id}","starred_url":"https://api.github.com/users/Hobbitsloth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Hobbitsloth/subscriptions","organizations_url":"https://api.github.com/users/Hobbitsloth/orgs","repos_url":"https://api.github.com/users/Hobbitsloth/repos","events_url":"https://api.github.com/users/Hobbitsloth/events{/privacy}","received_events_url":"https://api.github.com/users/Hobbitsloth/received_events","type":"User","site_admin":false},"body":"Not yet finished.","created_at":"2018-07-04T08:26:31Z","updated_at":"2018-07-06T10:22:06Z","closed_at":null,"merged_at":null,"merge_commit_sha":"006bc5538fbb1972bb92aabc390cfa8436f8f020","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/AmyAssist/Amy/pulls/146/commits","review_comments_url":"https://api.github.com/repos/AmyAssist/Amy/pulls/146/comments","review_comment_url":"https://api.github.com/repos/AmyAssist/Amy/pulls/comments{/number}","comments_url":"https://api.github.com/repos/AmyAssist/Amy/issues/146/comments","statuses_url":"https://api.github.com/repos/AmyAssist/Amy/statuses/3220b389adfbc7caefe08344b33641c60237d180","head":{"label":"AmyAssist:calendar","ref":"calendar","sha":"3220b389adfbc7caefe08344b33641c60237d180","user":{"login":"AmyAssist","id":39340355,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM5MzQwMzU1","avatar_url":"https://avatars0.githubusercontent.com/u/39340355?v=4","gravatar_id":"","url":"https://api.github.com/users/AmyAssist","html_url":"https://github.com/AmyAssist","followers_url":"https://api.github.com/users/AmyAssist/followers","following_url":"https://api.github.com/users/AmyAssist/following{/other_user}","gists_url":"https://api.github.com/users/AmyAssist/gists{/gist_id}","starred_url":"https://api.github.com/users/AmyAssist/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AmyAssist/subscriptions","organizations_url":"https://api.github.com/users/AmyAssist/orgs","repos_url":"https://api.github.com/users/AmyAssist/repos","events_url":"https://api.github.com/users/AmyAssist/events{/privacy}","received_events_url":"https://api.github.com/users/AmyAssist/received_events","type":"Organization","site_admin":false},"repo":{"id":134390462,"node_id":"MDEwOlJlcG9zaXRvcnkxMzQzOTA0NjI=","name":"Amy","full_name":"AmyAssist/Amy","owner":{"login":"AmyAssist","id":39340355,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM5MzQwMzU1","avatar_url":"https://avatars0.githubusercontent.com/u/39340355?v=4","gravatar_id":"","url":"https://api.github.com/users/AmyAssist","html_url":"https://github.com/AmyAssist","followers_url":"https://api.github.com/users/AmyAssist/followers","following_url":"https://api.github.com/users/AmyAssist/following{/other_user}","gists_url":"https://api.github.com/users/AmyAssist/gists{/gist_id}","starred_url":"https://api.github.com/users/AmyAssist/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AmyAssist/subscriptions","organizations_url":"https://api.github.com/users/AmyAssist/orgs","repos_url":"https://api.github.com/users/AmyAssist/repos","events_url":"https://api.github.com/users/AmyAssist/events{/privacy}","received_events_url":"https://api.github.com/users/AmyAssist/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/AmyAssist/Amy","description":"Personal Assistance System","fork":false,"url":"https://api.github.com/repos/AmyAssist/Amy","forks_url":"https://api.github.com/repos/AmyAssist/Amy/forks","keys_url":"https://api.github.com/repos/AmyAssist/Amy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/AmyAssist/Amy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/AmyAssist/Amy/teams","hooks_url":"https://api.github.com/repos/AmyAssist/Amy/hooks","issue_events_url":"https://api.github.com/repos/AmyAssist/Amy/issues/events{/number}","events_url":"https://api.github.com/repos/AmyAssist/Amy/events","assignees_url":"https://api.github.com/repos/AmyAssist/Amy/assignees{/user}","branches_url":"https://api.github.com/repos/AmyAssist/Amy/branches{/branch}","tags_url":"https://api.github.com/repos/AmyAssist/Amy/tags","blobs_url":"https://api.github.com/repos/AmyAssist/Amy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/AmyAssist/Amy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/AmyAssist/Amy/git/refs{/sha}","trees_url":"https://api.github.com/repos/AmyAssist/Amy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/AmyAssist/Amy/statuses/{sha}","languages_url":"https://api.github.com/repos/AmyAssist/Amy/languages","stargazers_url":"https://api.github.com/repos/AmyAssist/Amy/stargazers","contributors_url":"https://api.github.com/repos/AmyAssist/Amy/contributors","subscribers_url":"https://api.github.com/repos/AmyAssist/Amy/subscribers","subscription_url":"https://api.github.com/repos/AmyAssist/Amy/subscription","commits_url":"https://api.github.com/repos/AmyAssist/Amy/commits{/sha}","git_commits_url":"https://api.github.com/repos/AmyAssist/Amy/git/commits{/sha}","comments_url":"https://api.github.com/repos/AmyAssist/Amy/comments{/number}","issue_comment_url":"https://api.github.com/repos/AmyAssist/Amy/issues/comments{/number}","contents_url":"https://api.github.com/repos/AmyAssist/Amy/contents/{+path}","compare_url":"https://api.github.com/repos/AmyAssist/Amy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/AmyAssist/Amy/merges","archive_url":"https://api.github.com/repos/AmyAssist/Amy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/AmyAssist/Amy/downloads","issues_url":"https://api.github.com/repos/AmyAssist/Amy/issues{/number}","pulls_url":"https://api.github.com/repos/AmyAssist/Amy/pulls{/number}","milestones_url":"https://api.github.com/repos/AmyAssist/Amy/milestones{/number}","notifications_url":"https://api.github.com/repos/AmyAssist/Amy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/AmyAssist/Amy/labels{/name}","releases_url":"https://api.github.com/repos/AmyAssist/Amy/releases{/id}","deployments_url":"https://api.github.com/repos/AmyAssist/Amy/deployments","created_at":"2018-05-22T09:16:34Z","updated_at":"2018-07-06T03:52:26Z","pushed_at":"2018-07-06T10:12:01Z","git_url":"git://github.com/AmyAssist/Amy.git","ssh_url":"git@github.com:AmyAssist/Amy.git","clone_url":"https://github.com/AmyAssist/Amy.git","svn_url":"https://github.com/AmyAssist/Amy","homepage":null,"size":2975,"stargazers_count":4,"watchers_count":4,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":29,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":29,"watchers":4,"default_branch":"dev"}},"base":{"label":"AmyAssist:dev","ref":"dev","sha":"e8dd18e96fbfe2e913656cb8bb0004fa54112a2c","user":{"login":"AmyAssist","id":39340355,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM5MzQwMzU1","avatar_url":"https://avatars0.githubusercontent.com/u/39340355?v=4","gravatar_id":"","url":"https://api.github.com/users/AmyAssist","html_url":"https://github.com/AmyAssist","followers_url":"https://api.github.com/users/AmyAssist/followers","following_url":"https://api.github.com/users/AmyAssist/following{/other_user}","gists_url":"https://api.github.com/users/AmyAssist/gists{/gist_id}","starred_url":"https://api.github.com/users/AmyAssist/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AmyAssist/subscriptions","organizations_url":"https://api.github.com/users/AmyAssist/orgs","repos_url":"https://api.github.com/users/AmyAssist/repos","events_url":"https://api.github.com/users/AmyAssist/events{/privacy}","received_events_url":"https://api.github.com/users/AmyAssist/received_events","type":"Organization","site_admin":false},"repo":{"id":134390462,"node_id":"MDEwOlJlcG9zaXRvcnkxMzQzOTA0NjI=","name":"Amy","full_name":"AmyAssist/Amy","owner":{"login":"AmyAssist","id":39340355,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM5MzQwMzU1","avatar_url":"https://avatars0.githubusercontent.com/u/39340355?v=4","gravatar_id":"","url":"https://api.github.com/users/AmyAssist","html_url":"https://github.com/AmyAssist","followers_url":"https://api.github.com/users/AmyAssist/followers","following_url":"https://api.github.com/users/AmyAssist/following{/other_user}","gists_url":"https://api.github.com/users/AmyAssist/gists{/gist_id}","starred_url":"https://api.github.com/users/AmyAssist/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AmyAssist/subscriptions","organizations_url":"https://api.github.com/users/AmyAssist/orgs","repos_url":"https://api.github.com/users/AmyAssist/repos","events_url":"https://api.github.com/users/AmyAssist/events{/privacy}","received_events_url":"https://api.github.com/users/AmyAssist/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/AmyAssist/Amy","description":"Personal Assistance System","fork":false,"url":"https://api.github.com/repos/AmyAssist/Amy","forks_url":"https://api.github.com/repos/AmyAssist/Amy/forks","keys_url":"https://api.github.com/repos/AmyAssist/Amy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/AmyAssist/Amy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/AmyAssist/Amy/teams","hooks_url":"https://api.github.com/repos/AmyAssist/Amy/hooks","issue_events_url":"https://api.github.com/repos/AmyAssist/Amy/issues/events{/number}","events_url":"https://api.github.com/repos/AmyAssist/Amy/events","assignees_url":"https://api.github.com/repos/AmyAssist/Amy/assignees{/user}","branches_url":"https://api.github.com/repos/AmyAssist/Amy/branches{/branch}","tags_url":"https://api.github.com/repos/AmyAssist/Amy/tags","blobs_url":"https://api.github.com/repos/AmyAssist/Amy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/AmyAssist/Amy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/AmyAssist/Amy/git/refs{/sha}","trees_url":"https://api.github.com/repos/AmyAssist/Amy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/AmyAssist/Amy/statuses/{sha}","languages_url":"https://api.github.com/repos/AmyAssist/Amy/languages","stargazers_url":"https://api.github.com/repos/AmyAssist/Amy/stargazers","contributors_url":"https://api.github.com/repos/AmyAssist/Amy/contributors","subscribers_url":"https://api.github.com/repos/AmyAssist/Amy/subscribers","subscription_url":"https://api.github.com/repos/AmyAssist/Amy/subscription","commits_url":"https://api.github.com/repos/AmyAssist/Amy/commits{/sha}","git_commits_url":"https://api.github.com/repos/AmyAssist/Amy/git/commits{/sha}","comments_url":"https://api.github.com/repos/AmyAssist/Amy/comments{/number}","issue_comment_url":"https://api.github.com/repos/AmyAssist/Amy/issues/comments{/number}","contents_url":"https://api.github.com/repos/AmyAssist/Amy/contents/{+path}","compare_url":"https://api.github.com/repos/AmyAssist/Amy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/AmyAssist/Amy/merges","archive_url":"https://api.github.com/repos/AmyAssist/Amy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/AmyAssist/Amy/downloads","issues_url":"https://api.github.com/repos/AmyAssist/Amy/issues{/number}","pulls_url":"https://api.github.com/repos/AmyAssist/Amy/pulls{/number}","milestones_url":"https://api.github.com/repos/AmyAssist/Amy/milestones{/number}","notifications_url":"https://api.github.com/repos/AmyAssist/Amy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/AmyAssist/Amy/labels{/name}","releases_url":"https://api.github.com/repos/AmyAssist/Amy/releases{/id}","deployments_url":"https://api.github.com/repos/AmyAssist/Amy/deployments","created_at":"2018-05-22T09:16:34Z","updated_at":"2018-07-06T03:52:26Z","pushed_at":"2018-07-06T10:12:01Z","git_url":"git://github.com/AmyAssist/Amy.git","ssh_url":"git@github.com:AmyAssist/Amy.git","clone_url":"https://github.com/AmyAssist/Amy.git","svn_url":"https://github.com/AmyAssist/Amy","homepage":null,"size":2975,"stargazers_count":4,"watchers_count":4,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":29,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":29,"watchers":4,"default_branch":"dev"}},"_links":{"self":{"href":"https://api.github.com/repos/AmyAssist/Amy/pulls/146"},"html":{"href":"https://github.com/AmyAssist/Amy/pull/146"},"issue":{"href":"https://api.github.com/repos/AmyAssist/Amy/issues/146"},"comments":{"href":"https://api.github.com/repos/AmyAssist/Amy/issues/146/comments"},"review_comments":{"href":"https://api.github.com/repos/AmyAssist/Amy/pulls/146/comments"},"review_comment":{"href":"https://api.github.com/repos/AmyAssist/Amy/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/AmyAssist/Amy/pulls/146/commits"},"statuses":{"href":"https://api.github.com/repos/AmyAssist/Amy/statuses/3220b389adfbc7caefe08344b33641c60237d180"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"sonarcloud"}}