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

How can i fetch IFileItem using server side plugin (pre-conditions) ?

Hi all,

I asked before this but I didn't get no answer from anyone.
I wrote a piece of code like the following but I get an error. How can i fetch?
Error is "

ILinkService linkService = (ILinkService) getService(ILinkService.class);
ILinkServiceLibrary linkLibrary = (ILinkServiceLibrary) linkService.getServiceLibrary(ILinkServiceLibrary.class);	
         IItemReference workItemRef = IReferenceFactory.INSTANCE.createReferenceToItem(sourceworkItem); ILinkQueryPage linkPage = linkLibrary.findLinks(WorkItemLinkTypes.CHANGE_SET, workItemRef); for (ILink link : linkPage.getAllLinksFromHereOn())  { IChangeSetHandle changeSetHandle = (IChangeSetHandle) link .getSourceRef().resolve(); IChangeSet changeSet = (IChangeSet) repositoryService.fetchItem(changeSetHandle, IRepositoryItemService.COMPLETE);             
List<IChange> changes =  changeSet.changes(); for (IChange change : changes)  { IVersionableHandle after2 =  change.afterState();
                if (after2 instanceof IFileItemHandle)
		{
			IFileItemHandle after = (IFileItemHandle) change.afterState();
			
			if( after != null )
			{
				IFileItem f = (IFileItem) repositoryService.fetchItem(after, null);
        } }
} // end for
} // end for


0 votes


Accepted answer

Permanent link
Hi all,
I found my answer.
IScmService scmService = (IScmService) getService(IScmService.class);
IFileItem f = (IFileItem) scmService.fetchState(handler, null, null);
Ralph Schoon selected this answer as the correct answer

0 votes

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
× 457
× 70
× 27

Question asked: Sep 22 '15, 3:31 a.m.

Question was seen: 2,259 times

Last updated: Sep 22 '15, 4:40 a.m.

Confirmation Cancel Confirm