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

How to create IVersionablehandle in server side

I have a IFileItem in repository of component, how to get handle of this IFileItem .I only have Ifileitem,getName() value fileName .

Kindly help .

0 votes


Accepted answer

Permanent link

Hello

To get a handle for an IFileItem from its fileName , you can use the repository to find the IFileItem and then convert it to an IFileItemHandle . Here's an example:

IFileItem fileItem = getFileItemByName(fileName); if (fileItem != null) { IFileItemHandle handle = fileItem.getItemHandle(); // Now you can use the handle }

Ensure proper error handling if the file item isn't found. Let me know if you need further help!

Yaswanth Garlapati selected this answer as the correct answer

0 votes

Comments

Hi, getFileItemByName is a custom method . Do you have any idea of this method?


One other answer

Permanent link

An IFileItem extends IVersionable, which in turn extends IVersionableHandle.
So if you are saying in your code you have an IFileItem, then you already have the IVersionableHandle.

Or are you saying you only have a String, which represents the name of some file, in which case there's no easy solution, as there could be all sorts of different files in the DB with the same string name.

0 votes

Comments

Actually I want to update a file(next version )that was already in source control how to do that in server side

I also have IFolderHandle

I want to re-emphasize that doing anything based on only a 'file name' is very error prone. There could be multiple different files with the same file name, and also such an approach likely breaks down if the file gets renamed (meaning it could have different names in different streams/branches).

It's really not clear what information you have, and the details of the use case / workflow.

If you are on EWM 7.0.3, you could try looking at IScmQueryService.searchFiles() to see if that helps with your use case.

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,954
× 7,511
× 1,341

Question asked: Nov 19 '24, 3:36 a.m.

Question was seen: 346 times

Last updated: Nov 25 '24, 9:29 a.m.

Confirmation Cancel Confirm