Skip to main content
summaryrefslogtreecommitdiffstats
blob: 0b3efbf258963efd7a4c633479949cc10cebe65c (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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
/*******************************************************************************
 * 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
 *     Frank Becker - improvements
 *******************************************************************************/

package org.eclipse.mylyn.tasks.core;

import java.util.Date;
import java.util.List;

import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.mylyn.internal.tasks.core.AttributeMap;
import org.eclipse.mylyn.tasks.core.ITask.PriorityLevel;
import org.eclipse.mylyn.tasks.core.data.AbstractTaskDataHandler;
import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
import org.eclipse.mylyn.tasks.core.data.TaskData;

/**
 * TaskInitialzationData should be used as alternative to implementing {@link ITaskMapping} when passing initialization
 * data into {@link AbstractTaskDataHandler#initializeTaskData()}. It provides common accessors and mutators for a set
 * of fields used during task data initialization. Only attributes of type {@link String} are supported, other accessors
 * throw {@link UnsupportedOperationException} as documented for each method.
 * 
 * @author Benjamin Muskalla
 * @since 3.10
 * @noextend This class is not intended to be subclassed by clients.
 */
public class TaskInitializationData implements ITaskMapping {

	private final AttributeMap attributesById = new AttributeMap();

	@Nullable
	public String getAttribute(String key) {
		return attributesById.getAttribute(key);
	}

	/**
	 * Returns <code>null</code>.
	 */
	@Nullable
	public List<String> getCc() {
		return null;
	}

	/**
	 * Returns <code>null</code>.
	 */
	@Nullable
	public Date getCompletionDate() {
		return null;
	}

	@Nullable
	public String getComponent() {
		return attributesById.getAttribute(TaskAttribute.COMPONENT);
	}

	/**
	 * Returns <code>null</code>.
	 */
	@Nullable
	public Date getCreationDate() {
		return null;
	}

	@Nullable
	public String getDescription() {
		return attributesById.getAttribute(TaskAttribute.DESCRIPTION);
	}

	/**
	 * Returns <code>null</code>.
	 */
	@Nullable
	public Date getDueDate() {
		return null;
	}

	/**
	 * Returns <code>null</code>.
	 */
	@Nullable
	public List<String> getKeywords() {
		return null;
	}

	/**
	 * Returns <code>null</code>.
	 */
	@Nullable
	public Date getModificationDate() {
		return null;
	}

	/**
	 * Returns <code>null</code>.
	 */
	@Nullable
	public String getOwner() {
		return null;

	}

	/**
	 * Returns <code>null</code>.
	 * 
	 * @since 3.15
	 */
	@Nullable
	public String getOwnerId() {
		return null;

	}

	@Nullable
	public String getPriority() {
		return attributesById.getAttribute(TaskAttribute.PRIORITY);
	}

	/**
	 * Returns <code>null</code>.
	 */
	@Nullable
	public PriorityLevel getPriorityLevel() {
		return null;
	}

	@Nullable
	public String getProduct() {
		return attributesById.getAttribute(TaskAttribute.PRODUCT);
	}

	@Nullable
	public String getReporter() {
		return attributesById.getAttribute(TaskAttribute.USER_REPORTER);
	}

	@Nullable
	public String getResolution() {
		return attributesById.getAttribute(TaskAttribute.RESOLUTION);
	}

	@Nullable
	public String getSeverity() {
		return attributesById.getAttribute(TaskAttribute.SEVERITY);
	}

	@Nullable
	public String getStatus() {
		return attributesById.getAttribute(TaskAttribute.STATUS);
	}

	@Nullable
	public String getSummary() {
		return attributesById.getAttribute(TaskAttribute.SUMMARY);
	}

	/**
	 * Returns <code>null</code>.
	 */
	@Nullable
	public TaskData getTaskData() {
		return null;
	}

	@Nullable
	public String getTaskKey() {
		return attributesById.getAttribute(TaskAttribute.TASK_KEY);
	}

	@Nullable
	public String getTaskKind() {
		return attributesById.getAttribute(TaskAttribute.TASK_KIND);
	}

	/**
	 * Does not map to a common attribute and hence Returns <code>null</code>.
	 */
	@Nullable
	public String getTaskStatus() {
		return null;
	}

	@Nullable
	public String getTaskUrl() {
		return attributesById.getAttribute(TaskAttribute.TASK_URL);
	}

	@Nullable
	public String getVersion() {
		return attributesById.getAttribute(TaskAttribute.VERSION);
	}

	/**
	 * Throws {@link UnsupportedOperationException}.
	 */
	@Nullable
	public void merge(ITaskMapping source) {
		throw new UnsupportedOperationException();
	}

	public void setAttribute(@NonNull String key, @Nullable String value) {
		attributesById.setAttribute(key, value);
	}

	public void setComponent(@Nullable String newComponent) {
		attributesById.setAttribute(TaskAttribute.COMPONENT, newComponent);
	}

	public void setDescription(@Nullable String description) {
		attributesById.setAttribute(TaskAttribute.DESCRIPTION, description);
	}

	public void setPriority(@Nullable String priority) {
		attributesById.setAttribute(TaskAttribute.PRIORITY, priority);
	}

	public void setProduct(@Nullable String product) {
		attributesById.setAttribute(TaskAttribute.PRODUCT, product);
	}

	public void setResolution(@Nullable String resolution) {
		attributesById.setAttribute(TaskAttribute.RESOLUTION, resolution);
	}

	public void setSeverity(@Nullable String severity) {
		attributesById.setAttribute(TaskAttribute.SEVERITY, severity);
	}

	public void setStatus(@Nullable String status) {
		attributesById.setAttribute(TaskAttribute.STATUS, status);
	}

	public void setSummary(@Nullable String summary) {
		attributesById.setAttribute(TaskAttribute.SUMMARY, summary);
	}

	public void setTaskKey(@Nullable String taskKey) {
		attributesById.setAttribute(TaskAttribute.TASK_KEY, taskKey);
	}

	public void setTaskKind(@Nullable String taskKind) {
		attributesById.setAttribute(TaskAttribute.TASK_KIND, taskKind);
	}

	public void setTaskUrl(@Nullable String newKind) {
		attributesById.setAttribute(TaskAttribute.TASK_URL, newKind);
	}

	public void setVersion(@Nullable String version) {
		attributesById.setAttribute(TaskAttribute.VERSION, version);
	}

}

Back to the top