It's all about the answers!

Ask a question

Creating category programmatically


Petcharat Viriyakattiyaporn (4113) | asked Jul 25 '08, 7:35 p.m.
Hi,

I'm trying JUnit tests for some process-related functions. My main goal is to create some work items for testing. I have successufully been able to create project area and initialized it programmatically. Now, I am trying to create a new category and save it to the new project area that I created by doing this:
// Setup categories in the project area.
IAuditableClient auditableClient= (IAuditableClient) fTeamRepo.getClientLibrary(IAuditableClient.class);
CategoriesManager catManager = CategoriesManager.createInstance(auditableClient,
fProjectArea, null);
CategoryTreeNode rootNode = catManager.getRoot();
CategoryTreeNode childCat = rootNode.createChil(CATEGORY_ID);
catManager.save(null);

But I got an error "Permission denied", I couldn't save the category.

If I continued to create a work item, using:
IAuditableClient auditableClient= (IAuditableClient) fTeamRepo.getClientLibrary(IAuditableClient.class);
WorkItemInitialization operation= new WorkItemInitialization(summary, category);
IWorkItemHandle handle= operation.run(workItemType, null);
IWorkItem workItem= auditableClient.resolveAuditable(handle, IWorkItem.FULL_PROFILE, null);

I got an error ItemNotFound, saying it couldn't find the Category that I gave as argument.

Can you help me out, please?

Thanks

One answer



permanent link
Kai-Uwe Maetzel (85611) | answered Jul 29 '08, 5:23 p.m.
JAZZ DEVELOPER
It seems that the process governing your project area does not grant
permission to save a work item category to the caller of
CategoriesManager#save.

You process specification needs to grant the permissions for the
"com.ibm.team.workitem.server.saveCategory" project operation to the
appropriate role. I.e. on of the roles assigned to the caller in the
project area.

Kai
Jazz Process team


petcharatv wrote:
Hi,

I'm trying JUnit tests for some process-related functions. My main
goal is to create some work items for testing. I have successufully
been able to create project area and initialized it programmatically.
Now, I am trying to create a new category and save it to the new
project area that I created by doing this:
// Setup categories in the project area.
IAuditableClient auditableClient= (IAuditableClient)
fTeamRepo.getClientLibrary(IAuditableClient.class);
CategoriesManager catManager =
CategoriesManager.createInstance(auditableClient,
fProjectArea, null);
CategoryTreeNode rootNode = catManager.getRoot();
CategoryTreeNode childCat = rootNode.createChil(CATEGORY_ID);
catManager.save(null);

But I got an error "Permission denied", I couldn't save the
category.

If I continued to create a work item, using:
IAuditableClient auditableClient= (IAuditableClient)
fTeamRepo.getClientLibrary(IAuditableClient.class);
WorkItemInitialization operation= new WorkItemInitialization(summary,
category);
IWorkItemHandle handle= operation.run(workItemType, null);
IWorkItem workItem= auditableClient.resolveAuditable(handle,
IWorkItem.FULL_PROFILE, null);

I got an error ItemNotFound, saying it couldn't find the Category that
I gave as argument.

Can you help me out, please?

Thanks

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.