cancel
Showing results for 
Search instead for 
Did you mean: 

Iterate over files in Taxonomy folder

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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

Former Member
0 Kudos

Oh my god!

I Can't believe I overlooked the forward slash in the beginning of the RID!!

Thx Romano

Answers (0)