Subversion Repositories XServices

Rev

Rev 31 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 31 Rev 39
Line 24... Line 24...
24
import java.util.List;
24
import java.util.List;
25
import java.util.Map;
25
import java.util.Map;
Line 26... Line 26...
26
 
26
 
27
import net.brutex.mylyn.sbmconnector.SBMConnectorPlugin;
27
import net.brutex.mylyn.sbmconnector.SBMConnectorPlugin;
-
 
28
import net.brutex.mylyn.sbmconnector.core.model.SBMStaticFields;
-
 
29
import net.brutex.mylyn.sbmconnector.ui.SBMRepositoryQueryPage;
28
import net.brutex.mylyn.sbmconnector.core.model.SBMStaticFields;
30
import net.brutex.mylyn.sbmconnector.ui.SBMRepositorySettingsPage;
Line 29... Line 31...
29
import net.brutex.sbm.wsclient.TTItem;
31
import net.brutex.sbm.wsclient.TTItem;
30
 
32
 
31
import org.eclipse.core.runtime.CoreException;
33
import org.eclipse.core.runtime.CoreException;
32
import org.eclipse.core.runtime.IProgressMonitor;
34
import org.eclipse.core.runtime.IProgressMonitor;
-
 
35
import org.eclipse.core.runtime.IStatus;
33
import org.eclipse.core.runtime.IStatus;
36
import org.eclipse.core.runtime.Status;
34
import org.eclipse.core.runtime.Status;
37
import org.eclipse.core.runtime.jobs.Job;
35
import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
38
import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
36
import org.eclipse.mylyn.tasks.core.IRepositoryQuery;
39
import org.eclipse.mylyn.tasks.core.IRepositoryQuery;
37
import org.eclipse.mylyn.tasks.core.ITask;
40
import org.eclipse.mylyn.tasks.core.ITask;
38
import org.eclipse.mylyn.tasks.core.TaskRepository;
41
import org.eclipse.mylyn.tasks.core.TaskRepository;
39
import org.eclipse.mylyn.tasks.core.data.AbstractTaskDataHandler;
42
import org.eclipse.mylyn.tasks.core.data.AbstractTaskDataHandler;
40
import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
43
import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
41
import org.eclipse.mylyn.tasks.core.data.TaskData;
44
import org.eclipse.mylyn.tasks.core.data.TaskData;
42
import org.eclipse.mylyn.tasks.core.data.TaskDataCollector;
45
import org.eclipse.mylyn.tasks.core.data.TaskDataCollector;
-
 
46
import org.eclipse.mylyn.tasks.core.data.TaskMapper;
Line 43... Line 47...
43
import org.eclipse.mylyn.tasks.core.data.TaskMapper;
47
import org.eclipse.mylyn.tasks.core.sync.ISynchronizationSession;
Line 44... Line 48...
44
import org.eclipse.mylyn.tasks.core.sync.ISynchronizationSession;
48
import org.eclipse.ui.statushandlers.StatusManager;
45
 
49
 
Line 73... Line 77...
73
 
77
 
74
	@Override
78
	@Override
75
	public boolean canSynchronizeTask(TaskRepository taskRepository, ITask task) {
79
	public boolean canSynchronizeTask(TaskRepository taskRepository, ITask task) {
76
		return true;
80
		return true;
77
	}
81
	}
78
	
82
 
79
	@Override
83
	@Override
80
	public String getConnectorKind() {
84
	public String getConnectorKind() {
81
		return SBMConnectorPlugin.CONNECTOR_KIND;
85
		return SBMConnectorPlugin.CONNECTOR_KIND;
Line 98... Line 102...
98
		monitor.beginTask("Loading SBM Ticket", IProgressMonitor.UNKNOWN);
102
		monitor.beginTask("Loading SBM Ticket", IProgressMonitor.UNKNOWN);
99
		TaskData data = null;
103
		TaskData data = null;
100
		try {
104
		try {
101
			SBMClient client = getClient(taskRepository);
105
			SBMClient client = getClient(taskRepository);
102
			TTItem item = client.getTTItem(taskId);
106
			TTItem item = client.getTTItem(taskId);
103
			data = datahandler.convert(taskRepository, item, monitor);
107
			data = datahandler.convert(taskRepository, item, monitor, null);
Line 104... Line 108...
104
 
108
 
105
		} finally {
109
		} finally {
106
			monitor.done();
110
			monitor.done();
107
		}
111
		}
Line 140... Line 144...
140
 
144
 
141
	@Override
145
	@Override
142
	public IStatus performQuery(TaskRepository repository,
146
	public IStatus performQuery(TaskRepository repository,
143
			IRepositoryQuery query, TaskDataCollector collector,
147
			IRepositoryQuery query, TaskDataCollector collector,
-
 
148
			ISynchronizationSession session, IProgressMonitor monitor) {
144
			ISynchronizationSession session, IProgressMonitor monitor) {
149
			monitor.subTask("Calculating query result size ...");
145
		try {
-
 
146
			monitor.beginTask("Lade Daten", IProgressMonitor.UNKNOWN);
-
 
147
 
150
		try {
-
 
151
			SBMClient client = new SBMClient(repository);
-
 
152
			int countItem = client.getResultCount(getQueryTable(repository), 
-
 
153
					query.getAttribute("sql_where"));
-
 
154
			monitor.beginTask("", countItem);
148
			SBMClient client = new SBMClient(repository);
155
			monitor.subTask("Loading "+countItem+" items ...");
149
		List<TTItem> list = client.getTTItemsByTable(query
156
			List<TTItem> list = client.getTTItemsByTable(
-
 
157
					getQueryTable(repository), query.getAttribute("sql_where"),
-
 
158
					true);
150
					.getAttribute("table"), query.getAttribute("sql_where"));
159
			monitor.worked(1);
151
			for (TTItem ttitem : list) {
160
			for (TTItem ttitem : list) {
152
				TaskData data = datahandler
161
				TaskData data = datahandler.convert(repository, ttitem,
153
						.convert(repository, ttitem, monitor);
162
						monitor, query);
-
 
163
				collector.accept(data);
-
 
164
				monitor.worked(1);
154
				collector.accept(data);
165
				if(monitor.isCanceled()) return Status.CANCEL_STATUS;
155
			}
166
			}
156
		} catch (CoreException e) {
167
		} catch (CoreException e) {
157
			return new Status(IStatus.ERROR, SBMConnectorPlugin.PLUGIN_ID,
168
			IStatus status =  new Status(IStatus.ERROR, SBMConnectorPlugin.PLUGIN_ID,
-
 
169
					e.getMessage(), e);
-
 
170
			//StatusManager.getManager().handle(status, StatusManager.BLOCK);
158
					"Query fehlgeschlagen.", e);
171
			return status;
159
		} finally {
172
		} finally {
160
			monitor.done();
173
			monitor.done();
161
		}
174
		}
162
		return Status.OK_STATUS;
175
		return Status.OK_STATUS;
Line 177... Line 190...
177
 
190
 
178
	@Override
191
	@Override
179
	public TaskMapper getTaskMapping(TaskData taskData) {
192
	public TaskMapper getTaskMapping(TaskData taskData) {
180
		return new TaskMapper(taskData);
193
		return new TaskMapper(taskData);
181
	}
194
	}
182
	
195
 
183
	@Override
196
	@Override
184
	public AbstractTaskDataHandler getTaskDataHandler() {
197
	public AbstractTaskDataHandler getTaskDataHandler() {
185
		return datahandler;
198
		return datahandler;
Line 186... Line 199...
186
	}
199
	}
187
 
200
 
188
	@Override
201
	@Override
189
	public boolean canDeleteTask(TaskRepository repository, ITask task) {
202
	public boolean canDeleteTask(TaskRepository repository, ITask task) {
-
 
203
		return false;
190
		return false;
204
	}
191
	}
205
 
192
	@Override
206
	@Override
193
	public boolean hasRepositoryDueDate(TaskRepository taskRepository,
207
	public boolean hasRepositoryDueDate(TaskRepository taskRepository,
194
			ITask task, TaskData taskData) {
208
			ITask task, TaskData taskData) {
-
 
209
		// TODO Auto-generated method stub
-
 
210
		return false;
-
 
211
	}
-
 
212
 
-
 
213
	private String getQueryTable(TaskRepository repository) {
195
		// TODO Auto-generated method stub
214
		return repository
196
	return false;
-
 
Line 197... Line 215...
197
	}
215
				.getProperty(SBMRepositorySettingsPage.STRING_SOLUTIONTABLE);