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

Workitem's owner is set null when using client library.

Hi folks,

We use client library to update some workitems continuously.The other day,I ran
to update workitems, the last one's owner was lost(set null).I'll show you owr
WorkitemUpdater class.Is it correct to use WorkItemOperation?

public class WorkItemUpdater extends WorkItemOperation {
private final IWorkItem workItem;
private ITeamRepository teamRepository;
private String statusIdenfier;

WorkItemUpdater(ITeamRepository teamRepository, IWorkItem workItem, String
statusIdenfier) {
super("Update work item", IWorkItem.FULL_PROFILE);
this.teamRepository = teamRepository;
this.workItem = workItem;
this.statusIdenfier = statusIdenfier;
}

@Override
protected void execute(WorkItemWorkingCopy workingCopy, IProgressMonitor
monitor)
throws TeamRepositoryException {
IWorkItem workItemTemp = workingCopy.getWorkItem();
IWorkflowInfo info = getIWorkItemInfo(monitor);
workItem().setStatus(workItemTemp, info);
workItem().addCustomAttribute(workItemTemp,
WorkItemCustomAttributes.ATTR_KEY_X);
workItem().addCustomAttribute(workItemTemp,
WorkItemCustomAttributes.ATTR_KEY_Y);
}


private WorkItemUpdater workItem() {
return this;
}

private void addCustomAttribute(IWorkItem workItemTemp, String attributeName) {
WorkItemCustomAttributes attrs =
new WorkItemCustomAttributes(getTeamRepository(),
workItem.getProjectArea());
attrs.addCustomAttribute(
workItemTemp,
attributeName);
}

private void setStatus(IWorkItem workItemTemp, IWorkflowInfo info) {
for(Identifier<IState> status : info.getAllStateIds()){
if((status.getStringIdentifier()).equals(this.statusIdenfier)){
workItemTemp.setState2(status);
}
}
}

private IWorkflowInfo getIWorkItemInfo(IProgressMonitor monitor) throws
TeamRepositoryException {
// get IWorkItemCommon
IWorkItemCommon client =
ClientLibraryUtil.getIWorkItemCommon(getTeamRepository());
IWorkflowInfo info = client.findWorkflowInfo(workItem, monitor);
return info;
}

public ITeamRepository getTeamRepository() {
return teamRepository;
}

public void setTeamRepository(ITeamRepository teamRepository) {
this.teamRepository = teamRepository;
}
}

Best regards,

- Hiroki

0 votes


Be the first one to answer this question!

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

Question asked: Nov 18 '08, 10:33 p.m.

Question was seen: 5,130 times

Last updated: Nov 18 '08, 10:33 p.m.

Confirmation Cancel Confirm