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 "
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