summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjbouthillie2011-05-27 15:41:30 (EDT)
committerjbouthillie2011-05-27 15:41:30 (EDT)
commit786aae046c3bf80c56a84c62e38a7739d66d1673 (patch)
treeb4510596f0467c75ddc3b441810dbbe50725da12
parent4bda4c7cb85eddc9be110e8d2d56fb5af982f73a (diff)
downloadorg.eclipse.mylyn.reviews.r4e-786aae046c3bf80c56a84c62e38a7739d66d1673.zip
org.eclipse.mylyn.reviews.r4e-786aae046c3bf80c56a84c62e38a7739d66d1673.tar.gz
org.eclipse.mylyn.reviews.r4e-786aae046c3bf80c56a84c62e38a7739d66d1673.tar.bz2
Initial release of Vcalendar
-rw-r--r--org.eclipse.mylyn.reviews.VCalendar/.classpath7
-rw-r--r--org.eclipse.mylyn.reviews.VCalendar/.project28
-rw-r--r--org.eclipse.mylyn.reviews.VCalendar/.settings/org.eclipse.jdt.core.prefs8
-rw-r--r--org.eclipse.mylyn.reviews.VCalendar/META-INF/MANIFEST.MF12
-rw-r--r--org.eclipse.mylyn.reviews.VCalendar/about.html28
-rw-r--r--org.eclipse.mylyn.reviews.VCalendar/build.properties6
-rw-r--r--org.eclipse.mylyn.reviews.VCalendar/plugin.properties11
-rw-r--r--org.eclipse.mylyn.reviews.VCalendar/src/org/eclipse/mylyn/reviews/vcalendar/core/VCalendar.java160
8 files changed, 260 insertions, 0 deletions
diff --git a/org.eclipse.mylyn.reviews.VCalendar/.classpath b/org.eclipse.mylyn.reviews.VCalendar/.classpath
new file mode 100644
index 0000000..2d1a430
--- /dev/null
+++ b/org.eclipse.mylyn.reviews.VCalendar/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/org.eclipse.mylyn.reviews.VCalendar/.project b/org.eclipse.mylyn.reviews.VCalendar/.project
new file mode 100644
index 0000000..7d674ef
--- /dev/null
+++ b/org.eclipse.mylyn.reviews.VCalendar/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.mylyn.reviews.VCalendar</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/org.eclipse.mylyn.reviews.VCalendar/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.mylyn.reviews.VCalendar/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..393371f
--- /dev/null
+++ b/org.eclipse.mylyn.reviews.VCalendar/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,8 @@
+#Wed Apr 06 09:26:41 EDT 2011
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
diff --git a/org.eclipse.mylyn.reviews.VCalendar/META-INF/MANIFEST.MF b/org.eclipse.mylyn.reviews.VCalendar/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..441cfbb
--- /dev/null
+++ b/org.eclipse.mylyn.reviews.VCalendar/META-INF/MANIFEST.MF
@@ -0,0 +1,12 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: org.eclipse.mylyn.reviews.VCalendar
+Bundle-Version: 0.8.0.qualifier
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.mylyn.reviews.notifications;bundle-version="0.1.0"
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Export-Package: org.eclipse.mylyn.reviews.vcalendar.core
+Bundle-Vendor: %providerName
diff --git a/org.eclipse.mylyn.reviews.VCalendar/about.html b/org.eclipse.mylyn.reviews.VCalendar/about.html
new file mode 100644
index 0000000..23193b8
--- /dev/null
+++ b/org.eclipse.mylyn.reviews.VCalendar/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>January, 2011</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p>
+
+</body>
+</html>
diff --git a/org.eclipse.mylyn.reviews.VCalendar/build.properties b/org.eclipse.mylyn.reviews.VCalendar/build.properties
new file mode 100644
index 0000000..ebe0275
--- /dev/null
+++ b/org.eclipse.mylyn.reviews.VCalendar/build.properties
@@ -0,0 +1,6 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.properties,\
+ about.html
diff --git a/org.eclipse.mylyn.reviews.VCalendar/plugin.properties b/org.eclipse.mylyn.reviews.VCalendar/plugin.properties
new file mode 100644
index 0000000..3e08f55
--- /dev/null
+++ b/org.eclipse.mylyn.reviews.VCalendar/plugin.properties
@@ -0,0 +1,11 @@
+/**
+ * Copyright (c) 2010 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ */
+pluginName = Mylyn Reviews R4E (Incubation)
+providerName = Eclipse Mylyn
diff --git a/org.eclipse.mylyn.reviews.VCalendar/src/org/eclipse/mylyn/reviews/vcalendar/core/VCalendar.java b/org.eclipse.mylyn.reviews.VCalendar/src/org/eclipse/mylyn/reviews/vcalendar/core/VCalendar.java
new file mode 100644
index 0000000..9f93210
--- /dev/null
+++ b/org.eclipse.mylyn.reviews.VCalendar/src/org/eclipse/mylyn/reviews/vcalendar/core/VCalendar.java
@@ -0,0 +1,160 @@
+/**
+ * Copyright (c) 2011 Ericsson and others.
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ericsson Research Canada - Initial implementation
+ *
+ */
+package org.eclipse.mylyn.reviews.vcalendar.core;
+
+import java.text.SimpleDateFormat;
+import java.util.Locale;
+import java.util.TimeZone;
+
+import org.eclipse.mylyn.reviews.notifications.core.IMeetingData;
+
+/**
+ * @author Jacques Bouthillier
+ *
+ * @version $Revision: 1.0 $
+ */
+public class VCalendar {
+
+ private long fTIME_ZONE_OFFSET = TimeZone.getDefault().getOffset(
+ System.currentTimeMillis());
+
+ private final String fNEW_LINE = "\n";
+
+ private final String fGMT_TIME = "Z";
+
+ private final SimpleDateFormat fDATE_FORMAT = new SimpleDateFormat(
+ "yyyyMMdd'T'HHmmss", new Locale("eng", "US"));
+
+ public VCalendar() {
+ }
+
+ /**
+ * Build the VCalendar and return it as a String
+ *
+ * @param aInfo
+ * Meeting data information
+ * @param aMsgBody
+ * @param aFrom
+ * Creator of the calendar
+ * @param aEmails
+ * List of email's of the recipients
+ * @return
+ */
+ public String createVCalendar(IMeetingData aInfo, String aFrom,
+ String[] aEmails) {
+ StringBuffer sb = new StringBuffer();
+ sb.append("BEGIN:VCALENDAR");
+ sb.append(fNEW_LINE);
+ sb.append("PRODID:-//Microsoft Corporation//Outlook 11.0 MIMEDIR//EN");
+ sb.append(fNEW_LINE);
+ sb.append("VERSION:1.0");
+ sb.append(fNEW_LINE);
+ sb.append("BEGIN:VEVENT");
+ sb.append(fNEW_LINE);
+ sb.append("ATTENDEE:");
+ sb.append(getAttendee(aEmails));
+ sb.append(fNEW_LINE);
+ sb.append("DTSTART:");
+ sb.append(getStartDate(aInfo));
+ sb.append(fGMT_TIME);
+ sb.append(fNEW_LINE);
+ sb.append("DTEND:");
+ sb.append(getEndDate(aInfo));
+ sb.append(fGMT_TIME);
+ sb.append(fNEW_LINE);
+ sb.append("LOCATION:");
+ sb.append(aInfo.getLocation());
+ sb.append(fNEW_LINE);
+
+ sb.append("DESCRIPTION;ENCODING=QUOTED-PRINTABLE:");
+ sb.append(reformatMessageBody(aInfo.getBody()));
+ sb.append("=0D=0A");
+ sb.append(fNEW_LINE);
+ sb.append("SUMMARY;ENCODING=QUOTED-PRINTABLE:");
+ sb.append(aInfo.getSubject());
+ sb.append(fNEW_LINE);
+ sb.append("PRIORITY:3");
+ sb.append(fNEW_LINE);
+ sb.append("END:VEVENT");
+ sb.append(fNEW_LINE);
+ sb.append("END:VCALENDAR");
+
+ return sb.toString();
+
+ }
+
+ /**
+ * Reformat the content of the message to replace "\n" char by the
+ * appropriate value to be used in the vCalendar
+ *
+ * @param aBody
+ * String
+ * @return String
+ */
+ private String reformatMessageBody(String aBody) {
+
+ String lineSeparator = System.getProperty("line.separator");
+
+ String str = aBody.trim().replaceAll(lineSeparator, "=0D=0A"); //line feed + carriage return
+
+ str = str.replaceAll("\n", "=0D=0A"); //new line
+
+ str = str.replaceAll("\r", "=0D=0A"); //CR
+
+ return str;
+
+
+ }
+
+ /**
+ * Get the list of attendee email's to include in the Vcalendar
+ *
+ * @return String
+ */
+ private String getAttendee(String[] aEmails) {
+ StringBuffer sb = new StringBuffer();
+ int size = aEmails.length;
+
+ for (int i = 0; i < size; i++) {
+ sb.append("\"MAILTO:");
+ sb.append(aEmails[i]);
+ if (i < (size - 1)) {
+ sb.append("\","); // Separator between attendees
+ } else {
+ sb.append('"'); // End quotes only
+ }
+ }
+ return sb.toString();
+
+ }
+
+ /**
+ * Compute a date the decision meeting should take place
+ *
+ * @return String
+ */
+ private String getStartDate(IMeetingData aInfo) {
+ return fDATE_FORMAT.format(aInfo.getStartTime() - fTIME_ZONE_OFFSET);
+ }
+
+ /**
+ * Compute the end meeting date and time
+ *
+ * @return String
+ */
+ private String getEndDate(IMeetingData aInfo) {
+ Long timeDuration= (long) (aInfo.getDuration() * 60 * 1000); //convert minutes to millisec
+ return fDATE_FORMAT.format(aInfo.getStartTime() + timeDuration- fTIME_ZONE_OFFSET);
+ }
+
+}