-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge commit 'b51e20210b849b03843e79c279c229f570a72e5b'
Conflicts: src/main/resources/local/techlooper.properties
- Loading branch information
Showing
20 changed files
with
268 additions
and
181 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -93,8 +93,6 @@ public class CoreConfiguration implements ApplicationContextAware { | |
|
||
@Value("classpath:google-auth/techLooper.p12") | ||
private org.springframework.core.io.Resource googleApiAuthResource; | ||
// @Value("classpath:google-auth") | ||
// private org.springframework.core.io.Resource googleApiAuthResource; | ||
|
||
private ApplicationContext applicationContext; | ||
|
||
|
@@ -392,13 +390,18 @@ public JsonNode vietnamworksConfiguration() throws IOException { | |
|
||
@Bean | ||
@DependsOn("jsonConfigRepository") | ||
public SocialConfig googleSocialConfig() { | ||
return applicationContext.getBean(JsonConfigRepository.class).getSocialConfig().stream() | ||
.filter(socialConfig -> socialConfig.getProvider() == SocialProvider.GOOGLE) | ||
.findFirst().get(); | ||
} | ||
|
||
@Bean | ||
public Calendar googleCalendar() throws GeneralSecurityException, IOException { | ||
JacksonFactory jsonFactory = JacksonFactory.getDefaultInstance(); | ||
HttpTransport transport = GoogleNetHttpTransport.newTrustedTransport(); | ||
|
||
SocialConfig googleConfig = applicationContext.getBean(JsonConfigRepository.class).getSocialConfig().stream() | ||
.filter(socialConfig -> socialConfig.getProvider() == SocialProvider.GOOGLE) | ||
.findFirst().get(); | ||
SocialConfig googleConfig = googleSocialConfig(); | ||
|
||
// GoogleAuthorizationCodeFlow flow = new GoogleAuthorizationCodeFlow.Builder(transport, jsonFactory, | ||
// googleConfig.getApiKey(), googleConfig.getSecretKey(), | ||
|
@@ -417,45 +420,11 @@ public Calendar googleCalendar() throws GeneralSecurityException, IOException { | |
.setServiceAccountId(googleConfig.getServiceAccountEmail()) | ||
.setServiceAccountPrivateKeyFromP12File(googleApiAuthResource.getFile()) | ||
.setServiceAccountScopes(Collections.singleton(CalendarScopes.CALENDAR)) | ||
.setServiceAccountUser("[email protected]") | ||
.setServiceAccountUser(googleConfig.getCalendarOwner()) | ||
.build(); | ||
|
||
// boolean bool = credential.refreshToken(); | ||
// String token = credential.getAccessToken(); | ||
// System.out.println(bool); | ||
// System.out.println(token); | ||
|
||
return new Calendar.Builder(transport, jsonFactory, credential) | ||
.setApplicationName("Techlooper").build(); | ||
|
||
// Event event = new Event() | ||
// .setSummary("Google I/O 2015") | ||
// .setLocation("800 Howard St., San Francisco, CA 94103") | ||
// .setDescription("A chance to hear more about Google's developer products."); | ||
// | ||
// DateTime startDateTime = new DateTime("2015-09-28T09:00:00-07:00"); | ||
// EventDateTime start = new EventDateTime() | ||
// .setDateTime(startDateTime) | ||
// .setTimeZone("America/Los_Angeles"); | ||
// event.setStart(start); | ||
// | ||
// DateTime endDateTime = new DateTime("2015-09-28T17:00:00-07:00"); | ||
// EventDateTime end = new EventDateTime() | ||
// .setDateTime(endDateTime) | ||
// .setTimeZone("America/Los_Angeles"); | ||
// event.setEnd(end); | ||
// | ||
// EventAttendee[] attendees = new EventAttendee[]{ | ||
// new EventAttendee().setEmail("[email protected]"), | ||
// new EventAttendee().setEmail("[email protected]"), | ||
// }; | ||
// event.setAttendees(Arrays.asList(attendees)); | ||
// | ||
// String calendarId = "[email protected]"; | ||
// event = calendar.events().insert(calendarId, event).setSendNotifications(true).execute(); | ||
// System.out.printf("Event created: %s\n", event.getHtmlLink()); | ||
// event.getHangoutLink() | ||
// return calendar; | ||
} | ||
|
||
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package com.techlooper.entity; | ||
|
||
import java.io.Serializable; | ||
|
||
/** | ||
* Created by phuonghqh on 8/27/15. | ||
*/ | ||
public class CalendarInfo implements Serializable { | ||
|
||
private String id; | ||
|
||
private String htmlLink; | ||
|
||
private String hangoutLink; | ||
|
||
public String getId() { | ||
return id; | ||
} | ||
|
||
public void setId(String id) { | ||
this.id = id; | ||
} | ||
|
||
public String getHtmlLink() { | ||
return htmlLink; | ||
} | ||
|
||
public void setHtmlLink(String htmlLink) { | ||
this.htmlLink = htmlLink; | ||
} | ||
|
||
public String getHangoutLink() { | ||
return hangoutLink; | ||
} | ||
|
||
public void setHangoutLink(String hangoutLink) { | ||
this.hangoutLink = hangoutLink; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.