It's all about the answers!

Ask a question

How to set Planned For and Category for template initialized via RTC Java API and instantiateTemplate method


Bartosz Chrabski (6811928) | asked May 17 '17, 10:31 a.m.

 Hi,


I was able to create instance of work item template using RTC Java plain APi.
Map<IAttributeVariable, Object> arg1 = new HashMap<IAttributeVariable, Object>();
Map<String, String> arg2 = new HashMap<String, String>();
service.instantiateTemplate(handle, arg1, arg2, monitor);
But I have problem with setting up Planned For and Category before creating instance of the template.

I know how to access attribute handle using findAttribute menthod but it is returns IAttribute type, not IAttributeVariable that is required by instantiateTemplate.

Any ideas how to conver IAttribute to IAttributeVariable or how exactly I should specify Planned For or Category before instanciating template ?


Comments
Ralph Schoon commented May 17 '17, 10:47 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

I would suggest to search in the SDK for

instantiateTemplate

and find out how this is used within RTC.


Bartosz Chrabski commented May 17 '17, 2:31 p.m.

 Ralph.


Maybe that will be surprize but I did that already. All the references to instatiateWorkItemTemplate are using empty lists of variables as input.


Ralph Schoon commented May 17 '17, 2:49 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Bummer. I did not try to insult you, I just described the approach I would have taken. I don't have a solution.


Bartosz Chrabski commented May 17 '17, 3:06 p.m.

 Ralph,


You didn't insult me at all :) When somebody is coming to me with simiar questions I am sending them to google or SDK as well. I already found solution to solve it. It is published below.


Accepted answer


permanent link
Bartosz Chrabski (6811928) | answered May 17 '17, 3:03 p.m.

That solved the issue

IAttributeVariable categoryAttribute = new AttributeVariable(ITemplateAttributeIdentifiers.WORKITEM_CATEGORY, ITemplateTypeIdentifiers.CATEGORY);
IAttributeVariable iterationAttribute = new AttributeVariable(ITemplateAttributeIdentifiers.WORKITEM_ITERATION, ITemplateTypeIdentifiers.ITERATION);
    

Ralph Schoon selected this answer as the correct answer

Comments
Ralph Schoon commented May 17 '17, 3:18 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Nice! Thanks For sharing Bartosz!

Your answer


Register or to post your answer.