/sbm4mylyn/trunk/src/net/brutex/mylyn/sbmconnector/core/SBMClient.java |
---|
139,8 → 139,9 |
return list; |
} |
public int getResultCount(String tablename, String sql) throws CoreException { |
public List<String> getResultCount(String tablename, String sql) throws CoreException { |
List<TTItem> list = new ArrayList<TTItem>(); |
List<String> idlist = new ArrayList<String>(); |
try { |
list = port.getItemsByQueryWithName( |
getAuth(), |
154,7 → 155,10 |
RepositoryStatus.createInternalError( |
SBMConnectorPlugin.PLUGIN_ID, e.getMessage(), e)); |
} |
return list.size(); |
for (TTItem item : list) { |
idlist.add(item.getGenericItem().getValue().getItemID().getValue()); |
} |
return idlist; |
} |
/** |
/sbm4mylyn/trunk/src/net/brutex/mylyn/sbmconnector/core/SBMRepositoryConnector.java |
---|
149,20 → 149,28 |
monitor.subTask("Calculating query result size ..."); |
try { |
SBMClient client = new SBMClient(repository); |
int countItem = client.getResultCount(getQueryTable(repository), |
List<String> idlist = client.getResultCount(getQueryTable(repository), |
query.getAttribute("sql_where")); |
int countItem = idlist.size(); |
monitor.beginTask("", countItem); |
monitor.subTask("Loading "+countItem+" items ..."); |
List<TTItem> list = client.getTTItemsByTable( |
getQueryTable(repository), query.getAttribute("sql_where"), |
true); |
//List<TTItem> list = client.getTTItemsByTable( |
// getQueryTable(repository), query.getAttribute("sql_where"), |
// true); |
monitor.worked(1); |
for (TTItem ttitem : list) { |
int i = 1; |
for (String id : idlist) { |
if(id!=null) { |
monitor.subTask("Loading item "+i+"/"+countItem+" ..."); |
TTItem ttitem = client.getTTItem("["+id+"]"); |
TaskData data = datahandler.convert(repository, ttitem, |
monitor, query); |
collector.accept(data); |
} |
monitor.worked(1); |
if(monitor.isCanceled()) return Status.CANCEL_STATUS; |
i++; |
} |
} catch (CoreException e) { |
IStatus status = new Status(IStatus.ERROR, SBMConnectorPlugin.PLUGIN_ID, |
/sbm4mylyn/trunk/src/net/brutex/mylyn/sbmconnector/core/SBMTicketDataHandler.java |
---|
232,12 → 232,12 |
// single selection |
if (f.getType() == SBMFieldTypes.SELECTION |
&& client.getFieldValue(ttitem, f.getName()) != null) { |
List<SBMFieldValue> options = client.getValidSet(client |
.getTableName(ttitem), f.getName()); |
for (SBMFieldValue optionvalue : options) { |
custom.putOption(optionvalue.getInternalValue(), |
optionvalue.getValue()); |
} |
//List<SBMFieldValue> options = client.getValidSet(client |
// .getTableName(ttitem), f.getName()); |
//for (SBMFieldValue optionvalue : options) { |
// custom.putOption(optionvalue.getInternalValue(), |
// optionvalue.getValue()); |
//} |
String val = client.getFieldValue(ttitem, f.getName()) |
.getValue(); |
custom.setValue(val); |