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.compareTo( "1" ) == 0 )
{
// We think it's a library
// This is how we display it, so this has the right path extension
String urlPath = doc.getValue( o, "DefaultViewUrl" );
// It's a library. 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("View url is not in the expected form: '"+urlPath+"'");
urlPath = urlPath.substring(chuckIndex);
if (!urlPath.startsWith("/"))
throw new ManifoldCFException("View url without site is not in the expected form: '"+urlPath+"'");
// We're at the library name. Figure out where the end of it is.
int index = urlPath.indexOf("/",1);
if (index == -1)
throw new ManifoldCFException("Bad view url without site: '"+urlPath+"'");
String pathpart = urlPath.substring(1,index);
if ( pathpart.equals(docLibrary) )
{
// We found it!
// Return its ID
return doc.getValue( o, "ID" );
}
}
}
}