Subversion Repositories XServices

Compare Revisions

Regard whitespace Rev 42 → Rev 169

/sbm4mylyn/branches/V2009R2-maintenance/src/net/brutex/mylyn/sbmconnector/core/SBMClient.java
47,6 → 47,11
import net.brutex.sbm.wsclient.NameValue;
import net.brutex.sbm.wsclient.Note;
import net.brutex.sbm.wsclient.ObjectFactory;
import net.brutex.sbm.wsclient.ReportCategory;
import net.brutex.sbm.wsclient.ReportInfo;
import net.brutex.sbm.wsclient.ReportResult;
import net.brutex.sbm.wsclient.ReportsFilter;
import net.brutex.sbm.wsclient.RunReportResult;
import net.brutex.sbm.wsclient.TTItem;
import net.brutex.sbm.wsclient.TableData;
import net.brutex.sbm.wsclient.TableType;
139,6 → 144,41
return list;
}
public List<TTItem> getTTItemsByReport(String reportuuid) throws CoreException {
List<TTItem> list = new ArrayList<TTItem>();
try {
RunReportResult result = port.runReport(
getAuth(), of.createQueryRange(), reportuuid, null, null, null, null, null, null,
null, null, null, null, null);
List<ReportResult> resultlist = result.getResult();
for(ReportResult r : resultlist) {
list.add(port.getItem( getAuth(), r.getItemId().getValue(), null));
}
} catch (AEWebservicesFaultFault e) {
throw new CoreException(
RepositoryStatus.createInternalError(
SBMConnectorPlugin.PLUGIN_ID, e.getMessage(), e));
}
return list;
}
public List<ReportInfo> getReportList(String solutionname) throws CoreException {
ReportsFilter filter = of.createReportsFilter();
List<ReportInfo> reportlist = new ArrayList<ReportInfo>();
filter.setSolutionName(of.createSolutionDataName(solutionname));
filter.setReportCategory(ReportCategory.USERREPORTS); //Limit this for now, because we execute by uuid only
try {
reportlist = port.getReports(getAuth(), null, filter).getReport();
} catch (AEWebservicesFaultFault e) {
throw new CoreException(
RepositoryStatus.createInternalError(
SBMConnectorPlugin.PLUGIN_ID, e.getMessage(), e));
}
return reportlist;
}
public List<String> getResultCount(String tablename, String sql) throws CoreException {
List<TTItem> list = new ArrayList<TTItem>();
List<String> idlist = new ArrayList<String>();
/sbm4mylyn/branches/V2009R2-maintenance/src/net/brutex/mylyn/sbmconnector/core/SBMTicketAttribute.java
37,7 → 37,7
SBMFieldTypes.TEXT,
TaskAttribute.DESCRIPTION,
TaskAttribute.TYPE_LONG_RICH_TEXT,
SBMTicketAttribute.HIDDEN), //hidden because has extra part
false), //hidden because has extra part
ID(
SBMStaticFields.ID.getValue(),
"ts_id",
44,7 → 44,7
SBMFieldTypes.SYSTEM,
TaskAttribute.TASK_KEY,
TaskAttribute.TYPE_SHORT_TEXT,
SBMTicketAttribute.HIDDEN),
false),
UUID(
SBMStaticFields.UUID.getValue(),
"ts_uuid",
51,7 → 51,7
SBMFieldTypes.SYSTEM,
TaskAttribute.KIND_DEFAULT,
TaskAttribute.TYPE_SHORT_TEXT,
SBMTicketAttribute.HIDDEN),
false),
PROJECT(
SBMStaticFields.PROJECTID.getValue(),
"label_project",
64,7 → 64,7
SBMFieldTypes.SYSTEM,
TaskAttribute.STATUS,
TaskAttribute.TYPE_SHORT_TEXT,
SBMTicketAttribute.HIDDEN), //hidden because has extra part
false), //hidden because has extra part
SUBMITTER(
SBMStaticFields.SUBMITTER.getValue(),
"label_submitter",
71,7 → 71,7
SBMFieldTypes.USER,
TaskAttribute.USER_REPORTER,
TaskAttribute.TYPE_PERSON,
SBMTicketAttribute.HIDDEN), //hidden because has extra part
false), //hidden because has extra part
SUBMITDATE(
SBMStaticFields.SUBMITDATE.getValue(),
"label_submitdate",
90,7 → 90,7
SBMFieldTypes.DATETIME,
TaskAttribute.DATE_MODIFICATION,
TaskAttribute.TYPE_DATETIME,
SBMTicketAttribute.HIDDEN), //hidden because has extra part
false), //hidden because has extra part
CLOSEDATE(
SBMStaticFields.CLOSEDATE.getValue(),
"label_closedate",
103,7 → 103,7
SBMFieldTypes.SYSTEM,
TaskAttribute.TASK_URL,
TaskAttribute.TYPE_URL,
SBMTicketAttribute.HIDDEN),
false),
TITLE(
"TITLE",
"label_title",
110,7 → 110,7
SBMFieldTypes.TEXT,
TaskAttribute.SUMMARY,
TaskAttribute.TYPE_SHORT_TEXT,
SBMTicketAttribute.HIDDEN), //hidden because has extra part
false), //hidden because has extra part
ACTIVEINACTIVE(
SBMStaticFields.ACTIVEINACTIVE.getValue(),
"label_activeinactive",
/sbm4mylyn/branches/V2009R2-maintenance/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);
}
 
}
/sbm4mylyn/branches/V2009R2-maintenance/src/net/brutex/mylyn/sbmconnector/core/SBMTicketDataHandler.java
120,8 → 120,7
/**
* Convert.
*
* @param repository
* the repository
* @param repository the repository
* @param ttitem
* the ttitem
* @param monitor