It's all about the answers!

Ask a question

Java provided attribute doesn't populate value set on modifying of work item


Paul B (21313) | asked Oct 02 '15, 8:41 p.m.
Hi all,

I've created a Java provided attribute for a work item that provides a value set by looking at two other attributes (enumerations) from the same/current work item which together form a directory path that the java provided attribute will create a value set using the names of files nested in that directory. It works well if a work item is created for the first time however on modifying the work item, it fails to populate the set so a new value can be selected.

I'm not sure how to have the java provided re-populate the set so a new value can be selected. I have de-bugged it and seen that when it tries to get the values of the two enumeration attributes that it returns an empty string each time though the attributes have values set.

Below is a link to my class file.

http://www.megafileupload.com/hPqE/SpecificArtifactType.java

Any help appreciated.
Thanks

2 answers



permanent link
Marek Siekierski (817510) | answered Oct 02 '15, 9:32 p.m.
edited Oct 02 '15, 9:32 p.m.
Hi Paul,

I believe you would have to write an operation participant that is triggered to re-populate the set on some operation, like a work item save.

Here is a post with an example of an participant:

https://rsjazz.wordpress.com/2012/07/31/rtc-update-parent-duration-estimation-and-effort-participant/

Comments
Paul B commented Oct 03 '15, 1:19 a.m.

Hi Marek,


Thanks for your reply. I don't think a participant is right option. The list needs to be repopulated with the files in the directory (decided by the two attributes) before a save operation. 


permanent link
Ralph Schoon (63.5k33646) | answered Oct 03 '15, 2:58 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Paul, have you set the dependencies to the other two attributes? If it is a calculated attribute, the calculation would be triggered by a change to either of them only if there is a dependency in the attribute customization.

Comments
1
Paul B commented Oct 04 '15, 2:04 a.m.

I dug deeper and found that when it gets to this statement:


IAttribute currentAttribute= (IAttribute) handle;

That an exception is generated. It can't cast to IAttribute handle because the return items from workItem.getCustomAttributes() are different between a new Wotk Item and a modified work item.

The exception message is:

com.ibm.team.workitem.common.internal.model.impl.AttributeHandleImpl incompatible with com.ibm.team.workitem.common.model.IAttribute

From here, I'm not sure how to get the IAttributeHandle that I can cast to IAttribute.



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.