Creating category programmatically
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
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
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:
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