It's all about the answers!

Ask a question

Fetch current userProperties for a file

Anita Jey (1611315) | asked Mar 21 '12, 11:29 a.m.

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)
(IItemHandle[]) deliverData.getChangeSetHandles()
.toArray(new IChangeSetHandle[0]),

for (int i = 0; i < changeSets.length; i++) {
IChangeSet changeSet = (IChangeSet) changeSets[i];

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();

One answer

permanent link
Anita Jey (1611315) | answered Mar 21 '12, 4:45 p.m.

I think I found out what was going on. I should have used getSourceWorkspace instead of getDestWorkSpace when I created the ServiceConfigurationProvider. Hope this helps someone else!


Your answer

Register or 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.