It's all about the answers!

Ask a question

RTC default value proivder JAVA API problem


Marcin Blacha (1461214) | asked Oct 28 '19, 6:48 a.m.
Hello all,

I developed server side extension, that provides default value for attribute and I'm facing one problem. Because it should generate unique sequential number, I'm using file to store last used number. But default value provider plug-in is run few times before workitem editor is shown in WebUI, and when I'm testing it, first time attribute has value 1, second time 6. How I can avoid this problem?

Comments
Ian Wark commented Oct 29 '19, 12:51 a.m.

Interesting problem. I don't know if it's possible to have this kind of semi-stateful behavior in the default value provider. It may be possible to avoid running the code which generates the sequence until later by adding some kind of a check in front of it. For example, checking on the value of something normally empty during initialization, but populated after initialization etc..

One answer



permanent link
Ralph Schoon (63.6k33646) | answered Oct 29 '19, 2:52 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

 Yes, value provider can run multiple times. So you would have to look at the value if it is not already there and only generate a new value if it is not yet set. Or, better, use a follow up action to generate the unique value only once, when the save happens like it is done here: https://github.com/jazz-community/rtc-workitem-numbering


Comments
Marcin Blacha commented Oct 29 '19, 6:27 a.m.

I thought it will be easier with default value provider, but I will do as you described and create follow up action.

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.