Subversion Repositories XServices

Compare Revisions

Ignore whitespace Rev 31 → Rev 39

/sbm4mylyn/trunk/src/net/brutex/mylyn/sbmconnector/core/SBMRepositoryConnector.java/SBMRepositoryConnector.java
26,6 → 26,8
 
import net.brutex.mylyn.sbmconnector.SBMConnectorPlugin;
import net.brutex.mylyn.sbmconnector.core.model.SBMStaticFields;
import net.brutex.mylyn.sbmconnector.ui.SBMRepositoryQueryPage;
import net.brutex.mylyn.sbmconnector.ui.SBMRepositorySettingsPage;
import net.brutex.sbm.wsclient.TTItem;
 
import org.eclipse.core.runtime.CoreException;
32,6 → 34,7
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
import org.eclipse.mylyn.tasks.core.IRepositoryQuery;
import org.eclipse.mylyn.tasks.core.ITask;
42,6 → 45,7
import org.eclipse.mylyn.tasks.core.data.TaskDataCollector;
import org.eclipse.mylyn.tasks.core.data.TaskMapper;
import org.eclipse.mylyn.tasks.core.sync.ISynchronizationSession;
import org.eclipse.ui.statushandlers.StatusManager;
 
public class SBMRepositoryConnector extends AbstractRepositoryConnector {
 
75,7 → 79,7
public boolean canSynchronizeTask(TaskRepository taskRepository, ITask task) {
return true;
}
 
@Override
public String getConnectorKind() {
return SBMConnectorPlugin.CONNECTOR_KIND;
100,7 → 104,7
try {
SBMClient client = getClient(taskRepository);
TTItem item = client.getTTItem(taskId);
data = datahandler.convert(taskRepository, item, monitor);
data = datahandler.convert(taskRepository, item, monitor, null);
 
} finally {
monitor.done();
142,20 → 146,29
public IStatus performQuery(TaskRepository repository,
IRepositoryQuery query, TaskDataCollector collector,
ISynchronizationSession session, IProgressMonitor monitor) {
monitor.subTask("Calculating query result size ...");
try {
monitor.beginTask("Lade Daten", IProgressMonitor.UNKNOWN);
 
SBMClient client = new SBMClient(repository);
List<TTItem> list = client.getTTItemsByTable(query
.getAttribute("table"), query.getAttribute("sql_where"));
int countItem = client.getResultCount(getQueryTable(repository),
query.getAttribute("sql_where"));
monitor.beginTask("", countItem);
monitor.subTask("Loading "+countItem+" items ...");
List<TTItem> list = client.getTTItemsByTable(
getQueryTable(repository), query.getAttribute("sql_where"),
true);
monitor.worked(1);
for (TTItem ttitem : list) {
TaskData data = datahandler
.convert(repository, ttitem, monitor);
TaskData data = datahandler.convert(repository, ttitem,
monitor, query);
collector.accept(data);
monitor.worked(1);
if(monitor.isCanceled()) return Status.CANCEL_STATUS;
}
} catch (CoreException e) {
return new Status(IStatus.ERROR, SBMConnectorPlugin.PLUGIN_ID,
"Query fehlgeschlagen.", e);
IStatus status = new Status(IStatus.ERROR, SBMConnectorPlugin.PLUGIN_ID,
e.getMessage(), e);
//StatusManager.getManager().handle(status, StatusManager.BLOCK);
return status;
} finally {
monitor.done();
}
179,7 → 192,7
public TaskMapper getTaskMapping(TaskData taskData) {
return new TaskMapper(taskData);
}
 
@Override
public AbstractTaskDataHandler getTaskDataHandler() {
return datahandler;
189,12 → 202,17
public boolean canDeleteTask(TaskRepository repository, ITask task) {
return false;
}
 
@Override
public boolean hasRepositoryDueDate(TaskRepository taskRepository,
ITask task, TaskData taskData) {
// TODO Auto-generated method stub
return false;
return false;
}
 
private String getQueryTable(TaskRepository repository) {
return repository
.getProperty(SBMRepositorySettingsPage.STRING_SOLUTIONTABLE);
}
 
}