RTC API usage. Can't find attachments in a child project area with unconfigured process template
A java program update the state of a work item created in a child project area (unconfigured process) which reuse the process template of a root project area (RTC 4.0 scrum process template). It works on the root project area. It is a custom workitem type.
Error: SEVERE: Error while retrieving image: processattachment:/workflow/transfer.gif
Throwable occurred: com.ibm.team.repository.common.ItemNotFoundException: CRRTC0317E: Could not find ProcessAttachment for path: _0PQbsAe1EeKiHO3ea305vg/workflow/transfer.gif
at com.ibm.team.workitem.service.internal.ImageContentService.findProcessAttachment(ImageContentService.java:156)
Program which does not work:
private static String changeStatus(ITeamRepository repo, Integer workItemId,
Boolean buildStatus, String actionOK, String actionKO, IProgressMonitor monitor)
throws TeamRepositoryException {
IWorkItemClient client = (IWorkItemClient) repo
.getClientLibrary(IWorkItemClient.class);
IWorkItemWorkingCopyManager copyManager = client
.getWorkItemWorkingCopyManager();
IWorkItem wi = client.findWorkItemById(workItemId,
IWorkItem.FULL_PROFILE, monitor);
if (null == wi) {
return ("work item " + workItemId + " cannot be found");
}
IDetailedStatus status = null;
String actionName = buildStatus ? actionOK : actionKO;
try {
copyManager.connect(wi, IWorkItem.FULL_PROFILE, monitor);
WorkItemWorkingCopy wc = copyManager.getWorkingCopy(wi);
IWorkflowInfo wfInfo = client.findWorkflowInfo(wi, monitor);
Identifier<IWorkflowAction>[] actionList = wfInfo.getActionIds(wi
.getState2());
String actionId = null;
for (int i = 0; i < actionList.length; i++) {
Identifier<IWorkflowAction> action = actionList[i];
String name = wfInfo.getActionName(action);
if (name != null) {
if (name.equals(actionName)) {
actionId = action.getStringIdentifier();
break;
}
}
}
if (null == actionId) {
return "Action not found: " + actionName;
}
wc.setWorkflowAction(actionId);
status = wc.save(monitor);
if (status.getCode() != org.eclipse.core.runtime.IStatus.OK) {
return "Error: " + status.getDetails();
}
} catch (Exception e) {
return "Unexpected error: " + e.getMessage();
} finally {
copyManager.disconnect(wi);
}
return null;
}
Any help would be greatly appreciated.
Thanks
Error: SEVERE: Error while retrieving image: processattachment:/workflow/transfer.gif
Throwable occurred: com.ibm.team.repository.common.ItemNotFoundException: CRRTC0317E: Could not find ProcessAttachment for path: _0PQbsAe1EeKiHO3ea305vg/workflow/transfer.gif
at com.ibm.team.workitem.service.internal.ImageContentService.findProcessAttachment(ImageContentService.java:156)
Program which does not work:
private static String changeStatus(ITeamRepository repo, Integer workItemId,
Boolean buildStatus, String actionOK, String actionKO, IProgressMonitor monitor)
throws TeamRepositoryException {
IWorkItemClient client = (IWorkItemClient) repo
.getClientLibrary(IWorkItemClient.class);
IWorkItemWorkingCopyManager copyManager = client
.getWorkItemWorkingCopyManager();
IWorkItem wi = client.findWorkItemById(workItemId,
IWorkItem.FULL_PROFILE, monitor);
if (null == wi) {
return ("work item " + workItemId + " cannot be found");
}
IDetailedStatus status = null;
String actionName = buildStatus ? actionOK : actionKO;
try {
copyManager.connect(wi, IWorkItem.FULL_PROFILE, monitor);
WorkItemWorkingCopy wc = copyManager.getWorkingCopy(wi);
IWorkflowInfo wfInfo = client.findWorkflowInfo(wi, monitor);
Identifier<IWorkflowAction>[] actionList = wfInfo.getActionIds(wi
.getState2());
String actionId = null;
for (int i = 0; i < actionList.length; i++) {
Identifier<IWorkflowAction> action = actionList[i];
String name = wfInfo.getActionName(action);
if (name != null) {
if (name.equals(actionName)) {
actionId = action.getStringIdentifier();
break;
}
}
}
if (null == actionId) {
return "Action not found: " + actionName;
}
wc.setWorkflowAction(actionId);
status = wc.save(monitor);
if (status.getCode() != org.eclipse.core.runtime.IStatus.OK) {
return "Error: " + status.getDetails();
}
} catch (Exception e) {
return "Unexpected error: " + e.getMessage();
} finally {
copyManager.disconnect(wi);
}
return null;
}
Any help would be greatly appreciated.
Thanks
4 answers
Hell Scott,
It was few months ago, but from what I remember depending on the languages settings defined in your Eclipse/RTC process template customization environment, you don't have exactly the same process template attachments. The plug in was developed in a given environment with some language settings but tested in another environment with different languages settings. Copying the attachments from one environment to the other has solved the problem.
Thanks,
Jean-Claude
It was few months ago, but from what I remember depending on the languages settings defined in your Eclipse/RTC process template customization environment, you don't have exactly the same process template attachments. The plug in was developed in a given environment with some language settings but tested in another environment with different languages settings. Copying the attachments from one environment to the other has solved the problem.
Thanks,
Jean-Claude