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>
int chuckIndex = decodedServerLocation.length() + parentSiteDecoded.length();
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)
{
if (urlPath.length() < chuckIndex)
throw new ManifoldCFException("List view url is not in the expected form: '"+urlPath+"'");
urlPath = urlPath.substring(chuckIndex);
if (!urlPath.startsWith("/"))
throw new ManifoldCFException("List view url without site is not in the expected form: '"+urlPath+"'");
// We're at the /Lists/listname part of the name. Figure out where the end of it is.
int index = urlPath.indexOf("/",1);
if (index == -1)
throw new ManifoldCFException("Bad list view url without site: '"+urlPath+"'");
String pathpart = urlPath.substring(1,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" );
}
}
}
}