Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

DefaultValueProvider : return Category

 Hello,

I try to code a Plugin (DefaultValueProvider) to return the default category according the workitem type.
I have this code but i don't understand how return the category.

public class DefaultValueProvider1 extends AbstractService implements IDefaultValueProvider<Category> {

public DefaultValueProvider1() {
// TODO Auto-generated constructor stub
}

@Override
public Category getDefaultValue(IAttribute attribute, IWorkItem workItem,
IWorkItemCommon workItemCommon, IConfiguration configuration,
IProgressMonitor monitor) throws TeamRepositoryException {
// TODO Auto-generated method stub
IWorkItemCommon common = getService(IWorkItemCommon.class);
IProjectAreaHandle projectArea = workItem.getProjectArea();
if(workItem.getWorkItemType().equals("dev_task")){
String categoryName = "Dev";
List<String> namePath= Arrays.asList(categoryName.split("/"));
ICategoryHandle category = common.findCategoryByNamePath(projectArea,namePath,monitor);
return category;
}
else
return null;
}
}

0 votes



One answer

Permanent link
Is there any exception thrown?

Currently you return the handle to the category. I would suggest to resolve the handle and to get the ICategory and return that. Consider looking at http://rsjazz.wordpress.com/2013/06/26/attribute-customization-java-based-value-providers-conditions-and-validators/ where, as far as I remember, I always return the resolved object and not the handle. Resolve using
workItemCommon.getAuditableCommon().resolveAuditable(.....
 Another approach you could try is returning category.getItemId(), but I don't think that is going to work.

0 votes

Your answer

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

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,943

Question asked: Jul 24 '13, 7:11 a.m.

Question was seen: 4,256 times

Last updated: Jul 25 '13, 2:59 a.m.

Confirmation Cancel Confirm