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

Modifying and saving work item

I try to modify a work item that was previously added in jazz. I get IWorkItem object with work item data. Than I would like to modify description, state, attachments and comments.

I use WorkItemInitialization object to modify and save work item:

WorkItemInitialization operation= new WorkItemInitialization(incomingWorkItem, category);

//modifying operation object data
addMissingData(incomingWorkItem, workItem, teamRepository, operation);
IWorkItemHandle handle= operation.run(workItemType, null);
IWorkItem workItem2= auditableClient.resolveAuditable(handle, IWorkItem.FULL_PROFILE, null);
System.out.println("Work item " + workItem2.getId() + " modified.");


private static class WorkItemInitialization extends WorkItemOperation {

//incoming data
private IWorkItem fWorkItem;

//changes
private String fDescription;
private String fState;
private ArrayList<File> fAttachments;
private ArrayList<String> fComments;

public WorkItemInitialization(IWorkItem workItem, ICategoryHandle category) {
super("Initializing Work Item");
this.fWorkItem = workItem;
}

@Override
protected void execute(WorkItemWorkingCopy workingCopy, IProgressMonitor monitor) throws TeamRepositoryException {


IWorkItem workItem= workingCopy.getWorkItem();
workItem = this.fWorkItem;

IWorkItem itemCopy = (IWorkItem) workItem.getWorkingCopy();
itemCopy.setHTMLDescription(XMLString.createFromPlainText(fDescription));
workItem = itemCopy;
....
....
workingCopy.save(null);
}
....
}

I get an exception while executing:
auditableClient.resolveAuditable(handle, IWorkItem.FULL_PROFILE, null)

com.ibm.team.repository.common.ItemNotFoundException: CRJAZ0215I Item not found: com.ibm.team.workitem.common.internal.model.impl.WorkItemHandleImpl@5c925c92 (stateId: <unset>, itemId: , origin: com.ibm.team.repository.client.internal.TeamRepository@743e743e, immutable: <unset>)
at com.ibm.team.repository.client.internal.ItemManager.internalFetchItem(ItemManager.java:1581)
at com.ibm.team.repository.client.internal.ItemManager.access$0(ItemManager.java:1538)


Am I doing something wrong while changing work item data or changed work item schould be saved in different way?

0 votes



One answer

Permanent link
hI
HAVE you tried
http://jazz.net/forums/viewtopic.php?t=8817
http://www.ibm.com/developerworks/cn/rational/tutorials/using-jazz-api-to-migrate-historical-data-cmvc-to-rtc/section6.html
http://jazz.net/forums/viewtopic.php?t=6320
where are u from rachelek

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: Feb 28 '11, 5:53 a.m.

Question was seen: 5,621 times

Last updated: Feb 28 '11, 5:53 a.m.

Confirmation Cancel Confirm