hi..
i create file in sandbox.
i want to get created file's name at pendding change.
my code :
for (IChange change : (List<IChange>) changeSet.changes()) {
if (((change.kind() & IChange.ADD) == IChange.ADD)) {
extractChangeInformation(scmService, itemService, deliverData, changeSet, change);
}
}
private void extractChangeInformation(IScmService scm, IRepositoryItemService repo, DeliverOperationData data, IChangeSet cs, IChange change) throws TeamRepositoryException {
comment = cs.getComment();
creator = ((IContributor)repo.fetchItem(cs.getAuthor(), null)).getName();
date = cs.getLastChangeDate().toString();
System.err.println("count =" + count);
IServerSideVersionedContentService contentService = getService(IServerSideVersionedContentService.class);
System.out.println("11111111111");
cfgs = ServiceConfigurationProvider.FACTORY.create(data.getDestWorkspace(), cs.getComponent());
System.out.println("222222222222");
IVersionableHandle afterStateHandle = change.afterState();
System.out.println("333333333333");
afterState = scm.fetchState(afterStateHandle, null, null);
System.out.println("4444444444444");
// IVersionableHandle beforeStateHandle = change.beforeState();
System.out.println("55555555555555");
// beforeState = scm.fetchState(beforeStateHandle, null, null);
System.out.println("66666666666666");
if (afterState instanceof IFileItem) {
// if (beforeState instanceof IFileItem) {
IFileItem file = (IFileItem) afterState;
// String aa=file.getName();
// IFileItem file = (IFileItem) beforeState;
// System.err.println("aaaaaa = " + aa);
reports = scm.configurationDetermineAncestorsInHistory(cfgs, new IVersionableHandle[] {file}, null, null);
System.err.println("aaa = "+getPath(reports));
reports = scm.configurationLocateAncestors(cfgs, new IVersionableHandle[] {file}, null, null);
System.err.println("bbb = " +getPath(reports));
System.err.println("=======================================================");
// reports = scm.configurationFindByName(cfgs, file.getName(), null, null);
// System.err.println(getPath(reports));
//out of range System.err.println("ccc = " +getPath(reports));
System.err.println("flag = " + flag);
allreports = getPath(reports);
System.err.println("allreports " + allreports);
if(flag>0){
flag--;
}
System.err.println(comment);
System.err.println(creator);
System.err.println(date);
System.err.println(Location.itemLocation(cs, getRepositoryURL()).toAbsoluteUri());
// printContents("Before file", (IFileItemHandle) beforeState, ((IFileItem)beforeState).getContent(), contentService);
// printContents("After file", (IFileItemHandle) afterState, ((IFileItem)afterState).getContent(), contentService);
}
}
but return value is space(" ").
let me know how to get change set's Add file name.
thanks.