It's all about the answers!

Ask a question

How to know if a file/item in RTC is deleted or not by knowing UUID(itemid) or UUID+stateid both


akshay p (15116) | asked Jul 15 '19, 1:47 a.m.
edited Aug 16 '19, 7:07 a.m. by Ralph Schoon (63.1k33645)
I have the item id and state id a file and i fetch the versionable as below

IVersionableHandle versionableHandle = (IVersionableHandle) type.createItemHandle(UUID.valueOf(file2ItemUuid), UUID.valueOf(file2StateUuid));
 IFileItem fileItem = (IFileItem) SCMPlatform.getWorkspaceManager (teamRepository).versionableManager(). fetchCompleteState(versionableHandle, new NullProgressMonitor());

But how can I identify if the fileitem is already deleted or not , because the above queries fetch the content of a file even when its already deleted from ALM streams.

One answer



permanent link
David Lafreniere (4.8k7) | answered Jul 15 '19, 12:24 p.m.
FORUM MODERATOR / JAZZ DEVELOPER
Note: A file can be deleted in StreamA, and not deleted in StreamB, thus in order to answer your question, you need a context/configuration.

You can look at IWorkspaceConnection API.
You can try:
    IWorkspaceConnection.changeHistory(<componentYouCareAbout>).getHistoryFile(versionableHandle...) - If the last change set contains that file, and if the 'after state' of that file is null, then it was deleted
or
    IWorkspaceConnection.configuration().fetchCompleteItems(...), if we have non-null states, and then a null state, then the file was deleted in that configuration.

Comments
akshay p commented Jul 16 '19, 1:38 a.m. | edited Jul 16 '19, 1:39 a.m.
Hi David,

Thank you for the answer.

Actually the task i am doing requires me to supply itemid and stateid of a fileitem from the entire team repository irrespective of the streams.
for example: if there is a file a.c (state 0) and then i delete the file. Even then i am able to get the versionable if i know the itemid and stateid of it.

This gives us incorrect results or misleading info and we are unable to figure out whether the file really exists or already deleted.

Here we are not just bothered about any particular stream or workspace, but the entire repository and we want to know if atleast one copy of the supplied itemd+stateid combination exists in entire workspace or not.

Even if one copy of it exists in stream A or Stream B, we are good.

David Lafreniere commented Jul 16 '19, 3:18 p.m. | edited Jul 16 '19, 3:48 p.m.
FORUM MODERATOR / JAZZ DEVELOPER
I'm not sure there is API to answer that question easily.

Also, I do not understand how the given file state is used at all. If a file is deleted, it's 'after state' will be 'null'.
-If your question is "was this file deleted from every stream it was ever delivered to?", then the specific given state would not come into question at all.
-If your question is "is there a stream that contains the file at state X?", then this has nothing to do with the file being deleted or not, as a stream could contain that file at version X-1 or X+1 for example.

Your answer


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.