Fetch current userProperties for a file
Hi,
I have the following precondition/advisor code that displays all user properties when a delivery takes place. What I find is that, the code always gets - for lack of a better word - the "beforestate" of the user properties.
So for instance, if I have a custom property 1 set on a file and I deliver it - it does not display any user property at all. If I modify the file and deliver it again, now I see the custom property set previously, but not any other new properties created just before the second delivery.
I am sure I am missing something in my code. Any help is greatly appreciated. Thanks!!
I have the following precondition/advisor code that displays all user properties when a delivery takes place. What I find is that, the code always gets - for lack of a better word - the "beforestate" of the user properties.
So for instance, if I have a custom property 1 set on a file and I deliver it - it does not display any user property at all. If I modify the file and deliver it again, now I see the custom property set previously, but not any other new properties created just before the second delivery.
I am sure I am missing something in my code. Any help is greatly appreciated. Thanks!!
IItem[] changeSets = getService(IRepositoryItemService.class)
.fetchItems(
(IItemHandle[]) deliverData.getChangeSetHandles()
.toArray(new IChangeSetHandle[0]),
IRepositoryItemService.COMPLETE);
for (int i = 0; i < changeSets.length; i++) {
IChangeSet changeSet = (IChangeSet) changeSets[i];
changeSetList.add(changeSet);
}
for (IChangeSet changeSet : changeSetList) {
List<IChange> changes = changeSet.changes();
for (int j = 0; j < changes.size(); j++) {
IVersionableHandle versionableHandle = changes.get(j).item(); //tried getting afterstate(), no difference
ServiceConfigurationProvider scp = ServiceConfigurationProvider.FACTORY.create(deliverData
.getDestWorkspace(), changeSet.getComponent());
IVersionable[] items = scmService.configurationFetch(scp, new IVersionableHandle[] {versionableHandle},
IScmService.COMPLETE, null, null);
for (IVersionable iVersionable : items) {
System.out.println("Name:" + iVersionable.getName());
Map<String> properties = iVersionable.getUserProperties();
printMap(properties);
}
}
}