/jbpm-workitems/src/main/java/org/jbpm/process/workitem/google/calendar/GoogleCalendarUtils.java

https://github.com/michelpohle/jbpm · Java · 80 lines · 5 code · 5 blank · 70 comment · 0 complexity · 20861992b28a681c3b526c9f92515a99 MD5 · raw file

  1. package org.jbpm.process.workitem.google.calendar;
  2. public final class GoogleCalendarUtils {
  3. private GoogleCalendarUtils() {
  4. }
  5. // private static CalendarService getCalendarService(String userName, String password) throws AuthenticationException {
  6. // CalendarService service = new CalendarService("Drools-Flow-WorkItem-1.0");
  7. // service.setUserCredentials(userName, password);
  8. // return service;
  9. // }
  10. //
  11. // public static List<String> getCalendars(String userName, String password) throws ServiceException {
  12. // CalendarService service = getCalendarService(userName, password);
  13. //
  14. // try {
  15. // URL feedUrl = new URL(
  16. // "http://www.google.com/calendar/feeds/default/allcalendars/full");
  17. // CalendarFeed resultFeed = service.getFeed(feedUrl, CalendarFeed.class);
  18. // List<String> result = new ArrayList<String>();
  19. // for (int i = 0; i < resultFeed.getEntries().size(); i++) {
  20. // CalendarEntry entry = resultFeed.getEntries().get(i);
  21. // result.add(entry.getTitle().getPlainText());
  22. // }
  23. // return result;
  24. // } catch (MalformedURLException e) {
  25. // e.printStackTrace();
  26. // throw new RuntimeException(e);
  27. // } catch (IOException e) {
  28. // e.printStackTrace();
  29. // throw new RuntimeException(e);
  30. // }
  31. // }
  32. //
  33. // public static void insertEntry(
  34. // String userName, String password,
  35. // String title, String content,
  36. // String start, String end)
  37. // throws AuthenticationException, ServiceException {
  38. // CalendarService service = getCalendarService(userName, password);
  39. // try {
  40. // URL postURL = new URL(
  41. // "http://www.google.com/calendar/feeds/" + userName + "/private/full");
  42. // CalendarEventEntry myEvent = new CalendarEventEntry();
  43. // myEvent.setTitle(new PlainTextConstruct(title));
  44. // myEvent.setContent(new PlainTextConstruct(content));
  45. // DateTime startTime = DateTime.parseDateTime(start);
  46. // DateTime endTime = DateTime.parseDateTime(end);
  47. // When eventTimes = new When();
  48. // eventTimes.setStartTime(startTime);
  49. // eventTimes.setEndTime(endTime);
  50. // myEvent.addTime(eventTimes);
  51. // service.insert(postURL, myEvent);
  52. // } catch (IOException e) {
  53. // e.printStackTrace();
  54. // throw new RuntimeException(e);
  55. // }
  56. // }
  57. //
  58. // public static List<CalendarEventEntry> getEntries(String userName, String password, String text) throws AuthenticationException, ServiceException {
  59. // CalendarService service = getCalendarService(userName, password);
  60. // try {
  61. // URL feedUrl = new URL(
  62. // "http://www.google.com/calendar/feeds/" + userName + "/private/full");
  63. // Query myQuery = new Query(feedUrl);
  64. // myQuery.setFullTextQuery(text);
  65. // CalendarEventFeed myResultsFeed = service.query(myQuery, CalendarEventFeed.class);
  66. // return myResultsFeed.getEntries();
  67. // } catch (MalformedURLException e) {
  68. // e.printStackTrace();
  69. // throw new RuntimeException(e);
  70. // } catch (IOException e) {
  71. // e.printStackTrace();
  72. // throw new RuntimeException(e);
  73. // }
  74. // }
  75. }