* Webdav compatible form.
* @throws RepositoryException
*/
private MultiStatus queryResultToMultiStatus(QueryResult qResult)
throws RepositoryException {
MultiStatus ms = new MultiStatus();
String[] columnNames = qResult.getColumnNames();
StringBuffer responseDescription = new StringBuffer();
String delim = "";
for (int i = 0; i < columnNames.length; i++) {
responseDescription.append(delim);
responseDescription.append(ISO9075.encode(columnNames[i]));
delim = " ";
}
ms.setResponseDescription(responseDescription.toString());
RowIterator rowIter = qResult.getRows();
while (rowIter.hasNext()) {
Row row = rowIter.nextRow();
Value[] values = row.getValues();
// get the jcr:path column indicating the node path and build
// a webdav compliant resource path of it.
String itemPath = row.getValue(JcrConstants.JCR_PATH).getString();
// create a new ms-response for this row of the result set
DavResourceLocator loc = locator.getFactory().createResourceLocator(locator.getPrefix(), locator.getWorkspacePath(), itemPath, false);
String href = loc.getHref(true);
MultiStatusResponse resp = new MultiStatusResponse(href, null);
// build the s-r-property
SearchResultProperty srp = new SearchResultProperty(columnNames, values);
resp.add(srp);
ms.addResponse(resp);
}
return ms;
}