It's all about the answers!

Ask a question

How to set iteration type value use plain java api


faith chen (116) | asked Jul 19 '21, 2:47 a.m.

My environment is 7.0.1 ifix9


I have a custom attribute,type is iteration
this is my code

IAttribute attribute = workItemClient.findAttribute(workItem.getProjectArea(), "custom_attr_id", monitor);
System.out.println("debug1>>"+iAttribute.getAttributeType());
IEnumeration<? extends ILiteral> enums = workItemClient.resolveEnumeration(iAttribute, monitor);
for (ILiteral literal : enums.getEnumerationLiterals()) {
   System.out.println("debug2>>"+literal.getName());
}
but always throw an exception
org.eclipse.core.runtime.AssertionFailedException: assertion failed: Expected enumeration or enumeration List, actual attributeType - interval type - interval

what is interval type?? and how can i set value if  select a dropdown value?

Accepted answer


permanent link
Ralph Schoon (63.3k33646) | answered Jul 19 '21, 3:44 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

An iteration is NOT an enumeration. See https://rsjazz.wordpress.com/2012/10/05/handling-iterations-automation-for-the-planned-for-attribute/ for how to work with timelines and iterations in the Java API.

Ralph Schoon selected this answer as the correct answer

Comments
faith chen commented Jul 19 '21, 4:45 a.m.

Hi Ralph


Thanks your answer .

My Main Development list:
Release 1.0 (current)
   ---0.ProjectRequirement (current)
   ---1.ProjectDesign
Backlog

My code
IDevelopmentLineHandle developmentLineHandle = projectArea.getProjectDevelopmentLine();

IDevelopmentLine developmentLine = auditableClient.resolveAuditable(developmentLineHandle,ItemProfile.DEVELOPMENT_LINE_DEFAULT, monitor);

List<IIteration> lines = auditableClient.findCurrentIterations(developmentLine, monitor);
for(IIteration iit:lines){
     System.out.println(iit.getName());
}

return :
Release 1.0
0.ProjectA-Requirement

How to get Backlog or other childs?




Ralph Schoon commented Jul 19 '21, 4:54 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
I think there is code on my blog that allows to find timelines by their name and also shows how to iterate the iteration hierarchy.
The purpose of my blog article was to provide readers an example so I do not have to answer this over and over here.

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.