ListsSoap listsCall = listsService.getListsSoapHandler( );
GetListCollectionResponseGetListCollectionResult listResp = listsCall.getListCollection();
org.apache.axis.message.MessageElement[] lists = listResp.get_any();
XMLDoc doc = new XMLDoc( lists[0].toString() );
ArrayList nodeList = new ArrayList();
doc.processPath(nodeList, "*", null);
if (nodeList.size() != 1)
{
throw new ManifoldCFException("Bad xml - missing outer 'ns1:Lists' node - there are "+Integer.toString(nodeList.size())+" nodes");
}
Object parent = nodeList.get(0);
if (!doc.getNodeName(parent).equals("ns1:Lists"))
throw new ManifoldCFException("Bad xml - outer node is not 'ns1:Lists'");
nodeList.clear();
doc.processPath(nodeList, "*", parent); // <ns1:Lists>
String prefixPath = decodedServerLocation + parentSiteDecoded + "/";
int i = 0;
while (i < nodeList.size())
{
Object o = nodeList.get( i++ );
String baseType = doc.getValue( o, "BaseType");
if ( baseType.equals("0") )
{
// We think it's a list
// This is how we display it, so this has the right path extension
String urlPath = doc.getValue( o, "DefaultViewUrl" );
// If it has no view url, we don't have any idea what to do with it
if (urlPath != null && urlPath.length() > 0)
{
// Normalize conditionally
if (!urlPath.startsWith("/"))
urlPath = prefixPath + urlPath;
// Get rid of what we don't want, unconditionally
if (urlPath.startsWith(prefixPath))
{
urlPath = urlPath.substring(prefixPath.length());
// We're at the Lists/listname part of the name. Figure out where the end of it is.
int index = urlPath.indexOf("/");
if (index == -1)
throw new ManifoldCFException("Bad list view url without site: '"+urlPath+"'");
String pathpart = urlPath.substring(0,index);
if("Lists".equals(pathpart))
{
int k = urlPath.indexOf("/",index+1);
if (k == -1)
throw new ManifoldCFException("Bad list view url without 'Lists': '"+urlPath+"'");
pathpart = urlPath.substring(index+1,k);
}
if ( pathpart.equals(listName) )
{
// We found it!
// Return its ID
return doc.getValue( o, "ID" );
}
}
else
{
Logging.connectors.warn("SharePoint: List view url is not in the expected form: '"+urlPath+"'; expected something beginning with '"+prefixPath+"'; skipping");