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

How to set new value to "Filed Against" attribute.

I need to check the existing value of "Filed Against" value and then set it to new value.
Appriciate any suggessions or Piece of code.

Thanks in Advance

Radhika Bandari

0 votes



3 answers

Permanent link
Please consider to search the development WiKi, especially the SDK. Here is some example code https://jazz.net/wiki/bin/view/Main/ProgrammaticWorkItemCreation

I think there is no example for modifying a work item. You could look that up in the SDK itself. This code has worked for me:



ITeamRepository teamRepository = TeamPlatform
.getTeamRepositoryService().getTeamRepository(repositoryURI);
teamRepository.registerLoginHandler(new LoginHandler(userId, password));
teamRepository.login(null);

IWorkItemClient workItemClient = (IWorkItemClient) teamRepository
.getClientLibrary(IWorkItemClient.class);

URI uri = URI.create(projectAreaName.replaceAll(" ", "%20"));
IProjectArea projectArea = (IProjectArea) processClient
.findProcessArea(uri, null, null);
if (projectArea == null) {
System.out.println("Project area not found.");
return false;
}

int id = new Integer(idString).intValue();

IWorkItem workItem = workItemClient.findWorkItemById(id, IWorkItem.SMALL_PROFILE, null);
IWorkItemWorkingCopyManager wcm = workItemClient.getWorkItemWorkingCopyManager();
wcm.connect(workItem, IWorkItem.FULL_PROFILE, null);

try {
WorkItemWorkingCopy wc = wcm.getWorkingCopy(workItem);

wc.getWorkItem().setHTMLSummary(XMLString.createFromPlainText(summary));
IDetailedStatus s = wc.save(null);
if (!s.isOK()) {
throw new TeamRepositoryException("Error saving work item",
s.getException());
}
} finally {
wcm.disconnect(workItem);
}



The filed against is



ICategoryHandle category = workItemClient.findCategoryByNamePath(
projectArea, path, null);

wc.getWorkItem().setCategory(category )


0 votes


Permanent link
Hi,

Thanks for your reply. My code looks like this. I tried getting existin category value.

import com.ibm.team.repository.client.IItemManager;
import com.ibm.team.repository.client.ITeamRepository;

IItemManager itm = teamRepository.itemManager();
//get existing category value.
ICategory category = (ICategory) itm.fetchCompleteItem(parentWorkItem.getCategory(), IItemManager.DEFAULT, monitor);
System.out.println("This is category: " + category.getName());

when I use above import statements, the plugin itself is not deployed on the server. It is giving this message

State
CopyAttributeValuesToChildWI (Operation Advisor) completed successfully.

what could be the probelm.
And I neednot change complete category list to new list of values, but I need to change the selected value against Filed Against field before saving workitem.
Please suggest me on this issue.
Regards,
Radhika

0 votes


Permanent link
Hi Ralph,

To work with ITeamRepository, IWorkItemClient I have imported respective packages
import com.ibm.team.workitem.client.IWorkItemClient;
import com.ibm.team.repository.client.ITeamRepository;
and added corresponding pulg-ins in Dependencies tab plug-in.xml.


If I add these plug-ins in Dependencies tab, the advisor plug-in is not deployed into server. These two packages are related to client.
I have checked windows->preferences->plug-in development->Target platform's Target Definition It has all the plug-ins listed there.

What is the procedure I need to follow.

Thanks in Advance,
Radhika Bandari

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,937

Question asked: Nov 07 '11, 6:44 a.m.

Question was seen: 5,661 times

Last updated: Nov 07 '11, 6:44 a.m.

Confirmation Cancel Confirm