It's all about the answers!

Ask a question

Modifying and saving work item


Anna Wymysłowska (122) | asked Feb 28 '11, 5:53 a.m.
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?

One answer



permanent link
Keleh car (6) | answered Mar 02 '11, 4:47 p.m.
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

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.