How to programatically get the lock status of a file from a stream?
Hi ,
I have prepared a change set with some files and associated that change set to some work item. I have developed a Plugin which will take input of Work Item number and fetch the files inside change set(s) associated to it.
Now to enhance that plugin, I want to display the List of files from change set which are locked by any Team user.
Currently I am using the IsImmutable method of IFileItem class. But there are some refresh problems occurring like even after the user has released / Locked the file, same is not reflecting to my plugin ONLINE.
Is there any direct method to know whether the given file in the Stream was locked by an user or not.
Regards
Pugazh
Accepted answer
Comments
Hi John.
Thanks a lot. Based on your input i have followed the below link.
https://jazz.net/forum/questions/83178/scm-apis-use-auto-lock-to-imitate-reserved-check-out
But it always shown as file locked.
My Code :
criteria = ILockSearchCriteria.FACTORY.newInstance();
criteria.getStreams().add(workspaceHandle);
criteria.getComponents().add(component);
criteria.getVersionables().add(fileItemHandle);
Note : i am using change set to get componet ,file handle and workspace handle is Stream. i need get the current status of a file(file is referred from change set) from Stream.
I don't see anything obviously wrong with the way you're constructing your search criteria. Maybe there's an issue with the code that's interpreting the results you're getting back? Or (and sorry in advance for the stupid question) is it at all possible that the file actually is locked? If you go to your project area in the web UI and choose Source Control --> Locks, do any locks appear?
John has the correct answer here. Please raise a defect if something is not working as expected.