Skip to main content
summaryrefslogtreecommitdiffstats
blob: 61678ef47740d7fbb2ef0d3f6a0c77fb3c321a54 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
/*******************************************************************************
 * Copyright (c) 2004 - 2006 University Of British Columbia 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:
 *     University Of British Columbia - initial API and implementation
 *******************************************************************************/

package org.eclipse.mylyn.tasks.core;

import java.io.Serializable;

/**
 * A comment posted by a user on a task.
 * 
 * @author Rob Elves
 * @since 2.0
 */
public class TaskComment extends AttributeContainer implements Serializable {

	private static final long serialVersionUID = 1076016406335550318L;

	/** Comment's number */
	private final int number;

	private boolean hasAttachment;

	private String attachmentId;

	public TaskComment(AbstractAttributeFactory attributeFactory, int num) {
		super(attributeFactory);
		this.number = num;
	}

	/**
	 * Get this comment's number
	 * 
	 * @return This comment's number
	 */
	public int getNumber() {
		return number;
	}

	/**
	 * Get the time that this comment was created
	 * 
	 * @return The comments creation timestamp
	 */
	public String getCreated() {
		return getAttributeValue(RepositoryTaskAttribute.COMMENT_DATE);
	}

	/**
	 * Get the author of the comment
	 * 
	 * @return The comments author
	 */
	public String getAuthor() {
		return getAttributeValue(RepositoryTaskAttribute.COMMENT_AUTHOR);
	}

	/**
	 * Get the authors real name
	 * 
	 * @return Returns author's name, or <code>null</code> if not known
	 */
	public String getAuthorName() {
		// TODO: Currently we don't get the real name from the xml.
		// Need retrieve these names somehow
		return getAuthor();
	}

	/**
	 * Get the text contained in the comment
	 * 
	 * @return The comments text
	 */
	public String getText() {
		return getAttributeValue(RepositoryTaskAttribute.COMMENT_TEXT);
	}

	public void setHasAttachment(boolean b) {
		this.hasAttachment = b;
	}

	public boolean hasAttachment() {
		return hasAttachment;
	}

	public void setAttachmentId(String attachmentID) {
		this.attachmentId = attachmentID;
	}

	public String getAttachmentId() {
		return attachmentId;
	}
}

Back to the top