Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Iterate over files in Taxonomy folder

Hi everybody,

I am trying to get a list in java with all files that are contained in a Taxonomy folder.

Now I have the following function to acces a Taxonomy folder and return a list of all the accessRIDs from the documents in this folder:

List xmlforms = null;

		  try
		  {
			  ep5User = WPUMFactory.getUserFactory().getEP5User(user);
			  IResourceContext context = new ResourceContext(ep5User);
			  RID pathRID = RID.getRID("taxonomies/DemoNews/DemoNews/All%20Items/");
			  com.sapportals.wcm.repository.IResource resource = com.sapportals.wcm.repository.ResourceFactory.getInstance().getResource(pathRID,context);
			
			  if(resource.isCollection())
			  {
				  xmlforms = new ArrayList();
				  ICollection collection = (ICollection)resource;
				  IResourceListIterator it = collection.getChildren().listIterator();
		   	   
				  while(it.hasNext())
				  {
				   		IResource res = (IResource)it.next();
				   		if(!res.isCollection())
				   		{
						  	xmlforms.add(res.getAccessRID());	
				   		}
				  }
			  }
		  }catch (Exception e) {
			   e.printStackTrace();
		   }
		  finally
		  {}
		  return xmlforms;

But when I execute this function it gives me a nullpointer. So the function isn't putting anything in the list.

However, when I change the RID of the folder to iterate to for example "/documents/news" then it works fine.

So my question is if it is possible to access the "/Taxonomies" directory using the KM API?

Thanks in advance

Kind regards

Wouter Delellio

Former Member
Former Member replied

Hi,

The best would be to post here the defaultTrace log to see, on which line of the code is the exception thrown. Maybe you just define the wrong RID.

Instead of:

taxonomies/DemoNews/DemoNews/All%20Items/

try:

/taxonomies/DemoNews/DemoNews/All Items/

(note the forst slash and the space between "All" "Items").

Romano

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question