It's all about the answers!

Ask a question

Link directly a file A from a Component B to an IFileItem type instance


ioana lazar (9910) | asked Aug 03 '12, 5:05 a.m.
 Hey,
I have the name of a file and it's full path. How can I get hold of the IFileItem type object for that certain file without going through all of my repository?  At this point  I have a recursive method that goes through the repository until it finds that certain file.
IConfiguration configuration= workspace.configuration(component);
From configuration.childEntriesForRoot(null);  I can obtain for each file a IVersionableHandle and after that I do the cast fileHandle = (IFileItemHandle) test;
This method it's really time consuming. I need a method that receives the full path of the file and if that file is in the repository, then it returns the IFileItem  for that file, else a error message.
I've tried :
  ISharingManager manager = FileSystemCore.getSharingManager();
   ILocation location = new PathLocation(fileContaingFolderPath); 
   IShareable shareable = manager.findShareable(location, ResourceType.FOLDER); but in shareable i get a null instance. Also I did not find the javadoc for the IShareable class.

Comments
ioana lazar commented Aug 03 '12, 8:21 a.m.

Hey, I solved my problem starting from this answer https://jazz.net/forum/questions/35000/how-do-you-retreve-file-content-using-java-api Thanks

Be the first one to answer this question!


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.