Skip to main content
summaryrefslogtreecommitdiffstats
blob: 68dd9dbbd93c6daef436980d8ee94b3e73b33ede (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
/*******************************************************************************
 * 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.internal.tasks.core;

import java.util.Calendar;
import java.util.Date;
import java.util.Set;

import org.eclipse.mylyn.tasks.core.AbstractTask;
import org.eclipse.mylyn.tasks.core.AbstractTaskContainer;

/**
 * @author Rob Elves
 * @author Mik Kersten
 */
public class ScheduledTaskDelegate extends AbstractTask {

	private AbstractTask task = null;

	private ScheduledTaskContainer parent;

	private long startMili = 0;

	private long endMili = 0;

	private long activity = 0;

	public ScheduledTaskDelegate(ScheduledTaskContainer parent, AbstractTask task, Calendar start, Calendar end) {
		this(parent, task, start, end, 0);
	}

	public ScheduledTaskDelegate(ScheduledTaskContainer parent, AbstractTask task, Calendar start, Calendar end, long activity) {
		super(task.getRepositoryUrl(), task.getTaskId(), task.getSummary());
		if (task == null) {
			throw new RuntimeException("attempted to instantiated with null task: " + parent);
		}
		this.task = task;
		if (start != null) {
			this.startMili = start.getTimeInMillis();
		}
		if (end != null) {
			this.endMili = end.getTimeInMillis();
		}
		this.parent = parent;
		this.activity = activity;
	}

	public long getEnd() {
		return endMili;
	}

	public long getStart() {
		return startMili;
	}

	public long getActivity() {
		return activity;
	}

	public AbstractTask getCorrespondingTask() {
		return task;
	}

	@Override
	public int hashCode() {
		final int PRIME = 31;
		int result = 1;
		result = PRIME * result + ((task == null) ? 0 : task.hashCode());
		result = PRIME * result + ((parent == null) ? 0 : parent.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 ScheduledTaskDelegate other = (ScheduledTaskDelegate) obj;
		if (task == null) {
			if (other.task != null)
				return false;
		} else if (!task.equals(other.task))
			return false;
		if (parent == null) {
			if (other.parent != null)
				return false;
		} else if (!parent.equals(other.parent))
			return false;
		return true;
	}

	public ScheduledTaskContainer getDateRangeContainer() {
		return parent;
	}

	@Override
	public Set<AbstractTaskContainer> getParentContainers() {
		return task.getParentContainers();
	}

	public Set<AbstractTask> getChildren() {
		return task.getChildren();
	}

	public Date getCompletionDate() {
		return task.getCompletionDate();
	}

	public Date getCreationDate() {
		return task.getCreationDate();
	}

	public String getSummary() {
		return task.getSummary();
	}

	public int getEstimateTimeHours() {
		return task.getEstimateTimeHours();
	}

	public String getTaskKind() {
		return task.getTaskKind();
	}

	public String getNotes() {
		return task.getNotes();
	}

	public String getPriority() {
		return task.getPriority();
	}

	public Date getScheduledForDate() {
		return task.getScheduledForDate();
	}

	public String getTaskUrl() {
		return task.getTaskUrl();
	}

	public boolean hasBeenReminded() {
		return task.hasBeenReminded();
	}

	public boolean hasValidUrl() {
		return task.hasValidUrl();
	}

	public boolean isActive() {
		return task.isActive();
	}

	public boolean isCompleted() {
		return task.isCompleted();
	}

	public boolean isPastReminder() {
		return task.isPastReminder();
	}

	public void setActive(boolean active) {
		task.setActive(active);
	}

	@Override
	public void addParentContainer(AbstractTaskContainer container) {
		task.addParentContainer(container);
	}
	
	@Override
	public void removeParentContainer(AbstractTaskContainer container) {
		task.removeParentContainer(container);
	}

	public void setCompleted(boolean completed) {
		task.setCompleted(completed);
	}

	public void setCompletionDate(Date date) {
		task.setCompletionDate(date);
	}

	public void setCreationDate(Date date) {
		task.setCreationDate(date);
	}

	public void setEstimatedTimeHours(int estimated) {
		task.setEstimatedTimeHours(estimated);
	}

	// public void setHandleIdentifier(String taskId) {
	// task.setHandleIdentifier(taskId);
	// }

	public void setKind(String kind) {
		task.setKind(kind);
	}

	public void setNotes(String notes) {
		task.setNotes(notes);
	}

	public void setPriority(String priority) {
		task.setPriority(priority);
	}

	public void setReminded(boolean reminded) {
		task.setReminded(reminded);
	}

	public void setScheduledForDate(Date date) {
		task.setScheduledForDate(date);
	}

	public void setTaskUrl(String url) {
		task.setTaskUrl(url);
	}

	public int compareTo(AbstractTaskContainer taskListElement) {
		return task.toString().compareTo(((AbstractTask) taskListElement).toString());
	}

	public void setSummary(String description) {
		task.setSummary(description);
	}

	public Date getDueDate() {
		return task.getDueDate();
	}

	public void setDueDate(Date date) {
		task.setDueDate(date);
	}

	@Override
	public boolean isLocal() {
		return ((AbstractTask)task).isLocal();
	}

	@Override
	public String getRepositoryKind() {
		return task.getRepositoryKind();
	}
}

Back to the top