It's all about the answers!

Ask a question

How to delete a file object in RTC Programatically using Java plain APIs ?


Jazzuser user (4823) | asked Mar 07 '18, 2:54 a.m.

Hello Team,

I have a scenario, wherein I have to delete the file already present in RTC Stream. I need to delete a particular file, checkin as a changeset and then deliver the changeset with the deleted file. All this should be done using RTC APIs.

I already have code for creating the repo workspace for the stream. get the files from that components. now i need to delete some files.

Are there any APIs to delete the particular file already existing in stream ?

Thanks.

Accepted answer


permanent link
Jazzuser user (4823) | answered Mar 21 '18, 5:01 a.m.

I got the solution :

                   IConfigurationOpFactory opFactory = fRepoWsConn.configurationOpFactory();
                   opFactory.delete(foundItem);
                  
                   Collection ops = new ArrayList();
                   ops.add(fRepoWsConn.configurationOpFactory().delete(foundItem));
                   IUpdateReport r = fRepoWsConn.commit(Collections.singletonList(getChangeSet("Deleting File")), Collections.singletonList(ops), null);
                    

David Lafreniere selected this answer as the correct answer

One other answer



permanent link
Ralph Schoon (58.2k23642) | answered Mar 07 '18, 6:20 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

https://jazz.net/library/article/1006 explains what can be deleted.
To find out what API that is, you could try to debug the Eclipse client. I had a quick look, but was unable to find the action at the moment.


Comments
Jazzuser user commented Mar 08 '18, 12:39 a.m.

Thanks for the reply Ralph,
we have the following code to file the IVersionable of the file.
             Map<String, IVersionableHandle> handles = fConfiguration.childEntries( parentFolder, fMonitor);
             IVersionableHandle foundHandle = handles.get(name);
             if(null!=foundHandle){
                 return fConfiguration.fetchCompleteItem(foundHandle, fMonitor);
            }
 Is there any APIs to delete the file with this IVersionable or we also have the IFileItem of the file.


Jazzuser user commented Mar 08 '18, 12:40 a.m.

I found following API on searching in the RTC plugins :
com.ibm.team.filesystem.client.internal package :  /**
     * Deletes this storage object plus any children. The order in which the children are deleted
    public abstract void delete(IProgressMonitor monitor) throws FileSystemException;

Could you pelase suggest on this.

Thanks

Your answer


Register or to post your answer.