summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteffen Pingel2012-07-15 16:55:08 (EDT)
committerSteffen Pingel2012-07-15 16:55:08 (EDT)
commit64a80f308e9553afc47a073b4571c0b8563686b2 (patch)
treec49e7e77cde2a2a57a0482f5525e4110839f71dd
parentbf51c873ff9e2c00caddda7d3838c5848d021b1e (diff)
downloadorg.eclipse.mylyn.tasks-64a80f308e9553afc47a073b4571c0b8563686b2.zip
org.eclipse.mylyn.tasks-64a80f308e9553afc47a073b4571c0b8563686b2.tar.gz
org.eclipse.mylyn.tasks-64a80f308e9553afc47a073b4571c0b8563686b2.tar.bz2
NEW - bug 382788: [activity] define data model for task activity records
https://bugs.eclipse.org/bugs/show_bug.cgi?id=382788 Change-Id: Ib338bcf384007064a152431b0a73a22a75d8cf4e
-rw-r--r--org.eclipse.mylyn.tasks.activity.core/META-INF/MANIFEST.MF2
-rw-r--r--org.eclipse.mylyn.tasks.activity.core/src/.placeholder0
-rw-r--r--org.eclipse.mylyn.tasks.activity.core/src/org/eclipse/mylyn/internal/tasks/activity/core/ActivityCoreInternal.java26
-rw-r--r--org.eclipse.mylyn.tasks.activity.core/src/org/eclipse/mylyn/internal/tasks/activity/core/ActivityManager.java27
-rw-r--r--org.eclipse.mylyn.tasks.activity.core/src/org/eclipse/mylyn/internal/tasks/activity/core/ActivityStream.java62
-rw-r--r--org.eclipse.mylyn.tasks.activity.core/src/org/eclipse/mylyn/tasks/activity/core/ActivityCore.java25
-rw-r--r--org.eclipse.mylyn.tasks.activity.core/src/org/eclipse/mylyn/tasks/activity/core/ActivityEvent.java96
-rw-r--r--org.eclipse.mylyn.tasks.activity.core/src/org/eclipse/mylyn/tasks/activity/core/ActivityScope.java16
-rw-r--r--org.eclipse.mylyn.tasks.activity.core/src/org/eclipse/mylyn/tasks/activity/core/IActivityManager.java29
-rw-r--r--org.eclipse.mylyn.tasks.activity.core/src/org/eclipse/mylyn/tasks/activity/core/IActivityStream.java27
10 files changed, 310 insertions, 0 deletions
diff --git a/org.eclipse.mylyn.tasks.activity.core/META-INF/MANIFEST.MF b/org.eclipse.mylyn.tasks.activity.core/META-INF/MANIFEST.MF
index 39d8ba9..0fe8f2f 100644
--- a/org.eclipse.mylyn.tasks.activity.core/META-INF/MANIFEST.MF
+++ b/org.eclipse.mylyn.tasks.activity.core/META-INF/MANIFEST.MF
@@ -8,3 +8,5 @@ Bundle-RequiredExecutionEnvironment: J2SE-1.5
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.mylyn.tasks.core;bundle-version="3.8.0"
Bundle-Localization: plugin
+Export-Package: org.eclipse.mylyn.internal.tasks.activity.core;x-internal:=true,
+ org.eclipse.mylyn.tasks.activity.core;x-internal:=true
diff --git a/org.eclipse.mylyn.tasks.activity.core/src/.placeholder b/org.eclipse.mylyn.tasks.activity.core/src/.placeholder
deleted file mode 100644
index e69de29..0000000
--- a/org.eclipse.mylyn.tasks.activity.core/src/.placeholder
+++ /dev/null
diff --git a/org.eclipse.mylyn.tasks.activity.core/src/org/eclipse/mylyn/internal/tasks/activity/core/ActivityCoreInternal.java b/org.eclipse.mylyn.tasks.activity.core/src/org/eclipse/mylyn/internal/tasks/activity/core/ActivityCoreInternal.java
new file mode 100644
index 0000000..78fbc93
--- /dev/null
+++ b/org.eclipse.mylyn.tasks.activity.core/src/org/eclipse/mylyn/internal/tasks/activity/core/ActivityCoreInternal.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Tasktop Technologies 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:
+ * Tasktop Technologies - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylyn.internal.tasks.activity.core;
+
+
+/**
+ * @author Steffen Pingel
+ */
+public class ActivityCoreInternal {
+
+ private static ActivityManager activityManager = new ActivityManager();
+
+ public static ActivityManager getActivityManager() {
+ return activityManager;
+ }
+
+}
diff --git a/org.eclipse.mylyn.tasks.activity.core/src/org/eclipse/mylyn/internal/tasks/activity/core/ActivityManager.java b/org.eclipse.mylyn.tasks.activity.core/src/org/eclipse/mylyn/internal/tasks/activity/core/ActivityManager.java
new file mode 100644
index 0000000..fc3664a
--- /dev/null
+++ b/org.eclipse.mylyn.tasks.activity.core/src/org/eclipse/mylyn/internal/tasks/activity/core/ActivityManager.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Tasktop Technologies 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:
+ * Tasktop Technologies - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylyn.internal.tasks.activity.core;
+
+import org.eclipse.mylyn.tasks.activity.core.ActivityScope;
+import org.eclipse.mylyn.tasks.activity.core.IActivityManager;
+import org.eclipse.mylyn.tasks.activity.core.IActivityStream;
+
+/**
+ * @author Steffen Pingel
+ */
+public class ActivityManager implements IActivityManager {
+
+ public IActivityStream getStream(ActivityScope scope) {
+ return new ActivityStream(this, scope);
+ }
+
+}
diff --git a/org.eclipse.mylyn.tasks.activity.core/src/org/eclipse/mylyn/internal/tasks/activity/core/ActivityStream.java b/org.eclipse.mylyn.tasks.activity.core/src/org/eclipse/mylyn/internal/tasks/activity/core/ActivityStream.java
new file mode 100644
index 0000000..6535573
--- /dev/null
+++ b/org.eclipse.mylyn.tasks.activity.core/src/org/eclipse/mylyn/internal/tasks/activity/core/ActivityStream.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Tasktop Technologies 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:
+ * Tasktop Technologies - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylyn.internal.tasks.activity.core;
+
+import java.util.List;
+import java.util.concurrent.CopyOnWriteArrayList;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.mylyn.tasks.activity.core.ActivityEvent;
+import org.eclipse.mylyn.tasks.activity.core.ActivityScope;
+import org.eclipse.mylyn.tasks.activity.core.IActivityManager;
+import org.eclipse.mylyn.tasks.activity.core.IActivityStream;
+
+/**
+ * @author Steffen Pingel
+ */
+public class ActivityStream implements IActivityStream {
+
+ private final List<ActivityEvent> events;
+
+ private final ActivityScope scope;
+
+ private final IActivityManager manager;
+
+ public ActivityStream(IActivityManager manager, ActivityScope scope) {
+ Assert.isNotNull(manager);
+ Assert.isNotNull(scope);
+ this.manager = manager;
+ this.scope = scope;
+ this.events = new CopyOnWriteArrayList<ActivityEvent>();
+ }
+
+ public void addEvent(ActivityEvent event) {
+ events.add(event);
+ }
+
+ public List<ActivityEvent> getEvents() {
+ return events;
+ }
+
+ public IActivityManager getManager() {
+ return manager;
+ }
+
+ public ActivityScope getScope() {
+ return scope;
+ }
+
+ public void removeEvent(ActivityEvent event) {
+ events.remove(event);
+ }
+
+}
diff --git a/org.eclipse.mylyn.tasks.activity.core/src/org/eclipse/mylyn/tasks/activity/core/ActivityCore.java b/org.eclipse.mylyn.tasks.activity.core/src/org/eclipse/mylyn/tasks/activity/core/ActivityCore.java
new file mode 100644
index 0000000..018bc1b
--- /dev/null
+++ b/org.eclipse.mylyn.tasks.activity.core/src/org/eclipse/mylyn/tasks/activity/core/ActivityCore.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Tasktop Technologies 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:
+ * Tasktop Technologies - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylyn.tasks.activity.core;
+
+import org.eclipse.mylyn.internal.tasks.activity.core.ActivityCoreInternal;
+
+/**
+ * @author Steffen Pingel
+ */
+public class ActivityCore {
+
+ public static IActivityManager getActivityManager() {
+ return ActivityCoreInternal.getActivityManager();
+ }
+
+}
diff --git a/org.eclipse.mylyn.tasks.activity.core/src/org/eclipse/mylyn/tasks/activity/core/ActivityEvent.java b/org.eclipse.mylyn.tasks.activity.core/src/org/eclipse/mylyn/tasks/activity/core/ActivityEvent.java
new file mode 100644
index 0000000..05a81dd
--- /dev/null
+++ b/org.eclipse.mylyn.tasks.activity.core/src/org/eclipse/mylyn/tasks/activity/core/ActivityEvent.java
@@ -0,0 +1,96 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Tasktop Technologies 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:
+ * Tasktop Technologies - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylyn.tasks.activity.core;
+
+import java.util.Date;
+import java.util.Map;
+
+import org.eclipse.core.runtime.Assert;
+
+/**
+ * @author Steffen Pingel
+ */
+public class ActivityEvent {
+
+ private final String handle;
+
+ private final String kind;
+
+ private final String summary;
+
+ private final Date date;
+
+ private final Map<String, String> attributes;
+
+ public ActivityEvent(String handle, String kind, String summary, Date date, Map<String, String> attributes) {
+ Assert.isNotNull(handle);
+ Assert.isNotNull(kind);
+ Assert.isNotNull(summary);
+ Assert.isNotNull(date);
+ this.handle = handle;
+ this.kind = kind;
+ this.summary = summary;
+ this.date = date;
+ this.attributes = attributes;
+ }
+
+ public String getKind() {
+ return kind;
+ }
+
+ public String getSummary() {
+ return summary;
+ }
+
+ public String getHandle() {
+ return handle;
+ }
+
+ public Date getDate() {
+ return date;
+ }
+
+ public Map<String, String> getAttributes() {
+ return attributes;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((handle == null) ? 0 : handle.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ ActivityEvent other = (ActivityEvent) obj;
+ if (handle == null) {
+ if (other.handle != null) {
+ return false;
+ }
+ } else if (!handle.equals(other.handle)) {
+ return false;
+ }
+ return true;
+ }
+
+}
diff --git a/org.eclipse.mylyn.tasks.activity.core/src/org/eclipse/mylyn/tasks/activity/core/ActivityScope.java b/org.eclipse.mylyn.tasks.activity.core/src/org/eclipse/mylyn/tasks/activity/core/ActivityScope.java
new file mode 100644
index 0000000..ee0fc5d
--- /dev/null
+++ b/org.eclipse.mylyn.tasks.activity.core/src/org/eclipse/mylyn/tasks/activity/core/ActivityScope.java
@@ -0,0 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Tasktop Technologies 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:
+ * Tasktop Technologies - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylyn.tasks.activity.core;
+
+public class ActivityScope {
+
+}
diff --git a/org.eclipse.mylyn.tasks.activity.core/src/org/eclipse/mylyn/tasks/activity/core/IActivityManager.java b/org.eclipse.mylyn.tasks.activity.core/src/org/eclipse/mylyn/tasks/activity/core/IActivityManager.java
new file mode 100644
index 0000000..7b05b3c
--- /dev/null
+++ b/org.eclipse.mylyn.tasks.activity.core/src/org/eclipse/mylyn/tasks/activity/core/IActivityManager.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Tasktop Technologies 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:
+ * Tasktop Technologies - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylyn.tasks.activity.core;
+
+/**
+ * @author Steffen Pingel
+ * @noextend This class is not intended to be subclassed by clients.
+ * @noinstantiate This class is not intended to be instantiated by clients.
+ */
+public interface IActivityManager {
+
+ /**
+ * Returns the activity stream for <code>scope</code>.
+ *
+ * @param scope
+ * the scope, must not be <code>null</code>
+ */
+ IActivityStream getStream(ActivityScope scope);
+
+}
diff --git a/org.eclipse.mylyn.tasks.activity.core/src/org/eclipse/mylyn/tasks/activity/core/IActivityStream.java b/org.eclipse.mylyn.tasks.activity.core/src/org/eclipse/mylyn/tasks/activity/core/IActivityStream.java
new file mode 100644
index 0000000..c48d588
--- /dev/null
+++ b/org.eclipse.mylyn.tasks.activity.core/src/org/eclipse/mylyn/tasks/activity/core/IActivityStream.java
@@ -0,0 +1,27 @@
+package org.eclipse.mylyn.tasks.activity.core;
+
+import java.util.List;
+
+/*******************************************************************************
+ * Copyright (c) 2012 Tasktop Technologies 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:
+ * Tasktop Technologies - initial API and implementation
+ *******************************************************************************/
+
+/**
+ * Defines a stream of {@link ActivityEvent}s that
+ *
+ * @author spingel
+ */
+public interface IActivityStream {
+
+ List<ActivityEvent> getEvents();
+
+ ActivityScope getScope();
+
+}