Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

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

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.

0 votes



One answer

Permanent link
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.

0 votes

Comments
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.

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 log in 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,938

Question asked: Jul 15 '19, 1:47 a.m.

Question was seen: 1,904 times

Last updated: Aug 16 '19, 7:07 a.m.

Confirmation Cancel Confirm