Subversion Repositories XServices

Compare Revisions

Regard whitespace Rev 42 → Rev 80

/sbm4mylyn/trunk/src/net/brutex/mylyn/sbmconnector/core/SBMRepositoryConnector.java
26,6 → 26,7
 
import net.brutex.mylyn.sbmconnector.SBMConnectorPlugin;
import net.brutex.mylyn.sbmconnector.core.model.SBMStaticFields;
import net.brutex.mylyn.sbmconnector.ui.SBMQueryComposite;
import net.brutex.mylyn.sbmconnector.ui.SBMRepositoryQueryPage;
import net.brutex.mylyn.sbmconnector.ui.SBMRepositorySettingsPage;
import net.brutex.sbm.wsclient.TTItem;
34,7 → 35,6
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;
45,7 → 45,6
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 {
 
121,7 → 120,7
@Override
public String getTaskUrl(String repositoryUrl, String taskId) {
// TODO Auto-generated method stub
return null;
return "http://something/I/havent/implemented/yet?"+taskId;
}
 
@Override
146,10 → 145,16
public IStatus performQuery(TaskRepository repository,
IRepositoryQuery query, TaskDataCollector collector,
ISynchronizationSession session, IProgressMonitor monitor) {
 
SBMClient client = new SBMClient(repository);
// do we use a report or a query?
if (query.getAttribute(SBMRepositoryQueryPage.SQL_QUERY_NAME).equals(
query.getAttribute(SBMRepositoryQueryPage.REPORT_OR_QUERY))) {
monitor.subTask("Calculating query result size ...");
try {
SBMClient client = new SBMClient(repository);
List<String> idlist = client.getResultCount(getQueryTable(repository),
 
List<String> idlist = client.getResultCount(
getQueryTable(repository),
query.getAttribute("sql_where"));
int countItem = idlist.size();
monitor.beginTask("", countItem);
162,7 → 167,8
int i = 1;
for (String id : idlist) {
if(id!=null) {
monitor.subTask("Loading item "+i+"/"+countItem+" ...");
monitor.subTask("Loading item " + i + "/" + countItem
+ " ...");
TTItem ttitem = client.getTTItem("["+id+"]");
TaskData data = datahandler.convert(repository, ttitem,
monitor, query);
169,17 → 175,41
collector.accept(data);
}
monitor.worked(1);
if(monitor.isCanceled()) return Status.CANCEL_STATUS;
if (monitor.isCanceled())
return Status.CANCEL_STATUS;
i++;
}
} catch (CoreException e) {
IStatus status = new Status(IStatus.ERROR, SBMConnectorPlugin.PLUGIN_ID,
e.getMessage(), e);
//StatusManager.getManager().handle(status, StatusManager.BLOCK);
IStatus status = new Status(IStatus.ERROR,
SBMConnectorPlugin.PLUGIN_ID, e.getMessage(), e);
// StatusManager.getManager().handle(status,
// StatusManager.BLOCK);
return status;
} finally {
monitor.done();
}
} else {
// use report
monitor.beginTask("Loading Report", 0);
try {
List<TTItem> list = client.getTTItemsByReport(query
.getAttribute(SBMRepositoryQueryPage.REPORT));
for(TTItem i:list) {
TaskData data = datahandler.convert(repository, i,
monitor, query);
collector.accept(data);
}
} catch (CoreException e) {
IStatus status = new Status(IStatus.ERROR,
SBMConnectorPlugin.PLUGIN_ID, e.getMessage(), e);
// StatusManager.getManager().handle(status,
// StatusManager.BLOCK);
return status;
} finally {
monitor.done();
}
}
 
return Status.OK_STATUS;
}
 
206,7 → 236,6
return datahandler;
}
 
@Override
public boolean canDeleteTask(TaskRepository repository, ITask task) {
return false;
}
223,4 → 252,5
.getProperty(SBMRepositorySettingsPage.STRING_SOLUTIONTABLE);
}
 
}