Skip to main content
summaryrefslogtreecommitdiffstats
blob: 936a196c055c3c8bddcac721a8ea2bbcc824b942 (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
/*******************************************************************************
 * Copyright (c) 2004, 2008 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.core.data;

import org.eclipse.core.runtime.Assert;
import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;

/**
 * @author Steffen Pingel
 * @since 3.0
 */
public final class TaskData {

	private final String connectorKind;

	private boolean partial;

	private String version;

	private final String repositoryUrl;

	private final String taskId;

	private final TaskAttributeMapper mapper;

	private final TaskAttribute root;

	public TaskData(TaskAttributeMapper mapper, String connectorKind, String repositoryUrl, String taskId) {
		Assert.isNotNull(mapper);
		Assert.isNotNull(connectorKind);
		Assert.isNotNull(repositoryUrl);
		Assert.isNotNull(taskId);
		this.mapper = mapper;
		this.connectorKind = connectorKind;
		this.repositoryUrl = repositoryUrl;
		this.taskId = taskId;
		this.root = new TaskAttribute(this);
	}

	public TaskAttribute getRoot() {
		return root;
	}

	public String getConnectorKind() {
		return connectorKind;
	}

	public String getRepositoryUrl() {
		return repositoryUrl;
	}

	public String getTaskId() {
		return taskId;
	}

	public String getVersion() {
		return version;
	}

	public void setVersion(String version) {
		this.version = version;
	}

	/**
	 * Returns true if this is a new, unsubmitted task; false otherwise.
	 */
	public boolean isNew() {
		return getTaskId().length() == 0;
	}

	/**
	 * Returns true, if this task data does not have all task attributes.
	 */
	public boolean isPartial() {
		return partial;
	}

	/**
	 * Set <code>partial</code> to true to indicate that this task data does not have all task attributes.
	 * 
	 * @see #isPartial()
	 * @see AbstractRepositoryConnector#performQuery(org.eclipse.mylyn.tasks.core.TaskRepository,
	 *      org.eclipse.mylyn.tasks.core.IRepositoryQuery, TaskDataCollector,
	 *      org.eclipse.mylyn.tasks.core.sync.ISynchronizationSession, org.eclipse.core.runtime.IProgressMonitor)
	 * @see AbstractRepositoryConnector#getTaskData(org.eclipse.mylyn.tasks.core.TaskRepository, String,
	 *      org.eclipse.core.runtime.IProgressMonitor)
	 * @see #isPartial()
	 */
	public void setPartial(boolean partial) {
		this.partial = partial;
	}

	public TaskAttributeMapper getAttributeMapper() {
		return mapper;
	}

}

Back to the top