Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrelves2007-02-05 18:37:53 -0500
committerrelves2007-02-05 18:37:53 -0500
commitbfc5c2bf07f4b5d90e6cd65b81eef452eaed7d0f (patch)
tree5b82f936a9973958459de51e9ecd14da37fd2eb5 /org.eclipse.mylyn.tasks.core
parent7713e325dfe46d746e32fd32079ff633429eb15c (diff)
downloadorg.eclipse.mylyn.tasks-bfc5c2bf07f4b5d90e6cd65b81eef452eaed7d0f.tar.gz
org.eclipse.mylyn.tasks-bfc5c2bf07f4b5d90e6cd65b81eef452eaed7d0f.tar.xz
org.eclipse.mylyn.tasks-bfc5c2bf07f4b5d90e6cd65b81eef452eaed7d0f.zip
NEW - bug 166305: Add the ability to discard pending upstream changes
https://bugs.eclipse.org/bugs/show_bug.cgi?id=166305
Diffstat (limited to 'org.eclipse.mylyn.tasks.core')
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/OfflineDataStore.java11
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskDataManager.java232
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/DelegatingTaskExternalizer.java2
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/IMylarStatusConstants.java2
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/MylarMessages.java2
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/MylarMessages.properties1
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/MylarStatus.java2
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/RepositoryTaskAttribute.java31
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/RepositoryTaskData.java9
9 files changed, 252 insertions, 40 deletions
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/OfflineDataStore.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/OfflineDataStore.java
index 46d6cad3b..82cd80ccf 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/OfflineDataStore.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/OfflineDataStore.java
@@ -11,7 +11,9 @@ package org.eclipse.mylar.internal.tasks.core;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
+import java.util.Set;
+import org.eclipse.mylar.tasks.core.RepositoryTaskAttribute;
import org.eclipse.mylar.tasks.core.RepositoryTaskData;
/**
@@ -22,11 +24,14 @@ import org.eclipse.mylar.tasks.core.RepositoryTaskData;
*/
class OfflineDataStore implements Serializable {
- private static final long serialVersionUID = -3909672088254980426L;
+ private static final long serialVersionUID = -3909632088254980426L;
/** Last new repository task id */
private int lastNewRepositoryTaskId = 0;
+ // Local changes to existing reports
+ private Map<String, Set<RepositoryTaskAttribute>> localEdits = new HashMap<String, Set<RepositoryTaskAttribute>>();
+
/** Older version of Task Data */
private Map<String, RepositoryTaskData> oldTaskDataMap = new HashMap<String, RepositoryTaskData>();
@@ -56,4 +61,8 @@ class OfflineDataStore implements Serializable {
public Map<String, RepositoryTaskData> getUnsubmittedTaskData() {
return unsubmittedTaskData;
}
+
+ public Map<String, Set<RepositoryTaskAttribute>> getLocalEdits() {
+ return localEdits;
+ }
} \ No newline at end of file
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskDataManager.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskDataManager.java
index 2a5ad1175..785c9fb94 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskDataManager.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskDataManager.java
@@ -10,6 +10,8 @@
*******************************************************************************/
package org.eclipse.mylar.internal.tasks.core;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
@@ -17,13 +19,16 @@ import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.Collections;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import org.eclipse.mylar.context.core.MylarStatusHandler;
import org.eclipse.mylar.tasks.core.AbstractAttributeFactory;
import org.eclipse.mylar.tasks.core.AbstractRepositoryConnector;
import org.eclipse.mylar.tasks.core.AbstractRepositoryTask;
+import org.eclipse.mylar.tasks.core.RepositoryTaskAttribute;
import org.eclipse.mylar.tasks.core.RepositoryTaskData;
import org.eclipse.mylar.tasks.core.TaskRepositoryManager;
@@ -39,6 +44,9 @@ public class TaskDataManager {
private OfflineDataStore dataStore;
/** Older version of Task Data */
+ private Map<String, Set<RepositoryTaskAttribute>> localChangesMap;
+
+ /** Older version of Task Data */
private Map<String, RepositoryTaskData> oldTaskDataMap;
/** Newest version of the task data */
@@ -48,8 +56,9 @@ public class TaskDataManager {
private Map<String, RepositoryTaskData> unsubmittedTaskData;
private TaskRepositoryManager taskRepositoryManager;
-
- public TaskDataManager(TaskRepositoryManager taskRepositoryManager, File file, boolean read) throws IOException, ClassNotFoundException {
+
+ public TaskDataManager(TaskRepositoryManager taskRepositoryManager, File file, boolean read) throws IOException,
+ ClassNotFoundException {
this.taskRepositoryManager = taskRepositoryManager;
this.file = file;
if (file.exists() && read) {
@@ -66,6 +75,13 @@ public class TaskDataManager {
return oldTaskDataMap;
}
+ private Map<String, Set<RepositoryTaskAttribute>> getLocalChangesMap() {
+ if (localChangesMap == null) {
+ localChangesMap = Collections.synchronizedMap(dataStore.getLocalEdits());
+ }
+ return localChangesMap;
+ }
+
private synchronized Map<String, RepositoryTaskData> getNewDataMap() {
if (newTaskDataMap == null) {
newTaskDataMap = Collections.synchronizedMap(dataStore.getNewDataMap());
@@ -84,18 +100,32 @@ public class TaskDataManager {
* Add a RepositoryTaskData to the offline reports file. Previously stored
* taskData is held and can be retrieved via getOldTaskData()
*/
- public void put(RepositoryTaskData newEntry) {
+ public void push(RepositoryTaskData newEntry) {
+ String handle = AbstractRepositoryTask.getHandle(newEntry.getRepositoryUrl(), newEntry.getId());
+ RepositoryTaskData moveToOld = getNewDataMap().get(handle);
synchronized (file) {
- String handle = AbstractRepositoryTask.getHandle(newEntry.getRepositoryUrl(), newEntry.getId());
- RepositoryTaskData moveToOld = getNewDataMap().get(handle);
if (moveToOld != null) {
getOldDataMap().put(handle, moveToOld);
+ } else {
+ getOldDataMap().put(handle, newEntry);
}
getNewDataMap().put(handle, newEntry);
}
}
/**
+ * Replace the recent (new) data with this copy
+ *
+ * @param newData
+ */
+ public void replace(RepositoryTaskData newData) {
+ String handle = AbstractRepositoryTask.getHandle(newData.getRepositoryUrl(), newData.getId());
+ synchronized (file) {
+ getNewDataMap().put(handle, newData);
+ }
+ }
+
+ /**
* Add an unsubmitted RepositoryTaskData to the offline reports file.
*/
public void putUnsubmitted(RepositoryTaskData newEntry) {
@@ -130,41 +160,132 @@ public class TaskDataManager {
return "" + dataStore.getNextTaskId();
}
+ private Set<RepositoryTaskAttribute> getLocalChanges(String handle) {
+ Set<RepositoryTaskAttribute> localChanges;
+ synchronized (file) {
+ localChanges = getLocalChangesMap().get(handle);
+ if (localChanges != null) {
+ return Collections.unmodifiableSet(localChanges);
+ }
+ }
+ return Collections.emptySet();
+ }
+
+ /**
+ * @return editable copy of task data with any edits applied
+ */
+ public RepositoryTaskData getEditableCopy(String handle) {
+ RepositoryTaskData data = getRepositoryTaskData(handle);
+ RepositoryTaskData clone;
+ try {
+ clone = (RepositoryTaskData) ObjectCloner.deepCopy(data);
+ updateAttributeFactory(clone);
+ } catch (Exception e) {
+ MylarStatusHandler.fail(e, "Error constructing modifiable task", false);
+ return null;
+ }
+ for (RepositoryTaskAttribute attribute : getLocalChanges(handle)) {
+ if (attribute == null)
+ continue;
+ RepositoryTaskAttribute existing = clone.getAttribute(attribute.getID());
+ if (existing != null) {
+ existing.clearValues();
+ List<String> options = existing.getOptions();
+
+ for (String value : attribute.getValues()) {
+ if (options.size() > 0) {
+ if (options.contains(value)) {
+ existing.addValue(value);
+ }
+ } else {
+ existing.addValue(value);
+ }
+ }
+
+ } else {
+ clone.addAttribute(attribute.getID(), attribute);
+ }
+
+ }
+
+ return clone;
+
+ }
+
+ /**
+ * @return editable copy of task data with any edits applied
+ */
+ public RepositoryTaskData getEditableCopy(String repositoryUrl, String taskId) {
+ String handle = AbstractRepositoryTask.getHandle(repositoryUrl, taskId);
+ return getEditableCopy(handle);
+ }
+
+ public void saveEdits(String handle, Set<RepositoryTaskAttribute> attributes) {
+ synchronized (file) {
+ Set<RepositoryTaskAttribute> edits = getLocalChangesMap().get(handle);
+ if (edits == null) {
+ edits = new HashSet<RepositoryTaskAttribute>();
+ edits.addAll(attributes);
+ getLocalChangesMap().put(handle, edits);
+ } else {
+ edits.removeAll(attributes);
+ edits.addAll(attributes);
+ }
+ }
+ }
+
+ public Set<RepositoryTaskAttribute> getEdits(String handle) {
+ Set<RepositoryTaskAttribute> changes = getLocalChangesMap().get(handle);
+ if (changes == null) {
+ return Collections.emptySet();
+ } else {
+ return Collections.unmodifiableSet(changes);
+ }
+
+ }
+
+ public void discardEdits(String handle) {
+ synchronized (file) {
+ getLocalChangesMap().remove(handle);
+ }
+ }
+
/**
* Returns the most recent copy of the task data.
+ *
+ * @return offline task data, null if no data found
*/
- public RepositoryTaskData getTaskData(String handle) {
+ public RepositoryTaskData getRepositoryTaskData(String handle) {
RepositoryTaskData data = getNewDataMap().get(handle);
if (data == null) {
- data = getOldTaskData(handle);
- if (data != null) {
- getNewDataMap().put(handle, data);
- }
+ data = getOldRepositoryTaskData(handle);
}
return data;
}
/**
* Returns the most recent copy of the task data.
+ *
+ * @return offline task data, null if no data found
*/
- public RepositoryTaskData getTaskData(String repositoryUrl, String taskId) {
+ public RepositoryTaskData getRepsitoryTaskData(String repositoryUrl, String taskId) {
String handle = AbstractRepositoryTask.getHandle(repositoryUrl, taskId);
- return getTaskData(handle);
+ return getRepositoryTaskData(handle);
}
/**
* Returns the old copy if exists, null otherwise.
*/
- public RepositoryTaskData getOldTaskData(String handle) {
+ public RepositoryTaskData getOldRepositoryTaskData(String handle) {
return getOldDataMap().get(handle);
}
/**
* Returns the old copy if exists, null otherwise.
*/
- public RepositoryTaskData getOldTaskData(String repositoryUrl, String taskId) {
+ public RepositoryTaskData getOldRepositoryTaskData(String repositoryUrl, String taskId) {
String handle = AbstractRepositoryTask.getHandle(repositoryUrl, taskId);
- return getOldTaskData(handle);
+ return getOldRepositoryTaskData(handle);
}
/**
@@ -190,7 +311,7 @@ public class TaskDataManager {
}
/**
- * Public for testing
+ * force a reset of all data maps
*/
public void clear() {
synchronized (file) {
@@ -198,6 +319,36 @@ public class TaskDataManager {
oldTaskDataMap = null;
newTaskDataMap = null;
unsubmittedTaskData = null;
+ localChangesMap = null;
+ }
+ }
+
+ /**
+ * After deserialization process the attributeFactory needs to be reset on
+ * each RepositoryTaskData.
+ */
+ private void updateAttributeFactory(RepositoryTaskData taskData) {
+ if (taskData == null)
+ return;
+ AbstractRepositoryConnector connector = taskRepositoryManager.getRepositoryConnector(taskData
+ .getRepositoryKind());
+ if (connector != null && connector.getTaskDataHandler() != null) {
+ AbstractAttributeFactory factory = connector.getTaskDataHandler().getAttributeFactory();
+ if (factory != null) {
+ taskData.setAttributeFactory(factory);
+ }
+ }
+ }
+
+ /**
+ * Make both new and old the same so that no deltas will be revealed.
+ */
+ public void clearIncoming(String handle) {
+ RepositoryTaskData newData = getNewDataMap().get(handle);
+ if (newData != null) {
+ synchronized (file) {
+ getOldDataMap().put(handle, newData);
+ }
}
}
@@ -219,12 +370,12 @@ public class TaskDataManager {
}
} finally {
if (in != null) {
- try {
- in.close();
- } catch(IOException e) {
- MylarStatusHandler.fail(e, "Could not close stream", false);
- }
- }
+ try {
+ in.close();
+ } catch (IOException e) {
+ MylarStatusHandler.fail(e, "Could not close stream", false);
+ }
+ }
}
}
}
@@ -252,17 +403,36 @@ public class TaskDataManager {
}
}
- private void updateAttributeFactory(RepositoryTaskData taskData) {
- AbstractRepositoryConnector connector = taskRepositoryManager.getRepositoryConnector(
- taskData.getRepositoryKind());
-// AbstractRepositoryConnector connector = TasksUiPlugin.getRepositoryManager().getRepositoryConnector(
-// taskData.getRepositoryKind());
- if (connector != null && connector.getTaskDataHandler() != null) {
- AbstractAttributeFactory factory = connector.getTaskDataHandler().getAttributeFactory();
- if (factory != null) {
- taskData.setAttributeFactory(factory);
+ // HACK: until we get proper offline storage....
+ // Reference:
+ // http://www.javaworld.com/javaworld/javatips/jw-javatip76.html?page=2
+ public static class ObjectCloner {
+
+ private ObjectCloner() {
+ // can not instantiate
+ }
+
+ static public Object deepCopy(Object oldObj) throws Exception {
+ ObjectOutputStream outputStream = null;
+ ObjectInputStream inputStream = null;
+ try {
+ ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
+ outputStream = new ObjectOutputStream(byteArrayOutputStream);
+
+ outputStream.writeObject(oldObj);
+ outputStream.flush();
+ ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(byteArrayOutputStream
+ .toByteArray());
+ inputStream = new ObjectInputStream(byteArrayInputStream);
+ return inputStream.readObject();
+ } catch (Exception e) {
+ throw (e);
+ } finally {
+ outputStream.close();
+ inputStream.close();
}
}
+
}
}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/DelegatingTaskExternalizer.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/DelegatingTaskExternalizer.java
index 0d87d8137..8e4cb8070 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/DelegatingTaskExternalizer.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/DelegatingTaskExternalizer.java
@@ -452,7 +452,7 @@ public class DelegatingTaskExternalizer implements ITaskListExternalizer {
}
protected void readTaskData(AbstractRepositoryTask task) {
- RepositoryTaskData data = taskDataManager.getTaskData(task.getHandleIdentifier());
+ RepositoryTaskData data = taskDataManager.getRepositoryTaskData(task.getHandleIdentifier());
// RepositoryTaskData data = TasksUiPlugin.getDefault().getTaskDataManager().getTaskData(task.getHandleIdentifier());
task.setTaskData(data);
if (data != null && data.hasLocalChanges()) {
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/IMylarStatusConstants.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/IMylarStatusConstants.java
index ecd0fb295..41e27f352 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/IMylarStatusConstants.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/IMylarStatusConstants.java
@@ -31,7 +31,7 @@ public interface IMylarStatusConstants {
public final static int IO_ERROR = 5;
-// public final static int NETWORK_LOGIN_ERROR = 6;
+ public final static int REPOSITORY_COLLISION = 6;
public final static int INTERNAL_ERROR = 7;
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/MylarMessages.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/MylarMessages.java
index 2605b27e5..f9c3e70fd 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/MylarMessages.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/MylarMessages.java
@@ -33,6 +33,8 @@ public class MylarMessages extends NLS {
public static String repository_not_found;
public static String repository_comment_reqd;
+
+ public static String repository_collision;
public static String operation_cancelled;
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/MylarMessages.properties b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/MylarMessages.properties
index 78a9b1d50..7733bc894 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/MylarMessages.properties
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/MylarMessages.properties
@@ -6,6 +6,7 @@ repository_error = Repository error from {0}:\n\n{1}
repository_login_failure = Unable to login to {0}.\n\n{1}\n\nPlease validate credentials via Task Repositories view.
repository_not_found = Repository {0} could not be found.
repository_comment_reqd = You have to specify a new comment when making this change. Please comment on the reason for this change.
+repository_collision = Mid-air collision occurred while submitting to {0}.\n\nSynchronize task and re-submit changes.
### repositoryUrl, class.simpleName, class.getMessage
io_error = I/O Error occurred while communicating with {0}.\n\n{1}: {2}
network_error = A network error occurred connecting to {0}.\n\n{1}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/MylarStatus.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/MylarStatus.java
index 5bd590da0..31d81f8da 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/MylarStatus.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/MylarStatus.java
@@ -72,6 +72,8 @@ public class MylarStatus extends Status implements IMylarStatusConstants {
return MylarMessages.bind(MylarMessages.internal_error, this.errorMessage);
case OPERATION_CANCELLED:
return MylarMessages.bind(MylarMessages.operation_cancelled, this.errorMessage);
+ case REPOSITORY_COLLISION:
+ return MylarMessages.bind(MylarMessages.repository_collision, this.errorMessage);
case REPOSITORY_COMMENT_REQD:
if (errorMessage == null) {
return MylarMessages.repository_comment_reqd;
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/RepositoryTaskAttribute.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/RepositoryTaskAttribute.java
index 7e1177c68..dfdc92b4d 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/RepositoryTaskAttribute.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/RepositoryTaskAttribute.java
@@ -24,7 +24,7 @@ import java.util.Map;
*/
public class RepositoryTaskAttribute implements Serializable {
- private static final long serialVersionUID = 6383803576644618720L;
+ private static final long serialVersionUID = 6383833576644618720L;
/**
* Key for the author of a comment.
@@ -35,6 +35,8 @@ public class RepositoryTaskAttribute implements Serializable {
public static final String USER_OWNER = "task.common.user.owner";
public static final String USER_CC = "task.common.user.cc";
+
+ public static final String COMMENT_NEW = "task.common.comment.new";
public static final String COMMENT_TEXT = "task.common.comment.text";
@@ -236,4 +238,31 @@ public class RepositoryTaskAttribute implements Serializable {
return getValue();
}
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((key == null) ? 0 : key.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;
+ final RepositoryTaskAttribute other = (RepositoryTaskAttribute) obj;
+ if (key == null) {
+ if (other.key != null)
+ return false;
+ } else if (!key.equals(other.key))
+ return false;
+ return true;
+ }
+
+
+
}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/RepositoryTaskData.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/RepositoryTaskData.java
index 8675c4bbe..f1af73519 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/RepositoryTaskData.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/RepositoryTaskData.java
@@ -28,7 +28,7 @@ import java.util.StringTokenizer;
*/
public final class RepositoryTaskData extends AttributeContainer implements Serializable {
- private static final long serialVersionUID = 2304511248225227689L;
+ private static final long serialVersionUID = 2304511248225237689L;
private boolean hasLocalChanges = false;
@@ -40,8 +40,6 @@ public final class RepositoryTaskData extends AttributeContainer implements Seri
private String repositoryURL;
- protected String newComment = "";
-
private List<TaskComment> taskComments = new ArrayList<TaskComment>();
private List<RepositoryAttachment> attachments = new ArrayList<RepositoryAttachment>();
@@ -239,14 +237,15 @@ public final class RepositoryTaskData extends AttributeContainer implements Seri
* Get the new comment that is to be added to the bug
*/
public String getNewComment() {
- return newComment;
+ RepositoryTaskAttribute attribute = getAttribute(RepositoryTaskAttribute.COMMENT_NEW);
+ return (attribute != null) ? attribute.getValue() : "";
}
/**
* Set the new comment that will be added to the bug
*/
public void setNewComment(String newComment) {
- this.newComment = newComment;
+ setAttributeValue(RepositoryTaskAttribute.COMMENT_NEW, newComment);
}
public void addComment(TaskComment taskComment) {

Back to the top