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 { |
|
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(); |
} |
189,6 → 202,7 |
public boolean canDeleteTask(TaskRepository repository, ITask task) { |
return false; |
} |
|
@Override |
public boolean hasRepositoryDueDate(TaskRepository taskRepository, |
ITask task, TaskData taskData) { |
196,5 → 210,9 |
return false; |
} |
|
private String getQueryTable(TaskRepository repository) { |
return repository |
.getProperty(SBMRepositorySettingsPage.STRING_SOLUTIONTABLE); |
} |
|
} |